|
@@ -9,11 +9,14 @@ import cn.cslg.pas.common.model.report.ExtraEmailDTO;
|
|
|
import cn.cslg.pas.common.model.report.MailMessageDTO;
|
|
|
import cn.cslg.pas.common.utils.CacheUtils;
|
|
|
import cn.cslg.pas.common.utils.LoginUtils;
|
|
|
+import cn.cslg.pas.common.vo.business.CronVO;
|
|
|
import cn.cslg.pas.common.vo.invalidVO.*;
|
|
|
import cn.cslg.pas.domain.BaseEntity;
|
|
|
import cn.cslg.pas.domain.business.*;
|
|
|
import cn.cslg.pas.exception.XiaoShiException;
|
|
|
+import cn.cslg.pas.mapper.ReportAffairCasePhaseMapper;
|
|
|
import cn.cslg.pas.mapper.ReportAffairMapper;
|
|
|
+import cn.cslg.pas.mapper.ReportProjectMapper;
|
|
|
import cn.cslg.pas.service.MailSendService;
|
|
|
import cn.cslg.pas.service.common.FileManagerService;
|
|
|
import cn.cslg.pas.service.permissions.PermissionService;
|
|
@@ -22,6 +25,8 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
@@ -77,6 +82,21 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
|
|
|
@Autowired
|
|
|
private MailSendService mailSendService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ReportAffairCasePhaseMapper reportAffairCasePhaseMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private AssoInvalidDecisionCronService assoInvalidDecisionCronService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SystemDictService systemDictService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private AssoReportCronService assoReportCronService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ReportProjectMapper reportProjectMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 创建报告事务
|
|
|
*
|
|
@@ -109,24 +129,45 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
|
|
|
LambdaQueryWrapper<AssoReportAffairFile> queryWrapper2 = new LambdaQueryWrapper<>();
|
|
|
queryWrapper2.eq(AssoReportAffairFile::getReportAffairId, id);
|
|
|
assoReportAffairFileService.remove(queryWrapper2);
|
|
|
+ Integer assoCasePhaseId = reportAffair.getAssoCasePhaseId();
|
|
|
+ ReportAffairCasePhase casePhase = reportAffairCasePhaseMapper.selectById(assoCasePhaseId);
|
|
|
+ Integer flowType = casePhase.getFlowType();
|
|
|
// 根据类型删除对应信息
|
|
|
- if (reportAffair.getAffairType() == 1) { //无效请求书
|
|
|
+ if (flowType.equals(1)) { //无效请求书
|
|
|
LambdaQueryWrapper<InvalidRequestFile> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
queryWrapper1.eq(InvalidRequestFile::getReportAffairId, id);
|
|
|
invalidRequestFileService.remove(queryWrapper1);
|
|
|
- } else if (reportAffair.getAffairType() == 0) {//口审查记录
|
|
|
+ } else if (flowType.equals(6)) {//口审查记录
|
|
|
LambdaQueryWrapper<OralTrail> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
queryWrapper1.eq(OralTrail::getReportAffairId, id);
|
|
|
oralTrailService.remove(queryWrapper1);
|
|
|
- } else if (reportAffair.getAffairType() == 3) {//无效决定书
|
|
|
+ } else if (flowType.equals(7)) {//无效决定书
|
|
|
+ Integer projectId = reportAffair.getProjectId();
|
|
|
+ //删除报告中的发文序号
|
|
|
+ ReportProject reportProject = reportProjectMapper.selectOne(new LambdaQueryWrapper<ReportProject>()
|
|
|
+ .eq(ReportProject::getProjectId, projectId));
|
|
|
+ reportProject.setId(reportProject.getId());
|
|
|
+ reportProject.setIssueNumber(null);
|
|
|
+ reportProject.updateById();
|
|
|
+ //删除报告无效结果与报告关联
|
|
|
+ LambdaQueryWrapper<AssoReportCron> reportCronWrapper = new LambdaQueryWrapper<>();
|
|
|
+ reportCronWrapper.eq(AssoReportCron::getProjectId, projectId);
|
|
|
+ assoReportCronService.remove(reportCronWrapper);
|
|
|
+ //删除无效决定书和无效结果关联
|
|
|
+ InvalidDecisionFile decisionFile = invalidDecisionFileService.getOne(new LambdaQueryWrapper<InvalidDecisionFile>()
|
|
|
+ .eq(InvalidDecisionFile::getReportAffairId, id));
|
|
|
+ LambdaQueryWrapper<AssoInvalidDecisionCron> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(AssoInvalidDecisionCron::getInvalidDecisionId, decisionFile.getId());
|
|
|
+ assoInvalidDecisionCronService.remove(wrapper);
|
|
|
+ //无效决定书
|
|
|
LambdaQueryWrapper<InvalidDecisionFile> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
queryWrapper1.eq(InvalidDecisionFile::getReportAffairId, id);
|
|
|
invalidDecisionFileService.remove(queryWrapper1);
|
|
|
- } else if (reportAffair.getAffairType().equals(5)) {//行政诉讼判决书
|
|
|
+ } else if (flowType.equals(16) || flowType.equals(26)) {//行政诉讼判决书
|
|
|
LambdaQueryWrapper<CourtOrder> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
queryWrapper1.eq(CourtOrder::getReportAffairId, id);
|
|
|
courtOrderService.remove(queryWrapper1);
|
|
|
- } else if (reportAffair.getAffairType().equals(8)) {//其他文档
|
|
|
+ } else if (flowType.equals(17) || flowType.equals(27) || flowType.equals(28)) {//其他文档
|
|
|
LambdaQueryWrapper<OtherDocuments> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
queryWrapper1.eq(OtherDocuments::getReportAffairId, id);
|
|
|
otherDocumentsService.remove(queryWrapper1);
|
|
@@ -162,30 +203,44 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
|
|
|
|
|
|
|
|
|
public List<ReportAffairVO> loadReportAffairVOS(List<ReportAffair> reportAffairs) {
|
|
|
+ List<Integer> collect = reportAffairs.stream().map(ReportAffair::getAssoCasePhaseId).collect(Collectors.toList());
|
|
|
+ List<ReportAffairCasePhase> phaseList = new ArrayList<>();
|
|
|
+ if (!CollectionUtils.isEmpty(collect)) {
|
|
|
+ List<ReportAffairCasePhase> phases = reportAffairCasePhaseMapper.selectList(new LambdaQueryWrapper<ReportAffairCasePhase>()
|
|
|
+ .in(BaseEntity::getId, collect));
|
|
|
+ phaseList.addAll(phases);
|
|
|
+ }
|
|
|
List<ReportAffairVO> reportAffairVOS = new ArrayList<>();
|
|
|
reportAffairs.forEach(item -> {
|
|
|
ReportAffairVO reportAffairVO = new ReportAffairVO();
|
|
|
BeanUtils.copyProperties(item, reportAffairVO);
|
|
|
- //根据事务类型选择不同的装载方式
|
|
|
- Integer type = reportAffairVO.getAffairType();
|
|
|
- if (type.equals(0)) {//0 口审记录
|
|
|
- this.loadOralTrail(reportAffairVO);
|
|
|
- } else if (type.equals(1)) {//1 无效请求书
|
|
|
- this.loadInvalidRequestFile(reportAffairVO);
|
|
|
- } else if (type.equals(2)) {//2 陈述意见书
|
|
|
- this.loadStateOpinion(reportAffairVO);
|
|
|
- } else if (type.equals(3)) {//3 无效决定书
|
|
|
- this.loadInvalidDecisionFile(reportAffairVO);
|
|
|
- } else if (type.equals(4)) {//4 行政诉讼书
|
|
|
- this.loadAdminProceed(reportAffairVO);
|
|
|
- } else if (type.equals(5)) {//5 行政诉讼判决书
|
|
|
- this.loadJudgment(reportAffairVO);
|
|
|
- } else if (type.equals(6)) {//6 权要修改记录
|
|
|
- this.loadClaimHistory(reportAffairVO);
|
|
|
- } else if (type.equals(7)) {//7 补充证据及理由
|
|
|
- this.loadSupplyEvidence(reportAffairVO);
|
|
|
- } else if (type.equals(8)) {//8 其他文档
|
|
|
- this.loadOtherDocuments(reportAffairVO);
|
|
|
+ ReportAffairCasePhase casePhase = phaseList.stream().filter(i -> i.getId().equals(item.getAssoCasePhaseId())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotEmpty(casePhase)) {
|
|
|
+ Integer type = casePhase.getFlowType();
|
|
|
+ reportAffairVO.setFlowName(casePhase.getFlowName());
|
|
|
+ reportAffairVO.setFlowType(type);
|
|
|
+ reportAffairVO.setCasePhase(casePhase.getCasePhase());
|
|
|
+ reportAffairVO.setCaseChildPhase(casePhase.getCaseChildPhase());
|
|
|
+ if (type.equals(6)) {//6 口审记录
|
|
|
+ this.loadOralTrail(reportAffairVO);
|
|
|
+ } else if (type.equals(1)) {//1 无效请求书
|
|
|
+ this.loadInvalidRequestFile(reportAffairVO);
|
|
|
+ } else if (type.equals(5)) {//5 陈述意见书
|
|
|
+ this.loadStateOpinion(reportAffairVO);
|
|
|
+ } else if (type.equals(7)) {//7 无效决定书
|
|
|
+ this.loadInvalidDecisionFile(reportAffairVO);
|
|
|
+ } else if (type.equals(15) || type.equals(25)) {//15 25 行政诉讼书
|
|
|
+ this.loadAdminProceed(reportAffairVO);
|
|
|
+ } else if (type.equals(16) || type.equals(26)) {//16 26 行政诉讼判决书
|
|
|
+ this.loadJudgment(reportAffairVO);
|
|
|
+ } else if (type.equals(2)) {//2 权要修改记录
|
|
|
+ this.loadClaimHistory(reportAffairVO);
|
|
|
+ } else if (type.equals(3)) {//3 补充证据及理由
|
|
|
+ this.loadSupplyEvidence(reportAffairVO);
|
|
|
+ } else if (type.equals(17) || type.equals(27) || type.equals(28)) {//17 27 28其他文档
|
|
|
+ this.loadOtherDocuments(reportAffairVO);
|
|
|
+ reportAffairVO.setCaseChildPhase(item.getCaseChildPhase());
|
|
|
+ }
|
|
|
}
|
|
|
reportAffairVOS.add(reportAffairVO);
|
|
|
});
|
|
@@ -194,6 +249,11 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
|
|
|
this.loadSystemFile(reportAffairVOS);
|
|
|
//装载创建人名
|
|
|
this.loadCreateName(reportAffairVOS);
|
|
|
+ List<ReportAffairVO> affairVOS = reportAffairVOS.stream().filter(i -> i.getFlowType().equals(7)).collect(Collectors.toList());
|
|
|
+ if (!CollectionUtils.isEmpty(affairVOS)) {
|
|
|
+ //装载无效决定书与无效结果关联
|
|
|
+ this.loadAssoInvalidDecisionCron(affairVOS);
|
|
|
+ }
|
|
|
}
|
|
|
return reportAffairVOS;
|
|
|
}
|
|
@@ -291,6 +351,46 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 装载无效决定书与无效结果关联
|
|
|
+ * @param reportAffairVOS
|
|
|
+ */
|
|
|
+ public void loadAssoInvalidDecisionCron(List<ReportAffairVO> reportAffairVOS) {
|
|
|
+ if (!CollectionUtils.isEmpty(reportAffairVOS)) {
|
|
|
+ List<InvalidDecisionFileVO> decisionFileVOS = reportAffairVOS.stream().map(ReportAffairVO::getInvalidDecisionFileVO).collect(Collectors.toList());
|
|
|
+ List<Integer> invalidDecisionIds = decisionFileVOS.stream().map(InvalidDecisionFileVO::getInvalidDecisionFileId).collect(Collectors.toList());
|
|
|
+ //查询核心结论
|
|
|
+ LambdaQueryWrapper<AssoInvalidDecisionCron> reportCronLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ reportCronLambdaQueryWrapper.in(AssoInvalidDecisionCron::getInvalidDecisionId, invalidDecisionIds);
|
|
|
+ List<AssoInvalidDecisionCron> crons = assoInvalidDecisionCronService.list(reportCronLambdaQueryWrapper);
|
|
|
+ List<SystemDict> systemDictList = new ArrayList<>();
|
|
|
+ if (!CollectionUtils.isEmpty(crons)) {
|
|
|
+ LambdaQueryWrapper<SystemDict> systemDictLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ systemDictLambdaQueryWrapper.eq(SystemDict::getGroupType, "ASSESS");
|
|
|
+ systemDictList = systemDictService.list(systemDictLambdaQueryWrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ for (InvalidDecisionFileVO decisionFileVO : decisionFileVOS) {
|
|
|
+ List<Integer> reCronIds = new ArrayList<>();
|
|
|
+ List<String> reCronNames = new ArrayList<>();
|
|
|
+ if (!CollectionUtils.isEmpty(crons)) {
|
|
|
+ List<AssoInvalidDecisionCron> decisionCrons = crons.stream().filter(item -> item.getInvalidDecisionId().equals(decisionFileVO.getInvalidDecisionFileId())).collect(Collectors.toList());
|
|
|
+ if (!CollectionUtils.isEmpty(decisionCrons)) {
|
|
|
+ //过滤出事件
|
|
|
+ List<Integer> cronIds = decisionCrons.stream().map(AssoInvalidDecisionCron::getCronId).collect(Collectors.toList());
|
|
|
+ List<SystemDict> systemDicts = systemDictList.stream().filter(item -> cronIds.contains(Integer.parseInt(item.getValue()))).collect(Collectors.toList());
|
|
|
+ systemDicts.forEach(item -> {
|
|
|
+ reCronIds.add(Integer.parseInt(item.getValue()));
|
|
|
+ reCronNames.add(item.getLabel());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ decisionFileVO.setCronIds(reCronIds);
|
|
|
+ decisionFileVO.setCronNames(reCronNames);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 装载行政诉讼书
|
|
|
*
|
|
|
* @param reportAffairVO
|
|
@@ -314,15 +414,17 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
|
|
|
if (projectId == null) {
|
|
|
throw new XiaoShiException("报告id为空");
|
|
|
}
|
|
|
+ if (ObjectUtils.isEmpty(addStateOpinionDTO.getAssoCasePhaseId())) {
|
|
|
+ throw new XiaoShiException("案件流程阶段id为空");
|
|
|
+ }
|
|
|
//1. 首先上传报告事务,拿到报告事务id
|
|
|
ReportAffairDTO reportAffairDTO = new ReportAffairDTO();
|
|
|
reportAffairDTO.setProjectId(projectId);
|
|
|
- //陈述意见书 2
|
|
|
- reportAffairDTO.setAffairType(2);
|
|
|
//发生时间是无效请求日
|
|
|
reportAffairDTO.setOccurredTime(addStateOpinionDTO.getStateReplyTime());
|
|
|
//备注
|
|
|
reportAffairDTO.setDescription(addStateOpinionDTO.getDescription());
|
|
|
+ reportAffairDTO.setAssoCasePhaseId(addStateOpinionDTO.getAssoCasePhaseId());
|
|
|
Integer reportAffairId = this.addReportAffair(reportAffairDTO);
|
|
|
|
|
|
if (reportAffairId == null) {
|
|
@@ -363,6 +465,9 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
|
|
|
if (projectId == null) {
|
|
|
throw new XiaoShiException("报告id为空");
|
|
|
}
|
|
|
+ if (ObjectUtils.isEmpty(updateStateOpinionDTO.getAssoCasePhaseId())) {
|
|
|
+ throw new XiaoShiException("案件流程阶段id为空");
|
|
|
+ }
|
|
|
//2. 拿到报告事务id,获取报告事务
|
|
|
ReportAffair reportAffair = this.getById(reportAffairId);
|
|
|
reportAffair.setProjectId(projectId);
|
|
@@ -370,6 +475,7 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
|
|
|
reportAffair.setOccurredTime(updateStateOpinionDTO.getStateReplyTime());
|
|
|
//备注
|
|
|
reportAffair.setDescription(updateStateOpinionDTO.getDescription());
|
|
|
+ reportAffair.setAssoCasePhaseId(updateStateOpinionDTO.getAssoCasePhaseId());
|
|
|
reportAffair.updateById();
|
|
|
//3. 更新报告事务与文件关联
|
|
|
List<String> fileGuids = updateStateOpinionDTO.getFileGuids();
|
|
@@ -428,15 +534,17 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
|
|
|
if (projectId == null) {
|
|
|
throw new XiaoShiException("报告id为空");
|
|
|
}
|
|
|
+ if (ObjectUtils.isEmpty(addClaimHistoryDTO.getAssoCasePhaseId())) {
|
|
|
+ throw new XiaoShiException("案件流程阶段id为空");
|
|
|
+ }
|
|
|
//1. 首先上传报告事务,拿到报告事务id
|
|
|
ReportAffairDTO reportAffairDTO = new ReportAffairDTO();
|
|
|
reportAffairDTO.setProjectId(projectId);
|
|
|
- //权要修改历史 6
|
|
|
- reportAffairDTO.setAffairType(6);
|
|
|
//发生时间是无效请求日
|
|
|
reportAffairDTO.setOccurredTime(addClaimHistoryDTO.getClaimHistoryTime());
|
|
|
//备注
|
|
|
reportAffairDTO.setDescription(addClaimHistoryDTO.getDescription());
|
|
|
+ reportAffairDTO.setAssoCasePhaseId(addClaimHistoryDTO.getAssoCasePhaseId());
|
|
|
Integer reportAffairId = this.addReportAffair(reportAffairDTO);
|
|
|
|
|
|
if (reportAffairId == null) {
|
|
@@ -477,6 +585,9 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
|
|
|
if (projectId == null) {
|
|
|
throw new XiaoShiException("报告id为空");
|
|
|
}
|
|
|
+ if (ObjectUtils.isEmpty(updateClaimHistoryDTO.getAssoCasePhaseId())) {
|
|
|
+ throw new XiaoShiException("案件流程阶段id为空");
|
|
|
+ }
|
|
|
//2. 拿到报告事务id,获取报告事务
|
|
|
ReportAffair reportAffair = this.getById(reportAffairId);
|
|
|
reportAffair.setProjectId(projectId);
|
|
@@ -484,6 +595,7 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
|
|
|
reportAffair.setOccurredTime(updateClaimHistoryDTO.getClaimHistoryTime());
|
|
|
//备注
|
|
|
reportAffair.setDescription(updateClaimHistoryDTO.getDescription());
|
|
|
+ reportAffair.setAssoCasePhaseId(updateClaimHistoryDTO.getAssoCasePhaseId());
|
|
|
reportAffair.updateById();
|
|
|
//3. 更新报告事务与文件关联
|
|
|
List<String> fileGuids = updateClaimHistoryDTO.getFileGuids();
|
|
@@ -507,15 +619,17 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
|
|
|
if (projectId == null) {
|
|
|
throw new XiaoShiException("报告id为空");
|
|
|
}
|
|
|
+ if (ObjectUtils.isEmpty(addSupplyEvidenceDTO.getAssoCasePhaseId())) {
|
|
|
+ throw new XiaoShiException("案件流程阶段id为空");
|
|
|
+ }
|
|
|
//1. 首先上传报告事务,拿到报告事务id
|
|
|
ReportAffairDTO reportAffairDTO = new ReportAffairDTO();
|
|
|
reportAffairDTO.setProjectId(projectId);
|
|
|
- //补充证据及理由 7
|
|
|
- reportAffairDTO.setAffairType(7);
|
|
|
//发生时间是无效请求日
|
|
|
reportAffairDTO.setOccurredTime(addSupplyEvidenceDTO.getSupplyEvidenceTime());
|
|
|
//备注
|
|
|
reportAffairDTO.setDescription(addSupplyEvidenceDTO.getDescription());
|
|
|
+ reportAffairDTO.setAssoCasePhaseId(addSupplyEvidenceDTO.getAssoCasePhaseId());
|
|
|
Integer reportAffairId = this.addReportAffair(reportAffairDTO);
|
|
|
|
|
|
if (reportAffairId == null) {
|
|
@@ -556,6 +670,9 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
|
|
|
if (projectId == null) {
|
|
|
throw new XiaoShiException("报告id为空");
|
|
|
}
|
|
|
+ if (ObjectUtils.isEmpty(updateSupplyEvidenceDTO.getAssoCasePhaseId())) {
|
|
|
+ throw new XiaoShiException("案件流程阶段id为空");
|
|
|
+ }
|
|
|
//2. 拿到报告事务id,获取报告事务
|
|
|
ReportAffair reportAffair = this.getById(reportAffairId);
|
|
|
reportAffair.setProjectId(projectId);
|
|
@@ -563,6 +680,7 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
|
|
|
reportAffair.setOccurredTime(updateSupplyEvidenceDTO.getSupplyEvidenceTime());
|
|
|
//备注
|
|
|
reportAffair.setDescription(updateSupplyEvidenceDTO.getDescription());
|
|
|
+ reportAffair.setAssoCasePhaseId(updateSupplyEvidenceDTO.getAssoCasePhaseId());
|
|
|
reportAffair.updateById();
|
|
|
//3. 更新报告事务与文件关联
|
|
|
List<String> fileGuids = updateSupplyEvidenceDTO.getFileGuids();
|
|
@@ -613,4 +731,89 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
|
|
|
reportAffairVO.setOtherDocumentsVO(otherDocumentsVO);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 添加案件文档
|
|
|
+ * @param vo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Integer addReportAffairCase(ReportAffairCaseDTO vo){
|
|
|
+ if (ObjectUtils.isEmpty(vo)) {
|
|
|
+ throw new XiaoShiException("入参为空");
|
|
|
+ }
|
|
|
+ Integer projectId = vo.getProjectId();
|
|
|
+ if (projectId == null) {
|
|
|
+ throw new XiaoShiException("报告id为空");
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isEmpty(vo.getAssoCasePhaseId())) {
|
|
|
+ throw new XiaoShiException("案件流程阶段id为空");
|
|
|
+ }
|
|
|
+ //1. 首先上传报告事务,拿到报告事务id
|
|
|
+ ReportAffairDTO reportAffairDTO = new ReportAffairDTO();
|
|
|
+ reportAffairDTO.setProjectId(projectId);
|
|
|
+ //发生时间是无效请求日
|
|
|
+ reportAffairDTO.setOccurredTime(vo.getOccurredTime());
|
|
|
+ //备注
|
|
|
+ reportAffairDTO.setDescription(vo.getDescription());
|
|
|
+ reportAffairDTO.setAssoCasePhaseId(vo.getAssoCasePhaseId());
|
|
|
+ Integer reportAffairId = this.addReportAffair(reportAffairDTO);
|
|
|
+
|
|
|
+ if (reportAffairId == null) {
|
|
|
+ throw new XiaoShiException("上传报告事务失败");
|
|
|
+ }
|
|
|
+ //3. 添加报告事务与文件关联
|
|
|
+ List<String> fileGuids = vo.getFileGuids();
|
|
|
+ if (!CollectionUtils.isEmpty(fileGuids)) {
|
|
|
+ List<AssoReportAffairFile> assoReportAffairFiles = new ArrayList<>();
|
|
|
+ fileGuids.forEach(item -> {
|
|
|
+ AssoReportAffairFile assoReportAffairFile = new AssoReportAffairFile();
|
|
|
+ assoReportAffairFile.setReportAffairId(reportAffairId);
|
|
|
+ assoReportAffairFile.setFileGuid(item);
|
|
|
+ assoReportAffairFiles.add(assoReportAffairFile);
|
|
|
+ });
|
|
|
+ assoReportAffairFileService.saveBatch(assoReportAffairFiles);
|
|
|
+ }
|
|
|
+ if (vo.getIfSendEmail()) {
|
|
|
+ sendReportMailService.finalSendEmail(projectId, fileGuids, vo.getExtraEmailDTOS());
|
|
|
+ }
|
|
|
+ return reportAffairId;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改案件文档
|
|
|
+ * @param vo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Integer updateReportAffairCase(ReportAffairCaseDTO vo){
|
|
|
+ if (ObjectUtils.isEmpty(vo)) {
|
|
|
+ throw new XiaoShiException("入参为空");
|
|
|
+ }
|
|
|
+ Integer projectId = vo.getProjectId();
|
|
|
+ Integer reportAffairId = vo.getId();
|
|
|
+ if (reportAffairId == null) {
|
|
|
+ throw new XiaoShiException("reportAffairId为空");
|
|
|
+ }
|
|
|
+ if (projectId == null) {
|
|
|
+ throw new XiaoShiException("报告id为空");
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isEmpty(vo.getAssoCasePhaseId())) {
|
|
|
+ throw new XiaoShiException("案件流程阶段id为空");
|
|
|
+ }
|
|
|
+ //2. 拿到报告事务id,获取报告事务
|
|
|
+ ReportAffair reportAffair = this.getById(reportAffairId);
|
|
|
+ reportAffair.setProjectId(projectId);
|
|
|
+ //发生时间是无效请求日
|
|
|
+ reportAffair.setOccurredTime(vo.getOccurredTime());
|
|
|
+ //备注
|
|
|
+ reportAffair.setDescription(vo.getDescription());
|
|
|
+ reportAffair.setAssoCasePhaseId(vo.getAssoCasePhaseId());
|
|
|
+ reportAffair.updateById();
|
|
|
+ //3. 更新报告事务与文件关联
|
|
|
+ List<String> fileGuids = vo.getFileGuids();
|
|
|
+ assoReportAffairFileService.updateAffairFile(reportAffairId, fileGuids);
|
|
|
+ if (vo.getIfSendEmail()) {
|
|
|
+ sendReportMailService.finalSendEmail(projectId, fileGuids, vo.getExtraEmailDTOS());
|
|
|
+ }
|
|
|
+ return reportAffairId;
|
|
|
+ }
|
|
|
+
|
|
|
}
|