增加返回信息,修复BUG

This commit is contained in:
2025-09-11 22:27:40 +08:00
parent d32e8436a5
commit 0f4b95f355
20 changed files with 247 additions and 69 deletions

View File

@ -3,6 +3,7 @@ package com.mosty.base.feign.remote;
import com.alibaba.fastjson.JSON;
import com.mosty.base.feign.service.MostyQwzxFeignService;
import com.mosty.base.model.dto.qwzx.TbQwXfbbVo;
import com.mosty.base.model.entity.qwzx.TbQwJl;
import com.mosty.base.model.entity.qwzx.TbQwXfbb;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.entity.log.SpringUtils;
@ -63,4 +64,19 @@ public class MostyQwzxFeignServiceRemote {
return responseResult.getData();
}
/**
* 查询勤务警力信息根据报备ID和巡防警力ID
* @param id 报备ID
* @param xfllId 巡防警力ID
* @return 勤务警力信息
*/
public static TbQwJl selectQwJlByBbInfo(String id, String xfllId) {
ResponseResult<TbQwJl> responseResult = MostyQwzxFeignServiceRemote.getService().selectQwJlByBbInfo(id, xfllId);
if (responseResult == null || !responseResult.isSuccess()) {
log.error("查询勤务警力信息根据报备ID和巡防警力ID异常 responseResult = {}", JSON.toJSONString(responseResult));
throw new BusinessException("查询勤务警力信息根据报备ID和巡防警力ID异常");
}
return responseResult.getData();
}
}

View File

@ -3,11 +3,13 @@ package com.mosty.base.feign.service;
import com.mosty.base.model.dto.qwzx.TbQwJlDto;
import com.mosty.base.model.dto.qwzx.TbQwXfbbQueryByJlDto;
import com.mosty.base.model.dto.qwzx.TbQwXfbbVo;
import com.mosty.base.model.entity.qwzx.TbQwJl;
import com.mosty.base.model.entity.qwzx.TbQwXfbb;
import com.mosty.common.base.domain.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import javax.websocket.server.PathParam;
import java.util.List;
import java.util.Map;
@ -62,4 +64,14 @@ public interface MostyQwzxFeignService {
*/
@GetMapping("/mosty-qwzx/tbQwXfbb/getMybbTodayNew")
ResponseResult<TbQwXfbb> getMyXfbbTodayNew(@RequestParam String bblx);
/**
* 查询勤务警力信息根据报备ID和巡防警力ID
* @param id 报备ID
* @param xfllId 巡防警力ID
* @return 勤务警力信息
*/
@GetMapping("/mosty-qwzx/tbQwXfbb/selectQwJlByBbInfo")
ResponseResult<TbQwJl> selectQwJlByBbInfo(@RequestParam("id") String id, @RequestParam("xfllId") String xfllId);
}

View File

@ -98,6 +98,12 @@ public class TbZdxlFgxlrwUpdateDTO {
@ApiModelProperty(value = "巡防报备ID")
private String xfbbId;
/**
* 巡防报备勤务警力ID
*/
@ApiModelProperty(value = "巡防报备勤务警力ID")
private String xfbbQwJlId;
/**
* 必到点列表
*/

View File

@ -123,11 +123,11 @@ public class TbZdxlFgdwBddxlrwJl extends BaseEntity implements Serializable, Clo
private String dkrXm;
/**
* 打卡人身份证号
* 打卡人ID
*/
@ApiModelProperty(value = "打卡人身份证号")
@TableField(value = "dkr_sfzh")
private String dkrSfzh;
@ApiModelProperty(value = "打卡人ID")
@TableField(value = "dkr_id")
private Long dkrId;
/**
* 所属部门id
@ -254,9 +254,9 @@ public class TbZdxlFgdwBddxlrwJl extends BaseEntity implements Serializable, Clo
public static String DKR_XM_FIELD = "dkr_xm";
/**
* 打卡人身份证号字段名
* 打卡人ID字段名
*/
public static String DKR_SFZH_FIELD = "dkr_sfzh";
public static String DKR_ID_FIELD = "dkr_id";
/**
* 所属部门id

View File

@ -237,6 +237,13 @@ public class TbZdxlFgxlrw extends BaseEntity implements Serializable, Cloneable
@TableField(value = "xfbb_id")
private String xfbbId;
/**
* 巡防报备勤务警力ID
*/
@ApiModelProperty(value = "巡防报备勤务警力ID")
@TableField(value = "xfbb_qw_jl_id")
private String xfbbQwJlId;
/**
* 主键ID字段名
@ -363,4 +370,9 @@ public class TbZdxlFgxlrw extends BaseEntity implements Serializable, Cloneable
*/
public static String XFBB_ID_FIELD = "xfbb_id";
/**
* 巡防报备勤务警力ID字段名
*/
public static String XFBB_QW_JL_ID_FIELD = "xfbb_qw_jl_id";
}

View File

@ -26,6 +26,12 @@ public class TbZdxlFgdwBddQuery extends BasePage {
@ApiModelProperty(value = "方格点位ID")
private Long fgdwId;
/**
* 方格点位名称
*/
@ApiModelProperty(value = "方格点位名称")
private String fgdwMc;
/**
* 必到点名称
*/

View File

@ -7,8 +7,6 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
/**
* @author zhangzhao
* @description 指导巡逻方格点位必到点巡逻任务表返回对象
@ -34,4 +32,10 @@ public class TbZdxlFgdwBddxlrwVO extends TbZdxlFgdwBddxlrw {
@ApiModelProperty(value = "必到点进度")
private Double bddProgress;
/**
* 是否勾选
*/
@ApiModelProperty(value = "是否勾选")
private Boolean selected;
}

View File

@ -1,6 +1,7 @@
package com.mosty.base.model.vo.yjzl;
import com.mosty.base.model.dto.qwzx.TbQwXfbbVo;
import com.mosty.base.model.entity.qwzx.TbQwJl;
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgxlrw;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -78,10 +79,22 @@ public class TbZdxlFgxlrwVO extends TbZdxlFgxlrw {
@ApiModelProperty(value = "必到点总进度")
private Double bddAllProgress;
/**
* 巡逻里程总进度
*/
@ApiModelProperty(value = "巡逻里程总进度")
private Double xllcProgress;
/**
* 巡防报备信息
*/
@ApiModelProperty(value = "巡防报备信息")
private TbQwXfbbVo xfbb;
/**
* 巡防报备勤务警力信息
*/
@ApiModelProperty(value = "巡防报备勤务警力信息")
private TbQwJl xfbbQwJl;
}

View File

@ -4,8 +4,11 @@ package com.mosty.qwzx.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mosty.base.model.dto.qwzx.*;
import com.mosty.base.model.entity.qwzx.TbQwJl;
import com.mosty.base.model.entity.qwzx.TbQwxfbbDk;
import com.mosty.base.model.entity.qwzx.TbQwXfbb;
import com.mosty.base.model.entity.qwzx.TbQwXfpbZq;
import com.mosty.base.model.query.qwzx.TbQwJmxzSearchDto;
import com.mosty.base.model.query.qwzx.TbQwXfbbJmxzQuery;
import com.mosty.base.model.query.qwzx.TbQwXfbbQuery;
import com.mosty.base.model.query.qwzx.TbQwxfbbDkQuery;
import com.mosty.base.model.query.sjzx.XfbbQuery;
import com.mosty.base.model.query.sjzx.XfbbTjQuery;
@ -14,10 +17,6 @@ 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.base.model.entity.qwzx.TbQwXfbb;
import com.mosty.base.model.entity.qwzx.TbQwXfpbZq;
import com.mosty.base.model.query.qwzx.TbQwXfbbJmxzQuery;
import com.mosty.base.model.query.qwzx.TbQwXfbbQuery;
import com.mosty.qwzx.service.TbQwXfbbService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@ -42,7 +41,7 @@ import java.util.Map;
public class TbQwXfbbController {
@Resource
private TbQwXfbbService tbQwXfbbService;
private final TbQwXfbbService tbQwXfbbService;
@ApiOperation("通过ID查询单条数据")
@JwtSysUser
@ -351,5 +350,18 @@ public class TbQwXfbbController {
return ResponseResult.success(tbQwXfbbService.updateXflc(bbid));
}
/**
* 查询勤务警力信息根据报备ID和巡防警力ID
* @param id 报备ID
* @param xfllId 巡防警力ID
* @return 勤务警力信息
*/
@ApiOperation("查询勤务警力信息根据报备ID和巡防警力ID")
@JwtSysUser
@GetMapping("/selectQwJlByBbInfo")
public ResponseResult<TbQwJl> selectQwJlByBbInfo(@PathParam("id") String id, @PathParam("xfllId") String xfllId) {
return ResponseResult.success(tbQwXfbbService.selectQwJlByBbInfo(id, xfllId));
}
}

View File

@ -5,14 +5,12 @@ import com.mosty.base.model.dto.qwzx.*;
import com.mosty.base.model.entity.qwzx.TbQwJl;
import com.mosty.base.model.entity.qwzx.TbQwXfbb;
import com.mosty.base.model.entity.qwzx.TbQwXfpbZq;
import com.mosty.base.model.entity.qwzx.TbQwxfbbDk;
import com.mosty.base.model.query.qwzx.TbQwJmxzSearchDto;
import com.mosty.base.model.query.qwzx.TbQwXfbbJmxzQuery;
import com.mosty.base.model.query.qwzx.TbQwXfbbQuery;
import com.mosty.base.model.query.qwzx.TbQwxfbbDkQuery;
import com.mosty.base.model.query.sjzx.XfbbQuery;
import com.mosty.base.model.query.sjzx.XfbbTjQuery;
import com.mosty.base.model.query.sjzx.XftjQuery;
import com.mosty.base.model.vo.qwzx.TbQwxfbbDkVO;
import io.swagger.annotations.ApiOperation;
@ -160,5 +158,12 @@ public interface TbQwXfbbService {
@ApiOperation("更新巡防里程")
Integer updateXflc(String bbid);
/**
* 查询勤务警力信息根据报备ID和巡防警力ID
* @param id 报备ID
* @param xfllId 巡防警力ID
* @return 勤务警力信息
*/
TbQwJl selectQwJlByBbInfo(String id, String xfllId);
}

View File

@ -18,8 +18,6 @@ import com.mosty.base.model.entity.lzother.BphJlxx;
import com.mosty.base.model.entity.qwzx.*;
import com.mosty.base.model.entity.wzzx.TbWzLswz;
import com.mosty.base.model.entity.wzzx.TbWzXfwz;
import com.mosty.base.model.entity.yjzl.TbYjxx;
import com.mosty.base.model.entity.yjzl.TbZlxx;
import com.mosty.base.model.query.qwzx.TbQwJmxzSearchDto;
import com.mosty.base.model.query.qwzx.TbQwXfbbJmxzQuery;
import com.mosty.base.model.query.qwzx.TbQwXfbbQuery;
@ -28,7 +26,6 @@ import com.mosty.base.model.query.sjzx.XfbbQuery;
import com.mosty.base.model.query.sjzx.XfbbTjQuery;
import com.mosty.base.model.vo.base.DeptInfoVo;
import com.mosty.base.model.vo.qwzx.TbQwxfbbDkVO;
import com.mosty.base.model.vo.yjzl.TbFzJlVo;
import com.mosty.base.model.vo.yszx.TbYsGajgVo;
import com.mosty.base.utils.*;
import com.mosty.common.base.exception.BusinessException;
@ -36,7 +33,6 @@ import com.mosty.common.core.business.entity.SysUser;
import com.mosty.common.redis.service.RedisService;
import com.mosty.common.token.UserInfo;
import com.mosty.common.token.UserInfoManager;
import com.mosty.common.util.PermissionsUtil;
import com.mosty.qwzx.mapper.*;
import com.mosty.qwzx.remote.*;
import com.mosty.qwzx.service.TbQwXfbbService;
@ -56,7 +52,6 @@ import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import java.util.zip.Inflater;
/**
@ -457,6 +452,7 @@ public class TbQwXfbbServiceImpl extends ServiceImpl<TbQwXfbbMapper, TbQwXfbb> i
return newList;
}
@Override
public void authJsbbTs() {
List<TbQwXfbb> bbList = this.tbQwXfbbMapper.selectList(
new LambdaQueryWrapper<TbQwXfbb>()
@ -1325,4 +1321,20 @@ public class TbQwXfbbServiceImpl extends ServiceImpl<TbQwXfbbMapper, TbQwXfbb> i
}
return lc;
}
@Override
public TbQwJl selectQwJlByBbInfo(String id, String xfllId) {
if(StringUtils.isBlank(id) || StringUtils.isBlank(xfllId)){
return null;
}
QueryWrapper<TbQwJl> qw = new QueryWrapper<>();
qw.eq("xt_sjzt", "1");
qw.eq("xt_scbz", "0");
qw.eq("ywid", id);
qw.eq("jl_id", xfllId);
return this.tbQwJlMapper.selectOne(qw);
}
}

View File

@ -11,6 +11,7 @@ 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.utils.TbZdxlFgxlrwUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
@ -108,11 +109,11 @@ public class TbZdxlFgdwBddxlrwJlController {
UserInfo user = UserInfoManager.get();
if(ObjectUtils.isNotEmpty(baseEntity.getDkKsSj())){
//开始和结束是否是同一个人
if(!user.getIdEntityCard().equals(baseEntity.getDkrSfzh())){
if(!user.getUserId().equals(baseEntity.getDkrId())){
return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "您不是此记录的打卡人,不能进行打卡");
}
//是否待满10分钟
if(dksj.getTime()-baseEntity.getDkKsSj().getTime() < 10*60*1000){
if(dksj.getTime()-baseEntity.getDkKsSj().getTime() < TbZdxlFgxlrwUtils.CLOCK_IN_INTERVAL_TIME){
return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "请在开始10分后再打卡结束");
}
}

View File

@ -15,7 +15,6 @@ import com.mosty.common.base.entity.log.Log;
import com.mosty.common.base.util.StringUtils;
import com.mosty.common.config.Excel.ExcelUtil;
import com.mosty.common.token.JwtSysUser;
import com.mosty.yjzl.service.TbZdxlFgdwBddxlrwJlService;
import com.mosty.yjzl.service.TbZdxlFgxlrwService;
import com.mosty.yjzl.utils.TbZdxlFgxlrwUtils;
import io.swagger.annotations.Api;
@ -50,11 +49,6 @@ public class TbZdxlFgxlrwController {
*/
private final TbZdxlFgxlrwService tbZdxlFgxlrwService;
/**
* 指导巡逻方格点位必到点巡逻任务记录表Service
*/
private final TbZdxlFgdwBddxlrwJlService tbZdxlFgdwBddxlrwJlService;
/**
* 查询分页
* @param query 实体查询对象
@ -221,10 +215,6 @@ public class TbZdxlFgxlrwController {
//下发
int resultInt = tbZdxlFgxlrwService.issueList(issueList);
if(resultInt > 0){
//新建打卡记录
for(TbZdxlFgxlrw entity : issueList){
tbZdxlFgdwBddxlrwJlService.createListByFgxlrwId(entity.getId());
}
//返回
return ResponseResult.success(resultInt);
}

View File

@ -199,6 +199,10 @@ public class TbZdxlFgdwBddServiceImpl extends ServiceImpl<TbZdxlFgdwBddMapper, T
//方格点位ID
qw.like(ObjectUtils.isNotEmpty(query.getFgdwId()), TbZdxlFgdwBdd.FGDW_ID_FIELD, query.getFgdwId());
//方格点位名称
if(StringUtils.isNotBlank(query.getFgdwMc())){
qw.inSql(TbZdxlFgdwBdd.FGDW_ID_FIELD, "select id from tb_zdxl_fgdw where xt_sjzt = '1' and xt_scbz = '0' and mc1 = '%" + query.getFgdwMc() + "%'");
}
//必到点名称
qw.like(StringUtils.isNotBlank(query.getBddMc()), TbZdxlFgdwBdd.BDD_MC_FIELD, query.getBddMc());
//必到点地址

View File

@ -88,6 +88,16 @@ public class TbZdxlFgdwBddxlrwJlServiceImpl extends ServiceImpl<TbZdxlFgdwBddxlr
return -2;
}
return this.createListByBddxlrwList(bddxlrwList);
}
@Override
@Transactional(rollbackFor = Exception.class)
public int createListByBddxlrwList(List<TbZdxlFgdwBddxlrw> bddxlrwList) {
if(CollectionUtils.isEmpty(bddxlrwList)){
return -1;
}
//循环组装数据
List<TbZdxlFgdwBddxlrwJl> saveList = new ArrayList<>();
for(TbZdxlFgdwBddxlrw bbdxlrw : bddxlrwList){
@ -127,7 +137,7 @@ public class TbZdxlFgdwBddxlrwJlServiceImpl extends ServiceImpl<TbZdxlFgdwBddxlr
baseEntity.setDkKsJd(dto.getDkJd());
baseEntity.setDkKsWd(dto.getDkWd());
baseEntity.setDkrXm(user.getUserName());
baseEntity.setDkrSfzh(user.getIdEntityCard());
baseEntity.setDkrId(user.getUserId());
}else{
//结束
baseEntity.setDkJsSj(dksj);

View File

@ -16,6 +16,7 @@ import com.mosty.yjzl.service.TbZdxlFgmrpzService;
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;
@ -113,7 +114,7 @@ public class TbZdxlFgdwBddxlrwServiceImpl extends ServiceImpl<TbZdxlFgdwBddxlrwM
@Override
@Transactional(rollbackFor = Exception.class)
public int handleList(List<TbZdxlFgdwBddxlrwHandleDTO> handleList) {
public int handleList(List<TbZdxlFgdwBddxlrwHandleDTO> handleList, String fgxlrwId) {
if(CollectionUtils.isEmpty(handleList)){
return -1;
}
@ -122,6 +123,8 @@ public class TbZdxlFgdwBddxlrwServiceImpl extends ServiceImpl<TbZdxlFgdwBddxlrwM
List<TbZdxlFgdwBddxlrwHandleDTO> saveDtoList = handleList.stream().filter(dto -> ObjectUtils.isEmpty(dto.getId())).collect(Collectors.toList());
List<TbZdxlFgdwBddxlrwHandleDTO> updateDtoList = handleList.stream().filter(dto -> ObjectUtils.isNotEmpty(dto.getId())).collect(Collectors.toList());
List<TbZdxlFgdwBddxlrw> saveList = new ArrayList<>(), updateList = new ArrayList<>();
Map<String, TbZdxlFgdwBddxlrwHandleDTO> updateIdMap;
List<String> cancelIdList = new ArrayList<>();
//组装保存列表
if(CollectionUtils.isNotEmpty(saveDtoList)){
@ -142,9 +145,16 @@ public class TbZdxlFgdwBddxlrwServiceImpl extends ServiceImpl<TbZdxlFgdwBddxlrwM
entity.setXlghDkcs(dto.getXlghDkcs());
updateList.add(entity);
}
//组装删除列表
List<TbZdxlFgdwBddxlrw> baseList = this.selectListByFgxlrwId(fgxlrwId);
if(CollectionUtils.isNotEmpty(baseList)){
updateIdMap = updateDtoList.stream().collect(Collectors.toMap(TbZdxlFgdwBddxlrwHandleDTO::getId, Function.identity(), (key1, key2) -> key2));
Map<String, TbZdxlFgdwBddxlrwHandleDTO> finalUpdateIdMap = updateIdMap;
cancelIdList = baseList.stream().map(TbZdxlFgdwBddxlrw::getId).filter(id -> !finalUpdateIdMap.containsKey(id)).collect(Collectors.toList());
}
}
//保存修改信息
//保存修改或删除信息
int resultInt = 0;
if(CollectionUtils.isNotEmpty(saveList)){
boolean success = this.saveBatch(saveList);
@ -158,32 +168,43 @@ public class TbZdxlFgdwBddxlrwServiceImpl extends ServiceImpl<TbZdxlFgdwBddxlrwM
resultInt += updateList.size();
}
}
if(CollectionUtils.isNotEmpty(cancelIdList)){
resultInt += this.baseMapper.deleteBatchIds(cancelIdList);
}
return resultInt;
}
@Override
@Transactional(rollbackFor = Exception.class)
public int handleListByFgxlrwList(List<TbZdxlFgxlrw> fgxlrwList) {
public List<TbZdxlFgdwBddxlrw> handleListByFgxlrwList(List<TbZdxlFgxlrw> fgxlrwList) {
if(CollectionUtils.isEmpty(fgxlrwList)){
return -1;
return null;
}
//通过查询vo列表组装成dto列表进行保存
int resultInt = 0;
//逻辑流程由原来的所有必到点都需要下发任务,改为用户选择的点位下发记录
List<TbZdxlFgdwBddxlrw> resultList = new ArrayList<>();
for(TbZdxlFgxlrw fgxlrw : fgxlrwList){
List<TbZdxlFgdwBddxlrwVO> voList = this.selectVoListByFgxlrwId(fgxlrw.getId());
if(CollectionUtils.isEmpty(voList)){
continue;
//查询是否已经保存了必到点的巡逻任务,如果已经保存,则不做处理,直接生成记录即可,
List<TbZdxlFgdwBddxlrw> baseList = this.selectListByFgxlrwId(fgxlrw.getId());
if(CollectionUtils.isEmpty(baseList)){
//如果没有保存,则需要根据必到点生成必到点巡逻任务
baseList = new ArrayList<>();
List<TbZdxlFgdwBdd> bddList = tbZdxlFgdwBddService.selectListByFgxlrwId(fgxlrw.getId());
List<TbZdxlFgdwBddxlrwVO> bbdXlrwVoList = this.buildAllInfoListByBddList(bddList, fgxlrw.getId(),true);
if(CollectionUtils.isNotEmpty(bbdXlrwVoList)){
for(TbZdxlFgdwBddxlrwVO vo : bbdXlrwVoList){
TbZdxlFgdwBddxlrw saveEntity = BeanUtil.copyProperties(vo, TbZdxlFgdwBddxlrw.class);
saveEntity.setId(UUIDGenerator.getUUID());
saveEntity.setXtSjly("1");
baseList.add(saveEntity);
}
this.saveBatch(baseList);
}
}
List<TbZdxlFgdwBddxlrwHandleDTO> dtoList = new ArrayList<>();
for(TbZdxlFgdwBddxlrwVO vo : voList){
TbZdxlFgdwBddxlrwHandleDTO dto = BeanUtil.copyProperties(vo, TbZdxlFgdwBddxlrwHandleDTO.class);
dtoList.add(dto);
}
resultInt += this.handleList(dtoList);
resultList.addAll(baseList);
}
return resultInt;
return resultList;
}
@Override
@ -241,6 +262,8 @@ public class TbZdxlFgdwBddxlrwServiceImpl extends ServiceImpl<TbZdxlFgdwBddxlrwM
return null;
}
boolean hasEntityList = CollectionUtils.isNotEmpty(entityList);
//组装实体数据
Map<String, TbZdxlFgdwBddxlrw> entityMap = new HashMap<>();
List<TbZdxlFgdwBddxlrwVO> allInfoVoList = new ArrayList<>();
@ -257,7 +280,7 @@ public class TbZdxlFgdwBddxlrwServiceImpl extends ServiceImpl<TbZdxlFgdwBddxlrwM
Map<String, TbZdxlFgdwBddxlrw> finalEntityMap = entityMap;
List<TbZdxlFgdwBdd> bddNotCreateList = bddList.stream().filter(bdd -> !finalEntityMap.containsKey(bdd.getId())).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(bddNotCreateList)){
List<TbZdxlFgdwBddxlrwVO> bddAllInfoList = this.buildAllInfoListByBddList(bddNotCreateList, fgxlrwId);
List<TbZdxlFgdwBddxlrwVO> bddAllInfoList = this.buildAllInfoListByBddList(bddNotCreateList, fgxlrwId, hasEntityList);
if(CollectionUtils.isNotEmpty(bddAllInfoList)){
allInfoVoList.addAll(bddAllInfoList);
}
@ -273,8 +296,8 @@ public class TbZdxlFgdwBddxlrwServiceImpl extends ServiceImpl<TbZdxlFgdwBddxlrwM
* @param fgxlrwId 方格巡逻任务ID
* @return 全量信息列表
*/
private List<TbZdxlFgdwBddxlrwVO> buildAllInfoListByBddList(List<TbZdxlFgdwBdd> bddList, String fgxlrwId){
if(CollectionUtils.isEmpty(bddList)){
private List<TbZdxlFgdwBddxlrwVO> buildAllInfoListByBddList(List<TbZdxlFgdwBdd> bddList, String fgxlrwId, boolean hasEntityList){
if(CollectionUtils.isEmpty(bddList) || StringUtils.isBlank(fgxlrwId)){
return null;
}
@ -294,6 +317,9 @@ public class TbZdxlFgdwBddxlrwServiceImpl extends ServiceImpl<TbZdxlFgdwBddxlrwM
vo.setXlsjDkcs(0);
vo.setSfKs(Constant.DICT_ITEM_D_BZ_SF_NO);
vo.setSfJs(Constant.DICT_ITEM_D_BZ_SF_NO);
//如果此方格巡逻任务没有生成必到点生成巡逻任务,说明是刚导入,则默认设置为勾选
vo.setSelected(!hasEntityList);
allInfoVOList.add(vo);
}
@ -335,6 +361,9 @@ public class TbZdxlFgdwBddxlrwServiceImpl extends ServiceImpl<TbZdxlFgdwBddxlrwM
}
}
//实体信息是默认需要选中的
resultVO.setSelected(true);
//计算进度
resultVO.setBddProgress(MathUtils.percentage(entity.getXlsjDkcs(), entity.getXlghDkcs()));

View File

@ -8,8 +8,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mosty.base.feign.remote.MostyQwzxFeignServiceRemote;
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.query.yjzl.TbZdxlFgxlrwQuery;
@ -20,11 +22,10 @@ import com.mosty.base.utils.MathUtils;
import com.mosty.base.utils.PageUtils;
import com.mosty.base.utils.QueryWrapperUtils;
import com.mosty.common.base.util.StringUtils;
import com.mosty.common.token.UserInfo;
import com.mosty.common.token.UserInfoManager;
import com.mosty.yjzl.mapper.TbZdxlFgxlrwMapper;
import com.mosty.yjzl.service.TbZdxlFgdwBddxlrwService;
import com.mosty.yjzl.service.TbZdxlFgdwService;
import com.mosty.yjzl.service.TbZdxlFgmrpzService;
import com.mosty.yjzl.service.TbZdxlFgxlrwService;
import com.mosty.yjzl.service.*;
import com.mosty.yjzl.utils.TbZdxlFgxlrwUtils;
import lombok.AllArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
@ -32,6 +33,7 @@ import org.apache.commons.lang3.ObjectUtils;
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;
@ -64,6 +66,9 @@ public class TbZdxlFgxlrwServiceImpl extends ServiceImpl<TbZdxlFgxlrwMapper, TbZ
*/
private final TbZdxlFgdwBddxlrwService tbZdxlFgdwBddxlrwService;
private final TbZdxlFgdwBddxlrwJlService tbZdxlFgdwBddxlrwJlService;
@Override
public TbZdxlFgxlrw selectById(String id) {
if(StringUtils.isBlank(id)){
@ -112,14 +117,21 @@ public class TbZdxlFgxlrwServiceImpl extends ServiceImpl<TbZdxlFgxlrwMapper, TbZ
this.buildListSelectQueryWrapper(qw, query);
//组装本人所在巡组需要打卡或者没有指定巡组的任务
qw.and(qw1 -> {
TbQwXfbb xfbb = MostyQwzxFeignServiceRemote.getMyXfbbTodayNew(null);
if(ObjectUtils.isNotEmpty(xfbb)){
qw1.eq(TbZdxlFgxlrw.XFBB_ID_FIELD, xfbb.getId()).or();
UserInfo user = UserInfoManager.get();
TbQwXfbb xfbb = MostyQwzxFeignServiceRemote.getMyXfbbTodayNew(null);
if(ObjectUtils.isEmpty(xfbb)){
qw.isNull(TbZdxlFgxlrw.XFBB_ID_FIELD).isNull(TbZdxlFgxlrw.XFBB_QW_JL_ID_FIELD);
}else{
qw.and(qw1 -> qw1.eq(TbZdxlFgxlrw.XFBB_ID_FIELD, xfbb.getId()).or().isNull(TbZdxlFgxlrw.XFBB_ID_FIELD));
//组装巡防力量查询条件
String xfllId = ObjectUtils.isEmpty(user.getUserId()) ? user.getXfllId() : user.getUserId().toString();
TbQwJl jl = MostyQwzxFeignServiceRemote.selectQwJlByBbInfo(xfbb.getId(), xfllId);
if(ObjectUtils.isEmpty(jl)){
qw.isNull(TbZdxlFgxlrw.XFBB_QW_JL_ID_FIELD);
}else{
qw.and(qw1 -> qw1.eq(TbZdxlFgxlrw.XFBB_QW_JL_ID_FIELD, jl.getId()).or().isNull(TbZdxlFgxlrw.XFBB_QW_JL_ID_FIELD));
}
//组装其他需要打卡的任务
qw1.isNull(TbZdxlFgxlrw.XFBB_ID_FIELD);
});
}
//返回Page
IPage<TbZdxlFgxlrwVO> resultPage = new Page<>(query.getPageCurrent(), query.getPageSize());
@ -192,7 +204,7 @@ public class TbZdxlFgxlrwServiceImpl extends ServiceImpl<TbZdxlFgxlrwMapper, TbZ
int resultInt = this.baseMapper.updateById(entity);
if(resultInt > 0){
//保存必到点信息
tbZdxlFgdwBddxlrwService.handleList(dto.getBddList());
tbZdxlFgdwBddxlrwService.handleList(dto.getBddList(), dto.getId());
//返回主键
return entity.getId();
}
@ -298,8 +310,12 @@ public class TbZdxlFgxlrwServiceImpl extends ServiceImpl<TbZdxlFgxlrwMapper, TbZ
boolean success = this.updateBatchById(updateList);
if(success){
//再保存一次打卡点信息
tbZdxlFgdwBddxlrwService.handleListByFgxlrwList(entityList);
//再保存一次必到点巡逻任务信息
List<TbZdxlFgdwBddxlrw> bddxlrwList = tbZdxlFgdwBddxlrwService.handleListByFgxlrwList(entityList);
if(CollectionUtils.isNotEmpty(bddxlrwList)){
//必到点巡逻任务保存后,生成对应的必到点巡逻任务记录
tbZdxlFgdwBddxlrwJlService.createListByBddxlrwList(bddxlrwList);
}
//返回
return updateList.size();
}
@ -391,11 +407,27 @@ public class TbZdxlFgxlrwServiceImpl extends ServiceImpl<TbZdxlFgxlrwMapper, TbZ
}
}
//组装巡逻里程总进度
double xlghXllc = resultVO.getXlghXllc();
double xlsjXllc = 0.0;
if(ObjectUtils.isNotEmpty(resultVO.getXlsjXllc())){
xlsjXllc = resultVO.getXlsjXllc();
}
resultVO.setXllcProgress(MathUtils.percentage(new BigDecimal(xlsjXllc + ""), new BigDecimal(xlghXllc + "")));
//组装巡防报备信息
if(StringUtils.isNotBlank(resultVO.getXfbbId())){
TbQwXfbbVo xfbb = MostyQwzxFeignServiceRemote.getXfbbInfo(resultVO.getXfbbId());
if(ObjectUtils.isNotEmpty(xfbb)){
resultVO.setXfbb(xfbb);
//组装选择的巡防报备勤务警力信息
if(StringUtils.isNotBlank(resultVO.getXfbbQwJlId()) && CollectionUtils.isNotEmpty(xfbb.getJlList())){
List<TbQwJl> selectedQwjlList = xfbb.getJlList().stream().filter(xfbbJl -> xfbbJl.getId().equals(resultVO.getXfbbQwJlId())).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(selectedQwjlList)){
resultVO.setXfbbQwJl(selectedQwjlList.get(0));
}
}
}
}

View File

@ -1,6 +1,7 @@
package com.mosty.yjzl.service;
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.common.token.UserInfo;
@ -45,6 +46,13 @@ public interface TbZdxlFgdwBddxlrwJlService {
*/
int createListByFgxlrwId(String fgxlrwId);
/**
* 创建列表(根据必到点巡逻任务列表)
* @param bddxlrwList 必到点巡逻任务列表
* @return 操作条数
*/
int createListByBddxlrwList(List<TbZdxlFgdwBddxlrw> bddxlrwList);
/**
* 打卡
* @param baseEntity 实体信息

View File

@ -48,16 +48,17 @@ public interface TbZdxlFgdwBddxlrwService {
/**
* 保存列表
* @param handleList 操作列表
* @param fgxlrwId 方格巡逻任务ID
* @return 操作条数
*/
int handleList(List<TbZdxlFgdwBddxlrwHandleDTO> handleList);
int handleList(List<TbZdxlFgdwBddxlrwHandleDTO> handleList, String fgxlrwId);
/**
* 保存列表(根据方格巡逻任务列表)
* @param fgxlrwList 方格巡逻任务列表
* @return 操作条数
*/
int handleListByFgxlrwList(List<TbZdxlFgxlrw> fgxlrwList);
List<TbZdxlFgdwBddxlrw> handleListByFgxlrwList(List<TbZdxlFgxlrw> fgxlrwList);
/**
* 打卡(根据打卡记录)

View File

@ -9,6 +9,11 @@ package com.mosty.yjzl.utils;
*/
public class TbZdxlFgxlrwUtils {
/**
* 打卡时间间隔默认10分钟
*/
public final static Long CLOCK_IN_INTERVAL_TIME = 10L*60L*1000L;
/**
* 方格巡逻任务-街面警情-查询开始日期运算长度
*/