增加各类查询和查询条件,增加追加必到点功能
This commit is contained in:
@ -0,0 +1,40 @@
|
||||
package com.mosty.base.model.dto.yjzl;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhangzhao
|
||||
* @description 指导巡逻方格点位必到点巡逻任务追加DTO对象
|
||||
* @modifier zhangzhao
|
||||
* @modifiedTime 2025/09/15 10:23
|
||||
* @since 2025/09/15 10:23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "TbZdxlFgdwBddxlrwAppendDTO对象", description = "指导巡逻方格点位必到点巡逻任务追加DTO对象")
|
||||
public class TbZdxlFgdwBddxlrwAppendDTO {
|
||||
|
||||
/**
|
||||
* 方格巡逻任务ID
|
||||
*/
|
||||
@ApiModelProperty(value = "方格巡逻任务ID")
|
||||
@NotBlank(message = "zdxl.fgxlrw.id.notBlank")
|
||||
private String fgxlrwId;
|
||||
|
||||
/**
|
||||
* 必到点列表
|
||||
*/
|
||||
@ApiModelProperty(value = "必到点列表")
|
||||
@NotEmpty(message = "zdxl.fgdwbddxlrw.handleList.notEmpty")
|
||||
List<TbZdxlFgdwBddxlrwHandleDTO> bddList;
|
||||
|
||||
}
|
@ -50,4 +50,10 @@ public class TbZdxlFgxlrwQuery extends BasePage {
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date rwRq;
|
||||
|
||||
/**
|
||||
* 任务状态 D_ZDXL_FGXLRW_RWZT
|
||||
*/
|
||||
@ApiModelProperty(value = "任务状态 D_ZDXL_FGXLRW_RWZT")
|
||||
private String rwZt;
|
||||
|
||||
}
|
||||
|
@ -162,6 +162,7 @@ zdxl.fgxlrw.rwRq.xlghSjKs.notNull=【巡逻规划开始时间】不能为空
|
||||
zdxl.fgxlrw.rwRq.xlghSjJs.notNull=【巡逻规划结束时间】不能为空
|
||||
zdxl.fgxlrw.rwRq.xlghXllc.notNull=【巡逻规划巡逻里程】不能为空
|
||||
zdxl.fgxlrw.rwRq.export.queryNull=当日没有生成任务,请生成后再下载
|
||||
zdxl.fgxlrw.id.notBlank=【方格巡逻任务ID】不能为空
|
||||
|
||||
#指导巡逻-方格点位必到点
|
||||
zdxl.fgdwBdd.fgdwId.notNull=请选择【方格点位】
|
||||
@ -172,6 +173,9 @@ zdxl.fgdwBdd.bddSm.size=【必到点说明】不能超过128位
|
||||
zdxl.fgdwBdd.jd.notNull=【经度】不能为空
|
||||
zdxl.fgdwBdd.wd.notNull=【纬度】不能为空
|
||||
|
||||
#指导巡逻-方格点位必到点巡逻任务
|
||||
zdxl.fgdwbddxlrw.handleList.notEmpty=【必到点】不能为空
|
||||
|
||||
#指导巡逻-方格点位必到点巡逻任务记录
|
||||
zdxl.fgdwBdd.xlrwJl.dkFj.notBlank=【打卡附件】不能为空
|
||||
zdxl.fgdwBdd.xlrwJl.dkFj.size=【打卡附件】不能超过64位
|
||||
|
@ -7,7 +7,6 @@ import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgdwBdd;
|
||||
import com.mosty.base.model.query.yjzl.TbZdxlFgdwBddQuery;
|
||||
import com.mosty.base.model.vo.yjzl.TbZdxlFgdwBddVO;
|
||||
import com.mosty.base.model.vo.yjzl.TbZdxlFgdwVO;
|
||||
import com.mosty.base.utils.Kit;
|
||||
import com.mosty.base.utils.MessageUtils;
|
||||
import com.mosty.base.utils.spring.SpringValidUtils;
|
||||
import com.mosty.common.base.domain.ResponseResult;
|
||||
@ -16,17 +15,16 @@ import com.mosty.common.base.entity.log.Log;
|
||||
import com.mosty.common.token.JwtSysUser;
|
||||
import com.mosty.yjzl.service.TbZdxlFgdwBddService;
|
||||
import com.mosty.yjzl.service.TbZdxlFgdwService;
|
||||
import com.mosty.yjzl.utils.TbZdxlFgxlrwUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.locationtech.jts.geom.Coordinate;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -65,6 +63,19 @@ public class TbZdxlFgdwBddController {
|
||||
return ResponseResult.success(tbZdxlFgdwBddService.selectById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单条(根据必到点巡逻任务ID)
|
||||
* @param bddxlrwId 必到点巡逻任务ID
|
||||
* @return ResponseResult 实体信息
|
||||
*/
|
||||
@ApiOperation(value = "查询单条(根据必到点巡逻任务ID)")
|
||||
@GetMapping("/selectByBddxlrwId/{bddxlrwId}")
|
||||
@JwtSysUser
|
||||
@Log(title = "指导巡逻-方格点位必到点接口-查询单条(根据必到点巡逻任务ID)", businessType = BusinessType.OTHER)
|
||||
public ResponseResult<TbZdxlFgdwBdd> selectByBddxlrwId(@PathVariable("bddxlrwId") String bddxlrwId) {
|
||||
return ResponseResult.success(tbZdxlFgdwBddService.selectByBddxlrwId(bddxlrwId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页
|
||||
* @param query 实体查询对象
|
||||
@ -117,7 +128,7 @@ public class TbZdxlFgdwBddController {
|
||||
if(ObjectUtils.isEmpty(fgdwVO.getX1()) || ObjectUtils.isEmpty(fgdwVO.getY1()) || ObjectUtils.isEmpty(fgdwVO.getX2()) || ObjectUtils.isEmpty(fgdwVO.getY2())){
|
||||
return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "方格信息不准确,请选择其他方格");
|
||||
}
|
||||
boolean isInGeometry = this.isInGeometry(fgdwVO, dto.getJd(), dto.getWd());
|
||||
boolean isInGeometry = TbZdxlFgxlrwUtils.isInGeometry(fgdwVO, dto.getJd(), dto.getWd());
|
||||
if(!isInGeometry){
|
||||
return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "点位不在方格内,请重新选点");
|
||||
}
|
||||
@ -165,7 +176,7 @@ public class TbZdxlFgdwBddController {
|
||||
if(ObjectUtils.isEmpty(fgdwVO.getX1()) || ObjectUtils.isEmpty(fgdwVO.getY1()) || ObjectUtils.isEmpty(fgdwVO.getX2()) || ObjectUtils.isEmpty(fgdwVO.getY2())){
|
||||
return ResponseResult.fail(MessageUtils.getEditFailMsg() + "方格信息不准确,请选择其他方格");
|
||||
}
|
||||
boolean isInGeometry = this.isInGeometry(fgdwVO, dto.getJd(), dto.getWd());
|
||||
boolean isInGeometry = TbZdxlFgxlrwUtils.isInGeometry(fgdwVO, dto.getJd(), dto.getWd());
|
||||
if(!isInGeometry){
|
||||
return ResponseResult.fail(MessageUtils.getEditFailMsg() + "点位不在方格内,请重新选点");
|
||||
}
|
||||
@ -210,27 +221,4 @@ public class TbZdxlFgdwBddController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验点位是否在方格中
|
||||
* @param fgdwVO 方格信息
|
||||
* @param jd 经度
|
||||
* @param wd 纬度
|
||||
* @return 是否在方格中
|
||||
*/
|
||||
private boolean isInGeometry(TbZdxlFgdwVO fgdwVO, BigDecimal jd, BigDecimal wd){
|
||||
if(ObjectUtils.isEmpty(fgdwVO) || ObjectUtils.isEmpty(jd) || ObjectUtils.isEmpty(wd)){
|
||||
return false;
|
||||
}
|
||||
Coordinate leftTop = new Coordinate(fgdwVO.getX1().doubleValue(), fgdwVO.getY2().doubleValue());
|
||||
Coordinate rightTop = new Coordinate(fgdwVO.getX2().doubleValue(), fgdwVO.getY2().doubleValue());
|
||||
Coordinate leftBottom = new Coordinate(fgdwVO.getX1().doubleValue(), fgdwVO.getY1().doubleValue());
|
||||
Coordinate rightBottom = new Coordinate(fgdwVO.getX2().doubleValue(), fgdwVO.getY1().doubleValue());
|
||||
Coordinate[] coordinates = new Coordinate[4];
|
||||
coordinates[0] = leftTop;
|
||||
coordinates[1] = rightTop;
|
||||
coordinates[2] = rightBottom;
|
||||
coordinates[3] = leftBottom;
|
||||
return Kit.isInGeometryByRay(coordinates, jd + "," + wd);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,35 @@
|
||||
package com.mosty.yjzl.controller;
|
||||
|
||||
import com.mosty.base.model.dto.yjzl.TbZdxlFgdwBddxlrwAppendDTO;
|
||||
import com.mosty.base.model.dto.yjzl.TbZdxlFgdwBddxlrwHandleDTO;
|
||||
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgdwBddxlrw;
|
||||
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgxlrw;
|
||||
import com.mosty.base.model.vo.yjzl.TbZdxlFgdwBddxlrwVO;
|
||||
import com.mosty.base.utils.DatePlusUtils;
|
||||
import com.mosty.base.utils.MessageUtils;
|
||||
import com.mosty.base.utils.spring.SpringValidUtils;
|
||||
import com.mosty.common.base.domain.ResponseResult;
|
||||
import com.mosty.common.base.entity.log.BusinessType;
|
||||
import com.mosty.common.base.entity.log.Log;
|
||||
import com.mosty.common.token.JwtSysUser;
|
||||
import com.mosty.yjzl.service.TbZdxlFgdwBddxlrwJlService;
|
||||
import com.mosty.yjzl.service.TbZdxlFgdwBddxlrwService;
|
||||
import com.mosty.yjzl.service.TbZdxlFgxlrwService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zhangzhao
|
||||
@ -18,9 +44,89 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RequestMapping("/tbZdxlFgdwBddxlrw")
|
||||
public class TbZdxlFgdwBddxlrwController {
|
||||
|
||||
/**
|
||||
* 指导巡逻方格点位必到点巡逻任务表Service
|
||||
*/
|
||||
private final TbZdxlFgdwBddxlrwService tbZdxlFgdwBddxlrwService;
|
||||
|
||||
/**
|
||||
* 指导巡逻方格巡逻任务表Service
|
||||
*/
|
||||
private final TbZdxlFgxlrwService tbZdxlFgxlrwService;
|
||||
|
||||
/**
|
||||
* 指导巡逻方格点位必到点巡逻任务记录表Service
|
||||
*/
|
||||
private final TbZdxlFgdwBddxlrwJlService tbZdxlFgdwBddxlrwJlService;
|
||||
|
||||
/**
|
||||
* 查询未选中的必到点返回信息列表(根据方格巡逻任务ID)
|
||||
* @param fgxlrwId 方格巡逻任务ID
|
||||
* @return ResponseResult 返回信息列表
|
||||
*/
|
||||
@ApiOperation(value = "查询未选中的必到点返回信息列表(根据方格巡逻任务ID)")
|
||||
@GetMapping("/selectUnSelectedVoListByFgxlrwId/{fgxlrwId}")
|
||||
@JwtSysUser
|
||||
@Log(title = "指导巡逻-方格点位必到点巡逻任务接口-查询未选中的必到点返回信息列表(根据方格巡逻任务ID)", businessType = BusinessType.OTHER)
|
||||
public ResponseResult<List<TbZdxlFgdwBddxlrwVO>> selectUnSelectedVoListByFgxlrwId(@PathVariable("fgxlrwId") String fgxlrwId) {
|
||||
return ResponseResult.success(tbZdxlFgdwBddxlrwService.selectUnSelectedVoListByFgxlrwId(fgxlrwId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 追加列表
|
||||
* @param dto 追加DTO对象
|
||||
* @param bindResult 校验对象
|
||||
* @return ResponseResult 操作条数
|
||||
*/
|
||||
@ApiOperation(value = "追加列表")
|
||||
@PostMapping("/appendList")
|
||||
@JwtSysUser
|
||||
@Log(title = "指导巡逻-方格点位必到点巡逻任务接口-追加列表", businessType = BusinessType.INSERT)
|
||||
public ResponseResult<Integer> appendList(@RequestBody @Valid TbZdxlFgdwBddxlrwAppendDTO dto, BindingResult bindResult) {
|
||||
try {
|
||||
//基础信息校验
|
||||
String message = SpringValidUtils.getErrorsMsg(bindResult);
|
||||
if (StringUtils.isNotBlank(message)) {
|
||||
return ResponseResult.fail(MessageUtils.getSaveFailMsg() + message);
|
||||
}
|
||||
|
||||
//校验方格巡逻任务信息
|
||||
TbZdxlFgxlrw fgxlrw = tbZdxlFgxlrwService.selectById(dto.getFgxlrwId());
|
||||
if(ObjectUtils.isEmpty(fgxlrw)){
|
||||
return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "方格巡逻任务信息不存在,请刷新页面后重新选择");
|
||||
}
|
||||
|
||||
//校验当前日期与任务日期是否相等
|
||||
if(!DatePlusUtils.getSystemDateString().equals(DatePlusUtils.getDateString(fgxlrw.getRwRq()))){
|
||||
return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "任务日期不是今日,无法再追加必到点");
|
||||
}
|
||||
|
||||
//查询已有的方格必到点巡逻任务信息
|
||||
Map<String, TbZdxlFgdwBddxlrw> baseMap = new HashMap<>();
|
||||
List<TbZdxlFgdwBddxlrw> baseList = tbZdxlFgdwBddxlrwService.selectListByFgxlrwId(dto.getFgxlrwId());
|
||||
if(CollectionUtils.isNotEmpty(baseList)){
|
||||
baseMap = baseList.stream().collect(Collectors.toMap(TbZdxlFgdwBddxlrw::getBddId, Function.identity(), (key1, key2) -> key2));
|
||||
}
|
||||
|
||||
//校验追加的必到点是否已经生成任务
|
||||
Map<String, TbZdxlFgdwBddxlrw> finalBaseMap = baseMap;
|
||||
List<TbZdxlFgdwBddxlrwHandleDTO> appendHandleList = dto.getBddList().stream().filter(handleDto -> !finalBaseMap.containsKey(handleDto.getBddId())).collect(Collectors.toList());
|
||||
if(CollectionUtils.isEmpty(appendHandleList)){
|
||||
return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "选择的必到点都已生成任务,无需再追加");
|
||||
}
|
||||
|
||||
//保存
|
||||
List<TbZdxlFgdwBddxlrw> resultList = tbZdxlFgdwBddxlrwService.appendList(appendHandleList, dto.getFgxlrwId());
|
||||
if(CollectionUtils.isNotEmpty(resultList)){
|
||||
//创建记录信息
|
||||
tbZdxlFgdwBddxlrwJlService.createListByBddxlrwList(resultList);
|
||||
//返回结果
|
||||
return ResponseResult.success(appendHandleList.size());
|
||||
}
|
||||
return ResponseResult.fail(MessageUtils.getSaveFailMsg());
|
||||
} catch (Exception e) {
|
||||
return ResponseResult.fail(MessageUtils.getSaveServerErrorMsg());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.mosty.yjzl.controller;
|
||||
|
||||
import com.mosty.base.model.dto.yjzl.TbZdxlFgdwBddxlrwJlClockInDTO;
|
||||
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgdwBddxlrw;
|
||||
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgdwBddxlrwJl;
|
||||
import com.mosty.base.model.vo.yjzl.TbZdxlFgdwVO;
|
||||
import com.mosty.base.utils.MessageUtils;
|
||||
import com.mosty.base.utils.spring.SpringValidUtils;
|
||||
import com.mosty.common.base.domain.ResponseResult;
|
||||
@ -11,6 +13,8 @@ import com.mosty.common.token.JwtSysUser;
|
||||
import com.mosty.common.token.UserInfo;
|
||||
import com.mosty.common.token.UserInfoManager;
|
||||
import com.mosty.yjzl.service.TbZdxlFgdwBddxlrwJlService;
|
||||
import com.mosty.yjzl.service.TbZdxlFgdwBddxlrwService;
|
||||
import com.mosty.yjzl.service.TbZdxlFgdwService;
|
||||
import com.mosty.yjzl.utils.TbZdxlFgxlrwUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -42,6 +46,16 @@ public class TbZdxlFgdwBddxlrwJlController {
|
||||
*/
|
||||
private final TbZdxlFgdwBddxlrwJlService tbZdxlFgdwBddxlrwJlService;
|
||||
|
||||
/**
|
||||
* 指导巡逻方格点位必到点巡逻任务表Service
|
||||
*/
|
||||
private final TbZdxlFgdwBddxlrwService tbZdxlFgdwBddxlrwService;
|
||||
|
||||
/**
|
||||
* 指导巡逻方格点位表Service
|
||||
*/
|
||||
private final TbZdxlFgdwService tbZdxlFgdwService;
|
||||
|
||||
/**
|
||||
* 查询列表(根据必到点巡逻任务ID)
|
||||
* @param bddxlrwId 必到点巡逻任务ID
|
||||
@ -94,7 +108,23 @@ public class TbZdxlFgdwBddxlrwJlController {
|
||||
//打卡时间
|
||||
Date dksj = new Date();
|
||||
|
||||
// TODO: 2025/9/7 需要加上方格内部和打卡点附近的坐标验证
|
||||
//当前位置是否在方格内
|
||||
TbZdxlFgdwBddxlrw bddxlrw = tbZdxlFgdwBddxlrwService.selectById(baseEntity.getBddxlrwId());
|
||||
if(ObjectUtils.isEmpty(bddxlrw)){
|
||||
return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "必到点巡逻任务不存在,请退出页面重新进入");
|
||||
}
|
||||
|
||||
TbZdxlFgdwVO fgdw = tbZdxlFgdwService.selectByBddId(bddxlrw.getBddId());
|
||||
if(ObjectUtils.isEmpty(bddxlrw)){
|
||||
return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "方格信息不存在,请退出页面重新进入");
|
||||
}
|
||||
|
||||
boolean inFgdw = TbZdxlFgxlrwUtils.isInGeometry(fgdw, dto.getDkJd(), dto.getDkWd());
|
||||
if(!inFgdw){
|
||||
return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "您不在方格内,请查看您的定位信息");
|
||||
}
|
||||
|
||||
// TODO: 2025/9/16 需要加上打卡点附近的坐标验证
|
||||
|
||||
//校验上一次打卡情况
|
||||
int lastSx = baseEntity.getDkSx() - 1;
|
||||
|
@ -55,6 +55,18 @@ public class TbZdxlFgdwBddServiceImpl extends ServiceImpl<TbZdxlFgdwBddMapper, T
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbZdxlFgdwBdd selectByBddxlrwId(String bddxlrwId) {
|
||||
if (StringUtils.isBlank(bddxlrwId)) {
|
||||
return null;
|
||||
}
|
||||
return this.baseMapper.selectOne(new QueryWrapper<TbZdxlFgdwBdd>()
|
||||
.inSql(TbZdxlFgdwBdd.ID_FIELD, "select bdd_id from tb_zdxl_fgdw_bddxlrw where xt_sjzt = '1' and xt_scbz = '0' and id = '" + bddxlrwId + "' ")
|
||||
.eq("xt_sjzt", "1")
|
||||
.eq("xt_scbz", "0")
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<TbZdxlFgdwBddVO> selectPage(TbZdxlFgdwBddQuery query) {
|
||||
IPage<TbZdxlFgdwBdd> page = PageUtils.buildPage(query.getPageSize(), query.getPageCurrent());
|
||||
|
@ -15,6 +15,7 @@ import com.mosty.yjzl.service.TbZdxlFgdwBddxlrwService;
|
||||
import com.mosty.yjzl.service.TbZdxlFgmrpzService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -112,6 +113,33 @@ public class TbZdxlFgdwBddxlrwServiceImpl extends ServiceImpl<TbZdxlFgdwBddxlrwM
|
||||
return this.buildAllInfoList(entityList, bddList, fgxlrwId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbZdxlFgdwBddxlrwVO> selectUnSelectedVoListByFgxlrwId(String fgxlrwId) {
|
||||
//查询已配置的任务数据
|
||||
List<TbZdxlFgdwBddxlrw> entityList = this.baseMapper.selectList(new QueryWrapper<TbZdxlFgdwBddxlrw>()
|
||||
.eq(TbZdxlFgdwBddxlrw.FGXLRW_ID_FIELD, fgxlrwId)
|
||||
.eq("xt_sjzt", "1")
|
||||
.eq("xt_scbz", "0")
|
||||
);
|
||||
//查询所有必到点
|
||||
List<TbZdxlFgdwBdd> bddList = tbZdxlFgdwBddService.selectListByFgxlrwId(fgxlrwId);
|
||||
|
||||
//筛选出未选择的必到点
|
||||
Map<String, TbZdxlFgdwBddxlrw> entityMap = new HashMap<>();
|
||||
if(CollectionUtils.isNotEmpty(entityList)){
|
||||
entityMap = entityList.stream().collect(Collectors.toMap(TbZdxlFgdwBddxlrw::getBddId, Function.identity(), (key1, key2) -> key2));
|
||||
}
|
||||
List<TbZdxlFgdwBdd> unSelectedBddList;
|
||||
if(MapUtils.isEmpty(entityMap)){
|
||||
unSelectedBddList = bddList;
|
||||
}else{
|
||||
Map<String, TbZdxlFgdwBddxlrw> finalEntityMap = entityMap;
|
||||
unSelectedBddList = bddList.stream().filter(bdd -> !finalEntityMap.containsKey(bdd.getId())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
return this.buildAllInfoList(null, unSelectedBddList, fgxlrwId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int handleList(List<TbZdxlFgdwBddxlrwHandleDTO> handleList, String fgxlrwId) {
|
||||
@ -207,6 +235,32 @@ public class TbZdxlFgdwBddxlrwServiceImpl extends ServiceImpl<TbZdxlFgdwBddxlrwM
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<TbZdxlFgdwBddxlrw> appendList(List<TbZdxlFgdwBddxlrwHandleDTO> appendHandleList, String fgxlrwId) {
|
||||
if(CollectionUtils.isEmpty(appendHandleList) || StringUtils.isBlank(fgxlrwId)){
|
||||
return null;
|
||||
}
|
||||
|
||||
List<TbZdxlFgdwBddxlrw> saveList = new ArrayList<>();
|
||||
for(TbZdxlFgdwBddxlrwHandleDTO dto : appendHandleList){
|
||||
TbZdxlFgdwBddxlrw entity = BeanUtil.copyProperties(dto, TbZdxlFgdwBddxlrw.class);
|
||||
//组装参数
|
||||
entity.setId(UUIDGenerator.getUUID());
|
||||
entity.setXtSjly("1");
|
||||
if(StringUtils.isBlank(entity.getFgxlrwId())){
|
||||
entity.setFgxlrwId(fgxlrwId);
|
||||
}
|
||||
saveList.add(entity);
|
||||
}
|
||||
|
||||
boolean success = this.saveBatch(saveList);
|
||||
if(success){
|
||||
return saveList;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String clockInByJl(TbZdxlFgdwBddxlrwJl jl, boolean start) {
|
||||
|
@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mosty.base.model.dto.yjzl.TbZdxlFgdwUpdateDTO;
|
||||
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgdw;
|
||||
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgdw;
|
||||
import com.mosty.base.model.query.yjzl.TbZdxlFgdwQuery;
|
||||
import com.mosty.base.model.vo.yjzl.TbZdxlFgdwVO;
|
||||
import com.mosty.base.utils.PageUtils;
|
||||
@ -17,6 +16,7 @@ import com.mosty.yjzl.service.TbZdxlFgdwService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -44,7 +44,19 @@ public class TbZdxlFgdwServiceImpl extends ServiceImpl<TbZdxlFgdwMapper, TbZdxlF
|
||||
.eq("xt_sjzt", "1")
|
||||
.eq("xt_scbz", "0")
|
||||
);
|
||||
return this.buildAllInfoByEntity(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbZdxlFgdwVO selectByBddId(String bddId) {
|
||||
if(StringUtils.isBlank(bddId)){
|
||||
return null;
|
||||
}
|
||||
TbZdxlFgdw entity = this.baseMapper.selectOne(new QueryWrapper<TbZdxlFgdw>()
|
||||
.inSql(TbZdxlFgdw.ID_FIELD, "select fgdw_id from tb_zdxl_fgdw_bdd where xt_sjzt = '1' and xt_scbz = '0' and id = '" + bddId + "' ")
|
||||
.eq("xt_sjzt", "1")
|
||||
.eq("xt_scbz", "0")
|
||||
);
|
||||
return this.buildAllInfoByEntity(entity);
|
||||
}
|
||||
|
||||
|
@ -34,10 +34,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -66,7 +63,9 @@ public class TbZdxlFgxlrwServiceImpl extends ServiceImpl<TbZdxlFgxlrwMapper, TbZ
|
||||
*/
|
||||
private final TbZdxlFgdwBddxlrwService tbZdxlFgdwBddxlrwService;
|
||||
|
||||
|
||||
/**
|
||||
* 指导巡逻方格点位必到点巡逻任务记录表Service
|
||||
*/
|
||||
private final TbZdxlFgdwBddxlrwJlService tbZdxlFgdwBddxlrwJlService;
|
||||
|
||||
@Override
|
||||
@ -113,6 +112,9 @@ public class TbZdxlFgxlrwServiceImpl extends ServiceImpl<TbZdxlFgxlrwMapper, TbZ
|
||||
IPage<TbZdxlFgxlrw> page = PageUtils.buildPage(query.getPageSize(), query.getPageCurrent());
|
||||
QueryWrapper<TbZdxlFgxlrw> qw = new QueryWrapper<>();
|
||||
|
||||
//组装默认任务状态
|
||||
query.setRwZt(TbZdxlFgxlrwUtils.DICT_ITEM_D_ZDXL_FGXLRW_RWZT_YXF + "," + TbZdxlFgxlrwUtils.DICT_ITEM_D_ZDXL_FGXLRW_RWZT_XLZ + "," + TbZdxlFgxlrwUtils.DICT_ITEM_D_ZDXL_FGXLRW_RWZT_XLJS);
|
||||
|
||||
//组装查询参数
|
||||
this.buildListSelectQueryWrapper(qw, query);
|
||||
|
||||
@ -165,8 +167,12 @@ public class TbZdxlFgxlrwServiceImpl extends ServiceImpl<TbZdxlFgxlrwMapper, TbZ
|
||||
return null;
|
||||
}
|
||||
|
||||
//转为VO返回
|
||||
return this.buildAllInfoListByEntityList(list);
|
||||
//转为VO并根据必到点打卡进度正序返回
|
||||
List<TbZdxlFgxlrwVO> resultList = this.buildAllInfoListByEntityList(list);
|
||||
if(CollectionUtils.isNotEmpty(resultList)){
|
||||
resultList = resultList.stream().sorted(Comparator.comparing(TbZdxlFgxlrwVO::getBddAllProgress, Comparator.nullsFirst(Double::compareTo))).collect(Collectors.toList());
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -330,8 +336,8 @@ public class TbZdxlFgxlrwServiceImpl extends ServiceImpl<TbZdxlFgxlrwMapper, TbZ
|
||||
private void buildListSelectQueryWrapper(QueryWrapper<TbZdxlFgxlrw> qw, TbZdxlFgxlrwQuery query){
|
||||
//默认使用排序字段
|
||||
if(StringUtils.isBlank(query.getSort())){
|
||||
query.setSort(TbZdxlFgxlrw.FG_PX_FIELD);
|
||||
query.setOrder(QueryWrapperUtils.ORDER_ASC_STRING);
|
||||
query.setSort(TbZdxlFgxlrw.RW_RQ_FIELD);
|
||||
query.setOrder(QueryWrapperUtils.ORDER_DESC_STRING);
|
||||
}
|
||||
//组装其他排序方式
|
||||
QueryWrapperUtils.buildQueryWrapperOrder(qw, query.getSort(), query.getOrder());
|
||||
@ -341,13 +347,16 @@ public class TbZdxlFgxlrwServiceImpl extends ServiceImpl<TbZdxlFgxlrwMapper, TbZ
|
||||
qw.eq(ObjectUtils.isNotEmpty(query.getFgId()), TbZdxlFgxlrw.FG_ID_FIELD, query.getFgId());
|
||||
//方格名称
|
||||
qw.inSql(StringUtils.isNotBlank(query.getFgMc()), TbZdxlFgxlrw.FG_ID_FIELD, "select id from tb_zdxl_fgdw where mc1 like '%" + query.getFgMc() + "%' ");
|
||||
|
||||
//方格预警等级
|
||||
if(StringUtils.isNotBlank(query.getFgYjdj())){
|
||||
qw.in(TbZdxlFgxlrw.FG_YJDJ_FIELD, Arrays.stream(query.getFgYjdj().split(",")).filter(org.apache.commons.lang3.StringUtils::isNotBlank).collect(Collectors.toList()));
|
||||
qw.in(TbZdxlFgxlrw.FG_YJDJ_FIELD, Arrays.stream(query.getFgYjdj().split(",")).filter(StringUtils::isNotBlank).collect(Collectors.toList()));
|
||||
}
|
||||
//任务日期
|
||||
qw.eq(ObjectUtils.isNotEmpty(query.getRwRq()), TbZdxlFgxlrw.RW_RQ_FIELD, query.getRwRq());
|
||||
//任务状态
|
||||
if(StringUtils.isNotBlank(query.getRwZt())){
|
||||
qw.in(TbZdxlFgxlrw.RW_ZT_FIELD, Arrays.stream(query.getRwZt().split(",")).filter(StringUtils::isNotBlank).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,6 +25,13 @@ public interface TbZdxlFgdwBddService {
|
||||
*/
|
||||
TbZdxlFgdwBdd selectById(String id);
|
||||
|
||||
/**
|
||||
* 查询单条(根据必到点巡逻任务ID)
|
||||
* @param bddxlrwId 必到点巡逻任务ID
|
||||
* @return 实体信息
|
||||
*/
|
||||
TbZdxlFgdwBdd selectByBddxlrwId(String bddxlrwId);
|
||||
|
||||
/**
|
||||
* 查询分页
|
||||
* @param query 实体查询对象
|
||||
|
@ -45,6 +45,13 @@ public interface TbZdxlFgdwBddxlrwService {
|
||||
*/
|
||||
List<TbZdxlFgdwBddxlrwVO> selectVoListByFgxlrwId(String fgxlrwId);
|
||||
|
||||
/**
|
||||
* 查询未选中的必到点返回信息列表(根据方格巡逻任务ID)
|
||||
* @param fgxlrwId 方格巡逻任务ID
|
||||
* @return 返回信息列表
|
||||
*/
|
||||
List<TbZdxlFgdwBddxlrwVO> selectUnSelectedVoListByFgxlrwId(String fgxlrwId);
|
||||
|
||||
/**
|
||||
* 保存列表
|
||||
* @param handleList 操作列表
|
||||
@ -56,10 +63,18 @@ public interface TbZdxlFgdwBddxlrwService {
|
||||
/**
|
||||
* 保存列表(根据方格巡逻任务列表)
|
||||
* @param fgxlrwList 方格巡逻任务列表
|
||||
* @return 操作条数
|
||||
* @return 实体列表
|
||||
*/
|
||||
List<TbZdxlFgdwBddxlrw> handleListByFgxlrwList(List<TbZdxlFgxlrw> fgxlrwList);
|
||||
|
||||
/**
|
||||
* 追加列表
|
||||
* @param appendHandleList 操作列表
|
||||
* @param fgxlrwId 方格巡逻任务ID
|
||||
* @return 实体列表
|
||||
*/
|
||||
List<TbZdxlFgdwBddxlrw> appendList(List<TbZdxlFgdwBddxlrwHandleDTO> appendHandleList, String fgxlrwId);
|
||||
|
||||
/**
|
||||
* 打卡(根据打卡记录)
|
||||
* @param jl 打卡记录
|
||||
|
@ -23,6 +23,13 @@ public interface TbZdxlFgdwService {
|
||||
*/
|
||||
TbZdxlFgdwVO selectById(Long id);
|
||||
|
||||
/**
|
||||
* 查询单条(根据必到点ID)
|
||||
* @param bddId 必到点ID
|
||||
* @return 实体信息
|
||||
*/
|
||||
TbZdxlFgdwVO selectByBddId(String bddId);
|
||||
|
||||
/**
|
||||
* 查询全量列表
|
||||
* @return 实体信息列表
|
||||
|
@ -1,5 +1,12 @@
|
||||
package com.mosty.yjzl.utils;
|
||||
|
||||
import com.mosty.base.model.vo.yjzl.TbZdxlFgdwVO;
|
||||
import com.mosty.base.utils.Kit;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.locationtech.jts.geom.Coordinate;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author zhangzhao
|
||||
* @description 指导巡逻方格巡逻任务工具类
|
||||
@ -119,6 +126,16 @@ public class TbZdxlFgxlrwUtils {
|
||||
*/
|
||||
public final static String DICT_ITEM_D_ZDXL_FGXLRW_RWZT_YXF = "03";
|
||||
|
||||
/**
|
||||
* 字典项-指导巡逻方格巡逻任务状态-巡逻中
|
||||
*/
|
||||
public final static String DICT_ITEM_D_ZDXL_FGXLRW_RWZT_XLZ = "04";
|
||||
|
||||
/**
|
||||
* 字典项-指导巡逻方格巡逻任务状态-巡逻结束
|
||||
*/
|
||||
public final static String DICT_ITEM_D_ZDXL_FGXLRW_RWZT_XLJS = "05";
|
||||
|
||||
/**
|
||||
* 系统配置配置键-方格巡逻任务警情配置-报警细类
|
||||
*/
|
||||
@ -129,4 +146,27 @@ public class TbZdxlFgxlrwUtils {
|
||||
*/
|
||||
public final static String SYS_CONFIG_PZJ_FGXLRW_JQPZ_BJZL = "ZDXL_FGYSJS_JQ_BJZL";
|
||||
|
||||
/**
|
||||
* 校验点位是否在方格中
|
||||
* @param fgdwVO 方格信息
|
||||
* @param jd 经度
|
||||
* @param wd 纬度
|
||||
* @return 是否在方格中
|
||||
*/
|
||||
public static boolean isInGeometry(TbZdxlFgdwVO fgdwVO, BigDecimal jd, BigDecimal wd){
|
||||
if(ObjectUtils.isEmpty(fgdwVO) || ObjectUtils.isEmpty(jd) || ObjectUtils.isEmpty(wd)){
|
||||
return false;
|
||||
}
|
||||
Coordinate leftTop = new Coordinate(fgdwVO.getX1().doubleValue(), fgdwVO.getY2().doubleValue());
|
||||
Coordinate rightTop = new Coordinate(fgdwVO.getX2().doubleValue(), fgdwVO.getY2().doubleValue());
|
||||
Coordinate leftBottom = new Coordinate(fgdwVO.getX1().doubleValue(), fgdwVO.getY1().doubleValue());
|
||||
Coordinate rightBottom = new Coordinate(fgdwVO.getX2().doubleValue(), fgdwVO.getY1().doubleValue());
|
||||
Coordinate[] coordinates = new Coordinate[4];
|
||||
coordinates[0] = leftTop;
|
||||
coordinates[1] = rightTop;
|
||||
coordinates[2] = rightBottom;
|
||||
coordinates[3] = leftBottom;
|
||||
return Kit.isInGeometryByRay(coordinates, jd + "," + wd);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user