diff --git a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/param/LoadTypeUserIUploadParam.java b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/param/LoadTypeUserIUploadParam.java index b930bbf5b..88a05e947 100644 --- a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/param/LoadTypeUserIUploadParam.java +++ b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/param/LoadTypeUserIUploadParam.java @@ -34,11 +34,9 @@ public class LoadTypeUserIUploadParam { private Integer iIsOverLimit; @ApiModelProperty(name = "iOverLimitTarget",value = "入网超标指标",required = true) - @NotBlank(message = "入网超标指标不可为空") private String iOverLimitTarget; @ApiModelProperty(name = "iPlanStep",value = "入网计划采取措施",required = true) - @NotBlank(message = "入网计划采取措施不可为空") private String iPlanStep; @ApiModelProperty(name = "iDescription",value = "入网详情") diff --git a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/RLoadTypeUserManage.java b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/RLoadTypeUserManage.java index 8f6176fb7..502a3d9fd 100644 --- a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/RLoadTypeUserManage.java +++ b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/RLoadTypeUserManage.java @@ -1,9 +1,18 @@ package com.njcn.process.pojo.po; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; import lombok.Data; import java.io.Serializable; +import java.time.LocalDateTime; import java.util.Date; /** @@ -19,6 +28,7 @@ public class RLoadTypeUserManage implements Serializable { /** * 主键 */ + @TableId private String id; /** * 单位ID @@ -63,7 +73,7 @@ public class RLoadTypeUserManage implements Serializable { /** * 入网报告状态,字典ID */ - private String iStatus; + private Integer iStatus; /** *入网报告审核人 */ @@ -108,7 +118,7 @@ public class RLoadTypeUserManage implements Serializable { /** * 实测报告状态,字典ID */ - private String aStatus; + private Integer aStatus; /** *实测报告审核人 */ @@ -146,6 +156,15 @@ public class RLoadTypeUserManage implements Serializable { */ private String aDescription; + @TableField(fill = FieldFill.INSERT) + private String createBy; + + @TableField(fill = FieldFill.INSERT) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonDeserialize(using = LocalDateTimeDeserializer.class) + @JsonSerialize(using = LocalDateTimeSerializer.class) + private LocalDateTime createTime; + } diff --git a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/vo/RLoadTypeUserManageVO.java b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/vo/RLoadTypeUserManageVO.java index ca5c9f043..32234781e 100644 --- a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/vo/RLoadTypeUserManageVO.java +++ b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/vo/RLoadTypeUserManageVO.java @@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; +import java.time.LocalDateTime; import java.util.Date; /** @@ -74,7 +75,18 @@ public class RLoadTypeUserManageVO implements Serializable { * 入网报告状态,字典ID */ @ApiModelProperty("入网报告状态,字典ID") - private String iStatus; + private Integer iStatus; + + /** + *入网报告审核人 + */ + private String iCheckPerson; + + private String iCheckPersonName; + /** + *入网报告审核意见 + */ + private String iCheckComment; /** * 入网报告路径 */ @@ -119,7 +131,7 @@ public class RLoadTypeUserManageVO implements Serializable { * 实测报告状态,字典ID */ @ApiModelProperty("实测报告状态,字典ID") - private String aStatus; + private Integer aStatus; /** * 实测报告路径 */ @@ -130,6 +142,18 @@ public class RLoadTypeUserManageVO implements Serializable { */ @ApiModelProperty("实测报告名称") private String aFilePathName; + + + /** + *实测报告审核人 + */ + private String aCheckPerson; + + private String aCheckPersonName; + /** + *实测报告审核意见 + */ + private String aCheckComment; /** * 实测报告上传时间 */ @@ -165,5 +189,13 @@ public class RLoadTypeUserManageVO implements Serializable { @ApiModelProperty("实测报告文件地址") private String aFile; + + + private String createBy; + + private String createByName; + + private LocalDateTime createTime; + } diff --git a/pqs-process/process-boot/src/main/java/com/njcn/process/controller/LoadTypeUserManageController.java b/pqs-process/process-boot/src/main/java/com/njcn/process/controller/LoadTypeUserManageController.java index 60b8448ca..9781c2451 100644 --- a/pqs-process/process-boot/src/main/java/com/njcn/process/controller/LoadTypeUserManageController.java +++ b/pqs-process/process-boot/src/main/java/com/njcn/process/controller/LoadTypeUserManageController.java @@ -117,7 +117,7 @@ public class LoadTypeUserManageController extends BaseController { * @author qijian * @date 2022/11/14 */ - @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType= OperateType.UPDATE) + @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/uploadLoadTypeUserI") @ApiOperation("上传干扰源用户入网报告(未建档干扰源用户管理)") public HttpResult uploadLoadTypeUserI(@Validated LoadTypeUserIUploadParam loadTypeUserIUploadParam){ @@ -234,4 +234,19 @@ public class LoadTypeUserManageController extends BaseController { PoiUtil.exportFileByWorkbook(workbook, fileName, response); return null; } + + /** + * 删除新增干扰源用户计划 + * @author cdf + * @date 2024/4/9 + */ + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @ApiOperation("删除新增干扰源用户计划") + @PostMapping(value = "delLoadTypeUserPlan") + @ApiImplicitParam(name = "list", value = "主键参数集合", required = true) + public HttpResultdelLoadTypeUserPlan(@RequestBody List list) { + String methodDescribe = getMethodDescribe("delLoadTypeUserPlan"); + loadTypeUserManageService.delLoadTypeUserPlan(list); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } } diff --git a/pqs-process/process-boot/src/main/java/com/njcn/process/service/LoadTypeUserManageService.java b/pqs-process/process-boot/src/main/java/com/njcn/process/service/LoadTypeUserManageService.java index 43edc2ff5..b77a761e9 100644 --- a/pqs-process/process-boot/src/main/java/com/njcn/process/service/LoadTypeUserManageService.java +++ b/pqs-process/process-boot/src/main/java/com/njcn/process/service/LoadTypeUserManageService.java @@ -79,20 +79,29 @@ public interface LoadTypeUserManageService { * @return */ List exportLoadTypeRelationList(List list); - /** + /** * @Description: 入网评估报告审核 - * @Param: [loadTypeUserCheckParam] - * @return: java.lang.Boolean + * @Param: [loadTypeUserCheckParam] + * @return: java.lang.Boolean * @Author: clam - * @Date: 2023/2/22 - */ + * @Date: 2023/2/22 + */ Boolean checkLoadTypeUserI(LoadTypeUserCheckParam loadTypeUserCheckParam); - /** + /** * @Description: 实测报告审核 - * @Param: [loadTypeUserCheckParam] - * @return: java.lang.Boolean + * @Param: [loadTypeUserCheckParam] + * @return: java.lang.Boolean * @Author: clam - * @Date: 2023/2/22 - */ + * @Date: 2023/2/22 + */ Boolean checkLoadTypeUserA(LoadTypeUserCheckParam loadTypeUserCheckParam); + + + /** + * + * @author cdf + * @date 2024/4/9 + */ + Boolean delLoadTypeUserPlan(List ids); + } diff --git a/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/LoadTypeUserManageServiceImpl.java b/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/LoadTypeUserManageServiceImpl.java index cef5a411f..796084021 100644 --- a/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/LoadTypeUserManageServiceImpl.java +++ b/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/LoadTypeUserManageServiceImpl.java @@ -1,11 +1,14 @@ package com.njcn.process.service.impl; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.lang.UUID; 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.update.UpdateWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.njcn.common.config.GeneralInfo; import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.exception.BusinessException; @@ -14,6 +17,7 @@ import com.njcn.oss.constant.OssPath; import com.njcn.device.pms.api.DistributionMonitorClient; import com.njcn.oss.utils.FileStorageUtil; import com.njcn.process.constant.Param; +import com.njcn.process.enums.AuditProcessEnum; import com.njcn.process.mapper.FlowFormAssMapper; import com.njcn.process.mapper.FlowableAssMapper; import com.njcn.process.mapper.LoadTypeUserManageMapper; @@ -34,8 +38,11 @@ import com.njcn.system.enums.DicDataEnum; import com.njcn.system.enums.DicDataTypeEnum; import com.njcn.system.pojo.po.DictData; import com.njcn.user.api.DeptFeignClient; +import com.njcn.user.api.UserFeignClient; import com.njcn.user.pojo.dto.DeptDTO; +import com.njcn.user.pojo.dto.UserDTO; import com.njcn.user.pojo.po.Dept; +import com.njcn.user.pojo.po.User; import com.njcn.user.pojo.vo.PvTerminalTreeVO; import com.njcn.web.utils.RequestUtil; import com.njcn.web.utils.WebUtil; @@ -51,6 +58,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; /** @@ -63,12 +71,14 @@ import java.util.stream.Collectors; @Service @RequiredArgsConstructor @Slf4j -public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService { +public class LoadTypeUserManageServiceImpl extends ServiceImpl implements LoadTypeUserManageService { private final LoadTypeUserManageMapper loadTypeUserManageMapper; private final DicDataFeignClient dicDataFeignClient; private final DeptFeignClient deptFeignClient; + private final UserFeignClient userFeignClient; + private final FileStorageUtil fileStorageUtil; private final FlowFormAssMapper flowFormAssMapper; @@ -100,12 +110,40 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService } //干扰源用户信息录入 Page loadTypeUserPage = loadTypeUserManageMapper.getLoadTypeUserPage(page, loadTypeUserSearchParam,ids,aStatus); + + //查询审核,创建用户信息 + List personList = new ArrayList<>(); + loadTypeUserPage.getRecords().forEach(it->{ + if(StrUtil.isNotBlank(it.getACheckPerson())){ + personList.add(it.getACheckPerson()); + } + if(StrUtil.isNotBlank(it.getACheckPerson())){ + personList.add(it.getICheckPerson()); + } + if(StrUtil.isNotBlank(it.getCreateBy())){ + personList.add(it.getCreateBy()); + } + }); + Map userMap = new HashMap<>(); + if(CollectionUtil.isNotEmpty(personList)){ + List userList = userFeignClient.getUserByIdList(personList.stream().distinct().collect(Collectors.toList())).getData(); + userMap = userList.stream().collect(Collectors.toMap(User::getId, Function.identity())); + } List dept = deptFeignClient.allDeptList().getData(); Map pvTerminalTreeVOMap = dept.stream().collect(Collectors.toMap(PvTerminalTreeVO::getId, pvTerminalTreeVO -> pvTerminalTreeVO)); //部门处理:根据部门code取名称 - loadTypeUserPage.getRecords().stream().forEach(item -> { - item.setOrgName(pvTerminalTreeVOMap.get(item.getOrgNo()).getName()); //单位名称 - }); + for(RLoadTypeUserManageVO rLoadTypeUserManageVO : loadTypeUserPage.getRecords()){ + if(StrUtil.isNotBlank(rLoadTypeUserManageVO.getACheckPerson())){ + rLoadTypeUserManageVO.setACheckPersonName(userMap.get(rLoadTypeUserManageVO.getACheckPerson()).getName()); + } + if(StrUtil.isNotBlank(rLoadTypeUserManageVO.getICheckPersonName())){ + rLoadTypeUserManageVO.setICheckPersonName(userMap.get(rLoadTypeUserManageVO.getICheckPersonName()).getName()); + } + if(StrUtil.isNotBlank(rLoadTypeUserManageVO.getCreateBy())){ + rLoadTypeUserManageVO.setCreateByName(userMap.get(rLoadTypeUserManageVO.getCreateBy()).getName()); + } + rLoadTypeUserManageVO.setOrgName(pvTerminalTreeVOMap.get(rLoadTypeUserManageVO.getOrgNo()).getName()); //单位名称 + } //返回新的数据组 return loadTypeUserPage; } @@ -149,15 +187,11 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService //塞入建档时间 Date date = DateUtil.parse(loadTypeUserParam.getRecordTime(), "yyyy-MM-dd HH:mm:ss"); rLoadTypeUserManage.setRecordTime(date); - //获取部门信息 - Dept data = deptFeignClient.getDeptById (loadTypeUserParam.getOrgNo()).getData(); - rLoadTypeUserManage.setICheckPerson(data.getPid()); - rLoadTypeUserManage.setACheckPerson(data.getPid()); + rLoadTypeUserManage.setIStatus(AuditProcessEnum.New.getStatus()); rLoadTypeUserManage.setId(IdUtil.simpleUUID()); loadTypeUserManageMapper.insert(rLoadTypeUserManage); //绑定工作流 - //开始流程 FlowFormAss flowFormAss = flowFormAssMapper.selectOne(new LambdaQueryWrapper().eq(FlowFormAss::getFormId, 2)); if (Objects.isNull(flowFormAss)) { @@ -195,25 +229,8 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService rLoadTypeUserManage.setIFilePathName(multipartFile.getOriginalFilename()); rLoadTypeUserManage.setIUploadTime(new Date()); } - - //提交:待审核/保存:新建 - String dictData; - if (Objects.equals(Param.LOAD_TYPE_USER_SUBMIT, loadTypeUserIUploadParam.getStatus())) { - dictData = dicDataFeignClient.getDicDataByCode(DicDataEnum.AUDIT.getCode()).getData().getId(); - rLoadTypeUserManage.setICheckPerson(""); - rLoadTypeUserManage.setICheckComment(""); - } else { - //是否是未通过,未通过则不修改状态 - if(aBoolean){ - dictData=null; - }else{ - dictData = dicDataFeignClient.getDicDataByCode(DicDataEnum.NEWLY.getCode()).getData().getId(); - } - } - rLoadTypeUserManage.setIStatus(dictData); rLoadTypeUserManage.setIIsFileUpload(rLoadTypeUserManage.getIFilePath()!=null?1:0); loadTypeUserManageMapper.updateById(rLoadTypeUserManage); - return true; } @@ -290,7 +307,7 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService } //提交:待审核/保存:新建 - DictData dictData; + /* DictData dictData; if (Objects.equals(Param.LOAD_TYPE_USER_SUBMIT, loadTypeUserAUploadParam.getStatus())) { dictData = dicDataFeignClient.getDicDataByCode(DicDataEnum.AUDIT.getCode()).getData(); } else { @@ -303,7 +320,7 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService } if(!aBoolean){ rLoadTypeUserManage.setAStatus(dictData.getId()); - } + }*/ rLoadTypeUserManage.setAIsFileUpload(rLoadTypeUserManage.getAFilePath()!=null?1:0); loadTypeUserManageMapper.updateById(rLoadTypeUserManage); return true; @@ -461,6 +478,26 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService return result; } + @Override + public Boolean delLoadTypeUserPlan(List ids) { + List rLoadTypeUserManageList = this.lambdaQuery().in(RLoadTypeUserManage::getId,ids).list(); + long count = rLoadTypeUserManageList.stream().map(RLoadTypeUserManage::getIStatus).filter(item-> Objects.equals(item, AuditProcessEnum.WaitAudit.getStatus())||Objects.equals(item, AuditProcessEnum.Release.getStatus())).count(); + if(count>0){ + throw new BusinessException("非新建驳回状态条目无法删除"); + } + this.removeByIds(ids); + //删除同时删除报告 + for(RLoadTypeUserManage rLoadTypeUserManage : rLoadTypeUserManageList){ + if(Objects.equals(rLoadTypeUserManage.getAIsFileUpload(),1)){ + fileStorageUtil.getFileUrl(rLoadTypeUserManage.getIFilePath()); + } + if(Objects.equals(rLoadTypeUserManage.getAIsFileUpload(),1)){ + fileStorageUtil.getFileUrl(rLoadTypeUserManage.getAFilePath()); + } + } + return true; + } + /** * @Description: 干扰源用户报告状态,待审核无法修改信息 * @param id @@ -469,37 +506,21 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService * @Date: 2024/1/30 10:44 */ private Boolean checkStatus(String id,Integer type){ - Boolean fly=false; RLoadTypeUserManage rLoadTypeUserManage = loadTypeUserManageMapper.selectById(id); if(type==0){ //入网评估 - DictData audit = dicDataFeignClient.getDicDataByCode(DicDataEnum.AUDIT.getCode()).getData(); - DictData finish = dicDataFeignClient.getDicDataByCode(DicDataEnum.FINISH.getCode()).getData(); - String iStatus = rLoadTypeUserManage.getIStatus(); - if(audit.getId().equals(iStatus)||finish.getId().equals(iStatus)){ + Integer iStatus = rLoadTypeUserManage.getIStatus(); + if(Objects.equals(iStatus, AuditProcessEnum.WaitAudit.getStatus()) ||Objects.equals(iStatus, AuditProcessEnum.Release.getStatus()) ){ throw new BusinessException(CommonResponseEnum.FAIL, "只有新建和未通过状态下,可修改信息"); } - DictData failed = dicDataFeignClient.getDicDataByCode(DicDataEnum.FAILED.getCode()).getData(); - if(failed.getId().equals(iStatus)){ - fly=true; - } - } - - if(type==1){ + }else if(type==1){ //实测评估 - DictData audit = dicDataFeignClient.getDicDataByCode(DicDataEnum.AUDITT.getCode()).getData(); - DictData success = dicDataFeignClient.getDicDataByCode(DicDataEnum.SUCCESS.getCode()).getData(); - String aStatus = rLoadTypeUserManage.getAStatus(); - if(audit.getId().equals(aStatus)||success.getId().equals(aStatus)){ + Integer aStatus = rLoadTypeUserManage.getAStatus(); + if(Objects.equals(aStatus, AuditProcessEnum.WaitAudit.getStatus()) ||Objects.equals(aStatus, AuditProcessEnum.Release.getStatus()) ){ throw new BusinessException(CommonResponseEnum.FAIL, "只有新建和未通过状态下,可修改信息"); } - DictData failed = dicDataFeignClient.getDicDataByCode(DicDataEnum.FAIL.getCode()).getData(); - if(failed.getId().equals(aStatus)){ - fly=true; - } } - return fly; - + return true; }