1.添加时间范围验证
2.附件上传时间自动更新,报告出具时间
This commit is contained in:
@@ -39,9 +39,14 @@ public class SupvFileController extends BaseController {
|
||||
@PostMapping("planUpload")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.UPLOAD)
|
||||
@ApiOperation("监督计划问题附件上传")
|
||||
public HttpResult<Object> planUpload(@ApiParam(value = "文件", required = true) @RequestPart("files") MultipartFile file, @RequestParam("planId") String planId, @RequestParam("type") Integer type,@RequestParam("attachmentType")String attachmentType){
|
||||
public HttpResult<Object> planUpload(@ApiParam(value = "文件", required = true) @RequestPart("files") MultipartFile file,
|
||||
@RequestParam("planId") String planId,
|
||||
@RequestParam("type") Integer type,
|
||||
@RequestParam("attachmentType")String attachmentType,
|
||||
@RequestParam("uploadTime")String uploadTime
|
||||
){
|
||||
String methodDescribe = getMethodDescribe("planUpload");
|
||||
iSupvFileService.planUpload(file,planId,type,attachmentType);
|
||||
iSupvFileService.planUpload(file,planId,type,attachmentType,uploadTime);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,4 +14,5 @@ import com.njcn.process.pojo.po.SupvFile;
|
||||
*/
|
||||
public interface SupvFileMapper extends BaseMapper<SupvFile> {
|
||||
|
||||
SupvFile selectFile(String ids);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public interface ISupvFileService extends IService<SupvFile> {
|
||||
* @author cdf
|
||||
* @date 2023/6/25
|
||||
*/
|
||||
boolean planUpload(MultipartFile file,String planId, Integer type,String attachmentType);
|
||||
boolean planUpload(MultipartFile file,String planId, Integer type,String attachmentType,String uploadTime);
|
||||
|
||||
|
||||
String detail(HttpServletResponse response,String busId,Integer type,String attachmentType);
|
||||
|
||||
@@ -1,22 +1,34 @@
|
||||
package com.njcn.process.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.process.mapper.SupvFileMapper;
|
||||
import com.njcn.process.pojo.po.SupvFile;
|
||||
import com.njcn.process.pojo.po.SupvPlan;
|
||||
import com.njcn.process.pojo.po.SupvProblem;
|
||||
import com.njcn.process.service.ISupvFileService;
|
||||
import com.njcn.process.service.ISupvPlanService;
|
||||
import com.njcn.process.service.ISupvProblemService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -32,28 +44,37 @@ public class SupvFileServiceImpl extends ServiceImpl<SupvFileMapper, SupvFile> i
|
||||
|
||||
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
private final ISupvProblemService supvProblemService;
|
||||
private final ISupvPlanService supvPlanService;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final SupvFileMapper supvFileMapper;
|
||||
|
||||
@Override
|
||||
public boolean planUpload(MultipartFile file, String planId, Integer type,String attachmentType) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean planUpload(MultipartFile file, String planId, Integer type,String attachmentType,String uploadTime) {
|
||||
Boolean fly=false;
|
||||
SupvFile supvFile = this.getOne(new LambdaQueryWrapper<SupvFile>().eq(SupvFile::getBusiId,planId).eq(SupvFile::getType,type).eq(SupvFile::getAttachmentType,attachmentType));
|
||||
String url = fileStorageUtil.uploadMultipart(file, OssPath.SURVEY_RESULT);
|
||||
SupvFile supvFilePO = new SupvFile();
|
||||
supvFilePO.setAttachmentName(file.getOriginalFilename());
|
||||
supvFilePO.setFileUrl(url);
|
||||
if(Objects.nonNull(supvFile)){
|
||||
fileStorageUtil.deleteFile(supvFile.getFileUrl());
|
||||
supvFilePO.setUuid(supvFile.getUuid());
|
||||
return this.updateById(supvFilePO);
|
||||
}
|
||||
supvFilePO.setAttachmentType(attachmentType);
|
||||
supvFilePO.setBusiId(planId);
|
||||
supvFilePO.setType(type);
|
||||
supvFilePO.setUploaderId(RequestUtil.getUserIndex());
|
||||
supvFilePO.setUploadTime(LocalDateTime.now());
|
||||
supvFilePO.setUploadTime(DateUtil.parseLocalDateTime(uploadTime));
|
||||
supvFilePO.setUploaderName(RequestUtil.getUsername());
|
||||
return this.save(supvFilePO);
|
||||
if(Objects.nonNull(supvFile)){
|
||||
fileStorageUtil.deleteFile(supvFile.getFileUrl());
|
||||
supvFilePO.setUuid(supvFile.getUuid());
|
||||
fly= this.updateById(supvFilePO);
|
||||
updateTime(type,planId,uploadTime,attachmentType,supvFile.getUuid());
|
||||
}else{
|
||||
supvFilePO.setCreateTime(LocalDateTime.now());
|
||||
fly= this.save(supvFilePO);
|
||||
updateTime(type,planId,uploadTime,attachmentType,null);
|
||||
}
|
||||
return fly;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,4 +87,48 @@ public class SupvFileServiceImpl extends ServiceImpl<SupvFileMapper, SupvFile> i
|
||||
throw new BusinessException("不存在附件");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @param type 区分问题计划
|
||||
* @param planId 业务id(问题id)
|
||||
* @param uploadTime 上传时间
|
||||
* @param attachmentType 下拉选择类型
|
||||
* @param id 附件id
|
||||
* @Author: wr
|
||||
* @Date: 2023/9/12 8:59
|
||||
*/
|
||||
private void updateTime(Integer type,String planId,String uploadTime,String attachmentType,String id){
|
||||
DictData stamped_report = dicDataFeignClient.getDicDataByCode("Stamped_Report").getData();
|
||||
if(type==1&&attachmentType.equals(stamped_report.getId())){
|
||||
//获取问题信息,查询所有问题
|
||||
SupvProblem byId = supvProblemService.getById(planId);
|
||||
List<SupvProblem> list = supvProblemService.list(new LambdaQueryWrapper<SupvProblem>()
|
||||
.eq(SupvProblem::getPlanId, byId.getPlanId()));
|
||||
if(list.size()<2){
|
||||
supvPlanService.update(new LambdaUpdateWrapper<SupvPlan>()
|
||||
.eq(SupvPlan::getPlanId,list.get(0).getPlanId())
|
||||
.set(SupvPlan::getReportIssueTime,uploadTime)
|
||||
);
|
||||
}else{
|
||||
//根据问题查询上传附件信息,在排序取第一条
|
||||
List<String> ids = list.stream().map(SupvProblem::getProblemId).collect(Collectors.toList());
|
||||
List<SupvFile> files = this.list(new LambdaQueryWrapper<SupvFile>()
|
||||
.in(SupvFile::getBusiId, ids)
|
||||
.eq(SupvFile::getType, type)
|
||||
.eq(SupvFile::getAttachmentType, stamped_report.getId())
|
||||
.orderByAsc(SupvFile::getCreateTime)
|
||||
);
|
||||
if(CollUtil.isNotEmpty(files)){
|
||||
if(files.get(0).getUuid().equals(id)){
|
||||
supvPlanService.update(new LambdaUpdateWrapper<SupvPlan>()
|
||||
.eq(SupvPlan::getPlanId,list.get(0).getPlanId())
|
||||
.set(SupvPlan::getReportIssueTime,uploadTime));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.process.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@@ -50,6 +51,8 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@@ -169,6 +172,8 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
|
||||
}
|
||||
}
|
||||
SupvPlan byId = this.getById(supvPlan.getPlanId());
|
||||
//实施问题
|
||||
List<SupvPlanHis> list =new ArrayList<>();
|
||||
if(1==byId.getIsUploadHead()){
|
||||
supvPlan.setIsUploadHead(3);
|
||||
|
||||
@@ -192,7 +197,7 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
|
||||
planHis.setUpdateTime(LocalDateTime.now());
|
||||
planHis.setDeleteFlag("0");
|
||||
//判断是否已存在问题
|
||||
List<SupvPlanHis> list = supvPlanHisService.list(new LambdaQueryWrapper<SupvPlanHis>()
|
||||
list = supvPlanHisService.list(new LambdaQueryWrapper<SupvPlanHis>()
|
||||
.eq(SupvPlanHis::getPlanId, planHis.getPlanId())
|
||||
.orderByDesc(SupvPlanHis::getUpdateTime)
|
||||
|
||||
@@ -204,6 +209,13 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
|
||||
planHis.setIsUploadHead(0);
|
||||
supvPlanHisService.save(planHis);
|
||||
}
|
||||
//报告出具时间
|
||||
if(StrUtil.isNotBlank(supvPlanParam.getReportIssueTime())){
|
||||
//查询是否存在实施问题
|
||||
if(CollUtil.isNotEmpty(list)){
|
||||
|
||||
}
|
||||
}
|
||||
return this.updateById(supvPlan);
|
||||
}
|
||||
|
||||
@@ -377,8 +389,36 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//判断时间范围
|
||||
if(StrUtil.isAllNotBlank(supvPlanParam.getEffectStartTime(),supvPlanParam.getEffectEndTime())||
|
||||
StrUtil.isAllNotBlank(supvPlanParam.getEffectStartTime(),supvPlanParam.getReportIssueTime())
|
||||
){
|
||||
String problemOcTime1 = supvPlanParam.getProblemOcTime();
|
||||
if(StrUtil.isNotBlank(problemOcTime1)){
|
||||
//实施开始时间
|
||||
DateTime effectStartTime = DateUtil.parse(supvPlanParam.getEffectStartTime(), "yyyy-MM-dd HH:mm:ss");
|
||||
//问题发现时间
|
||||
DateTime problemOcTime = DateUtil.parse(problemOcTime1, "yyyy-MM-dd HH:mm:ss");
|
||||
Boolean fly = false;
|
||||
if(StrUtil.isNotBlank(supvPlanParam.getEffectEndTime())){
|
||||
//实施结束时间
|
||||
DateTime effectEndTime = DateUtil.parse(supvPlanParam.getEffectEndTime(), "yyyy-MM-dd HH:mm:ss");
|
||||
if (DateUtil.isIn(problemOcTime, effectStartTime, effectEndTime)) {
|
||||
fly = true;
|
||||
}
|
||||
}
|
||||
if(StrUtil.isNotBlank(supvPlanParam.getReportIssueTime())){
|
||||
//报告出具时间
|
||||
DateTime reportIssueTime = DateUtil.parse(supvPlanParam.getReportIssueTime(), "yyyy-MM-dd HH:mm:ss");
|
||||
if (DateUtil.isIn(problemOcTime, effectStartTime, reportIssueTime)) {
|
||||
fly = true;
|
||||
}
|
||||
}
|
||||
if (!fly) {
|
||||
throw new BusinessException("问题发现时时间,不在实施开始时间到(实施结束时间/报告出具时间)范围内");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ package com.njcn.process.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -15,8 +18,10 @@ import com.njcn.process.mapper.SupvFileMapper;
|
||||
import com.njcn.process.mapper.SupvProblemMapper;
|
||||
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.SupvProblem;
|
||||
import com.njcn.process.pojo.vo.SupvProblemVO;
|
||||
import com.njcn.process.service.ISupvPlanService;
|
||||
import com.njcn.process.service.ISupvProblemService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
@@ -29,6 +34,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
@@ -54,9 +60,12 @@ public class SupvProblemServiceImpl extends ServiceImpl<SupvProblemMapper, SupvP
|
||||
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
private final ISupvPlanService iSupvPlanService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean addProblem(SupvProblemParam supvProblemParam) {
|
||||
checkParam(supvProblemParam.getPlanId(),supvProblemParam.getDiscoveryTime());
|
||||
SupvProblem supvProblem = new SupvProblem();
|
||||
BeanUtil.copyProperties(supvProblemParam, supvProblem);
|
||||
supvProblem.setPlanRectificationTime(PubUtils.beginTimeToLocalDateTime(supvProblemParam.getPlanRectificationTime()));
|
||||
@@ -71,6 +80,7 @@ public class SupvProblemServiceImpl extends ServiceImpl<SupvProblemMapper, SupvP
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateProblem(SupvProblemParam supvProblemParam) {
|
||||
checkParam(supvProblemParam.getPlanId(),supvProblemParam.getDiscoveryTime());
|
||||
SupvProblem supvProblem = new SupvProblem();
|
||||
BeanUtil.copyProperties(supvProblemParam, supvProblem);
|
||||
supvProblem.setPlanRectificationTime(PubUtils.beginTimeToLocalDateTime(supvProblemParam.getPlanRectificationTime()));
|
||||
@@ -107,6 +117,8 @@ public class SupvProblemServiceImpl extends ServiceImpl<SupvProblemMapper, SupvP
|
||||
|
||||
@Override
|
||||
public Page<SupvProblem> pageProblem(SupvProblemParam supvProblemParam) {
|
||||
DictData stamped_report = dicDataFeignClient.getDicDataByCode("Stamped_Report").getData();
|
||||
|
||||
LambdaQueryWrapper<SupvProblem> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SupvProblem::getPlanId, supvProblemParam.getPlanId());
|
||||
Page<SupvProblem> page = this.page(new Page<>(PageFactory.getPageNum(supvProblemParam), PageFactory.getPageSize(supvProblemParam)), lambdaQueryWrapper);
|
||||
@@ -122,7 +134,7 @@ public class SupvProblemServiceImpl extends ServiceImpl<SupvProblemMapper, SupvP
|
||||
List<SupvFile> supvFileList = supvFileMapper.selectList(new LambdaQueryWrapper<SupvFile>().eq(SupvFile::getBusiId, item.getProblemId()).eq(SupvFile::getType, 1));
|
||||
if (CollUtil.isNotEmpty(supvFileList)) {
|
||||
for(SupvFile supvFile:supvFileList){
|
||||
if(supvFile.getAttachmentType().equals("01")){
|
||||
if(supvFile.getAttachmentType().equals(stamped_report.getId())){
|
||||
item.setAttachmentName(supvFile.getAttachmentName());
|
||||
}else {
|
||||
item.setAttachmentNameTwo(supvFile.getAttachmentName());
|
||||
@@ -167,6 +179,42 @@ public class SupvProblemServiceImpl extends ServiceImpl<SupvProblemMapper, SupvP
|
||||
ExcelUtil.exportExcel("实施问题信息.xlsx",SupvProblemVO.class,supvProblemVOS);
|
||||
|
||||
}
|
||||
//判断是否存在时间范围内
|
||||
public void checkParam(String id,String time) {
|
||||
if(StrUtil.isNotBlank(time)){
|
||||
SupvPlan supvPlan = iSupvPlanService.getById(id);
|
||||
if(ObjectUtil.isNotNull(supvPlan)){
|
||||
//判断时间范围
|
||||
if (ObjectUtil.isAllNotEmpty(supvPlan.getEffectStartTime(), supvPlan.getEffectEndTime())||
|
||||
ObjectUtil.isAllNotEmpty(supvPlan.getEffectStartTime(), supvPlan.getReportIssueTime())
|
||||
) {
|
||||
//实施开始时间
|
||||
DateTime effectStartTime = DateUtil.parse(DateUtil.formatLocalDateTime(supvPlan.getEffectStartTime()), "yyyy-MM-dd HH:mm:ss");
|
||||
//问题发现时间
|
||||
DateTime problemOcTime = DateUtil.parse(time, "yyyy-MM-dd HH:mm:ss");
|
||||
Boolean fly = false;
|
||||
if(ObjectUtil.isNotNull(supvPlan.getEffectEndTime())){
|
||||
//实施结束时间
|
||||
DateTime effectEndTime = DateUtil.parse(DateUtil.formatLocalDateTime(supvPlan.getEffectEndTime()), "yyyy-MM-dd HH:mm:ss");
|
||||
if (DateUtil.isIn(problemOcTime, effectStartTime, effectEndTime)) {
|
||||
fly = true;
|
||||
}
|
||||
}
|
||||
if(ObjectUtil.isNotNull(supvPlan.getReportIssueTime())){
|
||||
//报告出具时间
|
||||
DateTime reportIssueTime = DateUtil.parse(DateUtil.formatLocalDateTime(supvPlan.getReportIssueTime()), "yyyy-MM-dd HH:mm:ss");
|
||||
if (DateUtil.isIn(problemOcTime, effectStartTime, reportIssueTime)) {
|
||||
fly = true;
|
||||
}
|
||||
}
|
||||
if (!fly) {
|
||||
throw new BusinessException("问题发现时时间,不在实施开始时间到(实施结束时间/报告出具时间)范围内");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.njcn.process.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -13,17 +15,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.process.enums.ProcessResponseEnum;
|
||||
import com.njcn.process.mapper.SupvFileMapper;
|
||||
import com.njcn.process.mapper.SupvPlanMapper;
|
||||
import com.njcn.process.mapper.SupvProblemMapper;
|
||||
import com.njcn.process.mapper.SupvReportMMapper;
|
||||
import com.njcn.process.pojo.param.SendParam;
|
||||
import com.njcn.process.pojo.param.SupvPlanParam;
|
||||
import com.njcn.process.pojo.po.*;
|
||||
import com.njcn.process.pojo.vo.gw.*;
|
||||
import com.njcn.process.service.ISupvAlarmBackService;
|
||||
import com.njcn.process.service.ISupvAlarmService;
|
||||
import com.njcn.process.service.ISupvPlanHisService;
|
||||
import com.njcn.process.service.SupvPushGwService;
|
||||
import com.njcn.process.service.*;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
@@ -47,6 +48,7 @@ import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
@@ -83,6 +85,9 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
||||
private final ISupvPlanHisService supvPlanHisService;
|
||||
private final ISupvAlarmService supvAlarmService;
|
||||
private final ISupvAlarmBackService supvAlarmBackService;
|
||||
private final SupvProblemServiceImpl supvProblemService;
|
||||
|
||||
|
||||
|
||||
@Value("${gw.url}")
|
||||
private String gwUrl;
|
||||
@@ -124,7 +129,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
||||
|
||||
|
||||
for (SupvPlan supvPlan : supvPlanList) {
|
||||
|
||||
checkParam(supvPlan);
|
||||
PvTerminalTreeVO pvTerminalTreeVO = null;
|
||||
if (mapCode.containsKey(supvPlan.getSupvOrgId())) {
|
||||
pvTerminalTreeVO = mapCode.get(supvPlan.getSupvOrgId());
|
||||
@@ -269,7 +274,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
||||
|
||||
|
||||
for (SupvProblem supvProblem : supvProblemList) {
|
||||
|
||||
supvProblemService.checkParam(supvProblem.getPlanId(),DateUtil.formatLocalDateTime(supvProblem.getDiscoveryTime()));
|
||||
Dept dept = deptFeignClient.getDeptByCode(supvProblem.getDutyOrgId()).getData();
|
||||
supvProblem.setDutyOrgName(dept.getName());
|
||||
|
||||
@@ -346,8 +351,20 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
||||
JSONArray objects = new JSONArray(Collections.singletonList(supvFiles));
|
||||
String s = objects.toString();
|
||||
log.info(Thread.currentThread().getName() + "获取返回体 推送附件接口:" + s + "结束----!");
|
||||
List<DictData> fileList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.file_type.getCode()).getData();
|
||||
Map<String, DictData> mapFile = fileList.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
DictData dictData ;
|
||||
//TODO 调用上送接口
|
||||
for (int i = 0; i < supvFiles.size(); i++) {
|
||||
|
||||
if(mapFile.containsKey(supvFiles.get(i).getAttachmentType())){
|
||||
dictData = mapFile.get(supvFiles.get(i).getAttachmentType());
|
||||
supvFiles.get(i).setAttachmentType(dictData.getValue());
|
||||
}else{
|
||||
stringBuilder.append("第" + i + "次操作失败: 请检查上送附件类型是否正确");
|
||||
continue;
|
||||
}
|
||||
|
||||
// Map<String, String> sendFile = sendFile(getUrl(4), supvFiles.get(i));
|
||||
Map<String, String> sendFile = new HashMap<>();
|
||||
log.info(Thread.currentThread().getName() + "获取返回体 总部提供附件接收接口,省公司调用此接口,完成附件上报响应结果:" + sendFile + "结束----!");
|
||||
@@ -430,7 +447,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
||||
for (String id : planIds) {
|
||||
SupvPlan supvPlan = new SupvPlan();
|
||||
supvPlan.setPlanId(id);
|
||||
supvPlan.setProvinceId("13B9B47F1E483324E05338297A0A0595");
|
||||
supvPlan.setDeleteFlag(null);
|
||||
supvPlanList.add(supvPlan);
|
||||
}
|
||||
|
||||
@@ -663,7 +680,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
||||
log.info(Thread.currentThread().getName() + "错误信息:" + e);
|
||||
map.put("error", e.toString());
|
||||
}
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
map.put("error", "当前时间段国网上送请求过多,请稍后再试");
|
||||
}
|
||||
return map;
|
||||
@@ -885,4 +902,37 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
||||
return url;
|
||||
}
|
||||
|
||||
private void checkParam(SupvPlan supvPlan) {
|
||||
//判断时间范围
|
||||
if (ObjectUtil.isAllNotEmpty(supvPlan.getEffectStartTime(), supvPlan.getEffectEndTime())||
|
||||
ObjectUtil.isAllNotEmpty(supvPlan.getEffectStartTime(), supvPlan.getReportIssueTime())
|
||||
) {
|
||||
LocalDateTime problemOcTime1 = supvPlan.getProblemOcTime();
|
||||
if (ObjectUtil.isNotNull(problemOcTime1)) {
|
||||
//实施开始时间
|
||||
DateTime effectStartTime = DateUtil.parse(DateUtil.formatLocalDateTime(supvPlan.getEffectStartTime()), "yyyy-MM-dd HH:mm:ss");
|
||||
//问题发现时间
|
||||
DateTime problemOcTime = DateUtil.parse(DateUtil.formatLocalDateTime(problemOcTime1), "yyyy-MM-dd HH:mm:ss");
|
||||
Boolean fly = false;
|
||||
if(ObjectUtil.isNotNull(supvPlan.getEffectEndTime())){
|
||||
//实施结束时间
|
||||
DateTime effectEndTime = DateUtil.parse(DateUtil.formatLocalDateTime(supvPlan.getEffectEndTime()), "yyyy-MM-dd HH:mm:ss");
|
||||
if (DateUtil.isIn(problemOcTime, effectStartTime, effectEndTime)) {
|
||||
fly = true;
|
||||
}
|
||||
}
|
||||
if(ObjectUtil.isNotNull(supvPlan.getReportIssueTime())){
|
||||
//报告出具时间
|
||||
DateTime reportIssueTime = DateUtil.parse(DateUtil.formatLocalDateTime(supvPlan.getReportIssueTime()), "yyyy-MM-dd HH:mm:ss");
|
||||
if (DateUtil.isIn(problemOcTime, effectStartTime, reportIssueTime)) {
|
||||
fly = true;
|
||||
}
|
||||
}
|
||||
if (!fly) {
|
||||
throw new BusinessException("问题发现时时间,不在实施开始时间到(实施结束时间/报告出具时间)范围内");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user