From 418eb69319481f176a49ab085b971d81d55661f7 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 20 五月 2025 10:32:36 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/2.0.1' into 2.0.1
---
server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java | 1167 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 1,153 insertions(+), 14 deletions(-)
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java
index f79a210..f55fd08 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java
@@ -1,7 +1,7 @@
package com.doumee.service.business.impl;
+import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.extension.api.R;
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
@@ -9,15 +9,16 @@
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Constants;
+import com.doumee.core.utils.DateUtil;
import com.doumee.core.utils.Utils;
-import com.doumee.dao.business.NoticesMapper;
-import com.doumee.dao.business.SettleClaimsLogMapper;
-import com.doumee.dao.business.SettleClaimsMapper;
-import com.doumee.dao.business.dto.SCSupplementDTO;
+import com.doumee.dao.business.*;
+import com.doumee.dao.business.dto.*;
import com.doumee.dao.business.join.MultifileJoinMapper;
import com.doumee.dao.business.join.SettleClaimsJoinMapper;
import com.doumee.dao.business.join.SettleClaimsLogJoinMapper;
import com.doumee.dao.business.model.*;
+import com.doumee.dao.business.vo.CompensationVO;
+import com.doumee.dao.business.vo.RiskConfigVO;
import com.doumee.dao.system.model.SystemUser;
import com.doumee.service.business.SettleClaimsLogService;
import com.doumee.service.business.SettleClaimsService;
@@ -25,21 +26,28 @@
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.doumee.service.system.impl.SystemDictDataServiceImpl;
import com.github.xiaoymin.knife4j.core.util.CollectionUtils;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
+import org.checkerframework.checker.units.qual.A;
+import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
+import java.math.BigDecimal;
import java.net.URLEncoder;
+import java.nio.charset.Charset;
import java.util.*;
import java.util.stream.Collectors;
@@ -70,6 +78,19 @@
@Autowired
private NoticesMapper noticesMapper;
+
+ @Autowired
+ private InsuranceApplyMapper insuranceApplyMapper;
+
+ @Autowired
+ private SolutionsMapper solutionsMapper;
+
+ @Autowired
+ private SolutionsBaseMapper solutionsBaseMapper;
+
+ @Autowired
+ private ApplyDetailMapper applyDetailMapper;
+
/**
* 鍒犻櫎闄勪欢
* @return
@@ -214,11 +235,11 @@
update.setId(model.getId());
settleClaimsMapper.updateById(update);
-// Constants.SettleClaimsLogType applyLogType = Constants.SettleClaimsLogType.PLATFORM_REMARK;
-// String info =applyLogType.getInfo();
-// info = info.replace("${param}", param.getCheckInfo());
-// SettleClaimsLog log = new SettleClaimsLog(update,applyLogType.getName(), info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update));
-// settleClaimsLogMapper.insert(log);
+ Constants.SettleClaimsLogType applyLogType = Constants.SettleClaimsLogType.PLATFORM_REMARK;
+ String info =applyLogType.getInfo();
+ info = info.replace("${param}", param.getCheckInfo());
+ SettleClaimsLog log = new SettleClaimsLog(update,applyLogType.getName(), info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update));
+ settleClaimsLogMapper.insert(log);
return 1;
}
@@ -352,7 +373,68 @@
SettleClaimsLog log = new SettleClaimsLog(update,applyLogType.getName(), info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update));
settleClaimsLogMapper.insert(log);
return 1;
+ }
+
+ @Override
+ public Integer createSys(SettleClaims settleClaims) {
+ LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ settleClaims.setOrigin(Constants.ONE);
+ if(Objects.isNull(settleClaims)
+ || Objects.isNull(settleClaims.getMemberName())
+ || Objects.isNull(settleClaims.getSolutionName())
+ || Objects.isNull(settleClaims.getDuId())
+ || Objects.isNull(settleClaims.getWorktypeId())
+ || Objects.isNull(settleClaims.getHappenTime())
+ || Objects.isNull(settleClaims.getType())
+ || Objects.isNull(settleClaims.getInHospital())
+ || Objects.isNull(settleClaims.getMedicalInsurance())
+ || Objects.isNull(settleClaims.getContent())
+ || Objects.isNull(settleClaims.getInformantName())
+ || Objects.isNull(settleClaims.getInformantPhone())){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ if(!loginUserInfo.getType().equals(Constants.ONE)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炰紒涓氬憳宸ユ棤娉曡繘琛岃鎿嶄綔");
+ }
+ //鏌ヨ鏄惁瀛樺湪宸叉彁鎶ョ殑鏁版嵁 鏍规嵁浜哄憳鍜屼繚闄╂柟妗堣繘琛岃繃婊� 鏄惁瀛樺湪杩涜涓殑鏁版嵁
+ if(settleClaimsMapper.selectCount(new QueryWrapper<SettleClaims>().lambda()
+ .eq(SettleClaims::getSolutionId,settleClaims.getSolutionId())
+ .eq(SettleClaims::getMemberId,loginUserInfo.getId())
+ .in(SettleClaims::getStatus,Constants.SettleClaimsStatus.WAIT_ACCEPTANCE.getKey(),
+ Constants.SettleClaimsStatus.CONFIRM_INFORMATION.getKey())
+ )>Constants.ZERO){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀛樺湪鎻愭姤涓殑鎶ユ鏁版嵁!");
+ }
+ settleClaims.setCreateDate(new Date());
+ settleClaims.setIsdeleted(Constants.ZERO);
+ settleClaims.setCompanyId(loginUserInfo.getCompanyId());
+ settleClaims.setStatus(Constants.SettleClaimsStatus.WAIT_ACCEPTANCE.getKey());
+ settleClaims.setCreator(loginUserInfo.getId());
+ settleClaims.setCheckUserId(loginUserInfo.getId());
+ settleClaimsMapper.insert(settleClaims);
+
+ List<Multifile> reportVideo = settleClaims.getReportFileList();
+ if(CollectionUtils.isNotEmpty(reportVideo)){
+ for (int i = 0; i < reportVideo.size(); i++) {
+ Multifile multifile = reportVideo.get(i);
+ if(Objects.isNull(multifile.getFileurl())
+ || Objects.isNull(multifile.getType())
+ || StringUtils.isBlank(multifile.getName())
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"闄勪欢鍐呭寮傚父");
+ }
+ multifile.setCreator(loginUserInfo.getId());
+ multifile.setCreateDate(new Date());
+ multifile.setIsdeleted(Constants.ZERO);
+ multifile.setObjId(settleClaims.getId());
+ multifile.setObjType(Constants.ONE);
+ multifile.setSortnum(i+1);
+ multifileJoinMapper.insert(multifile);
+ }
+ }
+
+ return settleClaims.getId();
}
@Override
public Integer create(SettleClaims settleClaims) {
@@ -445,6 +527,7 @@
List<File> fileList = new ArrayList<>();
List<Multifile> multifileList = multifileJoinMapper.selectList(new QueryWrapper<Multifile>().lambda()
+ .eq(Multifile::getIsdeleted,Constants.ZERO)
.eq(Multifile::getObjId,id)
.isNotNull(Multifile::getFileurl)
.in(Multifile::getObjType, Arrays.asList(new Integer[]{
@@ -471,14 +554,14 @@
if(fileList == null || fileList.size() == 0){
throw new BusinessException(ResponseStatus.DATA_EMPTY);
}
- String fileName = model.getInformantName() +"鐞嗚禂璧勬枡涓媉"+System.currentTimeMillis()+".zip" ;
- String encodeFileName = URLEncoder.encode(fileName);
+ String fileName = model.getInformantName() +"-鐞嗚禂璧勬枡-" +System.currentTimeMillis();
+ String encodeFileName =URLEncoder.encode(fileName, Charset.forName("UTF-8").toString())+".zip";
response.setHeader("Content-Disposition","attachment;filename=" + encodeFileName);
response.setContentType("application/octet-stream");
response.setHeader("eva-opera-type", "download");
response.setHeader("eva-download-filename", encodeFileName);
Constants.packFilesToZip(fileList,response.getOutputStream());
- } catch (IOException e) {
+ } catch (Exception e) {
throw new BusinessException(ResponseStatus.EXPORT_EXCEL_ERROR, e);
}
}
@@ -548,6 +631,8 @@
settleClaims.setDisabilityFileList(multifileList.stream().filter(m->m.getObjType().equals(Constants.MultiFile.LP_SCZL_FILE.getKey())).collect(Collectors.toList()));
settleClaims.setCompensationFileList(multifileList.stream().filter(m->m.getObjType().equals(Constants.MultiFile.LP_JACL_FILE.getKey())).collect(Collectors.toList()));
+
+ settleClaims.setOtherFileList(multifileList.stream().filter(m->m.getObjType().equals(Constants.MultiFile.LP_OTHER_FILE.getKey())).collect(Collectors.toList()));
}
//鏌ヨ鎿嶄綔璁板綍
@@ -691,7 +776,6 @@
){
throw new BusinessException(ResponseStatus.BAD_REQUEST);
}
-
SettleClaims settleClaims = settleClaimsMapper.selectById(scSupplementDTO.getId());
if(!(settleClaims.getStatus().equals(Constants.SettleClaimsStatus.WAIT_ACCEPTANCE.getKey())
|| settleClaims.getStatus().equals(Constants.SettleClaimsStatus.DEAL_ING.getKey())
@@ -803,6 +887,7 @@
.leftJoin(InsuranceApply.class,InsuranceApply::getId,SettleClaims::getInsuranceApplyId)
.leftJoin(Solutions.class,Solutions::getId,SettleClaims::getSolutionId);
queryWrapper.eq(DispatchUnit::getIsdeleted,Constants.ZERO);
+ queryWrapper.eq(SettleClaims::getIsdeleted,Constants.ZERO);
if(Constants.equalsInteger(user.getType(),Constants.ZERO)){
//鍙兘鐪嬫潈闄愯寖鍥村唴
if(user.getCompanyIdList() == null || user.getCompanyIdList().size() == 0){
@@ -938,4 +1023,1058 @@
QueryWrapper<SettleClaims> wrapper = new QueryWrapper<>(settleClaims);
return settleClaimsMapper.selectCount(wrapper);
}
+
+
+ @Override
+ @Transactional(rollbackFor = {BusinessException.class,Exception.class})
+ public void saveSettleClaims(SettleClaimsDTO settleClaimsDTO,SystemDictDataServiceImpl systemDictDataService){
+ LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ if(!loginUserInfo.getType().equals(Constants.ONE)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炰紒涓氬憳宸ユ棤娉曡繘琛岃鎿嶄綔");
+ }
+ if(Objects.isNull(settleClaimsDTO)
+ || Objects.isNull(settleClaimsDTO.getSaveType())
+ || Objects.isNull(settleClaimsDTO.getMemberId())
+ ||StringUtils.isBlank(settleClaimsDTO.getIdcardNo())
+ || Objects.isNull(settleClaimsDTO.getInsuranceApplyId())
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ if(Constants.equalsInteger(settleClaimsDTO.getSaveType(),Constants.ONE)){
+ if(Objects.isNull(settleClaimsDTO.getSolutionId())
+ ||Objects.isNull(settleClaimsDTO.getWorktypeId())
+ ||Objects.isNull(settleClaimsDTO.getDuId())
+ ||StringUtils.isBlank(settleClaimsDTO.getHappenTime())
+ ||StringUtils.isBlank(settleClaimsDTO.getContent())
+ ||Objects.isNull(settleClaimsDTO.getType())
+ ||Objects.isNull(settleClaimsDTO.getInHospital())
+ ||Objects.isNull(settleClaimsDTO.getHurtType())
+ ||Objects.isNull(settleClaimsDTO.getMedicalInsurance())
+ ||StringUtils.isBlank(settleClaimsDTO.getInformantName())
+ ||StringUtils.isBlank(settleClaimsDTO.getInformantPhone())
+ ||StringUtils.isBlank(settleClaimsDTO.getReceiveUserName())
+ ||StringUtils.isBlank(settleClaimsDTO.getReceiveBank())
+ ||StringUtils.isBlank(settleClaimsDTO.getReceiveAccount())
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ }
+ SettleClaims settleClaims = new SettleClaims();
+ BeanUtils.copyProperties(settleClaimsDTO,settleClaims);
+ settleClaims.setReportNumStatus(Constants.ZERO);
+ if(Objects.nonNull(settleClaims.getId())){
+ settleClaims.setEditDate(new Date());
+ settleClaims.setEditor(loginUserInfo.getId());
+ settleClaims.setStatus(Constants.equalsInteger(settleClaimsDTO.getSaveType(),Constants.ONE)?
+ Constants.SettleClaimsStatus.RETURN_ACCEPTANCE.getKey():Constants.SettleClaimsStatus.WAIT_ACCEPTANCE.getKey());
+ if(Constants.equalsInteger(settleClaimsDTO.getSaveType(),Constants.ONE)){
+ //澶勭悊椋庨櫓淇℃伅
+ this.saveRisk(settleClaims,settleClaimsDTO,systemDictDataService);
+ }
+
+ settleClaimsMapper.updateById(settleClaims);
+ }else{
+ settleClaims.setCreateDate(new Date());
+ settleClaims.setIsdeleted(Constants.ZERO);
+ settleClaims.setCompanyId(loginUserInfo.getCompanyId());
+ settleClaims.setStatus(Constants.equalsInteger(settleClaimsDTO.getSaveType(),Constants.ONE)?
+ Constants.SettleClaimsStatus.RETURN_ACCEPTANCE.getKey():Constants.SettleClaimsStatus.WAIT_ACCEPTANCE.getKey());
+ if(Constants.equalsInteger(settleClaimsDTO.getSaveType(),Constants.ONE)){
+ //澶勭悊椋庨櫓淇℃伅
+ this.saveRisk(settleClaims,settleClaimsDTO,systemDictDataService);
+ }
+ settleClaims.setCreator(loginUserInfo.getId());
+ settleClaims.setCheckUserId(loginUserInfo.getId());
+ settleClaimsMapper.insert(settleClaims);
+ }
+ this.saveFile(settleClaims,settleClaimsDTO,loginUserInfo);
+
+ //璁板綍鏃ュ織
+ this.saveSettleClaimsLog(settleClaims,Constants.SettleClaimsLogType.UPLOAD,null);
+ }
+
+ public void saveRisk(SettleClaims settleClaims, SettleClaimsDTO settleClaimsDTO, SystemDictDataServiceImpl systemDictDataService){
+ //鏍规嵁淇濆崟淇℃伅 鏌ヨ鍑轰富鏂规
+ InsuranceApply insuranceApply = insuranceApplyMapper.selectById(settleClaims.getInsuranceApplyId());
+ if(Objects.isNull(insuranceApply)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌淇濆崟鏁版嵁");
+ }
+ Date happenTime = DateUtil.StringToDate(settleClaims.getHappenTime());
+ if(happenTime.getTime() < insuranceApply.getStartTime().getTime() || happenTime.getTime() > insuranceApply.getEndTime().getTime()){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"浜嬫晠鍙戠敓浜嬩欢鏈湪淇濆崟鐢熸晥鑼冨洿鍐�");
+ }
+ Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId());
+ if(Objects.isNull(solutions)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌瀛愭柟妗堜俊鎭�");
+ }
+ SolutionsBase solutionsBase = solutionsBaseMapper.selectById(solutions.getParentId());
+ if(Objects.isNull(solutionsBase)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌涓绘柟妗堜俊鎭�");
+ }
+ List<Map<String,String>> riskList = new ArrayList<>();
+ //鏌ヨ淇濆崟鏄庣粏鏁版嵁
+ ApplyDetail applyDetail = applyDetailMapper.selectOne(new QueryWrapper<ApplyDetail>().lambda().eq(ApplyDetail::getApplyId,settleClaims.getInsuranceApplyId()).eq(ApplyDetail::getId,settleClaimsDTO.getApplyDetailId()).last("limit 1 "));
+ //鏄惁寮�鍚� 鏂板憳宸ユ姤妗� 0涓嶅厑璁� 1鍏佽
+ if(Constants.equalsInteger(solutionsBase.getRiskNewUserStatus(),Constants.ONE)
+ && Objects.nonNull(solutionsBase.getRiskNewUserUnit())
+ && Objects.nonNull(solutionsBase.getRiskNewUserTime())
+ ){
+ if(happenTime.getTime() > applyDetail.getEndTime().getTime()){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"浜嬫晠鍙戠敓鏃堕棿鏈湪浜哄憳淇濋殰鏃ユ湡鑼冨洿鍐�");
+ }
+ Map<String,String> map = new HashMap<>();
+ map.put("title","淇濆崟宸叉姇淇濇湭鐢熸晥");
+ Date startDate = applyDetail.getStartTime();
+ if(Constants.equalsInteger(solutionsBase.getRiskNewUserUnit(),Constants.ONE)){
+ startDate = DateUtil.afterMinutesByDate(-solutionsBase.getRiskNewUserTime()*60,startDate);
+ }else if(Constants.equalsInteger(solutionsBase.getRiskNewUserUnit(),Constants.TWO)){
+ startDate = DateUtil.afterDayByDate(-solutionsBase.getRiskNewUserTime(),happenTime);
+ }else{
+ if(happenTime.getTime() < applyDetail.getStartTime().getTime() || happenTime.getTime() > applyDetail.getEndTime().getTime()){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"浜嬫晠鍙戠敓鏃堕棿鏈湪浜哄憳淇濋殰鏃ユ湡鑼冨洿鍐�");
+ }
+ }
+ if(happenTime.getTime() < startDate.getTime() ){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"浜嬫晠鍙戠敓鏃堕棿鏈湪浜哄憳淇濋殰鏃ユ湡鑼冨洿鍐�");
+ }else{
+ map.put("info","浜嬫晠鍙戠敓鏃堕棿鏃╀簬淇濆崟鐢熸晥鏃堕棿"+solutionsBase.getRiskNewUserUnit()+(Constants.equalsInteger(solutionsBase.getRiskNewUserUnit(),Constants.ONE)?"灏忔椂鍐�":"澶╁唴"));
+ riskList.add(map);
+ }
+ }else{
+ if(happenTime.getTime() < applyDetail.getStartTime().getTime() || happenTime.getTime() > applyDetail.getEndTime().getTime()){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"浜嬫晠鍙戠敓鏃堕棿鏈湪浜哄憳淇濋殰鏃ユ湡鑼冨洿鍐�");
+ }
+ }
+
+ //鏄惁寮�鍚� 寤惰繜鎶ユ鎻愰啋鏄惁寮�鍚� 0涓嶅厑璁� 1鍏佽
+ if(Constants.equalsInteger(solutionsBase.getRiskDelayStatus(),Constants.ONE)){
+ Map<String,String> map = new HashMap<>();
+ map.put("title","寤惰繜鎶ユ鎻愰啋");
+ //鏍规嵁閰嶇疆 鏌ヨ 寤惰繜鎶ユ鎻愰啋鏃堕棿鍗曚綅 0鍒嗛挓 1灏忔椂 2澶�
+ if(Constants.equalsInteger(solutionsBase.getRiskDelayUnit(),Constants.ZERO)){
+ if(DateUtil.getBetweenMin(happenTime,new Date())>solutionsBase.getRiskDelayTime()){
+ map.put("info","鎶ユ鏃堕棿瓒呰繃妗堝彂鏃堕棿"+solutionsBase.getRiskDelayUnit()+"鍒嗛挓");
+ riskList.add(map);
+ }
+ }else if(Constants.equalsInteger(solutionsBase.getRiskDelayUnit(),Constants.ONE)){
+ if(DateUtil.getBetweenHours(happenTime,new Date())>solutionsBase.getRiskDelayTime()){
+ map.put("info","鎶ユ鏃堕棿瓒呰繃妗堝彂鏃堕棿"+solutionsBase.getRiskDelayUnit()+"灏忔椂");
+ riskList.add(map);
+ }
+ }else if(Constants.equalsInteger(solutionsBase.getRiskDelayUnit(),Constants.TWO)){
+ if(DateUtil.getBetweenDay(happenTime,new Date())>solutionsBase.getRiskDelayTime()){
+ map.put("info","鎶ユ鏃堕棿瓒呰繃妗堝彂鏃堕棿"+solutionsBase.getRiskDelayUnit()+"澶�");
+ riskList.add(map);
+ }
+ }
+ }
+
+ //鏌ヨ瀛楀吀鍊奸厤缃俊鎭�
+ RiskConfigVO riskConfigVO = systemDictDataService.getRiskConfig();
+ //澶氭鍑洪櫓鎻愰啋
+ if(StringUtils.isNotBlank(riskConfigVO.getRiskTimesOpen()) && StringUtils.equals(riskConfigVO.getRiskTimesOpen(),Constants.ONE+"")
+ && StringUtils.isNotBlank(riskConfigVO.getRiskTimesReportTimes())){
+ Integer cxcs = settleClaimsMapper.selectCount(new QueryWrapper<SettleClaims>().lambda()
+ .eq(SettleClaims::getMemberId,settleClaimsDTO.getMemberId())
+ .ne(Objects.nonNull(settleClaims.getId()),SettleClaims::getId,settleClaims.getId())
+ .apply(" HAPPEN_TIME > DATE_SUB(now(), INTERVAL 365 DAY) ")
+ );
+ if(cxcs>Integer.valueOf(riskConfigVO.getRiskTimesReportTimes())){
+ Map<String,String> map = new HashMap<>();
+ map.put("title","鐤戜技澶氭鍑洪櫓");
+ map.put("info","鍑洪櫓浜轰竴骞村唴宸插嚭闄�"+cxcs+"娆�");
+ riskList.add(map);
+ settleClaims.setRiskTimesCx(Constants.ONE);
+ };
+ }
+ //鐤戜技閲嶅鎶ユ
+ if(StringUtils.isNotBlank(riskConfigVO.getRiskRepeatReportOpen())
+ && StringUtils.equals(riskConfigVO.getRiskRepeatReportOpen(),Constants.ONE+"")
+ && StringUtils.isNotBlank(riskConfigVO.getRiskRepeatReportTimeUnit())
+ && StringUtils.isNotBlank(riskConfigVO.getRiskRepeatReportTime())){
+ Integer cxcs = settleClaimsMapper.selectCount(new QueryWrapper<SettleClaims>().lambda()
+ .eq(SettleClaims::getMemberId,settleClaimsDTO.getMemberId())
+ .ne(Objects.nonNull(settleClaims.getId()),SettleClaims::getId,settleClaims.getId())
+ .apply(riskConfigVO.getRiskRepeatReportTimeUnit().equals("1")," HAPPEN_TIME > DATE_SUB(now(), INTERVAL "+riskConfigVO.getRiskRepeatReportTime()+" HOUR) ")
+ .apply(riskConfigVO.getRiskRepeatReportTimeUnit().equals("2")," HAPPEN_TIME > DATE_SUB(now(), INTERVAL "+riskConfigVO.getRiskRepeatReportTime()+" DAY) ")
+ );
+ if(cxcs > Constants.TWO){
+ Map<String,String> map = new HashMap<>();
+ map.put("title","鐤戜技閲嶅鎶ユ");
+ map.put("info","璇ュ嚭闄╀汉鍦�"+riskConfigVO.getRiskRepeatReportTime()+(riskConfigVO.getRiskRepeatReportTimeUnit().equals("1")?"灏忔椂":"澶�")+"鍐呭凡鎶ユ"+cxcs+"娆�");
+ riskList.add(map);
+ settleClaims.setRiskRepeat(Constants.ONE);
+ }
+ }
+
+
+ //绱㈣禂娆℃暟杩囧鎻愰啋
+ if(StringUtils.isNotBlank(riskConfigVO.getRiskClaimTimesOpen())
+ && StringUtils.equals(riskConfigVO.getRiskClaimTimesOpen(),Constants.ONE+"")
+ && StringUtils.isNotBlank(riskConfigVO.getRiskClaimTimes())){
+ Integer cxcs = settleClaimsMapper.selectCount(new QueryWrapper<SettleClaims>().lambda()
+ .eq(SettleClaims::getInsuranceApplyId,settleClaimsDTO.getInsuranceApplyId())
+ .ne(Objects.nonNull(settleClaims.getId()),SettleClaims::getId,settleClaims.getId())
+ .apply(" HAPPEN_TIME > DATE_SUB(now(), INTERVAL 365 DAY) ")
+ );
+ if(cxcs > Integer.valueOf(riskConfigVO.getRiskClaimTimes())){
+ Map<String,String> map = new HashMap<>();
+ map.put("title","璇ヤ繚鍗曠储璧旀鏁拌繃澶�");
+ map.put("info","绱绱㈣禂娆℃暟宸插埌杈�"+cxcs+"娆�");
+ riskList.add(map);
+ settleClaims.setRiskTimesSp(Constants.ONE);
+ }
+ }
+
+ //璁捐鏁忔劅璇嶆眹
+ if(StringUtils.isNotBlank(riskConfigVO.getRiskSensitiveWordsOpen())
+ && StringUtils.equals(riskConfigVO.getRiskSensitiveWordsOpen(),Constants.ONE+"")
+ && StringUtils.isNotBlank(riskConfigVO.getRiskSensitiveWords())){
+ String [] words = riskConfigVO.getRiskSensitiveWords().split(",");
+ String sensitiveWord = "";
+ for (String word:words) {
+ if(settleClaims.getContent().indexOf(word)>=Constants.ZERO){
+ if(Constants.equalsInteger(sensitiveWord.length(),Constants.ZERO)){
+ sensitiveWord = word;
+ }else{
+ sensitiveWord = sensitiveWord + "銆�" + word ;
+ }
+ }
+ }
+ if(!Constants.equalsInteger(sensitiveWord.length(),Constants.ZERO)){
+ Map<String,String> map = new HashMap<>();
+ map.put("title","娑夊強鏁忔劅璇�");
+ map.put("info","妫�娴嬪埌鏁忔劅璇嶏細"+sensitiveWord);
+ riskList.add(map);
+ settleClaims.setRiskSensitive(sensitiveWord);
+ }
+ }
+ //鐤戜技鏂板憳宸ュ嚭闄�
+ if(StringUtils.isNotBlank(riskConfigVO.getRiskNewMemberOpen())
+ && StringUtils.equals(riskConfigVO.getRiskNewMemberOpen(),Constants.ONE+"")
+ && StringUtils.isNotBlank(riskConfigVO.getRiskNewMemberTimeUnit())
+ && StringUtils.isNotBlank(riskConfigVO.getRiskNewMemberTime())
+ ){
+ Map<String,String> map = new HashMap<>();
+ map.put("title","鐤戜技鏂板憳宸ュ嚭闄�");
+ if(riskConfigVO.getRiskNewMemberTimeUnit().equals(Constants.ONE+"")){
+ if(DateUtil.afterMinutesByDate(Integer.valueOf(riskConfigVO.getRiskNewMemberTime())*60,insuranceApply.getStartTime()).getTime() < happenTime.getTime()){
+ map.put("info","淇濋櫓鐢熸晥鏃堕棿涓�"+DateUtil.getFomartDate(insuranceApply.getStartTime(),"yyyy-MM-dd")+"");
+ riskList.add(map);
+ settleClaims.setRiskNewUser(Constants.ONE);
+ };
+
+ }else if(Constants.equalsInteger(solutionsBase.getRiskDelayUnit(),Constants.TWO)){
+ if(DateUtil.afterDayByDate(Integer.valueOf(riskConfigVO.getRiskNewMemberTime()),insuranceApply.getStartTime()).getTime() < happenTime.getTime()){
+ map.put("info","淇濋櫓鐢熸晥鏃堕棿涓�"+DateUtil.getFomartDate(insuranceApply.getStartTime(),"yyyy-MM-dd")+"");
+ riskList.add(map);
+ settleClaims.setRiskNewUser(Constants.ONE);
+ }
+ }
+ }
+ settleClaims.setRiskContent(JSONObject.toJSONString(riskList));
+ if(riskList.size()>Constants.ZERO){
+ settleClaims.setIsRisk(Constants.ONE);
+ }else{
+ settleClaims.setIsRisk(Constants.ZERO);
+ settleClaims.setStatus(Constants.SettleClaimsStatus.CONFIRM_INFORMATION.getKey());
+ }
+ }
+
+ public void saveFile(SettleClaims settleClaims,SettleClaimsDTO settleClaimsDTO,LoginUserInfo loginUserInfo){
+ multifileJoinMapper.delete(new QueryWrapper<Multifile>().lambda()
+ .eq(Multifile::getObjId,settleClaims.getId())
+ .in(Multifile::getObjType,
+ Constants.MultiFile.LP_SGXC_FILE.getKey(),
+ Constants.MultiFile.LP_YGGX_FILE.getKey(),
+ Constants.MultiFile.LP_MZCL_FILE.getKey(),
+ Constants.MultiFile.LP_ZYCL_FILE.getKey(),
+ Constants.MultiFile.LP_OTHER_FILE.getKey(),
+ Constants.MultiFile.LP_SCZL_FILE.getKey()
+ )
+ );
+ List<Multifile> reportVideo = settleClaimsDTO.getReportFileList();
+ if(CollectionUtils.isNotEmpty(reportVideo)){
+ for (int i = 0; i < reportVideo.size(); i++) {
+ Multifile multifile = reportVideo.get(i);
+ if(Objects.isNull(multifile.getFileurl())
+ || Objects.isNull(multifile.getType())
+ || StringUtils.isBlank(multifile.getName())
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"闄勪欢鍐呭寮傚父");
+ }
+ multifile.setCreator(loginUserInfo.getId());
+ multifile.setCreateDate(new Date());
+ multifile.setIsdeleted(Constants.ZERO);
+ multifile.setObjId(settleClaims.getId());
+ multifile.setObjType(Constants.MultiFile.LP_SGXC_FILE.getKey());
+ multifile.setSortnum(i+1);
+ multifileJoinMapper.insert(multifile);
+ }
+ }
+
+ List<Multifile> relationFileList = settleClaimsDTO.getRelationFileList();
+ if(CollectionUtils.isNotEmpty(relationFileList)){
+ for (int i = 0; i < reportVideo.size(); i++) {
+ Multifile multifile = reportVideo.get(i);
+ if(Objects.isNull(multifile.getFileurl())
+ || Objects.isNull(multifile.getType())
+ || StringUtils.isBlank(multifile.getName())
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"闄勪欢鍐呭寮傚父");
+ }
+ multifile.setCreator(loginUserInfo.getId());
+ multifile.setCreateDate(new Date());
+ multifile.setIsdeleted(Constants.ZERO);
+ multifile.setObjId(settleClaims.getId());
+ multifile.setObjType(Constants.MultiFile.LP_YGGX_FILE.getKey());
+ multifile.setSortnum(i+1);
+ multifileJoinMapper.insert(multifile);
+ }
+ }
+
+ List<Multifile> outpatientFileList = settleClaimsDTO.getOutpatientFileList();
+ if(CollectionUtils.isNotEmpty(outpatientFileList)){
+ for (int i = 0; i < reportVideo.size(); i++) {
+ Multifile multifile = reportVideo.get(i);
+ if(Objects.isNull(multifile.getFileurl())
+ || Objects.isNull(multifile.getType())
+ || StringUtils.isBlank(multifile.getName())
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"闄勪欢鍐呭寮傚父");
+ }
+ multifile.setCreator(loginUserInfo.getId());
+ multifile.setCreateDate(new Date());
+ multifile.setIsdeleted(Constants.ZERO);
+ multifile.setObjId(settleClaims.getId());
+ multifile.setObjType(Constants.MultiFile.LP_MZCL_FILE.getKey());
+ multifile.setSortnum(i+1);
+ multifileJoinMapper.insert(multifile);
+ }
+ }
+
+ List<Multifile> hospitalFileList = settleClaimsDTO.getHospitalFileList();
+ if(CollectionUtils.isNotEmpty(hospitalFileList)){
+ for (int i = 0; i < reportVideo.size(); i++) {
+ Multifile multifile = reportVideo.get(i);
+ if(Objects.isNull(multifile.getFileurl())
+ || Objects.isNull(multifile.getType())
+ || StringUtils.isBlank(multifile.getName())
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"闄勪欢鍐呭寮傚父");
+ }
+ multifile.setCreator(loginUserInfo.getId());
+ multifile.setCreateDate(new Date());
+ multifile.setIsdeleted(Constants.ZERO);
+ multifile.setObjId(settleClaims.getId());
+ multifile.setObjType(Constants.MultiFile.LP_ZYCL_FILE.getKey());
+ multifile.setSortnum(i+1);
+ multifileJoinMapper.insert(multifile);
+ }
+ }
+
+ List<Multifile> disabilityFileList = settleClaimsDTO.getDisabilityFileList();
+ if(CollectionUtils.isNotEmpty(disabilityFileList)){
+ for (int i = 0; i < reportVideo.size(); i++) {
+ Multifile multifile = reportVideo.get(i);
+ if(Objects.isNull(multifile.getFileurl())
+ || Objects.isNull(multifile.getType())
+ || StringUtils.isBlank(multifile.getName())
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"闄勪欢鍐呭寮傚父");
+ }
+ multifile.setCreator(loginUserInfo.getId());
+ multifile.setCreateDate(new Date());
+ multifile.setIsdeleted(Constants.ZERO);
+ multifile.setObjId(settleClaims.getId());
+ multifile.setObjType(Constants.MultiFile.LP_SCZL_FILE.getKey());
+ multifile.setSortnum(i+1);
+ multifileJoinMapper.insert(multifile);
+ }
+ }
+
+ List<Multifile> otherFileList = settleClaimsDTO.getOtherFileList();
+ if(CollectionUtils.isNotEmpty(otherFileList)){
+ for (int i = 0; i < reportVideo.size(); i++) {
+ Multifile multifile = reportVideo.get(i);
+ if(Objects.isNull(multifile.getFileurl())
+ || Objects.isNull(multifile.getType())
+ || StringUtils.isBlank(multifile.getName())
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"闄勪欢鍐呭寮傚父");
+ }
+ multifile.setCreator(loginUserInfo.getId());
+ multifile.setCreateDate(new Date());
+ multifile.setIsdeleted(Constants.ZERO);
+ multifile.setObjId(settleClaims.getId());
+ multifile.setObjType(Constants.MultiFile.LP_OTHER_FILE.getKey());
+ multifile.setSortnum(i+1);
+ multifileJoinMapper.insert(multifile);
+ }
+ }
+ }
+
+// public void getRiskSettleDetail(Integer id){
+// settleClaimsJoinMapper.selectJoinOne(SettleClaims.class,new MPJLambdaWrapper<SettleClaims>()
+// .selectAll(SettleClaims.class)
+// .selectAs(DispatchUnit::getName,SettleClaims::getDuName)
+// .selectAs(Worktype::getName,SettleClaims::getWorktypeName)
+// .selectAs(Solutions::getName,SettleClaims::getSolutionName)
+// .selectAs(InsuranceApply::getStartTime,SettleClaims::getBaoxianStartTime)
+// .selectAs(InsuranceApply::getEndTime,SettleClaims::getBaoxianEndTime)
+// .leftJoin(Solutions.class,Solutions::getId,SettleClaims::getSolutionId)
+// .leftJoin(DispatchUnit.class,DispatchUnit::getId,SettleClaims::getDuId)
+// .leftJoin(Worktype.class,Worktype::getId,SettleClaims::getWorktypeId)
+// .leftJoin(InsuranceApply.class,InsuranceApply::getId,SettleClaims::getInsuranceApplyId)
+//
+//
+// .eq(SettleClaims::getId,id)
+// .last(" limit 1 ")
+// );
+// }
+
+ @Override
+ @Transactional(rollbackFor = {BusinessException.class,Exception.class})
+ public void saveSupplementDescribe(SaveSupplementDescribeDTO dto){
+ if(Objects.isNull(dto)
+ || Objects.isNull(dto.getId())
+ || Objects.isNull(dto.getDescribe())){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ if(!loginUserInfo.getType().equals(Constants.ZERO)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炵鐞嗗憳鏃犳硶杩涜璇ユ搷浣�");
+ }
+ SettleClaims settleClaims = settleClaimsJoinMapper.selectById(dto.getId());
+ if(Objects.isNull(settleClaims)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ if(!Constants.equalsInteger(Constants.SettleClaimsStatus.ACCEPTANCE.getKey(),settleClaims.getStatus())){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝涓氬姟鐘舵�佸凡娴佽浆~");
+ }
+ if(Constants.equalsInteger(settleClaims.getWaitSupplement(),Constants.ONE)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"寰呬紒涓氳ˉ鍏呮枃浠讹紝璇风瓑寰呬紒涓氳ˉ鍏呮枃浠�");
+ }
+ //瀛樺偍鏃ュ織
+ this.saveSettleClaimsLog(settleClaims,Constants.SettleClaimsLogType.SUPPLEMENT_DESCRIBE,dto.getDescribe());
+ settleClaimsMapper.update(null,new UpdateWrapper<SettleClaims>().lambda()
+ .eq(SettleClaims::getId,dto.getId()).set(SettleClaims::getEditDate,DateUtil.getCurrDateTime()).set(SettleClaims::getWaitSupplement,Constants.ONE));
+ }
+
+ @Override
+ @Transactional(rollbackFor = {BusinessException.class,Exception.class})
+ public void saveSupplementFile(SaveSupplementDescribeDTO dto){
+ if(Objects.isNull(dto)
+ || Objects.isNull(dto.getId())
+ || CollectionUtils.isEmpty(dto.getSupplementFileList())){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ if(!(loginUserInfo.getType().equals(Constants.ZERO)||loginUserInfo.getType().equals(Constants.ONE))){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲钩鍙颁笌浼佷笟鍛樺伐鏃犳硶杩涜璇ユ搷浣�");
+ }
+ SettleClaims settleClaims = settleClaimsJoinMapper.selectById(dto.getId());
+ if(Objects.isNull(settleClaims)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ if(loginUserInfo.getType().equals(Constants.ZERO)){
+ if(!(Constants.equalsInteger(Constants.SettleClaimsStatus.ACCEPTANCE.getKey(),settleClaims.getStatus())
+ || Constants.equalsInteger(Constants.SettleClaimsStatus.WAIT_AUDIT_COMPENSATION.getKey(),settleClaims.getStatus())
+ )){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝涓氬姟鐘舵�佸凡娴佽浆~");
+ }
+ }else{
+ //濡傛灉鏄紒涓� 鏌ヨ鏄惁鏄嚜宸变紒涓氱殑鏁版嵁
+ if(!Constants.equalsInteger(settleClaims.getCompanyId(),loginUserInfo.getCompanyId())){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炴偍浼佷笟鐨勬暟鎹紝鎮ㄦ棤娉曡繘琛岃鎿嶄綔");
+ }
+ if(!Constants.equalsInteger(settleClaims.getWaitSupplement(),Constants.ONE)) {
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "褰撳墠涓氬姟鏃犻渶杩涜娣诲姞鏉愭枡");
+ }
+ if(!(Constants.equalsInteger(Constants.SettleClaimsStatus.ACCEPTANCE.getKey(),settleClaims.getStatus())
+ || Constants.equalsInteger(Constants.SettleClaimsStatus.WAIT_AUDIT_COMPENSATION.getKey(),settleClaims.getStatus())
+ || Constants.equalsInteger(Constants.SettleClaimsStatus.REJECT_DEAL.getKey(),settleClaims.getStatus())
+ || Constants.equalsInteger(Constants.SettleClaimsStatus.WAIT_DISCUSS_REJECT.getKey(),settleClaims.getStatus())
+ )){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝涓氬姟鐘舵�佸凡娴佽浆~");
+ }
+ settleClaimsMapper.update(null,new UpdateWrapper<SettleClaims>().lambda()
+ .eq(SettleClaims::getId,dto.getId()).set(SettleClaims::getEditDate,DateUtil.getCurrDateTime()).set(SettleClaims::getWaitSupplement,Constants.ZERO));
+ }
+ multifileJoinMapper.delete(new QueryWrapper<Multifile>().lambda().eq(Multifile::getObjId,dto.getId()).eq(Multifile::getObjType,Constants.MultiFile.LP_OTHER_FILE.getKey()));
+ List<Multifile> fileList = dto.getSupplementFileList();
+ if(CollectionUtils.isNotEmpty(fileList)){
+ for (int i = 0; i < fileList.size(); i++) {
+ Multifile multifile = fileList.get(i);
+ if(Objects.isNull(multifile.getFileurl())
+ || Objects.isNull(multifile.getType())
+ || StringUtils.isBlank(multifile.getName())
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"闄勪欢鍐呭寮傚父");
+ }
+ multifile.setCreator(loginUserInfo.getId());
+ multifile.setCreateDate(new Date());
+ multifile.setIsdeleted(Constants.ZERO);
+ multifile.setObjId(settleClaims.getId());
+ //娣诲姞鏉愭枡鏀惧叆 鍏朵粬鏉愭枡涓氬姟鍐�
+ multifile.setObjType(Constants.MultiFile.LP_OTHER_FILE.getKey());
+ multifile.setSortnum(i+1);
+ multifileJoinMapper.insert(multifile);
+ }
+ }
+ //瀛樺偍鏃ュ織
+ this.saveSettleClaimsLog(settleClaims,Constants.SettleClaimsLogType.SUPPLEMENT,null);
+ }
+
+
+ /**
+ * 鎾ら攢鎶ユ
+ * @param dto
+ */
+ @Override
+ @Transactional(rollbackFor = {BusinessException.class,Exception.class})
+ public void returnSettle(OptSettleClaimsDTO dto){
+ if(Objects.isNull(dto)
+ || Objects.isNull(dto.getId())){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ if(!loginUserInfo.getType().equals(Constants.ONE)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炰紒涓氫汉鍛樻棤娉曡繘琛岃鎿嶄綔");
+ }
+ SettleClaims settleClaims = settleClaimsJoinMapper.selectById(dto.getId());
+ if(Objects.isNull(settleClaims)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ //濡傛灉鏄紒涓� 鏌ヨ鏄惁鏄嚜宸变紒涓氱殑鏁版嵁
+ if(!Constants.equalsInteger(settleClaims.getCompanyId(),loginUserInfo.getCompanyId())){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炴偍浼佷笟鐨勬暟鎹紝鎮ㄦ棤娉曡繘琛岃鎿嶄綔");
+ }
+ if(!Constants.equalsInteger(Constants.SettleClaimsStatus.RETURN_ACCEPTANCE.getKey(),settleClaims.getStatus())){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝涓氬姟鐘舵�佸凡娴佽浆~");
+ }
+ //瀛樺偍鏃ュ織
+ this.saveSettleClaimsLog(settleClaims,Constants.SettleClaimsLogType.RETURN_SETTLE,null);
+ settleClaimsMapper.update(null,new UpdateWrapper<SettleClaims>().lambda()
+ .eq(SettleClaims::getId,dto.getId()).set(SettleClaims::getEditDate,DateUtil.getCurrDateTime()).set(SettleClaims::getStatus,Constants.SettleClaimsStatus.RETURN.getKey()));
+ }
+
+
+ @Override
+ @Transactional(rollbackFor = {BusinessException.class,Exception.class})
+ public void updCaseType(CaseTypeDTO dto){
+ if(Objects.isNull(dto)
+ || Objects.isNull(dto.getId())
+ || Objects.isNull(dto.getCaseType())
+ || !(dto.getCaseType()>=Constants.ONE&&dto.getCaseType()<=Constants.THREE)
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ if(!loginUserInfo.getType().equals(Constants.ZERO)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炵鐞嗗憳鏃犳硶杩涜璇ユ搷浣�");
+ }
+ SettleClaims settleClaims = settleClaimsJoinMapper.selectById(dto.getId());
+ if(Objects.isNull(settleClaims)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ if(!Constants.equalsInteger(Constants.SettleClaimsStatus.ACCEPTANCE.getKey(),settleClaims.getStatus())){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝涓氬姟鐘舵�佸凡娴佽浆~");
+ }
+ //瀛樺偍鏃ュ織
+ this.saveSettleClaimsLog(settleClaims, Constants.SettleClaimsLogType.UPD_CASE_TYPE,Constants.SettleClaimsLogType.UPD_CASE_TYPE.getInfo());
+ settleClaimsMapper.update(null,new UpdateWrapper<SettleClaims>().lambda()
+ .eq(SettleClaims::getId,dto.getId()).set(SettleClaims::getEditDate,DateUtil.getCurrDateTime())
+ .set(SettleClaims::getEditor,loginUserInfo.getId())
+ .set(SettleClaims::getCaseType,dto.getCaseType()));
+ }
+
+
+
+ @Override
+ @Transactional(rollbackFor = {BusinessException.class,Exception.class})
+ public void register(OptSettleClaimsDTO dto){
+ if(Objects.isNull(dto)
+ || Objects.isNull(dto.getId())
+ || Objects.isNull(dto.getRegisterStatus())
+ || !(Constants.equalsInteger(dto.getRegisterStatus(),Constants.SettleClaimsStatus.CONFIRM_INFORMATION.getKey())||Constants.equalsInteger(dto.getRegisterStatus(),Constants.SettleClaimsStatus.FINISH_ACCEPTANCE.getKey()))
+ || (Constants.equalsInteger(dto.getRegisterStatus(),Constants.SettleClaimsStatus.FINISH_ACCEPTANCE.getKey())&&StringUtils.isBlank(dto.getDescribe()))
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ if(!loginUserInfo.getType().equals(Constants.ZERO)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炵鐞嗗憳鏃犳硶杩涜璇ユ搷浣�");
+ }
+ SettleClaims settleClaims = settleClaimsJoinMapper.selectById(dto.getId());
+ if(Objects.isNull(settleClaims)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ if(!Constants.equalsInteger(Constants.SettleClaimsStatus.RETURN_ACCEPTANCE.getKey(),settleClaims.getStatus())){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝涓氬姟鐘舵�佸凡娴佽浆~");
+ }
+ Constants.SettleClaimsStatus settleClaimsStatus =
+ Constants.equalsInteger(dto.getRegisterStatus(),Constants.SettleClaimsStatus.CONFIRM_INFORMATION.getKey())?Constants.SettleClaimsStatus.CONFIRM_INFORMATION:Constants.SettleClaimsStatus.FINISH_ACCEPTANCE;
+ //瀛樺偍鏃ュ織
+ this.saveSettleClaimsLog(settleClaims, Constants.equalsInteger(dto.getRegisterStatus(),Constants.SettleClaimsStatus.CONFIRM_INFORMATION.getKey())?Constants.SettleClaimsLogType.PLATFORM_REGISTER:Constants.SettleClaimsLogType.PLATFORM_RETURN,dto.getDescribe());
+ settleClaimsMapper.update(null,new UpdateWrapper<SettleClaims>().lambda()
+ .eq(SettleClaims::getId,dto.getId()).set(SettleClaims::getEditDate,
+ DateUtil.getCurrDateTime()).set(SettleClaims::getStatus,settleClaimsStatus.getKey()));
+ }
+
+
+ @Override
+ @Transactional(rollbackFor = {BusinessException.class,Exception.class})
+ public Integer addReportNum(OptSettleClaimsDTO param){
+ if(param.getId() == null
+ ||StringUtils.isBlank( param.getReportNum()) ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ SettleClaims model = settleClaimsMapper.selectById(param.getId());
+ if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ if(!(Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.CONFIRM_INFORMATION.getKey())
+ || Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.ACCEPTANCE.getKey())
+ )
+ ){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝涓氬姟鐘舵�佸凡娴佽浆~");
+ }
+ LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ if(!user.getType().equals(Constants.ZERO)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炵鐞嗗憳鏃犳硶杩涜璇ユ搷浣�");
+ }
+ if(Constants.equalsInteger(model.getReportNumStatus(),Constants.TWO)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"浠呭彲淇敼涓�娆℃姤妗堝彿");
+ }
+ if(!((Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.ACCEPTANCE.getKey())&&Constants.equalsInteger(model.getReportNumStatus(),Constants.ONE))
+ ||(Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.WAIT_DEAL.getKey())&&Constants.equalsInteger(model.getReportNumStatus(),Constants.ZERO)))){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"浠呭彲淇敼涓�娆℃姤妗堝彿");
+ }
+
+
+// //鏌ヨ鏄惁鏈夋姤妗堝彿鏇存敼璁板綍
+// if(Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.ACCEPTANCE.getKey())
+// && settleClaimsLogMapper.selectCount(new QueryWrapper<SettleClaimsLog>().lambda()
+// .eq(SettleClaimsLog::getObjType,Constants.SettleClaimsLogType.PLATFORM_ADDCODE.getKey())
+// .eq(SettleClaimsLog::getSettleClainmsId,param.getId()))>=Constants.ONE){
+// throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"浠呭彲淇敼涓�娆℃姤妗堝彿");
+// }
+// if(Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.CONFIRM_INFORMATION.getKey())&&StringUtils.isNotBlank(model.getReportNum())){
+// throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"宸蹭慨鏀规姤妗堝彿锛屾棤娉曞啀娆′慨鏀�");
+// }
+ settleClaimsMapper.update(null,new UpdateWrapper<SettleClaims>().lambda()
+ .eq(SettleClaims::getId,param.getId()).set(SettleClaims::getEditDate,
+ DateUtil.getCurrDateTime()).set(SettleClaims::getReportNum,param.getReportNum()));
+
+ SettleClaims update = new SettleClaims();
+ update.setEditDate(new Date());
+ update.setEditor(user.getId());
+ update.setReportNumStatus(model.getReportNumStatus()+Constants.ONE);
+ update.setId(model.getId());
+ update.setCheckDate(update.getEditDate());
+ update.setCheckInfo("娣诲姞澶囨鍙�");
+ update.setCheckUserId(user.getId());
+ update.setReportNum(param.getReportNum());
+ settleClaimsMapper.updateById(update);
+
+ Constants.SettleClaimsLogType applyLogType = Constants.SettleClaimsLogType.PLATFORM_ADDCODE;
+ String info =applyLogType.getInfo();
+ info = info.replace("${param}", update.getReportNum());
+ SettleClaimsLog log = new SettleClaimsLog(update,applyLogType.getName(), info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update));
+ settleClaimsLogMapper.insert(log);
+
+ return 1;
+ }
+
+
+ @Override
+ @Transactional(rollbackFor = {BusinessException.class,Exception.class})
+ public Integer addRemark(OptSettleClaimsDTO param){
+ if(param.getId() == null
+ ||StringUtils.isBlank( param.getDescribe()) ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ SettleClaims model = settleClaimsMapper.selectById(param.getId());
+ if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ if(!(Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.CONFIRM_INFORMATION.getKey())
+ ||Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.ACCEPTANCE.getKey())
+ ||Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.REJECT_DEAL.getKey())
+ ||Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.WAIT_DISCUSS_AUDIT.getKey())
+ ||Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.WAIT_DISCUSS_REJECT.getKey())
+ ||Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.WAIT_AUDIT_COMPENSATION.getKey())
+ ||Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.COMPENSATION.getKey())
+ ||Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.CONFIRM_FEE.getKey())
+ ||Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.CLOSE_CASE.getKey())
+ )){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇峰綋鍓嶄笉鏀寔璇ユ搷浣渵");
+ }
+ LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ SettleClaims update = new SettleClaims();
+ update.setEditDate(new Date());
+ update.setEditor(user.getId());
+ update.setCheckDate(update.getEditDate());
+ update.setCheckInfo("娣诲姞澶囨敞鏍囩");
+ update.setCheckUserId(user.getId());
+ update.setId(model.getId());
+ settleClaimsMapper.updateById(update);
+
+ Constants.SettleClaimsLogType applyLogType = Constants.SettleClaimsLogType.PLATFORM_REMARK;
+ String info =applyLogType.getInfo();
+ info = info.replace("${param}", param.getDescribe());
+ SettleClaimsLog log = new SettleClaimsLog(update,applyLogType.getName(), info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update));
+ settleClaimsLogMapper.insert(log);
+ return 1;
+
+ }
+
+
+
+
+
+
+ @Override
+ @Transactional(rollbackFor = {BusinessException.class,Exception.class})
+ public void acceptance(AcceptanceSettleClaimsDTO dto){
+ if(Objects.isNull(dto)
+ || Objects.isNull(dto.getId())
+ || Objects.isNull(dto.getStatus())
+ || StringUtils.isBlank(dto.getDescribe())
+ || !(dto.getStatus()>=Constants.ZERO||dto.getStatus()<=Constants.THREE)
+ || ((Constants.equalsInteger(dto.getStatus(),Constants.THREE) ||Constants.equalsInteger(dto.getStatus(),Constants.TWO)) && StringUtils.isBlank(dto.getSyProblemOpts()) )
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ if(!loginUserInfo.getType().equals(Constants.ZERO)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炵鐞嗗憳鏃犳硶杩涜璇ユ搷浣�");
+ }
+ SettleClaims settleClaims = settleClaimsJoinMapper.selectById(dto.getId());
+ if(Objects.isNull(settleClaims)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ if(!Constants.equalsInteger(Constants.SettleClaimsStatus.WAIT_DEAL.getKey(),settleClaims.getStatus())){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝涓氬姟鐘舵�佸凡娴佽浆~");
+ }
+ if(Constants.equalsInteger(dto.getStatus(),Constants.ZERO) || Constants.equalsInteger(dto.getStatus(),Constants.THREE)){
+ //鍙楃悊
+ settleClaimsMapper.update(null,new UpdateWrapper<SettleClaims>().lambda()
+ .eq(SettleClaims::getId,dto.getId()).set(SettleClaims::getEditDate,DateUtil.getCurrDateTime()).set(SettleClaims::getEditor,loginUserInfo.getId())
+ .set(SettleClaims::getStatus,Constants.SettleClaimsStatus.ACCEPTANCE.getKey()));
+ //瀛樺偍鏃ュ織
+ this.saveSettleClaimsLog(settleClaims,
+ Constants.equalsInteger(dto.getStatus(),Constants.ZERO)?Constants.SettleClaimsLogType.PLATFORM_ACCEPTANCE:Constants.SettleClaimsLogType.PLATFORM_DISCUSS,
+ dto.getDescribe());
+ }else if(Constants.equalsInteger(dto.getStatus(),Constants.ONE)){
+ //鎷掔粷鍙楃悊
+ settleClaimsMapper.update(null,new UpdateWrapper<SettleClaims>().lambda()
+ .eq(SettleClaims::getId,dto.getId()).set(SettleClaims::getEditDate,DateUtil.getCurrDateTime()).set(SettleClaims::getEditor,loginUserInfo.getId())
+ .set(SettleClaims::getStatus,Constants.SettleClaimsStatus.REJECT_DEAL.getKey()));
+ //瀛樺偍鏃ュ織
+ this.saveSettleClaimsLog(settleClaims,
+ Constants.SettleClaimsLogType.PLATFORM_REFUSE_ACCEPTANCE,
+ Constants.SettleClaimsLogType.PLATFORM_REFUSE_ACCEPTANCE.getInfo().replace("{param}",dto.getDescribe()));
+ }else if(Constants.equalsInteger(dto.getStatus(),Constants.TWO)){
+ //鍙楃悊鍟嗚瀹℃壒
+ settleClaimsMapper.update(null,new UpdateWrapper<SettleClaims>().lambda()
+ .eq(SettleClaims::getId,dto.getId()).set(SettleClaims::getEditDate,DateUtil.getCurrDateTime()).set(SettleClaims::getEditor,loginUserInfo.getId())
+ .set(SettleClaims::getStatus,Constants.SettleClaimsStatus.REJECT_DEAL.getKey()));
+ //瀛樺偍鏃ュ織
+ this.saveSettleClaimsLog(settleClaims,
+ Constants.SettleClaimsLogType.PLATFORM_WAIT_DISCUSS,
+ dto.getDescribe());
+ }
+ }
+
+
+ @Override
+ public List<CompensationVO> getCompensation(Integer id){
+ SettleClaims settleClaims = settleClaimsMapper.selectById(id);
+ List<CompensationVO> modelList = new ArrayList<>();
+ if (Objects.nonNull(settleClaims)&&StringUtils.isNotBlank(settleClaims.getAccountContent())) {
+ modelList = JSONArray.parseArray(settleClaims.getAccountContent(),CompensationVO.class);
+ }
+ Constants.compensation [] compensations = Constants.compensation.values();
+ List<CompensationVO> list = new ArrayList<>();
+ for (Constants.compensation c:compensations) {
+ CompensationVO compensationVO = new CompensationVO();
+ compensationVO.setType(c.getType());
+ compensationVO.setName(c.getName());
+ if(CollectionUtils.isNotEmpty(modelList)){
+ Optional<CompensationVO> optionalModel = modelList.stream().filter(i->i.getName().equals(c.getName())).findFirst();
+ if(optionalModel.isPresent()){
+ CompensationVO oldModel = optionalModel.get();
+ compensationVO.setFee(oldModel.getFee());
+ compensationVO.setDescribe(oldModel.getDescribe());
+ }
+ }
+ list.add(compensationVO);
+ }
+ return list;
+ }
+
+
+ @Override
+ @Transactional(rollbackFor = {BusinessException.class,Exception.class})
+ public void compensation(CompensationDTO dto){
+ if(Objects.isNull(dto)
+ || Objects.isNull(dto.getId())
+ || StringUtils.isBlank(dto.getCompensationJson())
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ if(!loginUserInfo.getType().equals(Constants.ZERO)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炵鐞嗗憳鏃犳硶杩涜璇ユ搷浣�");
+ }
+ SettleClaims settleClaims = settleClaimsJoinMapper.selectById(dto.getId());
+ if(Objects.isNull(settleClaims)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ if(!(Constants.equalsInteger(Constants.SettleClaimsStatus.ACCEPTANCE.getKey(),settleClaims.getStatus()))||Constants.equalsInteger(Constants.SettleClaimsStatus.WAIT_AUDIT_COMPENSATION.getKey(),settleClaims.getStatus())){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝涓氬姟鐘舵�佸凡娴佽浆~");
+ }
+
+ List<CompensationVO> modelList = JSONArray.parseArray(settleClaims.getAccountContent(),CompensationVO.class);
+
+ SettleClaims update = new SettleClaims();
+ update.setEditDate(new Date());
+ update.setEditor(loginUserInfo.getId());
+ update.setYlClaimAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&i.getName().equals(Constants.compensation.YL_COMPENSATION.getName())).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
+ update.setWgClaimAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&i.getName().equals(Constants.compensation.WG_COMPENSATION.getName())).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
+ update.setScClaimAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&i.getName().equals(Constants.compensation.SC_COMPENSATION.getName())).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
+ update.setSwClaimAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&i.getName().equals(Constants.compensation.SW_COMPENSATION.getName())).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
+ update.setClaimAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
+ update.setOtherAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.TWO)).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
+ update.setAccountContent(dto.getCompensationJson());
+ update.setId(settleClaims.getId());
+ update.setStatus(Constants.SettleClaimsStatus.WAIT_AUDIT_COMPENSATION.getKey());
+ settleClaimsMapper.updateById(update);
+
+ //瀛樺偍鏃ュ織
+ this.saveSettleClaimsLog(settleClaims,
+ Constants.SettleClaimsLogType.PLATFORM_LP_DEAL,
+ Constants.SettleClaimsLogType.PLATFORM_LP_DEAL.getInfo());
+ }
+
+
+ /**
+ * 鍟嗚瀹℃壒
+ * @param dto
+ */
+ @Override
+ @Transactional(rollbackFor = {BusinessException.class,Exception.class})
+ public void discussAudit(DiscussAuditDTO dto){
+ if(Objects.isNull(dto)
+ || Objects.isNull(dto.getId())
+ || Objects.isNull(dto.getStatus())
+ || !(Constants.equalsInteger(dto.getStatus(),Constants.ZERO)||Constants.equalsInteger(dto.getStatus(),Constants.ONE))
+ || (Constants.equalsInteger(dto.getStatus(),Constants.ONE)&&StringUtils.isBlank(dto.getDescribe()))
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ if(!loginUserInfo.getType().equals(Constants.ZERO)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炵鐞嗗憳鏃犳硶杩涜璇ユ搷浣�");
+ }
+ SettleClaims settleClaims = settleClaimsJoinMapper.selectById(dto.getId());
+ if(Objects.isNull(settleClaims)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ if(!Constants.equalsInteger(Constants.SettleClaimsStatus.WAIT_DISCUSS_AUDIT.getKey(),settleClaims.getStatus())){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝涓氬姟鐘舵�佸凡娴佽浆~");
+ }
+ Constants.SettleClaimsStatus settleClaimsStatus =
+ Constants.equalsInteger(dto.getStatus(),Constants.ZERO)?Constants.SettleClaimsStatus.ACCEPTANCE:Constants.SettleClaimsStatus.WAIT_DISCUSS_REJECT;
+ //瀛樺偍鏃ュ織
+ Constants.SettleClaimsLogType settleClaimsLogType = Constants.equalsInteger(dto.getStatus(),Constants.ZERO)
+ ?Constants.SettleClaimsLogType.PLATFORM_DISCUSS_PASS:Constants.SettleClaimsLogType.PLATFORM_DISCUSS_REFUSE;
+ this.saveSettleClaimsLog(settleClaims, settleClaimsLogType
+ ,settleClaimsLogType.getInfo().replace("${param}",dto.getDescribe()));
+ settleClaimsMapper.update(null,new UpdateWrapper<SettleClaims>().lambda()
+ .eq(SettleClaims::getId,dto.getId()).set(SettleClaims::getEditDate, DateUtil.getCurrDateTime())
+ .set(SettleClaims::getEditor,loginUserInfo.getId())
+ .set(SettleClaims::getStatus,settleClaimsStatus.getKey()));
+ }
+
+
+
+
+
+
+ @Override
+ @Transactional(rollbackFor = {BusinessException.class,Exception.class})
+ public void nuclearCompensation(CompensationDTO dto){
+ if(Objects.isNull(dto)
+ || Objects.isNull(dto.getId())
+ || StringUtils.isBlank(dto.getCompensationJson())
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ if(!loginUserInfo.getType().equals(Constants.ZERO)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炵鐞嗗憳鏃犳硶杩涜璇ユ搷浣�");
+ }
+ SettleClaims settleClaims = settleClaimsJoinMapper.selectById(dto.getId());
+ if(Objects.isNull(settleClaims)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ if(!Constants.equalsInteger(Constants.SettleClaimsStatus.WAIT_AUDIT_COMPENSATION.getKey(),settleClaims.getStatus())){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝涓氬姟鐘舵�佸凡娴佽浆~");
+ }
+
+ List<CompensationVO> modelList = JSONArray.parseArray(settleClaims.getAccountContent(),CompensationVO.class);
+
+ SettleClaims update = new SettleClaims();
+ update.setEditDate(new Date());
+ update.setEditor(loginUserInfo.getId());
+ update.setYlClaimAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&i.getName().equals(Constants.compensation.YL_COMPENSATION.getName())).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
+ update.setWgClaimAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&i.getName().equals(Constants.compensation.WG_COMPENSATION.getName())).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
+ update.setScClaimAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&i.getName().equals(Constants.compensation.SC_COMPENSATION.getName())).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
+ update.setSwClaimAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&i.getName().equals(Constants.compensation.SW_COMPENSATION.getName())).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
+ update.setClaimAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
+ update.setOtherAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.TWO)).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
+ update.setAccountContent(dto.getCompensationJson());
+ update.setId(settleClaims.getId());
+ update.setStatus(Constants.SettleClaimsStatus.COMPENSATION.getKey());
+ settleClaimsMapper.updateById(update);
+
+ //瀛樺偍鏃ュ織
+ this.saveSettleClaimsLog(settleClaims,
+ Constants.SettleClaimsLogType.PLATFORM_HP_DEAL,
+ Constants.SettleClaimsLogType.PLATFORM_HP_DEAL.getInfo());
+ }
+
+
+ @Override
+ @Transactional(rollbackFor = {BusinessException.class,Exception.class})
+ public void updFee(CompensationDTO dto){
+ if(Objects.isNull(dto)
+ || Objects.isNull(dto.getId())
+ || StringUtils.isBlank(dto.getCompensationJson())
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ if(!loginUserInfo.getType().equals(Constants.ZERO)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炵鐞嗗憳鏃犳硶杩涜璇ユ搷浣�");
+ }
+ SettleClaims settleClaims = settleClaimsJoinMapper.selectById(dto.getId());
+ if(Objects.isNull(settleClaims)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ if(!(Constants.equalsInteger(Constants.SettleClaimsStatus.COMPENSATION.getKey(),settleClaims.getStatus())
+ || Constants.equalsInteger(Constants.SettleClaimsStatus.CONFIRM_FEE.getKey(),settleClaims.getStatus()))
+ ){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝涓氬姟鐘舵�佸凡娴佽浆~");
+ }
+
+ List<CompensationVO> modelList = JSONArray.parseArray(dto.getCompensationJson(),CompensationVO.class);
+
+ SettleClaims update = new SettleClaims();
+ update.setEditDate(new Date());
+ update.setEditor(loginUserInfo.getId());
+ if(Constants.equalsInteger(Constants.SettleClaimsStatus.CONFIRM_FEE.getKey(),settleClaims.getStatus())){
+ update.setFeeUpdate(Constants.ONE);
+ }
+ update.setYlClaimAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&i.getName().equals(Constants.compensation.YL_COMPENSATION.getName())).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
+ update.setWgClaimAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&i.getName().equals(Constants.compensation.WG_COMPENSATION.getName())).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
+ update.setScClaimAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&i.getName().equals(Constants.compensation.SC_COMPENSATION.getName())).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
+ update.setSwClaimAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&i.getName().equals(Constants.compensation.SW_COMPENSATION.getName())).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
+ update.setClaimAccount(modelList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
+ //澶勭悊鍘嗗彶鏁版嵁
+ List<CompensationVO> oldList = JSONArray.parseArray(settleClaims.getAccountContent(),CompensationVO.class);
+ for (CompensationVO compensationVO:oldList) {
+ if(compensationVO.getName().equals(Constants.compensation.YL_COMPENSATION.getName())){
+ compensationVO.setFee(update.getYlClaimAccount());
+ }else if(compensationVO.getName().equals(Constants.compensation.WG_COMPENSATION.getName())){
+ compensationVO.setFee(update.getWgClaimAccount());
+ }else if(compensationVO.getName().equals(Constants.compensation.SC_COMPENSATION.getName())){
+ compensationVO.setFee(update.getScClaimAccount());
+ }else if(compensationVO.getName().equals(Constants.compensation.SW_COMPENSATION.getName())){
+ compensationVO.setFee(update.getSwClaimAccount());
+ }else{
+ continue;
+ }
+ }
+ update.setAccountContent(dto.getCompensationJson());
+ update.setAccountContent(JSONArray.toJSONString(oldList));
+ update.setId(settleClaims.getId());
+ settleClaimsMapper.updateById(update);
+
+ //瀛樺偍鏃ュ織
+ this.saveSettleClaimsLog(settleClaims,
+ Constants.SettleClaimsLogType.PLATFORM_UPD_FEE,
+ Constants.SettleClaimsLogType.PLATFORM_UPD_FEE.getInfo());
+ }
+
+
+ @Override
+ @Transactional(rollbackFor = {BusinessException.class,Exception.class})
+ public void confirmFee(Integer id){
+ LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ if(!loginUserInfo.getType().equals(Constants.ZERO)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炵鐞嗗憳鏃犳硶杩涜璇ユ搷浣�");
+ }
+ SettleClaims settleClaims = settleClaimsJoinMapper.selectById(id);
+ if(Objects.isNull(settleClaims)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ if(!Constants.equalsInteger(Constants.SettleClaimsStatus.COMPENSATION.getKey(),settleClaims.getStatus())){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝涓氬姟鐘舵�佸凡娴佽浆~");
+ }
+ SettleClaims update = new SettleClaims();
+ update.setEditDate(new Date());
+ update.setEditor(loginUserInfo.getId());
+ update.setStatus(Constants.SettleClaimsStatus.WAIT_DEAL.getKey());
+ update.setId(settleClaims.getId());
+ settleClaimsMapper.updateById(update);
+
+ //瀛樺偍鏃ュ織
+ this.saveSettleClaimsLog(settleClaims,
+ Constants.SettleClaimsLogType.CONFIRM_FEE,
+ Constants.SettleClaimsLogType.CONFIRM_FEE.getInfo());
+ }
+
+
+// @Override
+// @Transactional(rollbackFor = {BusinessException.class,Exception.class})
+// public void payCash(PayCashDTO dto){
+// if(Objects.isNull(dto)
+// || Objects.isNull(dto.getId())
+// || StringUtils.isBlank(dto.getDescribe())
+// ){
+// throw new BusinessException(ResponseStatus.BAD_REQUEST);
+// }
+// LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+// if(!loginUserInfo.getType().equals(Constants.ZERO)){
+// throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炵鐞嗗憳鏃犳硶杩涜璇ユ搷浣�");
+// }
+// SettleClaims settleClaims = settleClaimsJoinMapper.selectById(dto.getId());
+// if(Objects.isNull(settleClaims)){
+// throw new BusinessException(ResponseStatus.DATA_EMPTY);
+// }
+// if(!Constants.equalsInteger(Constants.SettleClaimsStatus.COMPENSATION.getKey(),settleClaims.getStatus())){
+// throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝涓氬姟鐘舵�佸凡娴佽浆~");
+// }
+// SettleClaims update = new SettleClaims();
+// update.setEditDate(new Date());
+// update.setEditor(loginUserInfo.getId());
+// update.setStatus(Constants.SettleClaimsStatus.WAIT_DEAL.getKey());
+// update.setId(settleClaims.getId());
+// settleClaimsMapper.updateById(update);
+//
+// //瀛樺偍鏃ュ織
+// this.saveSettleClaimsLog(settleClaims,
+// Constants.SettleClaimsLogType.CONFIRM_FEE,
+// Constants.SettleClaimsLogType.CONFIRM_FEE.getInfo());
+// }
+
+
+
+
+
+
}
--
Gitblit v1.9.3