|
@@ -13,6 +13,7 @@ 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.service.MailSendService;
|
|
|
import cn.cslg.pas.service.common.FileManagerService;
|
|
@@ -22,6 +23,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 +80,9 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
|
|
|
@Autowired
|
|
|
private MailSendService mailSendService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ReportAffairCasePhaseMapper reportAffairCasePhaseMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 创建报告事务
|
|
|
*
|
|
@@ -109,24 +115,27 @@ 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)) {//无效决定书
|
|
|
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)) {//其他文档
|
|
|
LambdaQueryWrapper<OtherDocuments> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
queryWrapper1.eq(OtherDocuments::getReportAffairId, id);
|
|
|
otherDocumentsService.remove(queryWrapper1);
|
|
@@ -162,30 +171,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)) {//17 27 其他文档
|
|
|
+ this.loadOtherDocuments(reportAffairVO);
|
|
|
+ reportAffairVO.setCaseChildPhase(item.getCaseChildPhase());
|
|
|
+ }
|
|
|
}
|
|
|
reportAffairVOS.add(reportAffairVO);
|
|
|
});
|
|
@@ -323,6 +346,7 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
|
|
|
reportAffairDTO.setOccurredTime(addStateOpinionDTO.getStateReplyTime());
|
|
|
//备注
|
|
|
reportAffairDTO.setDescription(addStateOpinionDTO.getDescription());
|
|
|
+ reportAffairDTO.setAssoCasePhaseId(addStateOpinionDTO.getAssoCasePhaseId());
|
|
|
Integer reportAffairId = this.addReportAffair(reportAffairDTO);
|
|
|
|
|
|
if (reportAffairId == null) {
|
|
@@ -370,6 +394,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();
|
|
@@ -437,6 +462,7 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
|
|
|
reportAffairDTO.setOccurredTime(addClaimHistoryDTO.getClaimHistoryTime());
|
|
|
//备注
|
|
|
reportAffairDTO.setDescription(addClaimHistoryDTO.getDescription());
|
|
|
+ reportAffairDTO.setAssoCasePhaseId(addClaimHistoryDTO.getAssoCasePhaseId());
|
|
|
Integer reportAffairId = this.addReportAffair(reportAffairDTO);
|
|
|
|
|
|
if (reportAffairId == null) {
|
|
@@ -484,6 +510,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();
|
|
@@ -516,6 +543,7 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
|
|
|
reportAffairDTO.setOccurredTime(addSupplyEvidenceDTO.getSupplyEvidenceTime());
|
|
|
//备注
|
|
|
reportAffairDTO.setDescription(addSupplyEvidenceDTO.getDescription());
|
|
|
+ reportAffairDTO.setAssoCasePhaseId(addSupplyEvidenceDTO.getAssoCasePhaseId());
|
|
|
Integer reportAffairId = this.addReportAffair(reportAffairDTO);
|
|
|
|
|
|
if (reportAffairId == null) {
|
|
@@ -563,6 +591,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 +642,83 @@ 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为空");
|
|
|
+ }
|
|
|
+ //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为空");
|
|
|
+ }
|
|
|
+ //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;
|
|
|
+ }
|
|
|
+
|
|
|
}
|