From 37aa5386234307cc156e2f9a75175597f25a4c38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=8C=87=E9=A3=8ESQL?= <495345283@qq.com> Date: Thu, 18 Dec 2025 16:56:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E8=87=AA=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/entity/yjzl/zddw/TbZdxlFgxlrw.java | 14 ++ .../model/entity/yjzl/zddw/TbZdxlFgzdyrw.java | 200 ++++++++++++++++++ .../model/query/yjzl/TbZdxlFgxlrwQuery.java | 7 + .../TbZdxlFgdwBddxlrwJlController.java | 19 +- .../controller/TbZdxlFgxlrwController.java | 23 ++ .../service/Impl/TbZdxlFgxlrwServiceImpl.java | 59 +++++- .../yjzl/service/TbZdxlFgxlrwService.java | 3 + 7 files changed, 309 insertions(+), 16 deletions(-) create mode 100644 feign-client-api/mosty-base-feign-sdk/src/main/java/com/mosty/base/model/entity/yjzl/zddw/TbZdxlFgzdyrw.java diff --git a/feign-client-api/mosty-base-feign-sdk/src/main/java/com/mosty/base/model/entity/yjzl/zddw/TbZdxlFgxlrw.java b/feign-client-api/mosty-base-feign-sdk/src/main/java/com/mosty/base/model/entity/yjzl/zddw/TbZdxlFgxlrw.java index 76f4c70..15e6800 100644 --- a/feign-client-api/mosty-base-feign-sdk/src/main/java/com/mosty/base/model/entity/yjzl/zddw/TbZdxlFgxlrw.java +++ b/feign-client-api/mosty-base-feign-sdk/src/main/java/com/mosty/base/model/entity/yjzl/zddw/TbZdxlFgxlrw.java @@ -42,6 +42,17 @@ public class TbZdxlFgxlrw extends BaseEntity implements Serializable, Cloneable @Excel(name = "主键ID", sort = 1) private String id; + @ApiModelProperty(value = "任务类型 D_BZ_RWBLX 1日常 2自定义") + @TableField(value = "rwlx") + private String rwlx; + + @ApiModelProperty(value = "任务标题 D_BZ_RWBLX 1日常 2自定义") + @TableField(value = "fg_rwbt") + private String fgRwbt; + + @ApiModelProperty(value = "任务内容 D_BZ_RWBLX 1日常 2自定义") + @TableField(value = "fg_rwnr") + private String fgRwnr; /** * 方格ID */ @@ -255,6 +266,9 @@ public class TbZdxlFgxlrw extends BaseEntity implements Serializable, Cloneable */ public static String FG_ID_FIELD = "fg_id"; + + public static String FG_RWLX_FIELD = "rwlx"; + /** * 方格排序字段名 */ diff --git a/feign-client-api/mosty-base-feign-sdk/src/main/java/com/mosty/base/model/entity/yjzl/zddw/TbZdxlFgzdyrw.java b/feign-client-api/mosty-base-feign-sdk/src/main/java/com/mosty/base/model/entity/yjzl/zddw/TbZdxlFgzdyrw.java new file mode 100644 index 0000000..db93f75 --- /dev/null +++ b/feign-client-api/mosty-base-feign-sdk/src/main/java/com/mosty/base/model/entity/yjzl/zddw/TbZdxlFgzdyrw.java @@ -0,0 +1,200 @@ +package com.mosty.base.model.entity.yjzl.zddw; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.mosty.base.model.BaseEntity; +import com.mosty.common.base.entity.log.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "TbZdxlFgzdyrw 对象", description = "指导巡逻方格自定义任务表") +public class TbZdxlFgzdyrw extends BaseEntity implements Serializable, Cloneable { + + @TableField(exist = false) + private static final long serialVersionUID = 5641782828254278649L; + + /** + * 主键ID + */ + @ApiModelProperty(value = "主键ID") + @Excel(name = "主键ID", sort = 1) + private String id; + + /** + * 方格ID + */ + @ApiModelProperty(value = "方格ID") + @Excel(name = "方格ID", sort = 2, cellType = Excel.ColumnType.NUMERIC) + private Long fgId; + + /** + * 方格排序 + */ + @ApiModelProperty(value = "方格排序") + @Excel(name = "方格排序", sort = 3, cellType = Excel.ColumnType.NUMERIC) + private Integer fgPx; + + /** + * 方格预警等级 D_ZDXL_FGXLRW_YJDJ + */ + @ApiModelProperty(value = "方格预警等级 D_ZDXL_FGXLRW_YJDJ") + @Excel(name = "方格预警等级", sort = 4) + private String fgYjdj; + + /** + * 方格预警颜色 D_ZDXL_FGXLRW_YJYS + */ + @ApiModelProperty(value = "方格预警颜色 D_ZDXL_FGXLRW_YJYS") + @Excel(name = "方格预警颜色", sort = 5) + private String fgYjys; + + /** + * 方格预警警情数量 + */ + @ApiModelProperty(value = "方格任务时段") + @Excel(name = "方格任务时段", sort = 6, cellType = Excel.ColumnType.NUMERIC) + private Integer fgRwsd; + + @ApiModelProperty(value = "任务类型 D_BZ_RWBLX 1日常 2自定义") + private String rwlx; + + /** + * 方格预警高发时段 + */ + @ApiModelProperty(value = "方格任务标题") + @Excel(name = "方格任务标题", sort = 7) + private String fgRwbt; + + /** + * 方格预警高发警情 + */ + @ApiModelProperty(value = "方格任务内容") + @Excel(name = "方格任务内容", sort = 8) + private String fgRwnr; + + /** + * 任务日期 + */ + @ApiModelProperty(value = "任务日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @Excel(name = "任务日期", sort = 11, dateFormat = "yyyy-MM-dd") + private Date rwRq; + + /** + * 任务状态 D_ZDXL_FGXLRW_RWZT + */ + @ApiModelProperty(value = "任务状态 D_ZDXL_FGXLRW_RWZT") + @Excel(name = "任务状态", sort = 12) + private String rwZt; + + /** + * 巡逻规划时长(分钟) + */ + @ApiModelProperty(value = "巡逻规划时长(分钟)") + @Excel(name = "巡逻规划时长(分钟)", sort = 13, cellType = Excel.ColumnType.NUMERIC) + private Double xlghSc; + + /** + * 巡逻规划开始时间 + */ + @ApiModelProperty(value = "巡逻规划开始时间") + @JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "HH:mm:ss") + @Excel(name = "巡逻规划开始时间", sort = 14, dateFormat = "HH:mm:ss") + private Date xlghSjKs; + + /** + * 巡逻规划结束时间 + */ + @ApiModelProperty(value = "巡逻规划结束时间") + @JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "HH:mm:ss") + @Excel(name = "巡逻规划结束时间", sort = 15, dateFormat = "HH:mm:ss") + private Date xlghSjJs; + + /** + * 巡逻规划巡逻里程(公里) + */ + @ApiModelProperty(value = "巡逻规划巡逻里程(公里)") + @Excel(name = "巡逻规划巡逻里程(公里)", sort = 16, cellType = Excel.ColumnType.NUMERIC) + private Double xlghXllc; + + /** + * 巡逻规划盘查车辆 + */ + @ApiModelProperty(value = "巡逻规划盘查车辆") + private Integer xlghPcCl; + + /** + * 巡逻规划盘查人员 + */ + @ApiModelProperty(value = "巡逻规划盘查人员") + private Integer xlghPcRy; + + /** + * 巡逻实际时长(分钟) + */ + @ApiModelProperty(value = "巡逻实际时长(分钟)") + @Excel(name = "巡逻实际时长(分钟)", sort = 17, cellType = Excel.ColumnType.NUMERIC) + private Double xlsjSc; + + /** + * 巡逻实际开始时间 + */ + @ApiModelProperty(value = "巡逻实际开始时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "巡逻实际开始时间", sort = 18, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date xlsjSjKs; + + /** + * 巡逻实际结束时间 + */ + @ApiModelProperty(value = "巡逻实际结束时间") + @Excel(name = "巡逻实际结束时间", sort = 19, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date xlsjSjJs; + + /** + * 巡逻实际巡逻里程(公里) + */ + @ApiModelProperty(value = "巡逻实际巡逻里程(公里)") + @Excel(name = "巡逻实际巡逻里程(公里)", sort = 20, cellType = Excel.ColumnType.NUMERIC) + private Double xlsjXllc; + + /** + * 巡逻实际盘查车辆 + */ + @ApiModelProperty(value = "巡逻实际盘查车辆") + private Integer xlsjPcCl; + + /** + * 巡逻实际盘查人员 + */ + @ApiModelProperty(value = "巡逻实际盘查人员") + private Integer xlsjPcRy; + + /** + * 巡防报备ID + */ + @ApiModelProperty(value = "巡防报备ID") + private String xfbbId; + + /** + * 巡防报备勤务警力ID + */ + @ApiModelProperty(value = "巡防报备勤务警力ID") + private String xfbbQwJlId; + +} diff --git a/feign-client-api/mosty-base-feign-sdk/src/main/java/com/mosty/base/model/query/yjzl/TbZdxlFgxlrwQuery.java b/feign-client-api/mosty-base-feign-sdk/src/main/java/com/mosty/base/model/query/yjzl/TbZdxlFgxlrwQuery.java index 1e9ae59..6ee702e 100644 --- a/feign-client-api/mosty-base-feign-sdk/src/main/java/com/mosty/base/model/query/yjzl/TbZdxlFgxlrwQuery.java +++ b/feign-client-api/mosty-base-feign-sdk/src/main/java/com/mosty/base/model/query/yjzl/TbZdxlFgxlrwQuery.java @@ -28,6 +28,10 @@ public class TbZdxlFgxlrwQuery extends BasePage { @ApiModelProperty(value = "方格ID") private String bbdId; + @ApiModelProperty(value = "任务类型 D_BZ_RWBLX 1日常 2自定义") + private String rwlx; + + /** * 方格ID */ @@ -60,4 +64,7 @@ public class TbZdxlFgxlrwQuery extends BasePage { @ApiModelProperty(value = "任务状态 D_ZDXL_FGXLRW_RWZT") private String rwZt; + @ApiModelProperty(value = "任务标题") + private String fgRwbt; + } diff --git a/mosty-yjzl/src/main/java/com/mosty/yjzl/controller/TbZdxlFgdwBddxlrwJlController.java b/mosty-yjzl/src/main/java/com/mosty/yjzl/controller/TbZdxlFgdwBddxlrwJlController.java index 1aeab10..38f4800 100644 --- a/mosty-yjzl/src/main/java/com/mosty/yjzl/controller/TbZdxlFgdwBddxlrwJlController.java +++ b/mosty-yjzl/src/main/java/com/mosty/yjzl/controller/TbZdxlFgdwBddxlrwJlController.java @@ -9,6 +9,7 @@ import com.mosty.base.model.query.yjzl.BddxlrwJlQuery; import com.mosty.base.model.vo.yjzl.TbZdxlFgdwBddxlrwJlVo; import com.mosty.base.model.vo.yjzl.TbZdxlFgdwVO; import com.mosty.base.utils.MessageUtils; +import com.mosty.base.utils.PositionUtil; import com.mosty.base.utils.spring.SpringValidUtils; import com.mosty.common.base.domain.ResponseResult; import com.mosty.common.base.entity.log.BusinessType; @@ -127,13 +128,15 @@ public class TbZdxlFgdwBddxlrwJlController { return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "方格信息不存在,请退出页面重新进入"); } - boolean inFgdw = TbZdxlFgxlrwUtils.isInGeometry(fgdw, dto.getDkJd(), dto.getDkWd()); - if(!inFgdw){ - return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "您不在方格内,请查看您的定位信息"); +// boolean inFgdw = TbZdxlFgxlrwUtils.isInGeometry(fgdw, dto.getDkJd(), dto.getDkWd()); +// if(!inFgdw){ +// return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "您不在方格内,请查看您的定位信息"); +// } + long jl = PositionUtil.getDistance(dto.getDkJd().doubleValue(), dto.getDkWd().doubleValue(),fgdw.getX1().doubleValue(),fgdw.getY1().doubleValue()); + if(jl > 100L){ + return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "您的位置在100米以外,无法打卡"); } - // TODO: 2025/9/16 需要加上打卡点附近的坐标验证 - //校验上一次打卡情况 // int lastSx = baseEntity.getDkSx() - 1; // if(lastSx > 0){ @@ -147,9 +150,9 @@ public class TbZdxlFgdwBddxlrwJlController { UserInfo user = UserInfoManager.get(); if(ObjectUtils.isNotEmpty(baseEntity.getDkKsSj())){ //开始和结束是否是同一个人 - if(!baseEntity.getDkrXm().equals(user.getUserName())){ - return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "您不是此记录的打卡人,不能进行打卡"); - } +// if(!baseEntity.getDkrXm().equals(user.getUserName())){ +// return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "您不是此记录的打卡人,不能进行打卡"); +// } TbZdxlFgdwBdd tbZdxlFgdwBdd = this.tbZdxlFgdwBddService.selectById(bddxlrw.getBddId()); Integer jgsj = 10; if(Objects.nonNull(tbZdxlFgdwBdd)){ diff --git a/mosty-yjzl/src/main/java/com/mosty/yjzl/controller/TbZdxlFgxlrwController.java b/mosty-yjzl/src/main/java/com/mosty/yjzl/controller/TbZdxlFgxlrwController.java index 2ae94de..34f1c55 100644 --- a/mosty-yjzl/src/main/java/com/mosty/yjzl/controller/TbZdxlFgxlrwController.java +++ b/mosty-yjzl/src/main/java/com/mosty/yjzl/controller/TbZdxlFgxlrwController.java @@ -5,6 +5,7 @@ import com.mosty.base.model.dto.yjzl.TbZdxlFgxlrwCreateDTO; import com.mosty.base.model.dto.yjzl.TbZdxlFgxlrwIssueDTO; import com.mosty.base.model.dto.yjzl.TbZdxlFgxlrwUpdateDTO; import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgxlrw; +import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgzdyrw; import com.mosty.base.model.query.yjzl.TbZdxlFgxlrwQuery; import com.mosty.base.model.vo.yjzl.TbZdxlFgxlrwVO; import com.mosty.base.utils.MessageUtils; @@ -192,6 +193,28 @@ public class TbZdxlFgxlrwController { } } + + @ApiOperation(value = "导入列表(自定义任务导入)") + @PostMapping("/importListByMbZdy") + @JwtSysUser + @Log(title = "指导巡逻-方格自定义任务接口-导入列表(根据导出的模板)", businessType = BusinessType.IMPORT) + public ResponseResult importListByMbZdy(MultipartFile file) { + try { + ExcelUtil util = new ExcelUtil<>(TbZdxlFgzdyrw.class); + List fgxlrwList = util.importExcel(file.getInputStream(), 1); + if(CollectionUtils.isEmpty(fgxlrwList)){ + return ResponseResult.fail(MessageUtils.getImportFailMsg() + "表格数据获取为空"); + } + int resultInt = tbZdxlFgxlrwService.importListByMbZdy(fgxlrwList); + if(resultInt > 0){ + return ResponseResult.success(resultInt); + } + return ResponseResult.fail(MessageUtils.getImportFailMsg()); + } catch (Exception e) { + return ResponseResult.fail(MessageUtils.getImportServerErrorMsg()); + } + } + /** * 下发任务 * @param dto 下发DTO对象 diff --git a/mosty-yjzl/src/main/java/com/mosty/yjzl/service/Impl/TbZdxlFgxlrwServiceImpl.java b/mosty-yjzl/src/main/java/com/mosty/yjzl/service/Impl/TbZdxlFgxlrwServiceImpl.java index 9dd7b8f..b0111a6 100644 --- a/mosty-yjzl/src/main/java/com/mosty/yjzl/service/Impl/TbZdxlFgxlrwServiceImpl.java +++ b/mosty-yjzl/src/main/java/com/mosty/yjzl/service/Impl/TbZdxlFgxlrwServiceImpl.java @@ -10,26 +10,23 @@ import com.mosty.base.model.dto.qwzx.TbQwXfbbVo; import com.mosty.base.model.dto.yjzl.TbZdxlFgxlrwUpdateDTO; import com.mosty.base.model.entity.qwzx.TbQwJl; import com.mosty.base.model.entity.qwzx.TbQwXfbb; -import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgdw; -import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgdwBddxlrw; -import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgmrpz; -import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgxlrw; +import com.mosty.base.model.entity.yjzl.zddw.*; import com.mosty.base.model.query.yjzl.TbZdxlFgxlrwQuery; import com.mosty.base.model.vo.yjzl.TbZdxlFgdwBddxlrwVO; import com.mosty.base.model.vo.yjzl.TbZdxlFgxlrwVO; -import com.mosty.base.utils.Constant; -import com.mosty.base.utils.MathUtils; -import com.mosty.base.utils.PageUtils; -import com.mosty.base.utils.QueryWrapperUtils; +import com.mosty.base.utils.*; import com.mosty.common.base.util.StringUtils; import com.mosty.common.token.UserInfo; import com.mosty.common.token.UserInfoManager; +import com.mosty.yjzl.mapper.TbZdxlFgdwBddMapper; +import com.mosty.yjzl.mapper.TbZdxlFgdwBddxlrwMapper; import com.mosty.yjzl.mapper.TbZdxlFgxlrwMapper; import com.mosty.yjzl.service.*; import com.mosty.yjzl.utils.TbZdxlFgxlrwUtils; import lombok.AllArgsConstructor; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -48,6 +45,7 @@ import java.util.stream.Collectors; @AllArgsConstructor public class TbZdxlFgxlrwServiceImpl extends ServiceImpl implements TbZdxlFgxlrwService { + /** * 指导巡逻Service */ @@ -195,6 +193,8 @@ public class TbZdxlFgxlrwServiceImpl extends ServiceImpl selectListByRwRq(Date rwRq) { if (ObjectUtils.isEmpty(rwRq)) { @@ -277,6 +277,7 @@ public class TbZdxlFgxlrwServiceImpl extends ServiceImpl entityList) { + if(CollectionUtils.isEmpty(entityList)){ + return -1; + } + + //查询默认配置 + TbZdxlFgmrpz mrpz = tbZdxlFgmrpzService.selectDefault(); + if(ObjectUtils.isEmpty(mrpz)){ + mrpz = new TbZdxlFgmrpz(); + mrpz.setPcCl(0); + mrpz.setPcRy(0); + mrpz.setXlSc(0.0); + mrpz.setXlLc(0.0); + } + + //筛选保存和修改列表 + for(TbZdxlFgzdyrw entity : entityList){ + TbZdxlFgxlrw baseEntity = this.selectById(entity.getId()); + + if(ObjectUtils.isEmpty(baseEntity)){ + //设置默认值 + entity.setXlghSc(mrpz.getXlSc()); + entity.setXlghXllc(mrpz.getXlLc()); + entity.setXlghPcCl(mrpz.getPcCl()); + entity.setXlghPcRy(mrpz.getPcRy()); + entity.setRwlx("2"); + baseEntity = new TbZdxlFgxlrw(); + BeanUtils.copyProperties(entity,baseEntity); + //保存 + this.baseMapper.insert(baseEntity); + }else{ + //修改 + BeanUtils.copyProperties(entity,baseEntity); + this.baseMapper.updateById(baseEntity); + } + } + + return 1; + } + @Override @Transactional(rollbackFor = Exception.class) public int issueList(List entityList) { @@ -352,6 +394,7 @@ public class TbZdxlFgxlrwServiceImpl extends ServiceImpl entityList); + int importListByMbZdy(List entityList); + /** * 下发列表 * @param entityList 需下发的列表