技术监督管理调整

This commit is contained in:
2023-07-04 16:42:44 +08:00
parent 106e63193d
commit e1347cd944
5 changed files with 105 additions and 59 deletions

View File

@@ -124,6 +124,9 @@ public class SupvProblem extends BaseEntity {
*/ */
private String remark; private String remark;
@TableField(exist = false)
private String attachmentName;
} }

View File

@@ -2,6 +2,7 @@ package com.njcn.process.controller;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
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.njcn.common.pojo.annotation.OperateInfo; import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType; import com.njcn.common.pojo.constant.OperateType;
@@ -11,6 +12,7 @@ import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil; import com.njcn.common.utils.HttpResultUtil;
import com.njcn.process.pojo.param.SupvProblemParam; import com.njcn.process.pojo.param.SupvProblemParam;
import com.njcn.process.pojo.po.SupvFile;
import com.njcn.process.pojo.po.SupvProblem; import com.njcn.process.pojo.po.SupvProblem;
import com.njcn.process.service.ISupvProblemService; import com.njcn.process.service.ISupvProblemService;
import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.api.DicDataFeignClient;
@@ -30,6 +32,7 @@ import com.njcn.web.controller.BaseController;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -52,6 +55,8 @@ public class SupvProblemController extends BaseController {
@PostMapping("addProblem") @PostMapping("addProblem")
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD) @OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
@ApiOperation("新增技术监督问题") @ApiOperation("新增技术监督问题")
@@ -92,7 +97,6 @@ public class SupvProblemController extends BaseController {
throw new BusinessException("监督计划索引不可为空"); throw new BusinessException("监督计划索引不可为空");
} }
Page<SupvProblem> page = iSupvProblemService.pageProblem(supvProblemParam); Page<SupvProblem> page = iSupvProblemService.pageProblem(supvProblemParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
} }
} }

View File

@@ -15,9 +15,11 @@ import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.process.enums.ProcessResponseEnum; import com.njcn.process.enums.ProcessResponseEnum;
import com.njcn.process.mapper.SupvFileMapper; import com.njcn.process.mapper.SupvFileMapper;
import com.njcn.process.mapper.SupvPlanMapper; import com.njcn.process.mapper.SupvPlanMapper;
import com.njcn.process.mapper.SupvProblemMapper;
import com.njcn.process.pojo.param.SupvPlanParam; import com.njcn.process.pojo.param.SupvPlanParam;
import com.njcn.process.pojo.po.SupvFile; import com.njcn.process.pojo.po.SupvFile;
import com.njcn.process.pojo.po.SupvPlan; import com.njcn.process.pojo.po.SupvPlan;
import com.njcn.process.pojo.po.SupvProblem;
import com.njcn.process.pojo.vo.SupvPlanVO; import com.njcn.process.pojo.vo.SupvPlanVO;
import com.njcn.process.service.ISupvFileService; import com.njcn.process.service.ISupvFileService;
import com.njcn.process.service.ISupvPlanService; import com.njcn.process.service.ISupvPlanService;
@@ -45,7 +47,7 @@ import java.util.stream.Collectors;
/** /**
* <p> * <p>
* 服务实现类 * 服务实现类
* </p> * </p>
* *
* @author hongawen * @author hongawen
@@ -63,12 +65,14 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
private final UserFeignClient userFeignClient; private final UserFeignClient userFeignClient;
private final SupvProblemMapper supvProblemMapper;
@Override @Override
public boolean addPlan(SupvPlanParam supvPlanParam) { public boolean addPlan(SupvPlanParam supvPlanParam) {
checkParam(supvPlanParam,false); checkParam(supvPlanParam, false);
SupvPlan supvPlan = new SupvPlan(); SupvPlan supvPlan = new SupvPlan();
BeanUtil.copyProperties(supvPlanParam,supvPlan); BeanUtil.copyProperties(supvPlanParam, supvPlan);
supvPlan.setPlanSupvDate(PubUtils.localDateFormat(supvPlanParam.getPlanSupvDate())); supvPlan.setPlanSupvDate(PubUtils.localDateFormat(supvPlanParam.getPlanSupvDate()));
supvPlan.setEffectEndTime(PubUtils.localDateFormat(supvPlanParam.getEffectEndTime())); supvPlan.setEffectEndTime(PubUtils.localDateFormat(supvPlanParam.getEffectEndTime()));
supvPlan.setEffectStartTime(PubUtils.localDateFormat(supvPlanParam.getEffectStartTime())); supvPlan.setEffectStartTime(PubUtils.localDateFormat(supvPlanParam.getEffectStartTime()));
@@ -82,9 +86,9 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
@Override @Override
public boolean updatePlan(SupvPlanParam supvPlanParam) { public boolean updatePlan(SupvPlanParam supvPlanParam) {
checkParam(supvPlanParam,true); checkParam(supvPlanParam, true);
SupvPlan supvPlan = new SupvPlan(); SupvPlan supvPlan = new SupvPlan();
BeanUtil.copyProperties(supvPlanParam,supvPlan); BeanUtil.copyProperties(supvPlanParam, supvPlan);
supvPlan.setPlanSupvDate(PubUtils.localDateFormat(supvPlanParam.getPlanSupvDate())); supvPlan.setPlanSupvDate(PubUtils.localDateFormat(supvPlanParam.getPlanSupvDate()));
supvPlan.setEffectEndTime(PubUtils.localDateFormat(supvPlanParam.getEffectEndTime())); supvPlan.setEffectEndTime(PubUtils.localDateFormat(supvPlanParam.getEffectEndTime()));
supvPlan.setEffectStartTime(PubUtils.localDateFormat(supvPlanParam.getEffectStartTime())); supvPlan.setEffectStartTime(PubUtils.localDateFormat(supvPlanParam.getEffectStartTime()));
@@ -97,53 +101,68 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
@Override @Override
public boolean delPlan(List<String> planIds) { public boolean delPlan(List<String> planIds) {
LambdaQueryWrapper<SupvPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SupvPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SupvPlan::getIsUploadHead,1).eq(SupvPlan::getPlanId,planIds); lambdaQueryWrapper.eq(SupvPlan::getIsUploadHead, 1).eq(SupvPlan::getPlanId, planIds);
int count = this.count(lambdaQueryWrapper); int count = this.count(lambdaQueryWrapper);
if(count > 0){ if (count > 0) {
throw new BusinessException("请选择未上送国网的删除"); throw new BusinessException("请选择未上送国网的删除");
} }
return this.removeByIds(planIds); this.removeByIds(planIds);
//删除问题
LambdaQueryWrapper<SupvProblem> supvProblemLambdaQueryWrapper = new LambdaQueryWrapper<>();
supvProblemLambdaQueryWrapper.in(SupvProblem::getPlanId, planIds);
List<SupvProblem> supvProblemList = this.supvProblemMapper.selectList(supvProblemLambdaQueryWrapper);
this.supvProblemMapper.delete(supvProblemLambdaQueryWrapper);
List<String> busIds = supvProblemList.stream().map(SupvProblem::getProblemId).collect(Collectors.toList());
if (CollUtil.isNotEmpty(busIds)) {
LambdaQueryWrapper<SupvFile> fileLambdaQueryWrapper = new LambdaQueryWrapper<>();
fileLambdaQueryWrapper.in(SupvFile::getBusiId, busIds);
supvFileMapper.delete(fileLambdaQueryWrapper);
}
return true;
} }
@Override @Override
public Page<SupvPlanVO> pagePlan(SupvPlanParam supvPlanParam) { public Page<SupvPlanVO> pagePlan(SupvPlanParam supvPlanParam) {
LambdaQueryWrapper<SupvPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SupvPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if(StrUtil.isNotBlank(supvPlanParam.getSupvOrgId())){ if (StrUtil.isNotBlank(supvPlanParam.getSupvOrgId())) {
List<String> deptIds = deptFeignClient.getDepSonSelfCodetByCode(supvPlanParam.getSupvOrgId()).getData(); List<String> deptIds = deptFeignClient.getDepSonSelfCodetByCode(supvPlanParam.getSupvOrgId()).getData();
lambdaQueryWrapper.in(SupvPlan::getSupvOrgId,deptIds).between(SupvPlan::getPlanSupvDate,supvPlanParam.getSearchBeginTime(),supvPlanParam.getSearchEndTime()); lambdaQueryWrapper.in(SupvPlan::getSupvOrgId, deptIds).between(SupvPlan::getPlanSupvDate, supvPlanParam.getSearchBeginTime(), supvPlanParam.getSearchEndTime());
} }
List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData(); List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData();
Map<String,PvTerminalTreeVO> mapCode = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getCode, Function.identity())); Map<String, PvTerminalTreeVO> mapCode = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getCode, Function.identity()));
Map<String,PvTerminalTreeVO> mapList = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getId, Function.identity())); Map<String, PvTerminalTreeVO> mapList = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getId, Function.identity()));
Page<SupvPlan> page = this.page(new Page<>(PageFactory.getPageNum(supvPlanParam), PageFactory.getPageSize(supvPlanParam)),lambdaQueryWrapper); Page<SupvPlan> page = this.page(new Page<>(PageFactory.getPageNum(supvPlanParam), PageFactory.getPageSize(supvPlanParam)), lambdaQueryWrapper);
List<SupvPlanVO> supvPlanVOList = BeanUtil.copyToList(page.getRecords(),SupvPlanVO.class); List<SupvPlanVO> supvPlanVOList = BeanUtil.copyToList(page.getRecords(), SupvPlanVO.class);
List<String> userIds = supvPlanVOList.stream().map(SupvPlanVO::getCreateBy).distinct().collect(Collectors.toList()); List<String> userIds = supvPlanVOList.stream().map(SupvPlanVO::getCreateBy).distinct().collect(Collectors.toList());
supvPlanVOList.forEach(item->{ supvPlanVOList.forEach(item -> {
PvTerminalTreeVO pvTerminalTreeVO = null; PvTerminalTreeVO pvTerminalTreeVO = null;
if(mapCode.containsKey(item.getSupvOrgId())) { if (mapCode.containsKey(item.getSupvOrgId())) {
pvTerminalTreeVO = mapCode.get(item.getSupvOrgId()); pvTerminalTreeVO = mapCode.get(item.getSupvOrgId());
item.setSupvOrgName(pvTerminalTreeVO.getName()); item.setSupvOrgName(pvTerminalTreeVO.getName());
int deptLevel = pvTerminalTreeVO.getPids().split(StrUtil.COMMA).length; int deptLevel = pvTerminalTreeVO.getPids().split(StrUtil.COMMA).length;
if(deptLevel == 2){ if (deptLevel == 2) {
//省 //省
item.setProvince(pvTerminalTreeVO.getName()); item.setProvince(pvTerminalTreeVO.getName());
}else if(deptLevel == 3){ } else if (deptLevel == 3) {
//市 //市
item.setCity(pvTerminalTreeVO.getName()); item.setCity(pvTerminalTreeVO.getName());
if(mapList.containsKey(pvTerminalTreeVO.getPid())) { if (mapList.containsKey(pvTerminalTreeVO.getPid())) {
PvTerminalTreeVO pvTerminalTreeOne = mapList.get(pvTerminalTreeVO.getPid()); PvTerminalTreeVO pvTerminalTreeOne = mapList.get(pvTerminalTreeVO.getPid());
item.setProvince(pvTerminalTreeOne.getName()); item.setProvince(pvTerminalTreeOne.getName());
} }
}else if(deptLevel == 4){ } else if (deptLevel == 4) {
//县 //县
if(mapList.containsKey(pvTerminalTreeVO.getPid())) { if (mapList.containsKey(pvTerminalTreeVO.getPid())) {
item.setCounty(pvTerminalTreeVO.getName()); item.setCounty(pvTerminalTreeVO.getName());
PvTerminalTreeVO pvTerminalTreeOne = mapList.get(pvTerminalTreeVO.getPid()); PvTerminalTreeVO pvTerminalTreeOne = mapList.get(pvTerminalTreeVO.getPid());
if (Objects.nonNull(pvTerminalTreeOne)) { if (Objects.nonNull(pvTerminalTreeOne)) {
item.setCity(pvTerminalTreeOne.getName()); item.setCity(pvTerminalTreeOne.getName());
if(mapList.containsKey(pvTerminalTreeOne.getPid())) { if (mapList.containsKey(pvTerminalTreeOne.getPid())) {
PvTerminalTreeVO pvTerminalTreeTwo = mapList.get(pvTerminalTreeOne.getPid()); PvTerminalTreeVO pvTerminalTreeTwo = mapList.get(pvTerminalTreeOne.getPid());
if (Objects.nonNull(pvTerminalTreeTwo)) { if (Objects.nonNull(pvTerminalTreeTwo)) {
item.setProvince(pvTerminalTreeTwo.getName()); item.setProvince(pvTerminalTreeTwo.getName());
@@ -154,24 +173,23 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
} }
} }
if(mapCode.containsKey(item.getPlanOrgId())) { if (mapCode.containsKey(item.getPlanOrgId())) {
item.setPlanOrgName(mapCode.get(item.getPlanOrgId()).getName()); item.setPlanOrgName(mapCode.get(item.getPlanOrgId()).getName());
} }
SupvFile supvFile = supvFileMapper.selectOne(new LambdaQueryWrapper<SupvFile>().eq(SupvFile::getBusiId,item.getPlanId()).eq(SupvFile::getType,0)); SupvFile supvFile = supvFileMapper.selectOne(new LambdaQueryWrapper<SupvFile>().eq(SupvFile::getBusiId, item.getPlanId()).eq(SupvFile::getType, 0));
if(Objects.nonNull(supvFile)){ if (Objects.nonNull(supvFile)) {
item.setAttachmentName(supvFile.getAttachmentName()); item.setAttachmentName(supvFile.getAttachmentName());
} }
List<User> userList= userFeignClient.getUserByIdList(userIds).getData(); List<User> userList = userFeignClient.getUserByIdList(userIds).getData();
Map<String, User> map = userList.stream().collect(Collectors.toMap(User::getId,Function.identity())); Map<String, User> map = userList.stream().collect(Collectors.toMap(User::getId, Function.identity()));
if(map.containsKey(item.getCreateBy())) { if (map.containsKey(item.getCreateBy())) {
item.setCreateBy(map.get(item.getCreateBy()).getName()); item.setCreateBy(map.get(item.getCreateBy()).getName());
} }
}); });
Page<SupvPlanVO> pageVo = new Page<>(); Page<SupvPlanVO> pageVo = new Page<>();
pageVo.setTotal(page.getTotal()); pageVo.setTotal(page.getTotal());
@@ -182,14 +200,12 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
} }
private void checkParam(SupvPlanParam supvPlanParam, Boolean updateFlag) {
private void checkParam(SupvPlanParam supvPlanParam,Boolean updateFlag){
LambdaQueryWrapper<SupvPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SupvPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SupvPlan::getWorkPlanName,supvPlanParam.getWorkPlanName()); lambdaQueryWrapper.eq(SupvPlan::getWorkPlanName, supvPlanParam.getWorkPlanName());
if(updateFlag) { if (updateFlag) {
if (supvPlanParam instanceof SupvPlanParam.UpdateSupvPlanParam) { if (supvPlanParam instanceof SupvPlanParam.UpdateSupvPlanParam) {
//修改 //修改
lambdaQueryWrapper.ne(SupvPlan::getPlanId, ((SupvPlanParam.UpdateSupvPlanParam) supvPlanParam).getPlanId()); lambdaQueryWrapper.ne(SupvPlan::getPlanId, ((SupvPlanParam.UpdateSupvPlanParam) supvPlanParam).getPlanId());
@@ -197,40 +213,39 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
} }
int count = this.count(lambdaQueryWrapper); int count = this.count(lambdaQueryWrapper);
if(count>0){ if (count > 0) {
throw new BusinessException(ProcessResponseEnum.SUPV_PLAN_REPEAT); throw new BusinessException(ProcessResponseEnum.SUPV_PLAN_REPEAT);
} }
//判断监督对象类型 //判断监督对象类型
if(StrUtil.isNotBlank(supvPlanParam.getSupvObjType())){ if (StrUtil.isNotBlank(supvPlanParam.getSupvObjType())) {
DictData dictData = dicDataFeignClient.getDicDataById(supvPlanParam.getSupvType()).getData(); DictData dictData = dicDataFeignClient.getDicDataById(supvPlanParam.getSupvType()).getData();
if(dictData.getCode().equals(DicDataEnum.New_Energy.getCode())){ if (dictData.getCode().equals(DicDataEnum.New_Energy.getCode())) {
if(StrUtil.isBlank(supvPlanParam.getSupvObjType())){ if (StrUtil.isBlank(supvPlanParam.getSupvObjType())) {
throw new BusinessException("监督对象类型不可为空"); throw new BusinessException("监督对象类型不可为空");
} }
if(StrUtil.isBlank(supvPlanParam.getObjType())){ if (StrUtil.isBlank(supvPlanParam.getObjType())) {
throw new BusinessException("监督对象属性名称不可为空"); throw new BusinessException("监督对象属性名称不可为空");
} }
if(Objects.isNull(supvPlanParam.getObjCapacity())){ if (Objects.isNull(supvPlanParam.getObjCapacity())) {
throw new BusinessException("监督对象协议容量不可为空"); throw new BusinessException("监督对象协议容量不可为空");
} }
}else if(!dictData.getCode().equals(DicDataEnum.Technical_Super.getCode())){ } else if (!dictData.getCode().equals(DicDataEnum.Technical_Super.getCode())) {
if(StrUtil.isBlank(supvPlanParam.getSupvObjName())){ if (StrUtil.isBlank(supvPlanParam.getSupvObjName())) {
throw new BusinessException("监督对象名称不可为空"); throw new BusinessException("监督对象名称不可为空");
} }
if(StrUtil.isBlank(supvPlanParam.getObjVoltageLevel())){ if (StrUtil.isBlank(supvPlanParam.getObjVoltageLevel())) {
throw new BusinessException("监督对象电压等级不可为空"); throw new BusinessException("监督对象电压等级不可为空");
} }
}else if(!dictData.getCode().equals(DicDataEnum.POWER_QUALITY.getCode())){ } else if (!dictData.getCode().equals(DicDataEnum.POWER_QUALITY.getCode())) {
if(Objects.isNull(supvPlanParam.getObjCapacity())){ if (Objects.isNull(supvPlanParam.getObjCapacity())) {
throw new BusinessException("监督对象协议容量不可为空"); throw new BusinessException("监督对象协议容量不可为空");
} }
} }
} }
} }

View File

@@ -2,14 +2,18 @@ package com.njcn.process.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.utils.PubUtils; import com.njcn.common.utils.PubUtils;
import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.process.enums.ProcessResponseEnum; import com.njcn.process.enums.ProcessResponseEnum;
import com.njcn.process.mapper.SupvFileMapper;
import com.njcn.process.mapper.SupvProblemMapper; import com.njcn.process.mapper.SupvProblemMapper;
import com.njcn.process.pojo.param.SupvProblemParam; import com.njcn.process.pojo.param.SupvProblemParam;
import com.njcn.process.pojo.po.SupvFile;
import com.njcn.process.pojo.po.SupvPlan; import com.njcn.process.pojo.po.SupvPlan;
import com.njcn.process.pojo.po.SupvProblem; import com.njcn.process.pojo.po.SupvProblem;
import com.njcn.process.pojo.po.SupvProblem; import com.njcn.process.pojo.po.SupvProblem;
@@ -23,12 +27,13 @@ import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* <p> * <p>
* 服务实现类 * 服务实现类
* </p> * </p>
* *
* @author hongawen * @author hongawen
@@ -42,10 +47,14 @@ public class SupvProblemServiceImpl extends ServiceImpl<SupvProblemMapper, SupvP
private final DeptFeignClient deptFeignClient; private final DeptFeignClient deptFeignClient;
private final SupvFileMapper supvFileMapper;
private final FileStorageUtil fileStorageUtil;
@Override @Override
public boolean addProblem(SupvProblemParam supvProblemParam) { public boolean addProblem(SupvProblemParam supvProblemParam) {
SupvProblem supvProblem = new SupvProblem(); SupvProblem supvProblem = new SupvProblem();
BeanUtil.copyProperties(supvProblemParam,supvProblem); BeanUtil.copyProperties(supvProblemParam, supvProblem);
supvProblem.setPlanRectificationTime(PubUtils.localDateFormat(supvProblemParam.getPlanRectificationTime())); supvProblem.setPlanRectificationTime(PubUtils.localDateFormat(supvProblemParam.getPlanRectificationTime()));
supvProblem.setRectificationTime(PubUtils.localDateFormat(supvProblemParam.getRectificationTime())); supvProblem.setRectificationTime(PubUtils.localDateFormat(supvProblemParam.getRectificationTime()));
supvProblem.setIsUploadHead(0); supvProblem.setIsUploadHead(0);
@@ -56,7 +65,7 @@ public class SupvProblemServiceImpl extends ServiceImpl<SupvProblemMapper, SupvP
@Override @Override
public boolean updateProblem(SupvProblemParam supvProblemParam) { public boolean updateProblem(SupvProblemParam supvProblemParam) {
SupvProblem supvProblem = new SupvProblem(); SupvProblem supvProblem = new SupvProblem();
BeanUtil.copyProperties(supvProblemParam,supvProblem); BeanUtil.copyProperties(supvProblemParam, supvProblem);
supvProblem.setPlanRectificationTime(PubUtils.localDateFormat(supvProblemParam.getPlanRectificationTime())); supvProblem.setPlanRectificationTime(PubUtils.localDateFormat(supvProblemParam.getPlanRectificationTime()));
supvProblem.setRectificationTime(PubUtils.localDateFormat(supvProblemParam.getRectificationTime())); supvProblem.setRectificationTime(PubUtils.localDateFormat(supvProblemParam.getRectificationTime()));
this.updateById(supvProblem); this.updateById(supvProblem);
@@ -66,31 +75,44 @@ public class SupvProblemServiceImpl extends ServiceImpl<SupvProblemMapper, SupvP
@Override @Override
public boolean delProblem(List<String> problemIds) { public boolean delProblem(List<String> problemIds) {
LambdaQueryWrapper<SupvProblem> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SupvProblem> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SupvProblem::getIsUploadHead,1).eq(SupvProblem::getProblemId,problemIds); lambdaQueryWrapper.eq(SupvProblem::getIsUploadHead, 1).eq(SupvProblem::getProblemId, problemIds);
int count = this.count(lambdaQueryWrapper); int count = this.count(lambdaQueryWrapper);
if(count > 0){ if (count > 0) {
throw new BusinessException("请选择未上送国网的删除"); throw new BusinessException("请选择未上送国网的删除");
} }
return this.removeByIds(problemIds); this.removeByIds(problemIds);
if (CollUtil.isNotEmpty(problemIds)) {
LambdaQueryWrapper<SupvFile> fileLambdaQueryWrapper = new LambdaQueryWrapper<>();
fileLambdaQueryWrapper.in(SupvFile::getBusiId, problemIds);
List<SupvFile> supvFileList = supvFileMapper.selectList(fileLambdaQueryWrapper);
supvFileList.forEach(item-> fileStorageUtil.downloadStream(item.getFileUrl()));
supvFileMapper.delete(fileLambdaQueryWrapper);
}
return true;
} }
@Override @Override
public Page<SupvProblem> pageProblem(SupvProblemParam supvProblemParam) { public Page<SupvProblem> pageProblem(SupvProblemParam supvProblemParam) {
LambdaQueryWrapper<SupvProblem> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SupvProblem> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SupvProblem::getPlanId,supvProblemParam.getPlanId()); lambdaQueryWrapper.eq(SupvProblem::getPlanId, supvProblemParam.getPlanId());
Page<SupvProblem> page = this.page(new Page<>(PageFactory.getPageNum(supvProblemParam), PageFactory.getPageSize(supvProblemParam)),lambdaQueryWrapper); Page<SupvProblem> page = this.page(new Page<>(PageFactory.getPageNum(supvProblemParam), PageFactory.getPageSize(supvProblemParam)), lambdaQueryWrapper);
List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData(); List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData();
Map<String,PvTerminalTreeVO> mapCode = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getCode, Function.identity())); Map<String, PvTerminalTreeVO> mapCode = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getCode, Function.identity()));
for (SupvProblem item : page.getRecords()) { for (SupvProblem item : page.getRecords()) {
if(mapCode.containsKey(item.getDutyOrgId())) { if (mapCode.containsKey(item.getDutyOrgId())) {
item.setDutyOrgName(mapCode.get(item.getDutyOrgId()).getName()); item.setDutyOrgName(mapCode.get(item.getDutyOrgId()).getName());
} }
SupvFile supvFile = supvFileMapper.selectOne(new LambdaQueryWrapper<SupvFile>().eq(SupvFile::getBusiId, item.getProblemId()).eq(SupvFile::getType, 1));
if (Objects.nonNull(supvFile)) {
item.setAttachmentName(supvFile.getAttachmentName());
}
} }
return page; return page;
} }
} }

View File

@@ -24,6 +24,7 @@ import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.enums.DicDataTypeEnum; import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData; import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient; import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.po.Dept;
import com.njcn.user.pojo.vo.PvTerminalTreeVO; import com.njcn.user.pojo.vo.PvTerminalTreeVO;
import com.njcn.web.factory.PageFactory; import com.njcn.web.factory.PageFactory;
import com.njcn.web.pojo.param.BaseParam; import com.njcn.web.pojo.param.BaseParam;
@@ -263,7 +264,8 @@ public class SupvReportMServiceImpl extends MppServiceImpl<SupvReportMMapper, Su
public Page<SupvReportM> statisticReportPage(BaseParam baseParam) { public Page<SupvReportM> statisticReportPage(BaseParam baseParam) {
List<String> deptCodes = new ArrayList<>(); List<String> deptCodes = new ArrayList<>();
if(StrUtil.isNotBlank(baseParam.getSearchValue())){ if(StrUtil.isNotBlank(baseParam.getSearchValue())){
deptCodes = deptFeignClient.getDepSonSelfCodetByCode(baseParam.getSearchValue()).getData(); List<Dept>deptList = deptFeignClient.getDirectSonSelf(baseParam.getSearchValue()).getData();
deptCodes = deptList.stream().map(Dept::getCode).collect(Collectors.toList());
} }
LambdaQueryWrapper<SupvReportM> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SupvReportM> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(StrUtil.isNotBlank(baseParam.getSearchValue()),SupvReportM::getStatisticsDept,deptCodes) lambdaQueryWrapper.in(StrUtil.isNotBlank(baseParam.getSearchValue()),SupvReportM::getStatisticsDept,deptCodes)