Browse Source

fix: 警务评议接收数据接口BUG修复

fix: 信访投诉、案件核查完善
fit: 新增涉及单位、办理单位查询
main
wxc 1 year ago
parent
commit
b5dc7cefaa
  1. 21
      sql/1027.sql
  2. 2
      src/main/java/com/biutag/supervision/constants/enums/ProblemSourcesEnum.java
  3. 4
      src/main/java/com/biutag/supervision/controller/api/jwdc/NegativeApiController.java
  4. 8
      src/main/java/com/biutag/supervision/controller/data/DataCaseVerifController.java
  5. 4
      src/main/java/com/biutag/supervision/controller/data/DataPetitionComplaintController.java
  6. 18
      src/main/java/com/biutag/supervision/controller/datav/DataVController.java
  7. 5
      src/main/java/com/biutag/supervision/flow/action/ApplyCompletionAction.java
  8. 6
      src/main/java/com/biutag/supervision/pojo/domain/Blame.java
  9. 12
      src/main/java/com/biutag/supervision/pojo/dto/DataCaseVerifImportDto.java
  10. 2
      src/main/java/com/biutag/supervision/pojo/dto/DataPetitionComplaintImportDto.java
  11. 12
      src/main/java/com/biutag/supervision/pojo/entity/DataCaseVerif.java
  12. 18
      src/main/java/com/biutag/supervision/pojo/entity/DataPetitionComplaint.java
  13. 4
      src/main/java/com/biutag/supervision/pojo/param/NegativeQueryParam.java
  14. 24
      src/main/java/com/biutag/supervision/service/DataCaseVerifService.java
  15. 24
      src/main/java/com/biutag/supervision/service/DataPetitionComplaintService.java
  16. 19
      src/main/java/com/biutag/supervision/service/NegativeQueryService.java
  17. 55
      src/main/java/com/biutag/supervision/service/NegativeService.java
  18. 43
      src/main/java/com/biutag/supervision/service/SupDepartService.java
  19. 11
      src/main/java/com/biutag/supervision/service/SupPoliceService.java

21
sql/1027.sql

@ -0,0 +1,21 @@
UPDATE negative_work w
LEFT JOIN negative n ON w.create_time = n.crtTime
AND n.involveDepartId = w.depart_id
SET w.negative_id = n.id
WHERE
w.negative_id IS NULL
AND n.id IS NOT NULL;
UPDATE negative
SET handle_three_depart_id = involveDepartId,
handle_three_depart_name = involveDepartName
WHERE
crtTime > '2024-10-25 19:00:00'
AND handle_three_depart_id IS NULL;
//
DELETE
FROM
negative_work
WHERE
negative_id IS NULL;

2
src/main/java/com/biutag/supervision/constants/enums/ProblemSourcesEnum.java

@ -24,7 +24,7 @@ public enum ProblemSourcesEnum {
SJJD("审计监督", "26"), SJJD("审计监督", "26"),
JWDC("警务调查", "2"), JWDC("警务评议", "2"),
JYDC("警意调查", "3"), JYDC("警意调查", "3"),
CFJD("持法监督", "4"), CFJD("持法监督", "4"),
JCKH("检查考核", "8"), JCKH("检查考核", "8"),

4
src/main/java/com/biutag/supervision/controller/api/jwdc/NegativeApiController.java

@ -1,11 +1,11 @@
package com.biutag.supervision.controller.api.jwdc; package com.biutag.supervision.controller.api.jwdc;
import com.alibaba.fastjson.JSON;
import com.biutag.supervision.pojo.domain.Blame; import com.biutag.supervision.pojo.domain.Blame;
import com.biutag.supervision.pojo.dto.jwdc.NegativeApiDto; import com.biutag.supervision.pojo.dto.jwdc.NegativeApiDto;
import com.biutag.supervision.pojo.entity.Negative; import com.biutag.supervision.pojo.entity.Negative;
import com.biutag.supervision.service.NegativeBlameService; import com.biutag.supervision.service.NegativeBlameService;
import com.biutag.supervision.service.NegativeService; import com.biutag.supervision.service.NegativeService;
import com.biutag.supervision.util.JSON;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -43,7 +43,7 @@ public class NegativeApiController {
return new ArrayList<>(); return new ArrayList<>();
} }
List<Blame> list = negativeBlameService.list(negative.getId()); List<Blame> list = negativeBlameService.list(negative.getId());
log.info("警务调查责任民警查询,返回结果: {}", JSON.toJSONString(list)); log.info("警务调查责任民警查询,返回结果数量: {}", list.size());
return list; return list;
} }
} }

8
src/main/java/com/biutag/supervision/controller/data/DataCaseVerifController.java

@ -62,14 +62,14 @@ public class DataCaseVerifController {
@Override @Override
public void invoke(DataCaseVerifImportDto data, AnalysisContext analysisContext) { public void invoke(DataCaseVerifImportDto data, AnalysisContext analysisContext) {
String secondDepartId = secondDeparts.stream() String secondDepartId = secondDeparts.stream()
.filter(item -> item.getShortName().equals(data.getInvolveSecondDepartName())).findFirst() .filter(item -> item.getShortName().equals(data.getSecondDepartName())).findFirst()
.map(SupDepart::getId).orElse(""); .map(SupDepart::getId).orElse("");
data.setInvolveSecondDepartName(secondDepartId); data.setSecondDepartId(secondDepartId);
if (StrUtil.isNotBlank(secondDepartId)) { if (StrUtil.isNotBlank(secondDepartId)) {
String complainedThirdDepartId = departService.list(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getPid, secondDepartId) String complainedThirdDepartId = departService.list(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getPid, secondDepartId)
.like(SupDepart::getShortName, data.getInvolveThirdDepartName())) .like(SupDepart::getShortName, data.getThirdDepartName()))
.stream().findFirst().map(SupDepart::getId).orElse(""); .stream().findFirst().map(SupDepart::getId).orElse("");
data.setInvolveThirdDepartName(complainedThirdDepartId); data.setThirdDepartId(complainedThirdDepartId);
} }
Set<ConstraintViolation<DataCaseVerifImportDto>> validate = validator.validate(data); Set<ConstraintViolation<DataCaseVerifImportDto>> validate = validator.validate(data);
if (!validate.isEmpty()) { if (!validate.isEmpty()) {

4
src/main/java/com/biutag/supervision/controller/data/DataPetitionComplaintController.java

@ -86,12 +86,12 @@ public class DataPetitionComplaintController {
String secondDepartId = secondDeparts.stream() String secondDepartId = secondDeparts.stream()
.filter(item -> item.getShortName().equals(data.getInvolveSecondDepartName())).findFirst() .filter(item -> item.getShortName().equals(data.getInvolveSecondDepartName())).findFirst()
.map(SupDepart::getId).orElse(""); .map(SupDepart::getId).orElse("");
data.setInvolveSecondDepartName(secondDepartId); data.setInvolveSecondDepartId(secondDepartId);
if (StrUtil.isNotBlank(secondDepartId)) { if (StrUtil.isNotBlank(secondDepartId)) {
String complainedThirdDepartId = departService.list(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getPid, secondDepartId) String complainedThirdDepartId = departService.list(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getPid, secondDepartId)
.like(SupDepart::getShortName, data.getInvolveThirdDepartName())) .like(SupDepart::getShortName, data.getInvolveThirdDepartName()))
.stream().findFirst().map(SupDepart::getId).orElse(""); .stream().findFirst().map(SupDepart::getId).orElse("");
data.setInvolveThirdDepartName(complainedThirdDepartId); data.setInvolveThirdDepartId(complainedThirdDepartId);
} }
Set<ConstraintViolation<DataPetitionComplaintImportDto>> validate = validator.validate(data); Set<ConstraintViolation<DataPetitionComplaintImportDto>> validate = validator.validate(data);
if (!validate.isEmpty()) { if (!validate.isEmpty()) {

18
src/main/java/com/biutag/supervision/controller/datav/DataVController.java

@ -1,13 +1,19 @@
package com.biutag.supervision.controller.datav; package com.biutag.supervision.controller.datav;
import cn.hutool.core.util.NumberUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.biutag.supervision.pojo.Result; import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.entity.DataCaseVerif;
import com.biutag.supervision.service.DataCaseVerifService; import com.biutag.supervision.service.DataCaseVerifService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
@ -22,22 +28,22 @@ public class DataVController {
private final DataCaseVerifService dataCaseVerifService; private final DataCaseVerifService dataCaseVerifService;
@GetMapping("caseVerif") @GetMapping("caseVerif")
public Result<JSONObject> caseVerif(Date beginTime, Date endTime) { public Result<JSONObject> caseVerif(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
long total = dataCaseVerifService.count(); long total = dataCaseVerifService.count(new LambdaQueryWrapper<DataCaseVerif>().between(DataCaseVerif::getDiscoveryTime, beginTime, endTime));
long confirmed = 0; long confirmed = 0;
JSONObject overview = new JSONObject() JSONObject overview = new JSONObject()
// 案件总数(起) // 案件总数(起)
.fluentPut("total", total) .fluentPut("total", total)
// 查实案件数 // 查实案件数
.fluentPut("confirmed", "") .fluentPut("confirmed", 0)
// 查处问题(个) // 查处问题(个)
.fluentPut("investigateAndPunish", 0) .fluentPut("investigateAndPunish", 0)
// 问责人次 // 问责人次
.fluentPut("wzrc", 0) .fluentPut("accountablePeopleNumber", 0)
// 问责单位数 // 问责单位数
.fluentPut("wzdws", 0) .fluentPut("accountableDepartNumber", 0)
// 查实率 // 查实率
.fluentPut("confirmedRate", confirmed / total * 100 + "%"); .fluentPut("confirmedRate", total == 0 ? 0 : BigDecimal.valueOf(NumberUtil.div(confirmed, total) * 100).intValue());
JSONObject data = new JSONObject().fluentPut("overview", overview); JSONObject data = new JSONObject().fluentPut("overview", overview);
return Result.success(data); return Result.success(data);
} }

5
src/main/java/com/biutag/supervision/flow/action/ApplyCompletionAction.java

@ -2,6 +2,7 @@ package com.biutag.supervision.flow.action;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.biutag.supervision.constants.AppConstants; import com.biutag.supervision.constants.AppConstants;
@ -91,7 +92,7 @@ public class ApplyCompletionAction implements Action {
negativeBlame.setAssistStartTime(item.getAssistTime().get(0)) negativeBlame.setAssistStartTime(item.getAssistTime().get(0))
.setAssistEndTime(item.getAssistTime().get(1)); .setAssistEndTime(item.getAssistTime().get(1));
} }
problemRelations.addAll(item.getProblems().stream().map(problem -> { problemRelations.addAll(item.getProblems().stream().filter(problem -> StrUtil.isNotBlank(problem.getOneLevelCode())).map(problem -> {
NegativeProblemRelation problemRelation = new NegativeProblemRelation(); NegativeProblemRelation problemRelation = new NegativeProblemRelation();
BeanUtil.copyProperties(problem, problemRelation); BeanUtil.copyProperties(problem, problemRelation);
problemRelation.setId(IdUtil.fastSimpleUUID()); problemRelation.setId(IdUtil.fastSimpleUUID());
@ -106,9 +107,9 @@ public class ApplyCompletionAction implements Action {
// 新增涉及人员 // 新增涉及人员
negativeBlameService.saveBatch(negativeBlames); negativeBlameService.saveBatch(negativeBlames);
// 新增涉及人员问题类型 // 新增涉及人员问题类型
if (!problemRelations.isEmpty()) {
// 先删除 // 先删除
negativeProblemRelationService.remove(negativeId); negativeProblemRelationService.remove(negativeId);
if (!problemRelations.isEmpty()) {
// 新增 // 新增
negativeProblemRelationService.saveBatch(problemRelations); negativeProblemRelationService.saveBatch(problemRelations);
} }

6
src/main/java/com/biutag/supervision/pojo/domain/Blame.java

@ -105,11 +105,11 @@ public class Blame {
private String assistCaseName; private String assistCaseName;
// 帮扶结束时间 // 帮扶结束时间
@JsonFormat(pattern = "YYYY-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime assistEndTime; private LocalDateTime assistEndTime;
// 帮扶开始时间 // 帮扶开始时间
@JsonFormat(pattern = "YYYY-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime assistStartTime; private LocalDateTime assistStartTime;
// 责任领导 // 责任领导
@ -165,8 +165,10 @@ public class Blame {
// 统计人员类型 1 民警 2 其他 // 统计人员类型 1 民警 2 其他
private String statisticsPersonType; private String statisticsPersonType;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime crtTime; private LocalDateTime crtTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updTime; private LocalDateTime updTime;
private String status; private String status;

12
src/main/java/com/biutag/supervision/pojo/dto/DataCaseVerifImportDto.java

@ -49,18 +49,16 @@ public class DataCaseVerifImportDto {
private String policeTypeName; private String policeTypeName;
// 被投诉机构 // 被投诉机构
private String secondDepartId;
@ExcelProperty({"问题基本信息", "涉及单位(二级机构)"}) @ExcelProperty({"问题基本信息", "涉及单位(二级机构)"})
private String involveSecondDepartName; private String secondDepartName;
// 被投诉机构 // 被投诉机构
@ExcelProperty({"问题基本信息", "涉及单位(三级机构)"}) @ExcelProperty({"问题基本信息", "涉及单位(三级机构)"})
private String involveThirdDepartName; private String thirdDepartName;
@NotBlank(message = "涉及二级机构为空或与系统未匹配上")
private String involveSecondDepartId;
private String involveThirdDepartId; private String thirdDepartId;
// 具体内容 // 具体内容
@ExcelProperty({"问题基本信息", "具体内容"}) @ExcelProperty({"问题基本信息", "具体内容"})

2
src/main/java/com/biutag/supervision/pojo/dto/DataPetitionComplaintImportDto.java

@ -64,7 +64,7 @@ public class DataPetitionComplaintImportDto {
@ExcelProperty({"信访基本信息", "业务类别"}) @ExcelProperty({"信访基本信息", "业务类别"})
private String businessTypeName; private String businessTypeName;
@NotBlank(message = "被投诉二级机构为空或与系统未匹配上") @ExcelProperty({"信访基本信息", "被投诉二级机构"})
private String involveSecondDepartName; private String involveSecondDepartName;
// 被投诉机构 // 被投诉机构

12
src/main/java/com/biutag/supervision/pojo/entity/DataCaseVerif.java

@ -50,11 +50,15 @@ public class DataCaseVerif {
@TableField("police_type_name") @TableField("police_type_name")
private String policeTypeName; private String policeTypeName;
// 涉及单位 // 涉及单位 二级
@TableField("involve_depart_name") private String secondDepartId;
private String involveDepartName;
private String involveDepartId; private String secondDepartName;
// 所对
private String thirdDepartId;
private String thirdDepartName;
// 事情简述 // 事情简述
@TableField("thing_desc") @TableField("thing_desc")

18
src/main/java/com/biutag/supervision/pojo/entity/DataPetitionComplaint.java

@ -44,11 +44,11 @@ public class DataPetitionComplaint {
// 缠访闹访 // 缠访闹访
@TableField("entanglement_visits") @TableField("entanglement_visits")
private String entanglementVisits; private Boolean entanglementVisits;
// 群众集访 // 群众集访
@TableField("mass_visits") @TableField("mass_visits")
private String massVisits; private Boolean massVisits;
// 涉嫌问题 // 涉嫌问题
@TableField("involve_problem") @TableField("involve_problem")
@ -69,13 +69,15 @@ public class DataPetitionComplaint {
//--------------------- //---------------------
// 涉及单位 // 涉及单位 二级
@TableField("involve_depart_id") private String secondDepartId;
private String involveDepartId;
// 涉及单位 private String secondDepartName;
@TableField("involve_depart_name")
private String involveDepartName; // 所对
private String thirdDepartId;
private String thirdDepartName;
private LocalDateTime createTime; private LocalDateTime createTime;

4
src/main/java/com/biutag/supervision/pojo/param/NegativeQueryParam.java

@ -44,4 +44,8 @@ public class NegativeQueryParam extends BasePage {
// 是否超时 // 是否超时
private Boolean timeoutFlag; private Boolean timeoutFlag;
private String involveDepartId;
private String handleDepartId;
} }

24
src/main/java/com/biutag/supervision/service/DataCaseVerifService.java

@ -50,13 +50,6 @@ public class DataCaseVerifService extends ServiceImpl<DataCaseVerifMapper, DataC
DataCaseVerif data = new DataCaseVerif(); DataCaseVerif data = new DataCaseVerif();
BeanUtils.copyProperties(dto, data); BeanUtils.copyProperties(dto, data);
data.setCreateTime(now); data.setCreateTime(now);
if (StrUtil.isBlank(dto.getInvolveThirdDepartId())) {
data.setInvolveDepartId(dto.getInvolveSecondDepartId());
data.setInvolveDepartName(dto.getInvolveSecondDepartName());
} else {
data.setInvolveDepartId(dto.getInvolveThirdDepartId());
data.setInvolveDepartName(dto.getInvolveThirdDepartName());
}
data.setDistributionState(DistributionStateEnum.UNDISTRIBUTED.getValue()); data.setDistributionState(DistributionStateEnum.UNDISTRIBUTED.getValue());
saveOrUpdate(data); saveOrUpdate(data);
} }
@ -76,13 +69,22 @@ public class DataCaseVerifService extends ServiceImpl<DataCaseVerifMapper, DataC
negativeDto.setResponderName(item.getResponderName()); negativeDto.setResponderName(item.getResponderName());
negativeDto.setContactPhone(item.getResponderPhone()); negativeDto.setContactPhone(item.getResponderPhone());
negativeDto.setThingDesc(item.getThingDesc()); negativeDto.setThingDesc(item.getThingDesc());
negativeDto.setInvolveDepartId(item.getInvolveDepartId()); String departId;
negativeDto.setInvolveDepartName(item.getInvolveDepartName()); String departName;
if (StrUtil.isBlank(item.getThirdDepartId())) {
departId = item.getSecondDepartId();
departName = item.getSecondDepartName();
} else {
departId = item.getThirdDepartId();
departName = item.getThirdDepartName();
}
negativeDto.setInvolveDepartId(departId);
negativeDto.setInvolveDepartName(departName);
negativeDto.setHostLevel(HostLevelEnums.SECOND.getValue()); negativeDto.setHostLevel(HostLevelEnums.SECOND.getValue());
negativeDto.setApprovalFlow(dataDistribute.getApprovalFlow()); negativeDto.setApprovalFlow(dataDistribute.getApprovalFlow());
negativeDto.setDepartId(item.getInvolveDepartId()); negativeDto.setDepartId(departId);
negativeDto.setDepartName(item.getInvolveDepartName()); negativeDto.setDepartName(departName);
negativeDto.setTimeLimit(dataDistribute.getTimeLimit()); negativeDto.setTimeLimit(dataDistribute.getTimeLimit());
negativeDto.setMaxSignDuration(dataDistribute.getMaxSignDuration()); negativeDto.setMaxSignDuration(dataDistribute.getMaxSignDuration());
negativeDto.setMaxHandleDuration(dataDistribute.getMaxHandleDuration()); negativeDto.setMaxHandleDuration(dataDistribute.getMaxHandleDuration());

24
src/main/java/com/biutag/supervision/service/DataPetitionComplaintService.java

@ -71,13 +71,6 @@ public class DataPetitionComplaintService extends ServiceImpl<DataPetitionCompla
data.setCreateTime(now); data.setCreateTime(now);
data.setUpdateTime(now); data.setUpdateTime(now);
data.setProblemSourcesCode(body.getProblemSourcesCode()); data.setProblemSourcesCode(body.getProblemSourcesCode());
if (StrUtil.isBlank(dto.getInvolveThirdDepartId())) {
data.setInvolveDepartId(dto.getInvolveSecondDepartId());
data.setInvolveDepartName(dto.getInvolveSecondDepartName());
} else {
data.setInvolveDepartId(dto.getInvolveThirdDepartId());
data.setInvolveDepartName(dto.getInvolveThirdDepartName());
}
data.setDistributionState(DistributionStateEnum.UNDISTRIBUTED.getValue()); data.setDistributionState(DistributionStateEnum.UNDISTRIBUTED.getValue());
saveOrUpdate(data); saveOrUpdate(data);
} }
@ -96,13 +89,22 @@ public class DataPetitionComplaintService extends ServiceImpl<DataPetitionCompla
negativeDto.setResponderName(item.getResponderName()); negativeDto.setResponderName(item.getResponderName());
negativeDto.setContactPhone(item.getResponderPhone()); negativeDto.setContactPhone(item.getResponderPhone());
negativeDto.setThingDesc(item.getThingDesc()); negativeDto.setThingDesc(item.getThingDesc());
negativeDto.setInvolveDepartId(item.getInvolveDepartId()); String departId;
negativeDto.setInvolveDepartName(item.getInvolveDepartName()); String departName;
if (StrUtil.isBlank(item.getThirdDepartId())) {
departId = item.getSecondDepartId();
departName = item.getSecondDepartName();
} else {
departId = item.getThirdDepartId();
departName = item.getThirdDepartName();
}
negativeDto.setInvolveDepartId(departId);
negativeDto.setInvolveDepartName(departName);
negativeDto.setHostLevel(HostLevelEnums.SECOND.getValue()); negativeDto.setHostLevel(HostLevelEnums.SECOND.getValue());
negativeDto.setApprovalFlow(dataDistribute.getApprovalFlow()); negativeDto.setApprovalFlow(dataDistribute.getApprovalFlow());
negativeDto.setDepartId(item.getInvolveDepartId()); negativeDto.setDepartId(departId);
negativeDto.setDepartName(item.getInvolveDepartName()); negativeDto.setDepartName(departName);
negativeDto.setTimeLimit(dataDistribute.getTimeLimit()); negativeDto.setTimeLimit(dataDistribute.getTimeLimit());
negativeDto.setMaxSignDuration(dataDistribute.getMaxSignDuration()); negativeDto.setMaxSignDuration(dataDistribute.getMaxSignDuration());
negativeDto.setMaxHandleDuration(dataDistribute.getMaxHandleDuration()); negativeDto.setMaxHandleDuration(dataDistribute.getMaxHandleDuration());

19
src/main/java/com/biutag/supervision/service/NegativeQueryService.java

@ -5,11 +5,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.common.UserContextHolder; import com.biutag.supervision.common.UserContextHolder;
import com.biutag.supervision.constants.AppConstants; import com.biutag.supervision.constants.AppConstants;
import com.biutag.supervision.constants.enums.DepartLevelEnum;
import com.biutag.supervision.constants.enums.ProcessingStatusEnum; import com.biutag.supervision.constants.enums.ProcessingStatusEnum;
import com.biutag.supervision.constants.enums.RoleCodeEnum; import com.biutag.supervision.constants.enums.RoleCodeEnum;
import com.biutag.supervision.pojo.entity.Negative; import com.biutag.supervision.pojo.entity.Negative;
import com.biutag.supervision.pojo.model.UserAuth; import com.biutag.supervision.pojo.model.UserAuth;
import com.biutag.supervision.pojo.param.NegativeQueryParam; import com.biutag.supervision.pojo.param.NegativeQueryParam;
import com.biutag.supervision.pojo.vo.DepartTree;
import com.biutag.supervision.pojo.vo.NegativeQueryVo; import com.biutag.supervision.pojo.vo.NegativeQueryVo;
import com.biutag.supervision.util.TimeUtil; import com.biutag.supervision.util.TimeUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -26,6 +28,8 @@ public class NegativeQueryService {
private final NegativeService negativeService; private final NegativeService negativeService;
private final SupDepartService departService;
public Page<NegativeQueryVo> page(NegativeQueryParam param) { public Page<NegativeQueryVo> page(NegativeQueryParam param) {
UserAuth user = UserContextHolder.getCurrentUser(); UserAuth user = UserContextHolder.getCurrentUser();
if (!AppConstants.USER_TYPE_SUPER.equals(user.getUserType()) && (user.getRoleCodes().isEmpty() || user.getAuthSources().isEmpty() || user.getAuthDepartIds().isEmpty())) { if (!AppConstants.USER_TYPE_SUPER.equals(user.getUserType()) && (user.getRoleCodes().isEmpty() || user.getAuthSources().isEmpty() || user.getAuthDepartIds().isEmpty())) {
@ -72,6 +76,21 @@ public class NegativeQueryService {
queryWrapper.isNotNull(Negative::getCompleteDate).apply("TIMESTAMPDIFF(HOUR, crtTime, completeDate) <= 72"); queryWrapper.isNotNull(Negative::getCompleteDate).apply("TIMESTAMPDIFF(HOUR, crtTime, completeDate) <= 72");
} }
} }
// 涉及单位
if (StrUtil.isNotBlank(param.getInvolveDepartId())) {
List<String> departIds = departService.getAllNodeIds(param.getInvolveDepartId());
queryWrapper.in(Negative::getInvolveDepartId, departIds);
}
// 办理单位
if (StrUtil.isNotBlank(param.getHandleDepartId())) {
List<DepartTree> nodes = departService.getAllNode(List.of(param.getHandleDepartId()));
List<String> secondIds = nodes.stream().filter(node -> DepartLevelEnum.SECOND.getValue().equals(node.getLevel())).map(DepartTree::getId).toList();
if (!secondIds.isEmpty()) {
queryWrapper.in(Negative::getHandleSecondDepartId, secondIds);
} else {
queryWrapper.in(Negative::getHandleThreeDepartId, nodes.stream().filter(node -> DepartLevelEnum.THREE.getValue().equals(node.getLevel())).map(DepartTree::getId).toList());
}
}
Page<Negative> page = negativeService.page(Page.of(param.getCurrent(), param.getSize()), queryWrapper); Page<Negative> page = negativeService.page(Page.of(param.getCurrent(), param.getSize()), queryWrapper);
long l = System.currentTimeMillis(); long l = System.currentTimeMillis();
List<NegativeQueryVo> list = page.getRecords().stream().map(item -> { List<NegativeQueryVo> list = page.getRecords().stream().map(item -> {

55
src/main/java/com/biutag/supervision/service/NegativeService.java

@ -158,8 +158,8 @@ public class NegativeService extends ServiceImpl<NegativeMapper, Negative> {
} }
NegativeWork work = new NegativeWork() NegativeWork work = new NegativeWork()
.setNegativeId(negative.getId()). .setNegativeId(negative.getId())
setStatus(WorkStatusEnum.todo.name()) .setStatus(WorkStatusEnum.todo.name())
.setDepartId(AppConstants.ROOT_DEPART_ID) .setDepartId(AppConstants.ROOT_DEPART_ID)
.setDepartName(AppConstants.ROOT_DEPART_NAME) .setDepartName(AppConstants.ROOT_DEPART_NAME)
.setRoleCode(RoleCodeEnum.FIRST_ADMIN.getCode()) .setRoleCode(RoleCodeEnum.FIRST_ADMIN.getCode())
@ -186,10 +186,13 @@ public class NegativeService extends ServiceImpl<NegativeMapper, Negative> {
public boolean saveByJwdc(List<NegativeApiDto> list) { public boolean saveByJwdc(List<NegativeApiDto> list) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
list.forEach(item -> { list.forEach(item -> {
if (exists(item.getOriginId())) {
throw new RuntimeException("样本源头编号已存在请核实");
}
SupDepart dept = departService.getByJwpyCode(item.getDepartCode()); SupDepart dept = departService.getByJwpyCode(item.getDepartCode());
Negative negative = new Negative(); Negative negative = new Negative();
BeanUtil.copyProperties(item, negative);
negative.setId(IdUtil.getSnowflakeNextIdStr()) negative
.setBusinessTypeCode(NegativeApiDto.BusinessType.getCode(item.getBusinessTypeName())) .setBusinessTypeCode(NegativeApiDto.BusinessType.getCode(item.getBusinessTypeName()))
.setPoliceType(NegativeApiDto.BusinessType.getPoliceType(item.getBusinessTypeName())) .setPoliceType(NegativeApiDto.BusinessType.getPoliceType(item.getBusinessTypeName()))
.setPoliceTypeName(NegativeApiDto.BusinessType.getPoliceTypeName(item.getBusinessTypeName())) .setPoliceTypeName(NegativeApiDto.BusinessType.getPoliceTypeName(item.getBusinessTypeName()))
@ -203,6 +206,7 @@ public class NegativeService extends ServiceImpl<NegativeMapper, Negative> {
.setMaxExtensionDuration(TimeLimitEnum.WORK_137.getMaxHandleDuration()) .setMaxExtensionDuration(TimeLimitEnum.WORK_137.getMaxHandleDuration())
.setApprovalFlow(ApprovalFlowEnum.SECOND_APPROVAL.getValue()) .setApprovalFlow(ApprovalFlowEnum.SECOND_APPROVAL.getValue())
.setFirstDistributeTime(now) .setFirstDistributeTime(now)
.setProcessingStatus(ProcessingStatusEnum.signing.name())
// 完成状态 0-待完善 1-已完善 // 完成状态 0-待完善 1-已完善
.setCompleteStatus("0") .setCompleteStatus("0")
.setTaskId("api") .setTaskId("api")
@ -216,35 +220,44 @@ public class NegativeService extends ServiceImpl<NegativeMapper, Negative> {
involveProblem.put("dictValue", "1"); involveProblem.put("dictValue", "1");
negative.setInvolveProblem(JSON.toJSONString(Collections.singletonList(involveProblem))); negative.setInvolveProblem(JSON.toJSONString(Collections.singletonList(involveProblem)));
NegativeWork work = new NegativeWork();
if (Objects.nonNull(dept)) { if (Objects.nonNull(dept)) {
negative.setInvolveDepartId(dept.getId()) negative.setInvolveDepartId(dept.getId())
.setInvolveDepartName(dept.getName()) .setInvolveDepartName(dept.getShortName())
.setFlowKey(FlowNodeEnum.THREE_SIGN.getKey()); .setFlowKey(FlowNodeEnum.THREE_SIGN.getKey());
work.setNegativeId(negative.getId()) }
.setStatus(WorkStatusEnum.todo.name()) save(negative);
.setDepartId(dept.getId()) // 新增work
.setDepartName(dept.getName()) String departId;
.setRoleCode(RoleCodeEnum.THREE_ADMIN.getCode()) String departName;
.setProblemSourcesCode(negative.getProblemSourcesCode()) String roleCode;
.setUpdateTime(now) if (Objects.nonNull(dept)) {
.setCreateTime(now); departId = dept.getId();
departName = dept.getShortName();
roleCode = RoleCodeEnum.THREE_ADMIN.getCode();
} else { } else {
log.error("未匹配上单位:{}, code: {}", item.getDepartName(), item.getDepartCode()); log.error("未匹配上单位:{}, code: {}", item.getDepartName(), item.getDepartCode());
work.setNegativeId(negative.getId()) departId = AppConstants.ROOT_DEPART_ID;
departName = AppConstants.ROOT_DEPART_NAME;
roleCode = RoleCodeEnum.FIRST_ADMIN.getCode();
}
NegativeWork work = new NegativeWork()
.setNegativeId(negative.getId())
.setDepartId(departId)
.setDepartName(departName)
.setRoleCode(roleCode)
.setProblemSourcesCode(negative.getProblemSourcesCode())
.setStatus(WorkStatusEnum.todo.name()) .setStatus(WorkStatusEnum.todo.name())
.setDepartId(AppConstants.ROOT_DEPART_ID)
.setDepartName(AppConstants.ROOT_DEPART_NAME)
.setRoleCode(RoleCodeEnum.FIRST_ADMIN.getCode())
.setUpdateTime(now) .setUpdateTime(now)
.setCreateTime(now); .setCreateTime(now);
}
save(negative);
workService.save(work); workService.save(work);
}); });
return true; return true;
} }
public boolean exists(String originId) {
return exists(new LambdaUpdateWrapper<Negative>().eq(Negative::getOriginId, originId));
}
/** /**
* 生成样本源头编号 * 生成样本源头编号
* @param problemSourcesCode * @param problemSourcesCode
@ -255,7 +268,7 @@ public class NegativeService extends ServiceImpl<NegativeMapper, Negative> {
StrUtil.isBlank(businessTypeCode) ? "" : BusinessTypeEnum.get(businessTypeCode).getKey(), StrUtil.isBlank(businessTypeCode) ? "" : BusinessTypeEnum.get(businessTypeCode).getKey(),
DateUtil.format(new Date(), DatePattern.PURE_DATE_FORMAT), DateUtil.format(new Date(), DatePattern.PURE_DATE_FORMAT),
RandomUtil.randomString(4)); RandomUtil.randomString(4));
if (exists(new LambdaUpdateWrapper<Negative>().eq(Negative::getOriginId, originId))) { if (exists(originId)) {
return generateOriginId(problemSourcesCode, businessTypeCode); return generateOriginId(problemSourcesCode, businessTypeCode);
} }
return originId; return originId;

43
src/main/java/com/biutag/supervision/service/SupDepartService.java

@ -44,40 +44,35 @@ public class SupDepartService extends ServiceImpl<SupDepartMapper, SupDepart> {
return list(new LambdaQueryWrapper<SupDepart>().in(SupDepart::getLevel, levels).eq(SupDepart::getStatus, StatusEnum.ENABLE.getValue()).orderByAsc(SupDepart::getOrderNo)); return list(new LambdaQueryWrapper<SupDepart>().in(SupDepart::getLevel, levels).eq(SupDepart::getStatus, StatusEnum.ENABLE.getValue()).orderByAsc(SupDepart::getOrderNo));
} }
public List<String> listAndChildrenIds(String departId) { public List<String> getAllNodeIds(String departId) {
return listAndChildrenIds(List.of(departId)); return getAllNodeIds(List.of(departId));
} }
public List<String> listAndChildrenIds(List<String> departIds) { public List<String> getAllNodeIds(List<String> departIds) {
List<DepartTree> list = buildTree(); return getAllNode(departIds).stream().map(DepartTree::getId).toList();
List<String> ids = new ArrayList<>();
listAndChildrenIds(departIds, list, ids);
return ids;
} }
private List<String> listAndChildrenIds(List<String> departIds, List<DepartTree> list, List<String> ids) { public List<DepartTree> getAllNode(List<String> departIds) {
list.forEach(item -> { List<DepartTree> treeList = buildTree();
List<DepartTree> nodes = new ArrayList<>();
getAllNodeRecursive(departIds, treeList, nodes);
return nodes;
}
private void getAllNodeRecursive(List<String> departIds, List<DepartTree> treeList, List<DepartTree> nodes) {
treeList.forEach(item -> {
if (departIds.contains(item.getId())) { if (departIds.contains(item.getId())) {
listAndChildrenIds(ids, item); getAllNodeRecursive(item, nodes);
} else { } else {
listAndChildrenIds(departIds, item.getChildren(), ids); getAllNodeRecursive(departIds, item.getChildren(), nodes);
} }
}); });
return ids;
} }
private void listAndChildrenIds(List<String> ids, DepartTree departTree) { private void getAllNodeRecursive(DepartTree tree, List<DepartTree> nodes) {
ids.add(departTree.getId()); nodes.add(tree);
listAndChildrenIds(ids, departTree.getChildren()); tree.getChildren().forEach(item -> {
} getAllNodeRecursive(item, nodes);
private void listAndChildrenIds(List<String> ids, List<DepartTree> list) {
if (list.isEmpty()) {
return;
}
ids.addAll(list.stream().map(DepartTree::getId).toList());
list.forEach(item -> {
listAndChildrenIds(ids, item.getChildren());
}); });
} }

11
src/main/java/com/biutag/supervision/service/SupPoliceService.java

@ -9,7 +9,6 @@ import com.biutag.supervision.common.UserContextHolder;
import com.biutag.supervision.constants.AppConstants; import com.biutag.supervision.constants.AppConstants;
import com.biutag.supervision.constants.enums.RoleCodeEnum; import com.biutag.supervision.constants.enums.RoleCodeEnum;
import com.biutag.supervision.mapper.SupPoliceMapper; import com.biutag.supervision.mapper.SupPoliceMapper;
import com.biutag.supervision.pojo.entity.SupDepart;
import com.biutag.supervision.pojo.entity.SupPolice; import com.biutag.supervision.pojo.entity.SupPolice;
import com.biutag.supervision.pojo.model.PoliceModel; import com.biutag.supervision.pojo.model.PoliceModel;
import com.biutag.supervision.pojo.model.UserAuth; import com.biutag.supervision.pojo.model.UserAuth;
@ -35,7 +34,7 @@ public class SupPoliceService extends ServiceImpl<SupPoliceMapper, SupPolice> {
if (user.getAuthDepartIds().isEmpty() || user.getRoleCodes().isEmpty() || !user.getRoleCodes().contains(RoleCodeEnum.SECOND_ADMIN.getCode()) && !user.getRoleCodes().contains(RoleCodeEnum.THREE_ADMIN.getCode())) { if (user.getAuthDepartIds().isEmpty() || user.getRoleCodes().isEmpty() || !user.getRoleCodes().contains(RoleCodeEnum.SECOND_ADMIN.getCode()) && !user.getRoleCodes().contains(RoleCodeEnum.THREE_ADMIN.getCode())) {
return new Page<PoliceModel>().setTotal(0).setRecords(new ArrayList<>()); return new Page<PoliceModel>().setTotal(0).setRecords(new ArrayList<>());
} }
List<String> orgIds = departService.listAndChildrenIds(user.getAuthDepartIds()); List<String> orgIds = departService.getAllNodeIds(user.getAuthDepartIds());
queryWrapper.in("p.org_id", orgIds); queryWrapper.in("p.org_id", orgIds);
} }
queryWrapper.like(StrUtil.isNotBlank(param.getName()), "p.name", StrUtil.trim(param.getName())); queryWrapper.like(StrUtil.isNotBlank(param.getName()), "p.name", StrUtil.trim(param.getName()));
@ -44,7 +43,7 @@ public class SupPoliceService extends ServiceImpl<SupPoliceMapper, SupPolice> {
queryWrapper.like(StrUtil.isNotBlank(param.getPhone()), "p.phone", StrUtil.trim(param.getPhone())); queryWrapper.like(StrUtil.isNotBlank(param.getPhone()), "p.phone", StrUtil.trim(param.getPhone()));
if (StrUtil.isNotBlank(param.getDepartId())) { if (StrUtil.isNotBlank(param.getDepartId())) {
if (Objects.nonNull(param.getDepartBranch()) && param.getDepartBranch()) { if (Objects.nonNull(param.getDepartBranch()) && param.getDepartBranch()) {
List<String> orgIds = departService.listAndChildrenIds(param.getDepartId()); List<String> orgIds = departService.getAllNodeIds(param.getDepartId());
queryWrapper.in("p.org_id", orgIds); queryWrapper.in("p.org_id", orgIds);
} else { } else {
queryWrapper.eq("p.org_id", param.getDepartId()); queryWrapper.eq("p.org_id", param.getDepartId());
@ -59,17 +58,17 @@ public class SupPoliceService extends ServiceImpl<SupPoliceMapper, SupPolice> {
} }
public List<SupPolice> listAllByDepartId(String departId) { public List<SupPolice> listAllByDepartId(String departId) {
List<String> departIds = departService.listAndChildrenIds(List.of(departId)); List<String> departIds = departService.getAllNodeIds(List.of(departId));
return list(new LambdaQueryWrapper<SupPolice>().in(SupPolice::getOrgId, departIds)); return list(new LambdaQueryWrapper<SupPolice>().in(SupPolice::getOrgId, departIds));
} }
public List<SupPolice> listLeaderByDepartId(String departId) { public List<SupPolice> listLeaderByDepartId(String departId) {
List<String> departIds = departService.listAndChildrenIds(List.of(departId)); List<String> departIds = departService.getAllNodeIds(List.of(departId));
return list(new LambdaQueryWrapper<SupPolice>().in(SupPolice::getOrgId, departIds).isNotNull(SupPolice::getPhone)); return list(new LambdaQueryWrapper<SupPolice>().in(SupPolice::getOrgId, departIds).isNotNull(SupPolice::getPhone));
} }
public Boolean exists(String departId) { public Boolean exists(String departId) {
List<String> orgIds = departService.listAndChildrenIds(departId); List<String> orgIds = departService.getAllNodeIds(departId);
if (orgIds.isEmpty()) { if (orgIds.isEmpty()) {
return false; return false;
} }

Loading…
Cancel
Save