Browse Source

241220

main
wxc 1 year ago
parent
commit
5e28b19039
  1. 5
      sql/20241220.sql
  2. 38
      src/main/java/com/biutag/supervision/controller/work/NegativeController.java
  3. 14
      src/main/java/com/biutag/supervision/flow/action/ApplyCompletionAction.java
  4. 26
      src/main/java/com/biutag/supervision/flow/action/SaveAction.java
  5. 10
      src/main/java/com/biutag/supervision/flow/action/SecondLocalProcessingAction.java
  6. 7
      src/main/java/com/biutag/supervision/mapper/NegativeFileMapper.java
  7. 3
      src/main/java/com/biutag/supervision/pojo/domain/NegativeVo.java
  8. 21
      src/main/java/com/biutag/supervision/pojo/dto/NegativeSpotCheckDto.java
  9. 3
      src/main/java/com/biutag/supervision/pojo/dto/flow/VerifyData.java
  10. 18
      src/main/java/com/biutag/supervision/pojo/entity/Negative.java
  11. 1
      src/main/java/com/biutag/supervision/pojo/entity/NegativeFile.java
  12. 38
      src/main/java/com/biutag/supervision/pojo/vo/NegativeFileVo.java
  13. 4
      src/main/java/com/biutag/supervision/service/FileService.java
  14. 5
      src/main/java/com/biutag/supervision/service/NegativeFileService.java
  15. 40
      src/main/java/com/biutag/supervision/service/NegativeService.java
  16. 1
      src/main/java/com/biutag/supervision/service/UserLoginService.java

5
sql/20241220.sql

@ -0,0 +1,5 @@
ALTER TABLE `negative`.`negative`
ADD COLUMN `spot_check_flag` tinyint NULL COMMENT '是否抽检' AFTER `second_involve_depart_id`,
ADD COLUMN `spot_check_result` varchar(255) NULL COMMENT '抽检结果' AFTER `spot_check_flag`,
ADD COLUMN `spot_check_desc` text NULL COMMENT '抽检情况' AFTER `spot_check_result`,
ADD COLUMN `unrectify_reason` text NULL COMMENT '未整改原因' AFTER `spot_check_desc`;

38
src/main/java/com/biutag/supervision/controller/work/NegativeController.java

@ -11,10 +11,12 @@ import com.biutag.supervision.common.validation.EditGroup;
import com.biutag.supervision.constants.AppConstants;
import com.biutag.supervision.constants.enums.*;
import com.biutag.supervision.flow.FlowService;
import com.biutag.supervision.flow.action.ApplyCompletionAction;
import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.domain.NegativeDetail;
import com.biutag.supervision.pojo.dto.ActionDto;
import com.biutag.supervision.pojo.dto.NegativeDto;
import com.biutag.supervision.pojo.dto.NegativeSpotCheckDto;
import com.biutag.supervision.pojo.entity.*;
import com.biutag.supervision.pojo.model.UserAuth;
import com.biutag.supervision.pojo.param.NegativeQueryParam;
@ -29,6 +31,7 @@ import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Objects;
@RequiredArgsConstructor
@RequestMapping("negative")
@ -47,6 +50,10 @@ public class NegativeController {
private final NegativeWorkService negativeWorkService;
private final NegativeScoreService negativeScoreService;
private final SupDepartService departService;
@GetMapping
public Result<Page<NegativeQueryVo>> list(NegativeQueryParam queryParam) {
return Result.success(negativeQueryService.page(queryParam));
@ -75,6 +82,17 @@ public class NegativeController {
throw new RuntimeException("数据异常,请系统联系管理员【问题ID为空】");
}
LambdaUpdateWrapper<Negative> updateWrapper = new LambdaUpdateWrapper<>();
// 涉及单位
SupDepart depart = departService.getById(negativeDto.getInvolveDepartId());
if (DepartLevelEnum.SECOND.getValue().equals(depart.getLevel())) {
updateWrapper.set(Negative::getSecondInvolveDepartId, depart.getId())
.set(Negative::getThreeInvolveDepartId, null);
} else if (DepartLevelEnum.THREE.getValue().equals(depart.getLevel())) {
updateWrapper.set(Negative::getSecondInvolveDepartId, depart.getPid())
.set(Negative::getThreeInvolveDepartId, depart.getId());
} else {
throw new RuntimeException("涉及单位请选择二级或三级单位");
}
updateWrapper.eq(Negative::getId, negativeDto.getId())
.set(Negative::getProblemSources, negativeDto.getProblemSources())
.set(Negative::getProblemSourcesCode, negativeDto.getProblemSourcesCode())
@ -213,12 +231,28 @@ public class NegativeController {
return Result.success(completionVo);
}
private final NegativeScoreService negativeScoreService;
@PostMapping("score/calculate")
public Result<Void> calculateScore() {
negativeScoreService.updateNegativeScore();
return Result.success();
}
private final ApplyCompletionAction applyCompletionAction;
@PostMapping("{id}/spotCheck")
@Transactional(rollbackFor = Exception.class)
public Result<Void> spotCheck(@PathVariable String id, @RequestBody NegativeSpotCheckDto dto) {
LambdaUpdateWrapper<Negative> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(Negative::getId, id)
.set(Negative::getSpotCheckFlag, true)
.set(Negative::getSpotCheckResult, dto.getSpotCheckResult())
.set(Negative::getSpotCheckDesc, dto.getSpotCheckDesc());
negativeService.update(updateWrapper);
if (Objects.nonNull(dto.getVerifyData())) {
Negative negative = negativeService.getById(id);
applyCompletionAction.updateNegative(negative, dto.getVerifyData());
}
return Result.success();
}
}

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

@ -62,6 +62,7 @@ public class ApplyCompletionAction implements Action {
LambdaUpdateWrapper<Negative> updateWrapper = new LambdaUpdateWrapper<Negative>()
.eq(Negative::getId, actionDto.getNegativeId())
.set(Negative::getProcessingStatus, ProcessingStatusEnum.approval.name())
.set(Negative::getFlowKey, negative.getIsSecondHandle() ? FlowNodeEnum.FIRST_APPROVE.getKey() : FlowNodeEnum.SECOND_APPROVE.getKey())
// 当前处理对象
.set(Negative::getCurrentProcessingObject, negative.getIsSecondHandle() ? "市局专班" : String.format("%s专班", negative.getHandleSecondDepartName()))
@ -75,7 +76,6 @@ public class ApplyCompletionAction implements Action {
LambdaUpdateWrapper<Negative> updateWrapper = new LambdaUpdateWrapper<Negative>()
.eq(Negative::getId, negative.getId())
.set(Negative::getUpdTime, now)
.set(Negative::getProcessingStatus, ProcessingStatusEnum.approval.name())
.set(Negative::getCheckStatus, verifyData.getCheckStatus())
.set(Negative::getCheckStatusDesc, verifyData.getCheckStatusDesc())
.set(Negative::getCheckStatusName, verifyData.getCheckStatusName())
@ -85,7 +85,19 @@ public class ApplyCompletionAction implements Action {
.set(Negative::getCaseNumber, verifyData.getCaseNumber())
.set(Negative::getRectifyDesc, verifyData.getRectifyDesc())
.set(Negative::getInvolveDepartId, verifyData.getInvolveDepartId())
.set(Negative::getUnrectifyReason, verifyData.getUnrectifyReason())
.set(Negative::getInvolveDepartName, departService.getById(verifyData.getInvolveDepartId()).getShortName());
// 涉及单位
SupDepart depart = departService.getById(verifyData.getInvolveDepartId());
if (DepartLevelEnum.SECOND.getValue().equals(depart.getLevel())) {
updateWrapper.set(Negative::getSecondInvolveDepartId, depart.getId())
.set(Negative::getThreeInvolveDepartId, null);
} else if (DepartLevelEnum.THREE.getValue().equals(depart.getLevel())) {
updateWrapper.set(Negative::getSecondInvolveDepartId, depart.getPid())
.set(Negative::getThreeInvolveDepartId, depart.getId());
} else {
throw new RuntimeException("涉及单位请选择二级或三级单位");
}
// 未整改
if (IsRectifyEnum.NOT.getValue().equals(verifyData.getIsRectifyCode())) {
updateWrapper.set(Negative::getRectifyRestrictionDays, verifyData.getRectifyRestrictionDays());

26
src/main/java/com/biutag/supervision/flow/action/SaveAction.java

@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.biutag.supervision.constants.enums.DepartLevelEnum;
import com.biutag.supervision.constants.enums.InspectCaseEnum;
import com.biutag.supervision.constants.enums.IsRectifyEnum;
import com.biutag.supervision.pojo.dto.ActionDto;
@ -45,14 +46,31 @@ public class SaveAction implements Action {
}
public void updateNegative(String negativeId, VerifyData verifyData) {
if (StrUtil.isBlank(verifyData.getInvolveDepartId())) {
throw new RuntimeException("涉及单位不能为空!");
}
LambdaUpdateWrapper<Negative> updateWrapper = new LambdaUpdateWrapper<Negative>()
.eq(Negative::getId, negativeId)
.set(Negative::getUpdTime, LocalDateTime.now())
.set(Negative::getCheckStatusDesc, verifyData.getCheckStatusDesc())
.set(Negative::getCaseNumber, verifyData.getCaseNumber())
.set(Negative::getCheckStatus, verifyData.getCheckStatus())
.set(Negative::getCheckStatusDesc, verifyData.getCheckStatusDesc())
.set(Negative::getRectifyDesc, verifyData.getRectifyDesc())
.set(Negative::getUnrectifyReason, verifyData.getUnrectifyReason())
.set(Negative::getCheckStatusName, verifyData.getCheckStatusName());
// 涉及单位
SupDepart depart = departService.getById(verifyData.getInvolveDepartId());
updateWrapper.set(Negative::getInvolveDepartId, verifyData.getInvolveDepartId())
.set(Negative::getInvolveDepartName, depart.getShortName());
if (DepartLevelEnum.SECOND.getValue().equals(depart.getLevel())) {
updateWrapper.set(Negative::getSecondInvolveDepartId, depart.getId())
.set(Negative::getThreeInvolveDepartId, null);
} else if (DepartLevelEnum.THREE.getValue().equals(depart.getLevel())) {
updateWrapper.set(Negative::getSecondInvolveDepartId, depart.getPid())
.set(Negative::getThreeInvolveDepartId, depart.getId());
} else {
throw new RuntimeException("涉及单位请选择二级或三级单位");
}
// 核查情况是否属实
if (InspectCaseEnum.isItTure(verifyData.getCheckStatus())) {
updateWrapper.set(Negative::getIsRectifyCode, verifyData.getIsRectifyCode())
@ -63,12 +81,8 @@ public class SaveAction implements Action {
updateWrapper.set(Negative::getRectifyRestrictionDays, verifyData.getRectifyRestrictionDays());
}
}
if (StrUtil.isNotBlank(verifyData.getInvolveDepartId())) {
SupDepart depart = departService.getById(verifyData.getInvolveDepartId());
updateWrapper.set(Negative::getInvolveDepartId, verifyData.getInvolveDepartId())
.set(Negative::getInvolveDepartName, depart.getShortName());
}
negativeService.update(updateWrapper);
/**
* 如果涉及不为空则先删除原有数据再新增
*/

10
src/main/java/com/biutag/supervision/flow/action/SecondLocalProcessingAction.java

@ -1,6 +1,7 @@
package com.biutag.supervision.flow.action;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.biutag.supervision.constants.enums.HostLevelEnums;
import com.biutag.supervision.constants.enums.ProcessingStatusEnum;
import com.biutag.supervision.pojo.dto.ActionDto;
import com.biutag.supervision.pojo.entity.Negative;
@ -22,12 +23,17 @@ public class SecondLocalProcessingAction implements Action {
}
public void updateNegative(ActionDto actionDto) {
negativeService.update(new LambdaUpdateWrapper<Negative>()
LambdaUpdateWrapper<Negative> updateWrapper = new LambdaUpdateWrapper<Negative>()
.set(Negative::getFlowKey, actionDto.getNextFlowKey())
.set(Negative::getIsSecondHandle, true)
.set(Negative::getProcessingStatus, ProcessingStatusEnum.processing.name())
.set(Negative::getUpdTime, LocalDateTime.now())
.eq(Negative::getId, actionDto.getNegativeId()));
.eq(Negative::getId, actionDto.getNegativeId());
Negative negative = negativeService.getById(actionDto.getNegativeId());
if (HostLevelEnums.THREE.getValue().equals(negative.getHostLevel())) {
updateWrapper.set(Negative::getHostLevel, HostLevelEnums.SECOND.getValue());
}
negativeService.update();
}
}

7
src/main/java/com/biutag/supervision/mapper/NegativeFileMapper.java

@ -2,7 +2,14 @@ package com.biutag.supervision.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.biutag.supervision.pojo.entity.NegativeFile;
import com.biutag.supervision.pojo.vo.NegativeFileVo;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface NegativeFileMapper extends BaseMapper<NegativeFile> {
@Select("select f.*, c.class_title file_class_title from negative_file f left join file_class c on f.file_class_id = c.id where f.negtiveId = #{negativeId}")
List<NegativeFileVo> selectList(String negativeId);
}

3
src/main/java/com/biutag/supervision/pojo/domain/NegativeVo.java

@ -5,6 +5,7 @@ import com.biutag.supervision.pojo.entity.FileClass;
import com.biutag.supervision.pojo.entity.NegativeFile;
import com.biutag.supervision.pojo.entity.NegativeScorePolice;
import com.biutag.supervision.pojo.entity.NegativeThingFile;
import com.biutag.supervision.pojo.vo.NegativeFileVo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
@ -198,7 +199,7 @@ public class NegativeVo {
private List<VerifyData.BlameLeader> blameLeaders = new ArrayList<>();
// 办结佐证材料
private List<NegativeFile> files = new ArrayList<>();
private List<NegativeFileVo> files = new ArrayList<>();
private List<NegativeThingFile> thingFiles = new ArrayList<>();

21
src/main/java/com/biutag/supervision/pojo/dto/NegativeSpotCheckDto.java

@ -0,0 +1,21 @@
package com.biutag.supervision.pojo.dto;
import com.biutag.supervision.pojo.dto.flow.VerifyData;
import lombok.Getter;
import lombok.Setter;
/**
* @author wxc
* @date 2024/12/19
*/
@Setter
@Getter
public class NegativeSpotCheckDto {
private String spotCheckResult;
private String spotCheckDesc;
private VerifyData verifyData;
}

3
src/main/java/com/biutag/supervision/pojo/dto/flow/VerifyData.java

@ -51,6 +51,9 @@ public class VerifyData {
// 问题整改情况
private String rectifyDesc;
// 未整改原因
private String unrectifyReason;
@Size(min = 1)
private List<Blame> blames = new ArrayList<>();

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

@ -279,4 +279,22 @@ public class Negative {
// 市局下发意见
private String firstDistributeComments;
// 是否抽检
private Boolean spotCheckFlag;
// 抽检结果
private String spotCheckResult;
// 抽检情况
private String spotCheckDesc;
// 未整改原因
private String unrectifyReason;
// 二级部门
private String secondInvolveDepartId;
// 三级部门
private String threeInvolveDepartId;
}

1
src/main/java/com/biutag/supervision/pojo/entity/NegativeFile.java

@ -1,6 +1,5 @@
package com.biutag.supervision.pojo.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Getter;

38
src/main/java/com/biutag/supervision/pojo/vo/NegativeFileVo.java

@ -0,0 +1,38 @@
package com.biutag.supervision.pojo.vo;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
/**
* @author wxc
* @date 2024/12/20
*/
@Setter
@Getter
public class NegativeFileVo {
private String id;
private String fileId;
private String filePath;
private String negtiveId;
private String type;
private LocalDateTime crtTime;
private String crtUser;
private String fileName;
private String status;
private Integer fileClassId;
private String fileClassTitle;
}

4
src/main/java/com/biutag/supervision/service/FileService.java

@ -3,19 +3,15 @@ package com.biutag.supervision.service;
import cn.hutool.core.io.FileUtil;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.vo.FileVo;
import com.github.tobato.fastdfs.domain.fdfs.StorePath;
import com.github.tobato.fastdfs.service.FastFileStorageClient;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@RequiredArgsConstructor
@Service

5
src/main/java/com/biutag/supervision/service/NegativeFileService.java

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.supervision.pojo.entity.NegativeFile;
import com.biutag.supervision.mapper.NegativeFileMapper;
import com.biutag.supervision.pojo.vo.FileVo;
import com.biutag.supervision.pojo.vo.NegativeFileVo;
import org.springframework.stereotype.Service;
import java.util.List;
@ -13,8 +14,8 @@ import java.util.List;
@Service
public class NegativeFileService extends ServiceImpl<NegativeFileMapper, NegativeFile> {
public List<NegativeFile> list(String negativeId) {
return list(new LambdaQueryWrapper<NegativeFile>().eq(NegativeFile::getNegtiveId, negativeId));
public List<NegativeFileVo> list(String negativeId) {
return baseMapper.selectList(negativeId);
}
public boolean remove(String negativeId) {

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

@ -26,6 +26,7 @@ import com.biutag.supervision.pojo.dto.flow.VerifyData;
import com.biutag.supervision.pojo.dto.jwdc.NegativeApiDto;
import com.biutag.supervision.pojo.entity.*;
import com.biutag.supervision.pojo.model.UserAuth;
import com.biutag.supervision.pojo.vo.NegativeFileVo;
import com.biutag.supervision.util.SpringUtil;
import com.biutag.supervision.util.TimeUtil;
import lombok.RequiredArgsConstructor;
@ -80,7 +81,7 @@ public class NegativeService extends ServiceImpl<NegativeMapper, Negative> {
Negative negative = getById(id);
List<NegativeHistory> flows = negativeHistoryService.listByNegativeId(id);
AtomicReference<String> flowKey = new AtomicReference<>(negative.getFlowKey());
List<NegativeFile> files = fileService.list(id);
List<NegativeFileVo> files = fileService.list(id);
List<NegativeThingFile> thingFiles = thingFileService.list(id);
if (Objects.nonNull(workId)) {
Optional.ofNullable(workService.getById(workId)).map(NegativeWork::getFlowKey).filter(StrUtil::isNotBlank).ifPresent(flowKey::set);
@ -164,26 +165,6 @@ public class NegativeService extends ServiceImpl<NegativeMapper, Negative> {
return getOne(new LambdaUpdateWrapper<Negative>().eq(Negative::getOriginId, originId));
}
public boolean saveNegative(NegativeDto negativeDto) {
Negative negative = new Negative();
BeanUtil.copyProperties(negativeDto, negative);
if (StrUtil.isBlank(negativeDto.getOriginId())) {
String originId = generateOriginId(negativeDto.getProblemSourcesCode(), negativeDto.getBusinessTypeCode());
negative.setOriginId(originId); // 如果是空就生成随机的线索源
}
LocalDateTime now = LocalDateTime.now();
negative.setId(IdUtil.getSnowflakeNextIdStr()) // negative唯一标识 雪花
.setProcessingStatus(ProcessingStatusEnum.completed.name())
.setFlowKey(FlowNodeEnum.COMPLETED.getKey()) // 市局下发
.setCrtDepartLevel(DepartLevelEnum.FIRST.getValue())
.setCrtTime(now)
.setUpdTime(now);
if (CollectionUtil.isNotEmpty(negativeDto.getInvolveProblem())) {
negative.setInvolveProblem(String.join(",", negativeDto.getInvolveProblem()));
}
return save(negative);
}
@Transactional(rollbackFor = Exception.class)
public Negative save(NegativeDto negativeDto) {
Negative negative = new Negative();
@ -192,6 +173,16 @@ public class NegativeService extends ServiceImpl<NegativeMapper, Negative> {
String originId = generateOriginId(negativeDto.getProblemSourcesCode(), negativeDto.getBusinessTypeCode());
negative.setOriginId(originId); // 如果是空就生成随机的线索源
}
// 涉及单位
SupDepart depart = departService.getById(negative.getInvolveDepartId());
if (DepartLevelEnum.SECOND.getValue().equals(depart.getLevel())) {
negative.setSecondInvolveDepartId(depart.getId());
} else if (DepartLevelEnum.THREE.getValue().equals(depart.getLevel())) {
negative.setThreeInvolveDepartId(depart.getId());
negative.setSecondInvolveDepartId(depart.getPid());
} else {
throw new RuntimeException("涉及单位请选择二级或三级单位");
}
LocalDateTime now = LocalDateTime.now();
UserAuth user = UserContextHolder.getCurrentUser();
boolean secondFlag = user.getRoleCodes().contains(RoleCodeEnum.SECOND_ADMIN.getCode());
@ -308,6 +299,13 @@ public class NegativeService extends ServiceImpl<NegativeMapper, Negative> {
departId = dept.getId();
departName = dept.getShortName();
roleCode = RoleCodeEnum.THREE_ADMIN.getCode();
// 涉及单位
if (DepartLevelEnum.SECOND.getValue().equals(dept.getLevel())) {
negative.setSecondInvolveDepartId(dept.getId());
} else if (DepartLevelEnum.THREE.getValue().equals(dept.getLevel())) {
negative.setThreeInvolveDepartId(dept.getId());
negative.setSecondInvolveDepartId(dept.getPid());
}
} else {
log.error("未匹配上单位:{}, code: {}", item.getDepartName(), item.getDepartCode());
departId = AppConstants.ROOT_DEPART_ID;

1
src/main/java/com/biutag/supervision/service/UserLoginService.java

@ -43,4 +43,5 @@ public class UserLoginService {
.setAuthDepartIds(departAuthorities.stream().map(NegDepartAuthority::getDepartId).toList());
return userAuth;
}
}

Loading…
Cancel
Save