安全员轨迹信息
This commit is contained in:
@ -1,14 +1,23 @@
|
|||||||
package org.dromara.test;
|
package org.dromara.test;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.manager.recognizermanager.RecognizerManager;
|
import org.dromara.manager.recognizermanager.RecognizerManager;
|
||||||
import org.dromara.manager.recognizermanager.enums.RecognizerTypeEnum;
|
import org.dromara.manager.recognizermanager.enums.RecognizerTypeEnum;
|
||||||
import org.dromara.manager.recognizermanager.vo.RecognizeVo;
|
import org.dromara.manager.recognizermanager.vo.RecognizeVo;
|
||||||
|
import org.dromara.progress.domain.PgsProgressPlanDetail;
|
||||||
|
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailFinishedVo;
|
||||||
|
import org.dromara.progress.service.IPgsProgressPlanDetailService;
|
||||||
|
import org.dromara.progress.service.IPgsProgressPlanService;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lilemy
|
* @author lilemy
|
||||||
@ -21,6 +30,12 @@ public class RecognizerTest {
|
|||||||
@Resource
|
@Resource
|
||||||
private RecognizerManager recognizerManager;
|
private RecognizerManager recognizerManager;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IPgsProgressPlanDetailService progressPlanDetailService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IPgsProgressPlanService progressPlanService;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void test() {
|
void test() {
|
||||||
RecognizeVo recognize = recognizerManager.recognize("http://xny.yj-3d.com:7363/file/tif/20250625160218orthophoto.png", List.of(RecognizerTypeEnum.PANEL));
|
RecognizeVo recognize = recognizerManager.recognize("http://xny.yj-3d.com:7363/file/tif/20250625160218orthophoto.png", List.of(RecognizerTypeEnum.PANEL));
|
||||||
@ -31,4 +46,39 @@ public class RecognizerTest {
|
|||||||
void testChange() {
|
void testChange() {
|
||||||
recognizerManager.convertCoordinate("http://xny.yj-3d.com:9000/xinnengyuan-dev/2025/11/11/d48767a62bc04867a552e06ba6712004.tif", List.of());
|
recognizerManager.convertCoordinate("http://xny.yj-3d.com:9000/xinnengyuan-dev/2025/11/11/d48767a62bc04867a552e06ba6712004.tif", List.of());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void checkNumber() {
|
||||||
|
List<PgsProgressPlanDetail> detailList = progressPlanDetailService.list();
|
||||||
|
List<PgsProgressPlanDetail> planDetailList = detailList.stream()
|
||||||
|
.filter(detail -> StringUtils.isNotBlank(detail.getFinishedDetail()))
|
||||||
|
.toList();
|
||||||
|
Map<String, List<PgsProgressPlanDetail>> collect = planDetailList.stream()
|
||||||
|
.collect(Collectors.groupingBy(PgsProgressPlanDetail::getFinishedDetail));
|
||||||
|
// 遍历分组结果,输出重复项
|
||||||
|
for (Map.Entry<String, List<PgsProgressPlanDetail>> entry : collect.entrySet()) {
|
||||||
|
String fieldValue = entry.getKey();
|
||||||
|
List<PgsProgressPlanDetail> duplicates = entry.getValue();
|
||||||
|
if (duplicates.size() > 1) { // 筛选出有重复的字段值
|
||||||
|
PgsProgressPlanDetail first = duplicates.getFirst();
|
||||||
|
Long id = first.getId();
|
||||||
|
Long planId = first.getProgressPlanId();
|
||||||
|
progressPlanService.removeById(planId);
|
||||||
|
progressPlanDetailService.removeById(id);
|
||||||
|
System.out.println("重复对象的对象:" + duplicates.stream().map(PgsProgressPlanDetail::getId).toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (PgsProgressPlanDetail detail : detailList) {
|
||||||
|
BigDecimal aiFill = detail.getFinishedNumber();
|
||||||
|
String finishedDetail = detail.getFinishedDetail();
|
||||||
|
if (StringUtils.isBlank(finishedDetail)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// log.info("id: {}, finishedDetail: {}", detail.getId(), finishedDetail);
|
||||||
|
List<PgsProgressPlanDetailFinishedVo> finishedVos = JSONUtil.toList(finishedDetail, PgsProgressPlanDetailFinishedVo.class);
|
||||||
|
if (aiFill.compareTo(BigDecimal.valueOf(finishedVos.size())) != 0) {
|
||||||
|
log.info("数量异常:{}:{}", detail.getId(), detail.getProgressCategoryId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -91,7 +91,7 @@ public class PlusDataPermissionHandler {
|
|||||||
DataPermissionHelper.setVariable("user", currentUser);
|
DataPermissionHelper.setVariable("user", currentUser);
|
||||||
}
|
}
|
||||||
// 如果是超级管理员或租户管理员,则不过滤数据
|
// 如果是超级管理员或租户管理员,则不过滤数据
|
||||||
if (LoginHelper.isSuperAdmin() || LoginHelper.isTenantAdmin()) {
|
if (LoginHelper.isSuperAdmin()) {
|
||||||
return where;
|
return where;
|
||||||
}
|
}
|
||||||
// 构造数据过滤条件的 SQL 片段
|
// 构造数据过滤条件的 SQL 片段
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import org.dromara.common.constant.GeoJsonConstant;
|
|||||||
import org.dromara.common.core.constant.HttpStatus;
|
import org.dromara.common.core.constant.HttpStatus;
|
||||||
import org.dromara.common.core.exception.ServiceException;
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
import org.dromara.common.domain.GeoPoint;
|
import org.dromara.common.domain.GeoPoint;
|
||||||
|
import org.dromara.facility.domain.FacMatrix;
|
||||||
import org.dromara.facility.domain.FacPhotovoltaicPanel;
|
import org.dromara.facility.domain.FacPhotovoltaicPanel;
|
||||||
import org.dromara.facility.domain.dto.geojson.FacFeatureByPlane;
|
import org.dromara.facility.domain.dto.geojson.FacFeatureByPlane;
|
||||||
import org.dromara.facility.domain.dto.geojson.FacFeatureByPoint;
|
import org.dromara.facility.domain.dto.geojson.FacFeatureByPoint;
|
||||||
@ -338,6 +339,29 @@ public class JSTUtil {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 匹配最近方阵,获取该方阵的信息
|
||||||
|
*
|
||||||
|
* @param pointEntity 点位
|
||||||
|
* @param matrices 方阵列表
|
||||||
|
* @return 最近方阵的信息
|
||||||
|
*/
|
||||||
|
public static FacMatrix findContainingMatrix(
|
||||||
|
RecognizeConvertCoordinateResult pointEntity,
|
||||||
|
List<FacMatrix> matrices
|
||||||
|
) {
|
||||||
|
double lng = Double.parseDouble(pointEntity.getLng());
|
||||||
|
double lat = Double.parseDouble(pointEntity.getLat());
|
||||||
|
Point point = geometryFactory.createPoint(new Coordinate(lng, lat));
|
||||||
|
for (FacMatrix matrix : matrices) {
|
||||||
|
Polygon polygon = parsePolygon(matrix.getPositions());
|
||||||
|
if (polygon.covers(point)) { // covers 包含边界}
|
||||||
|
return matrix;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将 FacPhotovoltaicPanel.positions 转成 Polygon
|
* 将 FacPhotovoltaicPanel.positions 转成 Polygon
|
||||||
*/
|
*/
|
||||||
@ -376,7 +400,7 @@ public class JSTUtil {
|
|||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
list.add(s);
|
list.add(s);
|
||||||
List<GeoPoint> matchingRange = findMatchingRange("30.247348", "105.729797", list);
|
List<GeoPoint> matchingRange = findMatchingRange("30.247348", "105.729797", list);
|
||||||
System.out.println(matchingRange==null);
|
System.out.println(matchingRange == null);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -472,7 +472,12 @@ class DroDroneBigPictureServiceImpl extends ServiceImpl<DroDroneBigPictureMapper
|
|||||||
if (!status.equals("2")) {
|
if (!status.equals("2")) {
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
DroneImgMergeProgressVo imgMergeProgress = droneManager.getImgMergeProgress(taskId);
|
DroneImgMergeProgressVo imgMergeProgress = null;
|
||||||
|
try {
|
||||||
|
imgMergeProgress = droneManager.getImgMergeProgress(taskId);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取图片合并进度失败:{}", e.getMessage());
|
||||||
|
}
|
||||||
if (imgMergeProgress == null) {
|
if (imgMergeProgress == null) {
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
@ -484,6 +489,7 @@ class DroDroneBigPictureServiceImpl extends ServiceImpl<DroDroneBigPictureMapper
|
|||||||
} else if (msg != null && msg.compareTo(BigDecimal.ZERO) >= 0 && msg.compareTo(BigDecimal.ONE) < 0) {
|
} else if (msg != null && msg.compareTo(BigDecimal.ZERO) >= 0 && msg.compareTo(BigDecimal.ONE) < 0) {
|
||||||
return vo;
|
return vo;
|
||||||
} else {
|
} else {
|
||||||
|
vo.setProgress(BigDecimal.ZERO);
|
||||||
newStatus = "4";
|
newStatus = "4";
|
||||||
picture.setStatus(newStatus);
|
picture.setStatus(newStatus);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -773,11 +773,11 @@ public class FacPhotovoltaicPanelServiceImpl extends ServiceImpl<FacPhotovoltaic
|
|||||||
// 获取项目下的所有未完成的光伏板
|
// 获取项目下的所有未完成的光伏板
|
||||||
List<FacPhotovoltaicPanel> panelList = this.lambdaQuery()
|
List<FacPhotovoltaicPanel> panelList = this.lambdaQuery()
|
||||||
.in(FacPhotovoltaicPanel::getProjectId, projectIds)
|
.in(FacPhotovoltaicPanel::getProjectId, projectIds)
|
||||||
.ne(FacPhotovoltaicPanel::getStatus, FacFinishStatusEnum.FINISH.getValue())
|
|
||||||
.eq(type.equals(RecognizerTypeEnum.BRACKET.getValue()), FacPhotovoltaicPanel::getProgressCategoryName, "支架安装")
|
.eq(type.equals(RecognizerTypeEnum.BRACKET.getValue()), FacPhotovoltaicPanel::getProgressCategoryName, "支架安装")
|
||||||
.eq(type.equals(RecognizerTypeEnum.PANEL.getValue()), FacPhotovoltaicPanel::getProgressCategoryName, "组件安装")
|
.eq(type.equals(RecognizerTypeEnum.PANEL.getValue()), FacPhotovoltaicPanel::getProgressCategoryName, "组件安装")
|
||||||
.list();
|
.list();
|
||||||
if (CollUtil.isEmpty(panelList)) {
|
if (CollUtil.isEmpty(panelList)) {
|
||||||
|
log.info("没有需要更新的光伏板");
|
||||||
return recognizeVoList;
|
return recognizeVoList;
|
||||||
}
|
}
|
||||||
// 判断识别出来的坐标是否包含在某个面内
|
// 判断识别出来的坐标是否包含在某个面内
|
||||||
@ -792,7 +792,9 @@ public class FacPhotovoltaicPanelServiceImpl extends ServiceImpl<FacPhotovoltaic
|
|||||||
vo.setName(containingPanel.getName());
|
vo.setName(containingPanel.getName());
|
||||||
vo.setType(type);
|
vo.setType(type);
|
||||||
recognizeVoList.add(vo);
|
recognizeVoList.add(vo);
|
||||||
finishPanelList.add(containingPanel);
|
if (!containingPanel.getStatus().equals(FacFinishStatusEnum.FINISH.getValue())) {
|
||||||
|
finishPanelList.add(containingPanel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(finishPanelList)) {
|
if (CollUtil.isNotEmpty(finishPanelList)) {
|
||||||
|
|||||||
@ -0,0 +1,106 @@
|
|||||||
|
package org.dromara.gps.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import org.dromara.common.log.annotation.Log;
|
||||||
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.gps.domain.bo.GpsSafetyUserRecordBo;
|
||||||
|
import org.dromara.gps.domain.vo.GpsSafetyUserRecordVo;
|
||||||
|
import org.dromara.gps.service.IGpsSafetyUserRecordService;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全员轨迹信息
|
||||||
|
*
|
||||||
|
* @author lilemy
|
||||||
|
* @date 2025-11-26
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/gps/safetyUserRecord")
|
||||||
|
public class GpsSafetyUserRecordController extends BaseController {
|
||||||
|
|
||||||
|
private final IGpsSafetyUserRecordService gpsSafetyUserRecordService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询安全员轨迹信息列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("gps:safetyUserRecord:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<GpsSafetyUserRecordVo> list(GpsSafetyUserRecordBo bo, PageQuery pageQuery) {
|
||||||
|
return gpsSafetyUserRecordService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出安全员轨迹信息列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("gps:safetyUserRecord:export")
|
||||||
|
@Log(title = "安全员轨迹信息", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(GpsSafetyUserRecordBo bo, HttpServletResponse response) {
|
||||||
|
List<GpsSafetyUserRecordVo> list = gpsSafetyUserRecordService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "安全员轨迹信息", GpsSafetyUserRecordVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取安全员轨迹信息详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("gps:safetyUserRecord:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<GpsSafetyUserRecordVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(gpsSafetyUserRecordService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增安全员轨迹信息
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("gps:safetyUserRecord:add")
|
||||||
|
@Log(title = "安全员轨迹信息", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody GpsSafetyUserRecordBo bo) {
|
||||||
|
return toAjax(gpsSafetyUserRecordService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改安全员轨迹信息
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("gps:safetyUserRecord:edit")
|
||||||
|
@Log(title = "安全员轨迹信息", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody GpsSafetyUserRecordBo bo) {
|
||||||
|
return toAjax(gpsSafetyUserRecordService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除安全员轨迹信息
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("gps:safetyUserRecord:remove")
|
||||||
|
@Log(title = "安全员轨迹信息", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(gpsSafetyUserRecordService.deleteWithValidByIds(List.of(ids), true));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,9 +1,8 @@
|
|||||||
package org.dromara.gps.domain;
|
package org.dromara.gps.domain;
|
||||||
|
|
||||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -29,12 +28,12 @@ public class GpsManmachine implements Serializable {
|
|||||||
private String clientId;
|
private String clientId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 绑定id
|
* 绑定id
|
||||||
*/
|
*/
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类型(绑定id类型,1、车辆,2人员)
|
* 类型(绑定id类型,1车辆 2人员 3安全员)
|
||||||
*/
|
*/
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,73 @@
|
|||||||
|
package org.dromara.gps.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全员轨迹信息对象 gps_safety_user_record
|
||||||
|
*
|
||||||
|
* @author lilemy
|
||||||
|
* @date 2025-11-26
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("gps_safety_user_record")
|
||||||
|
public class GpsSafetyUserRecord extends BaseEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备id
|
||||||
|
*/
|
||||||
|
private String clientId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员名称
|
||||||
|
*/
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录时间
|
||||||
|
*/
|
||||||
|
private LocalDate recordDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入场时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime entryTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退场时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime exitTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,13 +1,12 @@
|
|||||||
package org.dromara.gps.domain.bo;
|
package org.dromara.gps.domain.bo;
|
||||||
|
|
||||||
import org.dromara.gps.domain.GpsEquipment;
|
|
||||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
|
||||||
import org.dromara.common.core.validate.AddGroup;
|
|
||||||
import org.dromara.common.core.validate.EditGroup;
|
|
||||||
import io.github.linpeilie.annotations.AutoMapper;
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import jakarta.validation.constraints.*;
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import org.dromara.gps.domain.GpsEquipment;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -25,7 +24,7 @@ public class GpsEquipmentBo extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 主键ID
|
* 主键ID
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "主键ID不能为空", groups = { EditGroup.class })
|
@NotNull(message = "主键ID不能为空", groups = {EditGroup.class})
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -88,7 +87,7 @@ public class GpsEquipmentBo extends BaseEntity {
|
|||||||
private Integer gpsType;
|
private Integer gpsType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备类型(0、人员设备,1、车辆设备)
|
* 设备类型(0人员设备 1车辆设备 2安全员设备)
|
||||||
*/
|
*/
|
||||||
private Integer clientType;
|
private Integer clientType;
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,81 @@
|
|||||||
|
package org.dromara.gps.domain.bo;
|
||||||
|
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import org.dromara.gps.domain.GpsSafetyUserRecord;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全员轨迹信息业务对象 gps_safety_user_record
|
||||||
|
*
|
||||||
|
* @author lilemy
|
||||||
|
* @date 2025-11-26
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = GpsSafetyUserRecord.class, reverseConvertGenerate = false)
|
||||||
|
public class GpsSafetyUserRecordBo extends BaseEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 70132320796943002L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@NotNull(message = "主键不能为空", groups = {EditGroup.class})
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "项目id不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "人员id不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备id
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "设备id不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||||
|
private String clientId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员名称
|
||||||
|
*/
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录时间
|
||||||
|
*/
|
||||||
|
@NotNull(message = "记录时间不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||||
|
private LocalDate recordDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入场时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime entryTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退场时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime exitTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
package org.dromara.gps.domain.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.dromara.gps.domain.GpsSafetyUserRecord;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全员轨迹信息视图对象 gps_safety_user_record
|
||||||
|
*
|
||||||
|
* @author lilemy
|
||||||
|
* @date 2025-11-26
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = GpsSafetyUserRecord.class)
|
||||||
|
public class GpsSafetyUserRecordVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "项目id")
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "人员id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备id")
|
||||||
|
private String clientId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "人员名称")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "记录时间")
|
||||||
|
private LocalDate recordDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入场时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "入场时间")
|
||||||
|
private LocalDateTime entryTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退场时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "退场时间")
|
||||||
|
private LocalDateTime exitTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,12 +1,10 @@
|
|||||||
package org.dromara.gps.mapper;
|
package org.dromara.gps.mapper;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
import org.apache.ibatis.annotations.Update;
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
import org.dromara.gps.domain.GpsEquipment;
|
import org.dromara.gps.domain.GpsEquipment;
|
||||||
import org.dromara.gps.domain.vo.GpsEquipmentVo;
|
import org.dromara.gps.domain.vo.GpsEquipmentVo;
|
||||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
|
||||||
import org.dromara.gps.domain.vo.GpsUserVo;
|
import org.dromara.gps.domain.vo.GpsUserVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -21,7 +19,7 @@ public interface GpsEquipmentMapper extends BaseMapperPlus<GpsEquipment, GpsEqui
|
|||||||
|
|
||||||
@Select("SELECT\n" +
|
@Select("SELECT\n" +
|
||||||
" gm.user_id AS userId,\n" +
|
" gm.user_id AS userId,\n" +
|
||||||
" su.user_name AS userName, \n" +
|
" su.nick_name AS userName, \n" +
|
||||||
" gm.project_id AS projectId,\n" +
|
" gm.project_id AS projectId,\n" +
|
||||||
" bp.project_name AS projectName \n" +
|
" bp.project_name AS projectName \n" +
|
||||||
"FROM\n" +
|
"FROM\n" +
|
||||||
|
|||||||
@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.gps.mapper;
|
||||||
|
|
||||||
|
import org.dromara.gps.domain.GpsSafetyUserRecord;
|
||||||
|
import org.dromara.gps.domain.vo.GpsSafetyUserRecordVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全员轨迹信息Mapper接口
|
||||||
|
*
|
||||||
|
* @author lilemy
|
||||||
|
* @date 2025-11-26
|
||||||
|
*/
|
||||||
|
public interface GpsSafetyUserRecordMapper extends BaseMapperPlus<GpsSafetyUserRecord, GpsSafetyUserRecordVo> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,82 @@
|
|||||||
|
package org.dromara.gps.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.gps.domain.GpsSafetyUserRecord;
|
||||||
|
import org.dromara.gps.domain.bo.GpsSafetyUserRecordBo;
|
||||||
|
import org.dromara.gps.domain.vo.GpsSafetyUserRecordVo;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全员轨迹信息Service接口
|
||||||
|
*
|
||||||
|
* @author lilemy
|
||||||
|
* @date 2025-11-26
|
||||||
|
*/
|
||||||
|
public interface IGpsSafetyUserRecordService extends IService<GpsSafetyUserRecord> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询安全员轨迹信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 安全员轨迹信息
|
||||||
|
*/
|
||||||
|
GpsSafetyUserRecordVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询安全员轨迹信息列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 安全员轨迹信息分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<GpsSafetyUserRecordVo> queryPageList(GpsSafetyUserRecordBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的安全员轨迹信息列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 安全员轨迹信息列表
|
||||||
|
*/
|
||||||
|
List<GpsSafetyUserRecordVo> queryList(GpsSafetyUserRecordBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增安全员轨迹信息
|
||||||
|
*
|
||||||
|
* @param bo 安全员轨迹信息
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(GpsSafetyUserRecordBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改安全员轨迹信息
|
||||||
|
*
|
||||||
|
* @param bo 安全员轨迹信息
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(GpsSafetyUserRecordBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除安全员轨迹信息信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并保存轨迹信息
|
||||||
|
* 核心逻辑:根据用户当前坐标判断是否在项目区域内,更新或创建轨迹记录(进入/离开区域)
|
||||||
|
*
|
||||||
|
* @param clientId 设备id,非空
|
||||||
|
* @param projectId 项目id,非空
|
||||||
|
* @param userId 用户id,非空
|
||||||
|
* @param longitude 经度,非空
|
||||||
|
* @param latitude 纬度,非空
|
||||||
|
*/
|
||||||
|
void validTrackByEquipment(String clientId, Long projectId, Long userId, String longitude, String latitude);
|
||||||
|
}
|
||||||
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.common.core.exception.ServiceException;
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
@ -31,6 +32,7 @@ import org.dromara.gps.mapper.GpsEquipmentMapper;
|
|||||||
import org.dromara.gps.mapper.GpsManmachineMapper;
|
import org.dromara.gps.mapper.GpsManmachineMapper;
|
||||||
import org.dromara.gps.service.IGpsEquipmentService;
|
import org.dromara.gps.service.IGpsEquipmentService;
|
||||||
import org.dromara.gps.service.IGpsEquipmentSonService;
|
import org.dromara.gps.service.IGpsEquipmentSonService;
|
||||||
|
import org.dromara.gps.service.IGpsSafetyUserRecordService;
|
||||||
import org.dromara.project.domain.vo.project.BusProjectVo;
|
import org.dromara.project.domain.vo.project.BusProjectVo;
|
||||||
import org.dromara.project.service.IBusProjectService;
|
import org.dromara.project.service.IBusProjectService;
|
||||||
import org.dromara.system.domain.vo.SysUserVo;
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
@ -81,6 +83,9 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IVehVehicleTripService iVehVehicleTripService;
|
private IVehVehicleTripService iVehVehicleTripService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IGpsSafetyUserRecordService safetyUserRecordService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询GPS设备详细
|
* 查询GPS设备详细
|
||||||
*
|
*
|
||||||
@ -265,7 +270,9 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
|
|||||||
|
|
||||||
gpsEquipmentSonService.insertByBo(gpsEquipmentSon);
|
gpsEquipmentSonService.insertByBo(gpsEquipmentSon);
|
||||||
|
|
||||||
|
// 记录安全员轨迹
|
||||||
|
safetyUserRecordService.validTrackByEquipment(gpsEquipmentSon.getClientId(), gpsEquipmentSon.getProjectId(),
|
||||||
|
gpsEquipmentSon.getUserId(), location.getStr("longitude"), location.getStr("latitude"));
|
||||||
//保存到redis,如果存在则更新存活时间
|
//保存到redis,如果存在则更新存活时间
|
||||||
|
|
||||||
// --------------------------
|
// --------------------------
|
||||||
@ -465,7 +472,13 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
|
|||||||
GpsManmachine gpsManmachine = new GpsManmachine();
|
GpsManmachine gpsManmachine = new GpsManmachine();
|
||||||
gpsManmachine.setClientId(bo.getClientId());
|
gpsManmachine.setClientId(bo.getClientId());
|
||||||
gpsManmachine.setUserId(bo.getUserId());
|
gpsManmachine.setUserId(bo.getUserId());
|
||||||
gpsManmachine.setType(bo.getClientType() == 1 ? 1 : 2);
|
Integer type = switch (bo.getClientType()) {
|
||||||
|
case 1 -> 1; // 车辆
|
||||||
|
case 0 -> 2; // 人员
|
||||||
|
case 2 -> 3; // 安全员
|
||||||
|
default -> throw new ServiceException("未知设备类型");
|
||||||
|
};
|
||||||
|
gpsManmachine.setType(type);
|
||||||
if (bo.getClientType() == 1) {
|
if (bo.getClientType() == 1) {
|
||||||
iVehVehicleInfoService.update(new LambdaUpdateWrapper<VehVehicleInfo>().set(VehVehicleInfo::getClientId, bo.getClientId()).eq(VehVehicleInfo::getId, bo.getUserId()));
|
iVehVehicleInfoService.update(new LambdaUpdateWrapper<VehVehicleInfo>().set(VehVehicleInfo::getClientId, bo.getClientId()).eq(VehVehicleInfo::getId, bo.getUserId()));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,266 @@
|
|||||||
|
package org.dromara.gps.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.utils.JSTUtil;
|
||||||
|
import org.dromara.facility.domain.FacMatrix;
|
||||||
|
import org.dromara.facility.service.IFacMatrixService;
|
||||||
|
import org.dromara.gps.domain.GpsSafetyUserRecord;
|
||||||
|
import org.dromara.gps.domain.bo.GpsSafetyUserRecordBo;
|
||||||
|
import org.dromara.gps.domain.vo.GpsSafetyUserRecordVo;
|
||||||
|
import org.dromara.gps.mapper.GpsSafetyUserRecordMapper;
|
||||||
|
import org.dromara.gps.service.IGpsSafetyUserRecordService;
|
||||||
|
import org.dromara.manager.recognizermanager.vo.RecognizeConvertCoordinateResult;
|
||||||
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
|
import org.dromara.system.service.ISysUserService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全员轨迹信息Service业务层处理
|
||||||
|
*
|
||||||
|
* @author lilemy
|
||||||
|
* @date 2025-11-26
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class GpsSafetyUserRecordServiceImpl extends ServiceImpl<GpsSafetyUserRecordMapper, GpsSafetyUserRecord>
|
||||||
|
implements IGpsSafetyUserRecordService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IFacMatrixService matrixService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询安全员轨迹信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 安全员轨迹信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public GpsSafetyUserRecordVo queryById(Long id) {
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询安全员轨迹信息列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 安全员轨迹信息分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<GpsSafetyUserRecordVo> queryPageList(GpsSafetyUserRecordBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<GpsSafetyUserRecord> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<GpsSafetyUserRecordVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的安全员轨迹信息列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 安全员轨迹信息列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<GpsSafetyUserRecordVo> queryList(GpsSafetyUserRecordBo bo) {
|
||||||
|
LambdaQueryWrapper<GpsSafetyUserRecord> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<GpsSafetyUserRecord> buildQueryWrapper(GpsSafetyUserRecordBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<GpsSafetyUserRecord> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.orderByDesc(GpsSafetyUserRecord::getId);
|
||||||
|
lqw.eq(bo.getProjectId() != null, GpsSafetyUserRecord::getProjectId, bo.getProjectId());
|
||||||
|
lqw.eq(bo.getUserId() != null, GpsSafetyUserRecord::getUserId, bo.getUserId());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getClientId()), GpsSafetyUserRecord::getClientId, bo.getClientId());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getUserName()), GpsSafetyUserRecord::getUserName, bo.getUserName());
|
||||||
|
lqw.eq(bo.getRecordDate() != null, GpsSafetyUserRecord::getRecordDate, bo.getRecordDate());
|
||||||
|
lqw.eq(bo.getEntryTime() != null, GpsSafetyUserRecord::getEntryTime, bo.getEntryTime());
|
||||||
|
lqw.eq(bo.getExitTime() != null, GpsSafetyUserRecord::getExitTime, bo.getExitTime());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增安全员轨迹信息
|
||||||
|
*
|
||||||
|
* @param bo 安全员轨迹信息
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(GpsSafetyUserRecordBo bo) {
|
||||||
|
GpsSafetyUserRecord add = MapstructUtils.convert(bo, GpsSafetyUserRecord.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改安全员轨迹信息
|
||||||
|
*
|
||||||
|
* @param bo 安全员轨迹信息
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(GpsSafetyUserRecordBo bo) {
|
||||||
|
GpsSafetyUserRecord update = MapstructUtils.convert(bo, GpsSafetyUserRecord.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(GpsSafetyUserRecord entity) {
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除安全员轨迹信息信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if (isValid) {
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并保存轨迹信息
|
||||||
|
* 核心逻辑:根据用户当前坐标判断是否在项目区域内,更新或创建轨迹记录(进入/离开区域)
|
||||||
|
*
|
||||||
|
* @param clientId 设备id,非空
|
||||||
|
* @param projectId 项目id,非空
|
||||||
|
* @param userId 用户id,非空
|
||||||
|
* @param longitude 经度,非空
|
||||||
|
* @param latitude 纬度,非空
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void validTrackByEquipment(String clientId, Long projectId, Long userId, String longitude, String latitude) {
|
||||||
|
// 1. 参数校验:任一参数为空则记录错误日志并终止流程
|
||||||
|
if (StringUtils.isBlank(clientId) || Objects.isNull(projectId)
|
||||||
|
|| Objects.isNull(userId) || StringUtils.isBlank(longitude)
|
||||||
|
|| StringUtils.isBlank(latitude)) {
|
||||||
|
log.error("同步安全员轨迹参数异常 clientId: {}, projectId: {}, userId: {}, longitude: {}, latitude: {}",
|
||||||
|
clientId, projectId, userId, longitude, latitude);
|
||||||
|
return; // 提前返回,避免无效执行
|
||||||
|
}
|
||||||
|
|
||||||
|
LocalDateTime currentTime = LocalDateTime.now();
|
||||||
|
LocalDate currentDate = LocalDate.now();
|
||||||
|
|
||||||
|
// 2. 查询当前项目的地理范围配置
|
||||||
|
List<FacMatrix> matrixList = matrixService.lambdaQuery()
|
||||||
|
.eq(FacMatrix::getProjectId, projectId)
|
||||||
|
.list();
|
||||||
|
if (CollUtil.isEmpty(matrixList)) {
|
||||||
|
log.error("同步安全员轨迹项目范围不存在 projectId: {}", projectId);
|
||||||
|
return; // 无地理范围配置,终止流程
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 解析坐标并判断是否在项目区域内
|
||||||
|
RecognizeConvertCoordinateResult coordinateResult = new RecognizeConvertCoordinateResult();
|
||||||
|
coordinateResult.setLng(longitude);
|
||||||
|
coordinateResult.setLat(latitude);
|
||||||
|
FacMatrix currentMatrix = JSTUtil.findContainingMatrix(coordinateResult, matrixList); // 命中的地理范围
|
||||||
|
|
||||||
|
// 4. 查询用户当天最新轨迹记录
|
||||||
|
GpsSafetyUserRecord latestRecord = lambdaQuery()
|
||||||
|
.eq(GpsSafetyUserRecord::getClientId, clientId)
|
||||||
|
.eq(GpsSafetyUserRecord::getProjectId, projectId)
|
||||||
|
.eq(GpsSafetyUserRecord::getUserId, userId)
|
||||||
|
.eq(GpsSafetyUserRecord::getRecordDate, currentDate)
|
||||||
|
.orderByDesc(GpsSafetyUserRecord::getId)
|
||||||
|
.last("limit 1")
|
||||||
|
.one();
|
||||||
|
|
||||||
|
// 5. 获取用户信息(用于轨迹记录)
|
||||||
|
SysUserVo userVo = userService.selectUserById(userId);
|
||||||
|
|
||||||
|
// 6. 轨迹记录逻辑处理:根据是否在区域内+是否已有记录,分支处理
|
||||||
|
handleTrackRecord(currentMatrix, latestRecord, userVo, clientId, projectId, userId, currentDate, currentTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理轨迹记录的创建或更新逻辑
|
||||||
|
* 封装核心业务逻辑,减少主方法嵌套
|
||||||
|
*
|
||||||
|
* @param currentMatrix 当前命中的地理范围(null表示不在区域内)
|
||||||
|
* @param latestRecord 用户当天最新轨迹记录
|
||||||
|
* @param userVo 用户信息
|
||||||
|
* @param clientId 设备ID
|
||||||
|
* @param projectId 项目ID
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @param currentDate 当前日期
|
||||||
|
* @param currentTime 当前时间
|
||||||
|
*/
|
||||||
|
private void handleTrackRecord(FacMatrix currentMatrix, GpsSafetyUserRecord latestRecord,
|
||||||
|
SysUserVo userVo, String clientId, Long projectId,
|
||||||
|
Long userId, LocalDate currentDate, LocalDateTime currentTime) {
|
||||||
|
// 场景1:用户当天已有轨迹记录
|
||||||
|
if (Objects.nonNull(latestRecord)) {
|
||||||
|
LocalDateTime exitTime = latestRecord.getExitTime();
|
||||||
|
|
||||||
|
// 子场景1.1:当前在区域内,且上次记录已标记离开 → 创建新的进入记录
|
||||||
|
if (Objects.nonNull(currentMatrix) && Objects.nonNull(exitTime)) {
|
||||||
|
createNewTrackRecord(userVo, clientId, projectId, userId, currentDate, currentTime);
|
||||||
|
}
|
||||||
|
// 子场景1.2:当前不在区域内,且上次记录未标记离开 → 更新离开时间
|
||||||
|
else if (Objects.isNull(currentMatrix) && Objects.isNull(exitTime)) {
|
||||||
|
latestRecord.setExitTime(currentTime);
|
||||||
|
this.updateById(latestRecord);
|
||||||
|
}
|
||||||
|
// 其他情况(如在区域内但未离开/不在区域内但已离开)无需处理
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 场景2:用户当天无轨迹记录,且当前在区域内 → 创建首次进入记录
|
||||||
|
if (Objects.nonNull(currentMatrix)) {
|
||||||
|
createNewTrackRecord(userVo, clientId, projectId, userId, currentDate, currentTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建新的轨迹记录(进入区域)
|
||||||
|
* 封装重复的对象创建逻辑,提升代码复用性
|
||||||
|
*/
|
||||||
|
private void createNewTrackRecord(SysUserVo userVo, String clientId, Long projectId,
|
||||||
|
Long userId, LocalDate currentDate, LocalDateTime currentTime) {
|
||||||
|
GpsSafetyUserRecord newRecord = new GpsSafetyUserRecord();
|
||||||
|
newRecord.setProjectId(projectId);
|
||||||
|
newRecord.setUserId(userId);
|
||||||
|
newRecord.setClientId(clientId);
|
||||||
|
newRecord.setUserName(Objects.nonNull(userVo) ? userVo.getNickName() : "未知用户"); // 空值保护
|
||||||
|
newRecord.setRecordDate(currentDate);
|
||||||
|
newRecord.setEntryTime(currentTime);
|
||||||
|
this.save(newRecord);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -98,17 +98,17 @@ public class DroneRequestUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下载图片合成结果
|
* 获取图片合成结果
|
||||||
*
|
*
|
||||||
* @param taskId 任务ID
|
* @param taskId 任务ID
|
||||||
*/
|
*/
|
||||||
public static DroneImgMergeUrlVo getMergedFileUrl(String url, String taskId) {
|
public static DroneImgMergeUrlVo getMergedFileUrl(String url, String taskId) {
|
||||||
if (StringUtils.isAnyBlank(taskId)) {
|
if (StringUtils.isAnyBlank(taskId)) {
|
||||||
throw new ServiceException("下载图片合成结果请求参数错误", HttpStatus.BAD_REQUEST);
|
throw new ServiceException("获取图片合成结果请求参数错误", HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
// 完整 URL
|
// 完整 URL
|
||||||
String fullUrl = url + DroneConstant.GET_MERGED_FILE_URL + "/" + taskId;
|
String fullUrl = url + DroneConstant.GET_MERGED_FILE_URL + "/" + taskId;
|
||||||
String errorMsg = "下载图片合成结果请求失败";
|
String errorMsg = "获取图片合成结果请求失败";
|
||||||
try (HttpResponse response = HttpRequest.get(fullUrl).execute()) {
|
try (HttpResponse response = HttpRequest.get(fullUrl).execute()) {
|
||||||
if (!response.isOk()) {
|
if (!response.isOk()) {
|
||||||
log.error("{}:{}", errorMsg, response.getStatus());
|
log.error("{}:{}", errorMsg, response.getStatus());
|
||||||
@ -122,7 +122,7 @@ public class DroneRequestUtils {
|
|||||||
}
|
}
|
||||||
String data = obj.getStr("data");
|
String data = obj.getStr("data");
|
||||||
DroneImgMergeUrlVo mergeUrlVo = JSONUtil.toBean(data, DroneImgMergeUrlVo.class);
|
DroneImgMergeUrlVo mergeUrlVo = JSONUtil.toBean(data, DroneImgMergeUrlVo.class);
|
||||||
log.info("下载图片合成结果请求成功:{}", mergeUrlVo);
|
log.info("获取图片合成结果请求成功:{}", mergeUrlVo);
|
||||||
return mergeUrlVo;
|
return mergeUrlVo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,7 +149,14 @@ public class DroneRequestUtils {
|
|||||||
JSONObject obj = JSONUtil.parseObj(body);
|
JSONObject obj = JSONUtil.parseObj(body);
|
||||||
if (!obj.getStr("code").equals("200")) {
|
if (!obj.getStr("code").equals("200")) {
|
||||||
log.error("{},状态码:{},错误信息:{}", errorMsg, obj.get("code"), obj.get("msg"));
|
log.error("{},状态码:{},错误信息:{}", errorMsg, obj.get("code"), obj.get("msg"));
|
||||||
throw new ServiceException(errorMsg + ":" + obj.get("msg"));
|
if (obj.getStr("code").equals("500")) {
|
||||||
|
DroneImgMergeProgressVo vo = new DroneImgMergeProgressVo();
|
||||||
|
vo.setCode("404");
|
||||||
|
vo.setMsg(null);
|
||||||
|
return vo;
|
||||||
|
} else {
|
||||||
|
throw new ServiceException(errorMsg + ":" + obj.get("msg"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
DroneImgMergeProgressVo progress = JSONUtil.toBean(obj, DroneImgMergeProgressVo.class);
|
DroneImgMergeProgressVo progress = JSONUtil.toBean(obj, DroneImgMergeProgressVo.class);
|
||||||
if (progress == null) {
|
if (progress == null) {
|
||||||
|
|||||||
@ -452,7 +452,7 @@ public class OutTableController extends BaseController {
|
|||||||
|
|
||||||
BigDecimal monthCompletionValue = BigDecimal.ZERO;
|
BigDecimal monthCompletionValue = BigDecimal.ZERO;
|
||||||
for (BusProcurement busProcurement : busProcurements1) {
|
for (BusProcurement busProcurement : busProcurements1) {
|
||||||
if(busProcurement.getAcceptedQuantity()!=null){
|
if (busProcurement.getAcceptedQuantity() != null && busProcurement.getUnitPrice() != null) {
|
||||||
monthCompletionValue = monthCompletionValue.add(busProcurement.getAcceptedQuantity().multiply(busProcurement.getUnitPrice()).setScale(4, RoundingMode.HALF_UP));
|
monthCompletionValue = monthCompletionValue.add(busProcurement.getAcceptedQuantity().multiply(busProcurement.getUnitPrice()).setScale(4, RoundingMode.HALF_UP));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1230,7 +1230,12 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
|
|||||||
}
|
}
|
||||||
if (recognizeVo.getHasTarget().equals(RecognizerHasTargetEnum.NO.getValue())) {
|
if (recognizeVo.getHasTarget().equals(RecognizerHasTargetEnum.NO.getValue())) {
|
||||||
log.info("没有识别到设施");
|
log.info("没有识别到设施");
|
||||||
return CompletableFuture.completedFuture(true);
|
// 更新数据和状态
|
||||||
|
boolean update = droDroneBigPictureService.lambdaUpdate()
|
||||||
|
.eq(DroDroneBigPicture::getId, bigPictureId)
|
||||||
|
.set(DroDroneBigPicture::getStatus, "6")
|
||||||
|
.update();
|
||||||
|
return CompletableFuture.completedFuture(update);
|
||||||
}
|
}
|
||||||
String fileName = FileNameUtil.getName(fileUrl);
|
String fileName = FileNameUtil.getName(fileUrl);
|
||||||
List<RecognizeTargetVo> targets = recognizeVo.getTargets();
|
List<RecognizeTargetVo> targets = recognizeVo.getTargets();
|
||||||
@ -1281,6 +1286,7 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
|
|||||||
recognizePic = drawnVo.getOssId();
|
recognizePic = drawnVo.getOssId();
|
||||||
}
|
}
|
||||||
} catch (IOException | URISyntaxException e) {
|
} catch (IOException | URISyntaxException e) {
|
||||||
|
log.error("将识别数据同步到图片上失败", e);
|
||||||
throw new ServiceException("将识别数据同步到图片上失败", HttpStatus.ERROR);
|
throw new ServiceException("将识别数据同步到图片上失败", HttpStatus.ERROR);
|
||||||
}
|
}
|
||||||
String recognizerStr = JSONUtil.toJsonStr(recognizerVoList);
|
String recognizerStr = JSONUtil.toJsonStr(recognizerVoList);
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import org.dromara.common.oss.core.OssClient;
|
|||||||
import org.dromara.common.oss.exception.OssException;
|
import org.dromara.common.oss.exception.OssException;
|
||||||
import org.dromara.common.oss.factory.OssFactory;
|
import org.dromara.common.oss.factory.OssFactory;
|
||||||
import org.dromara.common.utils.DocumentUtil;
|
import org.dromara.common.utils.DocumentUtil;
|
||||||
|
import org.dromara.project.domain.BusProject;
|
||||||
import org.dromara.project.service.IBusProjectService;
|
import org.dromara.project.service.IBusProjectService;
|
||||||
import org.dromara.quality.constant.QltQualityConstant;
|
import org.dromara.quality.constant.QltQualityConstant;
|
||||||
import org.dromara.quality.domain.QltQualityConstructionLog;
|
import org.dromara.quality.domain.QltQualityConstructionLog;
|
||||||
@ -31,6 +32,7 @@ import org.dromara.quality.domain.vo.qualityconstructionlog.QltQualityConstructi
|
|||||||
import org.dromara.quality.mapper.QltQualityConstructionLogMapper;
|
import org.dromara.quality.mapper.QltQualityConstructionLogMapper;
|
||||||
import org.dromara.quality.service.IQltQualityConstructionLogService;
|
import org.dromara.quality.service.IQltQualityConstructionLogService;
|
||||||
import org.dromara.system.domain.vo.SysOssVo;
|
import org.dromara.system.domain.vo.SysOssVo;
|
||||||
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
import org.dromara.system.service.ISysOssService;
|
import org.dromara.system.service.ISysOssService;
|
||||||
import org.dromara.system.service.ISysUserService;
|
import org.dromara.system.service.ISysUserService;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
@ -336,11 +338,25 @@ public class QltQualityConstructionLogServiceImpl extends ServiceImpl<QltQuality
|
|||||||
*/
|
*/
|
||||||
public Map<String, String> getReplacementMap(QltQualityConstructionLog qualityConstructionLog) {
|
public Map<String, String> getReplacementMap(QltQualityConstructionLog qualityConstructionLog) {
|
||||||
Map<String, String> replacementMap = new HashMap<>();
|
Map<String, String> replacementMap = new HashMap<>();
|
||||||
String createName = userService.selectUserById(qualityConstructionLog.getCreateBy()).getNickName();
|
Long createBy = qualityConstructionLog.getCreateBy();
|
||||||
|
String createName = "";
|
||||||
|
if (createBy != null) {
|
||||||
|
SysUserVo userVo = userService.selectUserById(createBy);
|
||||||
|
if (userVo != null) {
|
||||||
|
createName = userVo.getNickName();
|
||||||
|
}
|
||||||
|
}
|
||||||
replacementMap.put("${createName}", createName);
|
replacementMap.put("${createName}", createName);
|
||||||
Date createTime = qualityConstructionLog.getCreateTime();
|
Date createTime = qualityConstructionLog.getCreateTime();
|
||||||
replacementMap.put("${createTime}", createTime != null ? DateUtils.formatDateTime(createTime) : "");
|
replacementMap.put("${createTime}", createTime != null ? DateUtils.formatDateTime(createTime) : "");
|
||||||
String projectName = projectService.getById(qualityConstructionLog.getProjectId()).getProjectName();
|
Long projectId = qualityConstructionLog.getProjectId();
|
||||||
|
String projectName = "";
|
||||||
|
if (projectId != null) {
|
||||||
|
BusProject project = projectService.getById(projectId);
|
||||||
|
if (project != null) {
|
||||||
|
projectName = project.getProjectName();
|
||||||
|
}
|
||||||
|
}
|
||||||
replacementMap.put("${projectName}", projectName);
|
replacementMap.put("${projectName}", projectName);
|
||||||
LocalDate happenDate = qualityConstructionLog.getHappenDate();
|
LocalDate happenDate = qualityConstructionLog.getHappenDate();
|
||||||
replacementMap.put("${happenDate}", happenDate != null ? happenDate.toString() : "");
|
replacementMap.put("${happenDate}", happenDate != null ? happenDate.toString() : "");
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
package org.dromara.xzd.bx.bxsq.mapper;
|
package org.dromara.xzd.bx.bxsq.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import org.apache.poi.ss.formula.functions.T;
|
|
||||||
import org.dromara.common.mybatis.annotation.DataColumn;
|
import org.dromara.common.mybatis.annotation.DataColumn;
|
||||||
import org.dromara.common.mybatis.annotation.DataPermission;
|
import org.dromara.common.mybatis.annotation.DataPermission;
|
||||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
@ -20,11 +18,9 @@ import org.dromara.xzd.bx.bxsq.domain.vo.XzdBxBxsqVo;
|
|||||||
public interface XzdBxBxsqMapper extends BaseMapperPlus<XzdBxBxsq, XzdBxBxsqVo> {
|
public interface XzdBxBxsqMapper extends BaseMapperPlus<XzdBxBxsq, XzdBxBxsqVo> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@DataPermission({
|
@DataPermission({
|
||||||
@DataColumn(key = "deptName", value = "dept_id"),
|
@DataColumn(key = "deptName", value = "dept_id"),
|
||||||
@DataColumn(key = "userName", value = "user_id")
|
@DataColumn(key = "userName", value = "bxr")
|
||||||
})
|
})
|
||||||
default Page<XzdBxBxsqVo> selectPage(IPage<XzdBxBxsq> page, LambdaQueryWrapper<XzdBxBxsq> wrapper) {
|
default Page<XzdBxBxsqVo> selectPage(IPage<XzdBxBxsq> page, LambdaQueryWrapper<XzdBxBxsq> wrapper) {
|
||||||
return this.selectVoPage(page, wrapper);
|
return this.selectVoPage(page, wrapper);
|
||||||
|
|||||||
@ -79,7 +79,7 @@ public class XzdBxBxsqServiceImpl extends ServiceImpl<XzdBxBxsqMapper, XzdBxBxsq
|
|||||||
* @return 报销-报销申请
|
* @return 报销-报销申请
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public XzdBxBxsqVo queryById(Long id){
|
public XzdBxBxsqVo queryById(Long id) {
|
||||||
XzdBxBxsqVo xzdBxBxsqVo = baseMapper.selectVoById(id);
|
XzdBxBxsqVo xzdBxBxsqVo = baseMapper.selectVoById(id);
|
||||||
List<XzdBxBxsqVo> xzdBxBxsqVo1 = List.of(xzdBxBxsqVo);
|
List<XzdBxBxsqVo> xzdBxBxsqVo1 = List.of(xzdBxBxsqVo);
|
||||||
setValue(xzdBxBxsqVo1);
|
setValue(xzdBxBxsqVo1);
|
||||||
@ -96,12 +96,12 @@ public class XzdBxBxsqServiceImpl extends ServiceImpl<XzdBxBxsqMapper, XzdBxBxsq
|
|||||||
@Override
|
@Override
|
||||||
public TableDataInfo<XzdBxBxsqVo> queryPageList(XzdBxBxsqBo bo, PageQuery pageQuery) {
|
public TableDataInfo<XzdBxBxsqVo> queryPageList(XzdBxBxsqBo bo, PageQuery pageQuery) {
|
||||||
//暂时定为只能看见自己的报销
|
//暂时定为只能看见自己的报销
|
||||||
if (bo.getBxr() == null){
|
if (bo.getBxr() == null && !LoginHelper.isSuperAdmin()) {
|
||||||
bo.setBxr(LoginHelper.getUserId());
|
bo.setBxr(LoginHelper.getUserId());
|
||||||
}
|
}
|
||||||
|
|
||||||
LambdaQueryWrapper<XzdBxBxsq> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<XzdBxBxsq> lqw = buildQueryWrapper(bo);
|
||||||
Page<XzdBxBxsqVo> result = baseMapper.selectPage(pageQuery.build(), lqw);
|
Page<XzdBxBxsqVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
setValue(result.getRecords());
|
setValue(result.getRecords());
|
||||||
return TableDataInfo.build(result);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
@ -167,12 +167,12 @@ public class XzdBxBxsqServiceImpl extends ServiceImpl<XzdBxBxsqMapper, XzdBxBxsq
|
|||||||
add.setBm(LoginHelper.getDeptId());
|
add.setBm(LoginHelper.getDeptId());
|
||||||
//公司
|
//公司
|
||||||
SysDeptVo sysDeptVo = sysDeptService.selectDeptById(LoginHelper.getDeptId());
|
SysDeptVo sysDeptVo = sysDeptService.selectDeptById(LoginHelper.getDeptId());
|
||||||
if (sysDeptVo != null && !sysDeptVo.getParentId().equals(100L)){
|
if (sysDeptVo != null && !sysDeptVo.getParentId().equals(100L)) {
|
||||||
SysDeptVo sysDeptVo1 = getCompanyByDeptId(sysDeptVo);
|
SysDeptVo sysDeptVo1 = getCompanyByDeptId(sysDeptVo);
|
||||||
if (sysDeptVo1 != null) {
|
if (sysDeptVo1 != null) {
|
||||||
add.setGs(sysDeptVo1.getDeptId());
|
add.setGs(sysDeptVo1.getDeptId());
|
||||||
}
|
}
|
||||||
}else if ((sysDeptVo != null && sysDeptVo.getParentId().equals(100L)) || (sysDeptVo != null && sysDeptVo.getDeptId() == 100L)){
|
} else if ((sysDeptVo != null && sysDeptVo.getParentId().equals(100L)) || (sysDeptVo != null && sysDeptVo.getDeptId() == 100L)) {
|
||||||
add.setGs(sysDeptVo.getDeptId());
|
add.setGs(sysDeptVo.getDeptId());
|
||||||
}
|
}
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
@ -180,7 +180,7 @@ public class XzdBxBxsqServiceImpl extends ServiceImpl<XzdBxBxsqMapper, XzdBxBxsq
|
|||||||
bo.setId(add.getId());
|
bo.setId(add.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bo.getFymx() != null && !bo.getFymx().isEmpty()){
|
if (bo.getFymx() != null && !bo.getFymx().isEmpty()) {
|
||||||
for (XzdBxBxsqFymx fymx : bo.getFymx()) {
|
for (XzdBxBxsqFymx fymx : bo.getFymx()) {
|
||||||
fymx.setBxId(add.getId());
|
fymx.setBxId(add.getId());
|
||||||
}
|
}
|
||||||
@ -218,16 +218,16 @@ public class XzdBxBxsqServiceImpl extends ServiceImpl<XzdBxBxsqMapper, XzdBxBxsq
|
|||||||
|
|
||||||
XzdBxBxsqVo old = queryById(bo.getId());
|
XzdBxBxsqVo old = queryById(bo.getId());
|
||||||
//费用明细
|
//费用明细
|
||||||
if (bo.getFymx() != null && !bo.getFymx().isEmpty()){
|
if (bo.getFymx() != null && !bo.getFymx().isEmpty()) {
|
||||||
if (old.getFymx() != null && !old.getFymx().isEmpty()){
|
if (old.getFymx() != null && !old.getFymx().isEmpty()) {
|
||||||
xzdBxBxsqFymxService.removeByIds(old.getFymx());
|
xzdBxBxsqFymxService.removeByIds(old.getFymx());
|
||||||
}
|
}
|
||||||
for (XzdBxBxsqFymx businessChange : bo.getFymx()) {
|
for (XzdBxBxsqFymx businessChange : bo.getFymx()) {
|
||||||
businessChange.setBxId(update.getId());
|
businessChange.setBxId(update.getId());
|
||||||
}
|
}
|
||||||
xzdBxBxsqFymxService.saveBatch(bo.getFymx());
|
xzdBxBxsqFymxService.saveBatch(bo.getFymx());
|
||||||
}else {
|
} else {
|
||||||
if (old.getFymx() != null && !old.getFymx().isEmpty()){
|
if (old.getFymx() != null && !old.getFymx().isEmpty()) {
|
||||||
xzdBxBxsqFymxService.removeByIds(old.getFymx());
|
xzdBxBxsqFymxService.removeByIds(old.getFymx());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -274,7 +274,7 @@ public class XzdBxBxsqServiceImpl extends ServiceImpl<XzdBxBxsqMapper, XzdBxBxsq
|
|||||||
/**
|
/**
|
||||||
* 保存前的数据校验
|
* 保存前的数据校验
|
||||||
*/
|
*/
|
||||||
private void validEntityBeforeSave(XzdBxBxsq entity){
|
private void validEntityBeforeSave(XzdBxBxsq entity) {
|
||||||
//TODO 做一些数据校验,如唯一约束
|
//TODO 做一些数据校验,如唯一约束
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,7 +287,7 @@ public class XzdBxBxsqServiceImpl extends ServiceImpl<XzdBxBxsqMapper, XzdBxBxsq
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
if(isValid){
|
if (isValid) {
|
||||||
//TODO 做一些业务上的校验,判断是否需要校验
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,7 +303,7 @@ public class XzdBxBxsqServiceImpl extends ServiceImpl<XzdBxBxsqMapper, XzdBxBxsq
|
|||||||
return baseMapper.deleteByIds(ids) > 0;
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValue(List<XzdBxBxsqVo> vos){
|
public void setValue(List<XzdBxBxsqVo> vos) {
|
||||||
for (XzdBxBxsqVo vo : vos) {
|
for (XzdBxBxsqVo vo : vos) {
|
||||||
//费用明细
|
//费用明细
|
||||||
LambdaQueryWrapper<XzdBxBxsqFymx> lqw = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<XzdBxBxsqFymx> lqw = new LambdaQueryWrapper<>();
|
||||||
@ -311,7 +311,7 @@ public class XzdBxBxsqServiceImpl extends ServiceImpl<XzdBxBxsqMapper, XzdBxBxsq
|
|||||||
List<XzdBxBxsqFymx> list = xzdBxBxsqFymxService.list(lqw);
|
List<XzdBxBxsqFymx> list = xzdBxBxsqFymxService.list(lqw);
|
||||||
//费用明细处理
|
//费用明细处理
|
||||||
List<XzdBxBxsqFymxVo> voList = new ArrayList<>();
|
List<XzdBxBxsqFymxVo> voList = new ArrayList<>();
|
||||||
if (list != null && !list.isEmpty()){
|
if (list != null && !list.isEmpty()) {
|
||||||
for (XzdBxBxsqFymx fymx : list) {
|
for (XzdBxBxsqFymx fymx : list) {
|
||||||
XzdBxBxsqFymxVo fymxVo = new XzdBxBxsqFymxVo();
|
XzdBxBxsqFymxVo fymxVo = new XzdBxBxsqFymxVo();
|
||||||
BeanUtils.copyProperties(fymx, fymxVo);
|
BeanUtils.copyProperties(fymx, fymxVo);
|
||||||
@ -330,7 +330,7 @@ public class XzdBxBxsqServiceImpl extends ServiceImpl<XzdBxBxsqMapper, XzdBxBxsq
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//费用承担部门
|
//费用承担部门
|
||||||
if (fymx.getFycdbm() != null){
|
if (fymx.getFycdbm() != null) {
|
||||||
SysDeptVo sysDeptVo = sysDeptService.selectDeptById(fymx.getFycdbm());
|
SysDeptVo sysDeptVo = sysDeptService.selectDeptById(fymx.getFycdbm());
|
||||||
if (sysDeptVo != null) {
|
if (sysDeptVo != null) {
|
||||||
fymxVo.setFycdbmmc(sysDeptVo.getDeptName());
|
fymxVo.setFycdbmmc(sysDeptVo.getDeptName());
|
||||||
@ -341,9 +341,9 @@ public class XzdBxBxsqServiceImpl extends ServiceImpl<XzdBxBxsqMapper, XzdBxBxsq
|
|||||||
vo.setFymx(voList);
|
vo.setFymx(voList);
|
||||||
}
|
}
|
||||||
//报销人名称
|
//报销人名称
|
||||||
if (vo.getBxr() != null){
|
if (vo.getBxr() != null) {
|
||||||
SysUserVo sysUserVo = sysUserService.selectUserById(vo.getBxr());
|
SysUserVo sysUserVo = sysUserService.selectUserById(vo.getBxr());
|
||||||
if (sysUserVo != null){
|
if (sysUserVo != null) {
|
||||||
vo.setBxrmc(sysUserVo.getNickName());
|
vo.setBxrmc(sysUserVo.getNickName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -379,10 +379,10 @@ public class XzdBxBxsqServiceImpl extends ServiceImpl<XzdBxBxsqMapper, XzdBxBxsq
|
|||||||
}
|
}
|
||||||
|
|
||||||
//通过部门查询出公司
|
//通过部门查询出公司
|
||||||
private SysDeptVo getCompanyByDeptId(SysDeptVo deptVo){
|
private SysDeptVo getCompanyByDeptId(SysDeptVo deptVo) {
|
||||||
if (!deptVo.getParentId().equals(100L)){
|
if (!deptVo.getParentId().equals(100L)) {
|
||||||
SysDeptVo sysDeptVo = sysDeptService.selectDeptById(deptVo.getParentId());
|
SysDeptVo sysDeptVo = sysDeptService.selectDeptById(deptVo.getParentId());
|
||||||
if (sysDeptVo == null){
|
if (sysDeptVo == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
getCompanyByDeptId(sysDeptVo);
|
getCompanyByDeptId(sysDeptVo);
|
||||||
|
|||||||
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.dromara.gps.mapper.GpsSafetyUserRecordMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -1953,3 +1953,24 @@ CREATE TABLE `ai_chat_memory`
|
|||||||
INDEX `idx_user_id` (`user_id` ASC) USING BTREE comment '用户id'
|
INDEX `idx_user_id` (`user_id` ASC) USING BTREE comment '用户id'
|
||||||
) comment = 'AI 对话记录信息';
|
) comment = 'AI 对话记录信息';
|
||||||
|
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS gps_safety_user_record;
|
||||||
|
CREATE TABLE `gps_safety_user_record`
|
||||||
|
(
|
||||||
|
`id` bigint not null auto_increment comment '主键',
|
||||||
|
`project_id` bigint not null comment '项目id',
|
||||||
|
`user_id` bigint not null comment '人员id',
|
||||||
|
`client_id` varchar(20) not null comment '设备id',
|
||||||
|
`user_name` varchar(64) null comment '人员名称',
|
||||||
|
`record_date` date not null comment '记录时间',
|
||||||
|
`entry_time` datetime null comment '入场时间',
|
||||||
|
`exit_time` datetime null comment '退场时间',
|
||||||
|
`remark` varchar(512) null comment '备注',
|
||||||
|
`create_by` bigint null comment '创建者',
|
||||||
|
`update_by` bigint null comment '更新者',
|
||||||
|
`create_dept` bigint null comment '创建部门',
|
||||||
|
`create_time` datetime default CURRENT_TIMESTAMP null comment '创建时间',
|
||||||
|
`update_time` datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
INDEX `idx_user_id` (`user_id` ASC) USING BTREE comment '用户id'
|
||||||
|
) comment '安全员轨迹信息';
|
||||||
|
|||||||
Reference in New Issue
Block a user