1.现场监督计划调整

This commit is contained in:
2024-11-27 16:22:37 +08:00
parent 0b5a3f0a32
commit f1ad74ea2d
5 changed files with 70 additions and 42 deletions

View File

@@ -10,6 +10,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException; 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.SupvPlanParam;
import com.njcn.process.pojo.param.SupvProblemParam; import com.njcn.process.pojo.param.SupvProblemParam;
import com.njcn.process.pojo.po.SupvProblem; import com.njcn.process.pojo.po.SupvProblem;
import com.njcn.process.pojo.vo.SupvProblemVO; import com.njcn.process.pojo.vo.SupvProblemVO;
@@ -92,8 +93,8 @@ public class SupvProblemController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("所有监督问题") @ApiOperation("所有监督问题")
@ApiImplicitParam(name = "supvProblemParam",value = "请求体",required = true) @ApiImplicitParam(name = "supvProblemParam",value = "请求体",required = true)
public void problemList(@RequestBody SupvProblemParam supvProblemParam){ public void problemList(@RequestBody SupvPlanParam supvPlanParam){
iSupvProblemService.problemList(supvProblemParam); iSupvProblemService.problemList(supvPlanParam);
} }
} }

View File

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.process.pojo.param.SupvProblemParam; import com.njcn.process.pojo.param.SupvProblemParam;
import com.njcn.process.pojo.po.SupvProblem; import com.njcn.process.pojo.po.SupvProblem;
import com.njcn.process.pojo.vo.SupvProblemVO; import com.njcn.process.pojo.vo.SupvProblemVO;
import liquibase.pro.packaged.S;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@@ -22,5 +23,5 @@ public interface SupvProblemMapper extends BaseMapper<SupvProblem> {
Boolean updateId(@Param("isUploadHead")Integer isUploadHead, Boolean updateId(@Param("isUploadHead")Integer isUploadHead,
@Param("id") String id); @Param("id") String id);
List<SupvProblemVO> listDerive(@Param("param") SupvProblemParam supvProblemParam); List<SupvProblemVO> listDerive(@Param("planIds")List<String> list);
} }

View File

@@ -12,6 +12,12 @@
from from
supv_problem spm supv_problem spm
INNER JOIN supv_plan sp on sp.plan_Id=spm.plan_id INNER JOIN supv_plan sp on sp.plan_Id=spm.plan_id
<where>
sp.plan_id in
<foreach collection="planIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</where>
</select> </select>
</mapper> </mapper>

View File

@@ -3,6 +3,7 @@ package com.njcn.process.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.process.pojo.param.SupvPlanParam;
import com.njcn.process.pojo.param.SupvProblemParam; import com.njcn.process.pojo.param.SupvProblemParam;
import com.njcn.process.pojo.po.SupvProblem; import com.njcn.process.pojo.po.SupvProblem;
import com.njcn.process.pojo.vo.SupvProblemVO; import com.njcn.process.pojo.vo.SupvProblemVO;
@@ -55,5 +56,5 @@ public interface ISupvProblemService extends IService<SupvProblem> {
* @Author: wr * @Author: wr
* @Date: 2023/9/1 9:44 * @Date: 2023/9/1 9:44
*/ */
void problemList(SupvProblemParam supvProblemParam); void problemList(SupvPlanParam supvPlanParam);
} }

View File

@@ -3,6 +3,7 @@ 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 cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
@@ -15,7 +16,9 @@ import com.njcn.common.utils.PubUtils;
import com.njcn.oss.utils.FileStorageUtil; import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.poi.excel.ExcelUtil; import com.njcn.poi.excel.ExcelUtil;
import com.njcn.process.mapper.SupvFileMapper; import com.njcn.process.mapper.SupvFileMapper;
import com.njcn.process.mapper.SupvPlanMapper;
import com.njcn.process.mapper.SupvProblemMapper; import com.njcn.process.mapper.SupvProblemMapper;
import com.njcn.process.pojo.param.SupvPlanParam;
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.SupvFile;
import com.njcn.process.pojo.po.SupvPlan; import com.njcn.process.pojo.po.SupvPlan;
@@ -35,6 +38,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
@@ -61,15 +65,16 @@ public class SupvProblemServiceImpl extends ServiceImpl<SupvProblemMapper, SupvP
private final FileStorageUtil fileStorageUtil; private final FileStorageUtil fileStorageUtil;
private final ISupvPlanService iSupvPlanService; private final ISupvPlanService iSupvPlanService;
private final SupvPlanMapper supvPlanMapper;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean addProblem(SupvProblemParam supvProblemParam) { public boolean addProblem(SupvProblemParam supvProblemParam) {
checkParam(supvProblemParam.getPlanId(),supvProblemParam.getDiscoveryTime()); checkParam(supvProblemParam.getPlanId(), supvProblemParam.getDiscoveryTime());
SupvProblem supvProblem = new SupvProblem(); SupvProblem supvProblem = new SupvProblem();
BeanUtil.copyProperties(supvProblemParam, supvProblem); BeanUtil.copyProperties(supvProblemParam, supvProblem);
supvProblem.setPlanRectificationTime(PubUtils.beginTimeToLocalDateTime(supvProblemParam.getPlanRectificationTime())); supvProblem.setPlanRectificationTime(PubUtils.beginTimeToLocalDateTime(supvProblemParam.getPlanRectificationTime()));
if(StrUtil.isNotBlank(supvProblemParam.getRectificationTime())) { if (StrUtil.isNotBlank(supvProblemParam.getRectificationTime())) {
supvProblem.setRectificationTime(PubUtils.beginTimeToLocalDateTime(supvProblemParam.getRectificationTime())); supvProblem.setRectificationTime(PubUtils.beginTimeToLocalDateTime(supvProblemParam.getRectificationTime()));
} }
supvProblem.setIsUploadHead(0); supvProblem.setIsUploadHead(0);
@@ -80,15 +85,15 @@ public class SupvProblemServiceImpl extends ServiceImpl<SupvProblemMapper, SupvP
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean updateProblem(SupvProblemParam supvProblemParam) { public boolean updateProblem(SupvProblemParam supvProblemParam) {
checkParam(supvProblemParam.getPlanId(),supvProblemParam.getDiscoveryTime()); checkParam(supvProblemParam.getPlanId(), supvProblemParam.getDiscoveryTime());
SupvProblem supvProblem = new SupvProblem(); SupvProblem supvProblem = new SupvProblem();
BeanUtil.copyProperties(supvProblemParam, supvProblem); BeanUtil.copyProperties(supvProblemParam, supvProblem);
supvProblem.setPlanRectificationTime(PubUtils.beginTimeToLocalDateTime(supvProblemParam.getPlanRectificationTime())); supvProblem.setPlanRectificationTime(PubUtils.beginTimeToLocalDateTime(supvProblemParam.getPlanRectificationTime()));
if(StrUtil.isNotBlank(supvProblemParam.getRectificationTime())) { if (StrUtil.isNotBlank(supvProblemParam.getRectificationTime())) {
supvProblem.setRectificationTime(PubUtils.beginTimeToLocalDateTime(supvProblemParam.getRectificationTime())); supvProblem.setRectificationTime(PubUtils.beginTimeToLocalDateTime(supvProblemParam.getRectificationTime()));
} }
SupvProblem byId = this.getById(supvProblem.getProblemId()); SupvProblem byId = this.getById(supvProblem.getProblemId());
if(1==byId.getIsUploadHead()){ if (1 == byId.getIsUploadHead()) {
supvProblem.setIsUploadHead(3); supvProblem.setIsUploadHead(3);
} }
this.updateById(supvProblem); this.updateById(supvProblem);
@@ -109,7 +114,7 @@ public class SupvProblemServiceImpl extends ServiceImpl<SupvProblemMapper, SupvP
LambdaQueryWrapper<SupvFile> fileLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SupvFile> fileLambdaQueryWrapper = new LambdaQueryWrapper<>();
fileLambdaQueryWrapper.in(SupvFile::getBusiId, problemIds); fileLambdaQueryWrapper.in(SupvFile::getBusiId, problemIds);
List<SupvFile> supvFileList = supvFileMapper.selectList(fileLambdaQueryWrapper); List<SupvFile> supvFileList = supvFileMapper.selectList(fileLambdaQueryWrapper);
supvFileList.forEach(item-> fileStorageUtil.getFileStream(item.getFileUrl())); supvFileList.forEach(item -> fileStorageUtil.getFileStream(item.getFileUrl()));
supvFileMapper.delete(fileLambdaQueryWrapper); supvFileMapper.delete(fileLambdaQueryWrapper);
} }
return true; return true;
@@ -133,10 +138,10 @@ public class SupvProblemServiceImpl extends ServiceImpl<SupvProblemMapper, SupvP
List<SupvFile> supvFileList = supvFileMapper.selectList(new LambdaQueryWrapper<SupvFile>().eq(SupvFile::getBusiId, item.getProblemId()).eq(SupvFile::getType, 1)); List<SupvFile> supvFileList = supvFileMapper.selectList(new LambdaQueryWrapper<SupvFile>().eq(SupvFile::getBusiId, item.getProblemId()).eq(SupvFile::getType, 1));
if (CollUtil.isNotEmpty(supvFileList)) { if (CollUtil.isNotEmpty(supvFileList)) {
for(SupvFile supvFile:supvFileList){ for (SupvFile supvFile : supvFileList) {
if(supvFile.getAttachmentType().equals(stamped_report.getId())){ if (supvFile.getAttachmentType().equals(stamped_report.getId())) {
item.setAttachmentName(supvFile.getAttachmentName()); item.setAttachmentName(supvFile.getAttachmentName());
}else { } else {
item.setAttachmentNameTwo(supvFile.getAttachmentName()); item.setAttachmentNameTwo(supvFile.getAttachmentName());
} }
@@ -148,8 +153,19 @@ public class SupvProblemServiceImpl extends ServiceImpl<SupvProblemMapper, SupvP
} }
@Override @Override
public void problemList(SupvProblemParam supvProblemParam) { public void problemList(SupvPlanParam supvPlanParam) {
List<SupvProblemVO> supvProblemVOS = this.baseMapper.listDerive(supvProblemParam); List<SupvProblemVO> supvProblemVOS = new ArrayList<>();
LambdaQueryWrapper<SupvPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>();
List<String> deptIds = deptFeignClient.getDepSonSelfCodetByCode(supvPlanParam.getPlanOrgId()).getData();
lambdaQueryWrapper.select(SupvPlan::getPlanId).in(SupvPlan::getPlanOrgId, deptIds)
.between(SupvPlan::getPlanSupvDate, DateUtil.parse(supvPlanParam.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN), DateUtil.parse(supvPlanParam.getSearchEndTime(), DatePattern.NORM_DATE_PATTERN))
.eq(StrUtil.isNotBlank(supvPlanParam.getSupvType()), SupvPlan::getSupvType, supvPlanParam.getSupvType());
List<String> planIds = supvPlanMapper.selectList(lambdaQueryWrapper).stream().map(SupvPlan::getPlanId).collect(Collectors.toList());
if (CollUtil.isNotEmpty(planIds)) {
supvProblemVOS = this.baseMapper.listDerive(planIds);
if(CollUtil.isNotEmpty(supvProblemVOS)) {
//监测点状态 //监测点状态
List<DictData> monitorTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.MONITOR_TYPE.getCode()).getData(); List<DictData> monitorTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.MONITOR_TYPE.getCode()).getData();
Map<String, DictData> mapMonitorType = monitorTypeList.stream().collect(Collectors.toMap(DictData::getId, Function.identity())); Map<String, DictData> mapMonitorType = monitorTypeList.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
@@ -175,17 +191,20 @@ public class SupvProblemServiceImpl extends ServiceImpl<SupvProblemMapper, SupvP
supvProblem.setProblemLevel(mapProblemLeve.get(supvProblem.getProblemLevel()).getName()); supvProblem.setProblemLevel(mapProblemLeve.get(supvProblem.getProblemLevel()).getName());
} }
} }
}
}
ExcelUtil.exportExcel("实施问题信息.xlsx",SupvProblemVO.class,supvProblemVOS); ExcelUtil.exportExcel("实施问题信息.xlsx", SupvProblemVO.class, supvProblemVOS);
} }
//判断是否存在时间范围内 //判断是否存在时间范围内
public void checkParam(String id,String time) { public void checkParam(String id, String time) {
if(StrUtil.isNotBlank(time)){ if (StrUtil.isNotBlank(time)) {
SupvPlan supvPlan = iSupvPlanService.getById(id); SupvPlan supvPlan = iSupvPlanService.getById(id);
if(ObjectUtil.isNotNull(supvPlan)){ if (ObjectUtil.isNotNull(supvPlan)) {
//判断时间范围 //判断时间范围
if (ObjectUtil.isAllNotEmpty(supvPlan.getEffectStartTime(), supvPlan.getEffectEndTime())|| if (ObjectUtil.isAllNotEmpty(supvPlan.getEffectStartTime(), supvPlan.getEffectEndTime()) ||
ObjectUtil.isAllNotEmpty(supvPlan.getEffectStartTime(), supvPlan.getReportIssueTime()) ObjectUtil.isAllNotEmpty(supvPlan.getEffectStartTime(), supvPlan.getReportIssueTime())
) { ) {
//实施开始时间 //实施开始时间
@@ -193,14 +212,14 @@ public class SupvProblemServiceImpl extends ServiceImpl<SupvProblemMapper, SupvP
//问题发现时间 //问题发现时间
DateTime problemOcTime = DateUtil.parse(time, "yyyy-MM-dd HH:mm:ss"); DateTime problemOcTime = DateUtil.parse(time, "yyyy-MM-dd HH:mm:ss");
Boolean fly = false; Boolean fly = false;
if(ObjectUtil.isNotNull(supvPlan.getEffectEndTime())){ if (ObjectUtil.isNotNull(supvPlan.getEffectEndTime())) {
//实施结束时间 //实施结束时间
DateTime effectEndTime = DateUtil.parse(DateUtil.formatLocalDateTime(supvPlan.getEffectEndTime()), "yyyy-MM-dd HH:mm:ss"); DateTime effectEndTime = DateUtil.parse(DateUtil.formatLocalDateTime(supvPlan.getEffectEndTime()), "yyyy-MM-dd HH:mm:ss");
if (DateUtil.isIn(problemOcTime, effectStartTime, effectEndTime)) { if (DateUtil.isIn(problemOcTime, effectStartTime, effectEndTime)) {
fly = true; fly = true;
} }
} }
if(ObjectUtil.isNotNull(supvPlan.getReportIssueTime())){ if (ObjectUtil.isNotNull(supvPlan.getReportIssueTime())) {
//报告出具时间 //报告出具时间
DateTime reportIssueTime = DateUtil.parse(DateUtil.formatLocalDateTime(supvPlan.getReportIssueTime()), "yyyy-MM-dd HH:mm:ss"); DateTime reportIssueTime = DateUtil.parse(DateUtil.formatLocalDateTime(supvPlan.getReportIssueTime()), "yyyy-MM-dd HH:mm:ss");
if (DateUtil.isIn(problemOcTime, effectStartTime, reportIssueTime)) { if (DateUtil.isIn(problemOcTime, effectStartTime, reportIssueTime)) {