|
|
|
@@ -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)) {
|
|
|
|
|