|  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | 
|---|
|  |  |  | 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.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.business.vo.SettleClaimsMoneyVO; | 
|---|
|  |  |  | import com.doumee.dao.system.model.SystemUser; | 
|---|
|  |  |  | import com.doumee.service.business.SettleClaimsLogService; | 
|---|
|  |  |  | import com.doumee.service.business.SettleClaimsService; | 
|---|
|  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SettleClaimsMapper settleClaimsMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SettleClaimsExtMapper settleClaimsExtMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SettleClaimsLogMapper settleClaimsLogMapper; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SettleClaimsLogJoinMapper settleClaimsLogJoinMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private NoticesMapper noticesMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private InsuranceApplyMapper insuranceApplyMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SolutionsMapper solutionsMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SolutionsBaseMapper solutionsBaseMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ApplyDetailMapper applyDetailMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 删除附件 | 
|---|
|  |  |  | 
|---|
|  |  |  | update.setStatus(Constants.SettleClaimsStatus.RETURN_ACCEPTANCE.getKey()); | 
|---|
|  |  |  | settleClaimsMapper.updateById(update); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //存储待办信息 | 
|---|
|  |  |  | Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.SETTLE_CLAIMS; | 
|---|
|  |  |  | //删除其他待办 | 
|---|
|  |  |  | noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,model.getId())); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Notices notices = new Notices(noticeObjectType,Constants.ONE,model.getId(),model.getInformantName(), | 
|---|
|  |  |  | model.getCompanyId(), Constants.NoticeType.FOUR); | 
|---|
|  |  |  | noticesMapper.insert(notices); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Constants.SettleClaimsLogType applyLogType = Constants.SettleClaimsLogType.PLATFORM_RETURN; | 
|---|
|  |  |  | String info =applyLogType.getInfo(); | 
|---|
|  |  |  | info = info.replace("${param}", update.getCheckInfo()); | 
|---|
|  |  |  | 
|---|
|  |  |  | update.setId(model.getId()); | 
|---|
|  |  |  | update.setStatus(Constants.SettleClaimsStatus.CONFIRM_INFORMATION.getKey()); | 
|---|
|  |  |  | settleClaimsMapper.updateById(update); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //存储待办信息 | 
|---|
|  |  |  | Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.SETTLE_CLAIMS; | 
|---|
|  |  |  | //删除其他待办 | 
|---|
|  |  |  | noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,model.getId())); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Constants.SettleClaimsLogType applyLogType = Constants.SettleClaimsLogType.PLATFORM_CONFIRM_INFORMATION; | 
|---|
|  |  |  | String info =applyLogType.getInfo(); | 
|---|
|  |  |  | 
|---|
|  |  |  | update.setClaimAccount(update.getYlClaimAccount().add(update.getSwClaimAccount()).add(update.getScClaimAccount()).add(update.getWgClaimAccount())); | 
|---|
|  |  |  | settleClaimsMapper.updateById(update); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //存储待办信息 | 
|---|
|  |  |  | Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.SETTLE_CLAIMS; | 
|---|
|  |  |  | //删除其他待办 | 
|---|
|  |  |  | noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,model.getId())); | 
|---|
|  |  |  | Notices notices = new Notices(noticeObjectType,Constants.ONE,model.getId(),model.getInformantName(), | 
|---|
|  |  |  | model.getCompanyId(), Constants.NoticeType.ONE); | 
|---|
|  |  |  | noticesMapper.insert(notices); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Constants.SettleClaimsLogType applyLogType = Constants.SettleClaimsLogType.PLATFORM_FINISH; | 
|---|
|  |  |  | String info =applyLogType.getInfo(); | 
|---|
|  |  |  | info = info.replace("${param}", update.getCheckInfo()); | 
|---|
|  |  |  | 
|---|
|  |  |  | 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.getExtData()) | 
|---|
|  |  |  | || Objects.isNull(settleClaims.getExtData().getMemberName()) | 
|---|
|  |  |  | || Objects.isNull(settleClaims.getExtData().getMemberIdcardType()) | 
|---|
|  |  |  | || Objects.isNull(settleClaims.getExtData().getMemberIdcard())){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.BAD_REQUEST); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(!Constants.equalsObject(settleClaims.getStatus(),Constants.ZERO) | 
|---|
|  |  |  | &&(  Objects.isNull(settleClaims.getExtData().getBxName()) | 
|---|
|  |  |  | || Objects.isNull(settleClaims.getExtData().getBxCode()) | 
|---|
|  |  |  | || Objects.isNull(settleClaims.getExtData().getBxEnddate()) | 
|---|
|  |  |  | || Objects.isNull(settleClaims.getExtData().getBxOrg()) | 
|---|
|  |  |  | || Objects.isNull(settleClaims.getInformantPhone()) )){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.BAD_REQUEST); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(!Constants.equalsInteger(loginUserInfo.getType(),Constants.ZERO)){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非平台管理员无法进行该操作"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Date date =new Date(); | 
|---|
|  |  |  | settleClaims.setCreateDate(date); | 
|---|
|  |  |  | settleClaims.setEditDate(date); | 
|---|
|  |  |  | settleClaims.setIsdeleted(Constants.ZERO); | 
|---|
|  |  |  | settleClaims.setCreator(loginUserInfo.getId()); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | List<SettleClaimsMoneyVO> feeList = settleClaims.getAccountList(); | 
|---|
|  |  |  | if(feeList!=null && feeList.size()>0){ | 
|---|
|  |  |  | for(SettleClaimsMoneyVO fee : feeList){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | settleClaims.setAccountContent(JSONObject.toJSONString(feeList)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | settleClaimsMapper.insert(settleClaims); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | settleClaims.getExtData().setCreator(settleClaims.getCreator()); | 
|---|
|  |  |  | settleClaims.getExtData().setCreateDate(date); | 
|---|
|  |  |  | settleClaims.getExtData().setEditor(settleClaims.getCreator()); | 
|---|
|  |  |  | settleClaims.getExtData().setEditDate(date); | 
|---|
|  |  |  | settleClaims.getExtData().setSettileClaimsId(settleClaims.getId()); | 
|---|
|  |  |  | settleClaimsExtMapper.insert(settleClaims.getExtData()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //--------------处理附件开始---------------- | 
|---|
|  |  |  | 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) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //记录日志 | 
|---|
|  |  |  | this.saveSettleClaimsLog(settleClaims,Constants.SettleClaimsLogType.UPLOAD,null); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //存储待办信息 | 
|---|
|  |  |  | Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.SETTLE_CLAIMS; | 
|---|
|  |  |  | //删除其他待办 | 
|---|
|  |  |  | noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,settleClaims.getId())); | 
|---|
|  |  |  | Notices notices = new Notices(noticeObjectType,Constants.ZERO,settleClaims.getId(),settleClaims.getInformantName(), | 
|---|
|  |  |  | settleClaims.getCompanyId(), Constants.NoticeType.ZERO); | 
|---|
|  |  |  | noticesMapper.insert(notices); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return settleClaims.getId(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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[]{ | 
|---|
|  |  |  | 
|---|
|  |  |  | Constants.MultiFile.LP_SCZL_FILE.getKey(), | 
|---|
|  |  |  | Constants.MultiFile.LP_JACL_FILE.getKey(), | 
|---|
|  |  |  | })) | 
|---|
|  |  |  | .orderByAsc(Multifile::getCreateDate) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(multifileList== null || multifileList.size() == 0){ | 
|---|
|  |  |  | throw  new BusinessException(ResponseStatus.DATA_EMPTY); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+systemDictDataBiz.queryByCode(Constants.OSS,Constants.SETTLE_FILE).getCode(); | 
|---|
|  |  |  | Integer sn = 1; | 
|---|
|  |  |  | for(Multifile l : multifileList){ | 
|---|
|  |  |  | File f = Constants.getFileByNetFile(path + l.getFileurl(),StringUtils.defaultString(l.getName(),"未命名")); | 
|---|
|  |  |  | File f = Constants.getFileByNetFile(path + l.getFileurl(),StringUtils.defaultString(sn + "_" +l.getName(),"未命名")); | 
|---|
|  |  |  | if(f !=null && f.isFile()){ | 
|---|
|  |  |  | fileList.add(f); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | sn = sn +1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | 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())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //查询操作记录 | 
|---|
|  |  |  | 
|---|
|  |  |  | .eq(SettleClaimsLog::getSettleClainmsId,settleClaims.getId()) | 
|---|
|  |  |  | .orderByAsc(SettleClaimsLog::getCreateDate) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | settleClaims.setSettleClaimsLogList(settleClaimsLogList); | 
|---|
|  |  |  | SettleClaimsLog lastConfirm = settleClaimsLogMapper.selectOne(new QueryWrapper<SettleClaimsLog>().lambda() | 
|---|
|  |  |  | .eq(SettleClaimsLog::getSettleClainmsId,settleClaims.getId()) | 
|---|
|  |  |  | .eq(SettleClaimsLog::getObjType,Constants.SettleClaimsLogType.PLATFORM_CONFIRM_INFORMATION.getKey()) | 
|---|
|  |  |  | .orderByDesc(SettleClaimsLog::getCreateDate) | 
|---|
|  |  |  | .last(" limit 1") | 
|---|
|  |  |  | ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Multifile multifile = multifileJoinMapper.selectOne(new QueryWrapper<Multifile>() | 
|---|
|  |  |  | .lambda() | 
|---|
|  |  |  | .eq(Multifile::getObjId,settleClaims.getId()) | 
|---|
|  |  |  | .eq(Multifile::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .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_SCZL_FILE.getKey(), | 
|---|
|  |  |  | Constants.MultiFile.LP_JACL_FILE.getKey()) | 
|---|
|  |  |  | .orderByDesc(Multifile::getCreateDate) | 
|---|
|  |  |  | .last(" limit 1") | 
|---|
|  |  |  | ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(!Objects.isNull(lastConfirm)&&!Objects.isNull(multifile)){ | 
|---|
|  |  |  | settleClaims.setFinishDate(lastConfirm.getCreateDate().compareTo(multifile.getCreateDate())>=0?lastConfirm.getCreateDate():multifile.getCreateDate()); | 
|---|
|  |  |  | }else if(!Objects.isNull(lastConfirm)&&Objects.isNull(multifile)){ | 
|---|
|  |  |  | settleClaims.setFinishDate(lastConfirm.getCreateDate()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return settleClaims; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"无法修改方案信息"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(!(oldSettleClaims.getStatus().equals(Constants.SettleClaimsStatus.WAIT_ACCEPTANCE.getKey()) | 
|---|
|  |  |  | || oldSettleClaims.getStatus().equals(Constants.SettleClaimsStatus.DEAL_ING.getKey()) | 
|---|
|  |  |  | || oldSettleClaims.getStatus().equals(Constants.SettleClaimsStatus.CONFIRM_INFORMATION.getKey()))){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"当前状态无法进行该操作"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | SettleClaims settleClaims  = settleClaimsMapper.selectById(scSupplementDTO.getId()); | 
|---|
|  |  |  | if(!(settleClaims.getStatus().equals(Constants.SettleClaimsStatus.WAIT_ACCEPTANCE.getKey()) | 
|---|
|  |  |  | || settleClaims.getStatus().equals(Constants.SettleClaimsStatus.DEAL_ING.getKey()) | 
|---|
|  |  |  | || settleClaims.getStatus().equals(Constants.SettleClaimsStatus.CONFIRM_INFORMATION.getKey()))){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"当前状态无法进行该操作"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | ){ | 
|---|
|  |  |  | 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()) | 
|---|
|  |  |  | || settleClaims.getStatus().equals(Constants.SettleClaimsStatus.CONFIRM_INFORMATION.getKey()))){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"当前状态无法进行该操作"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | multifile.setObjType(scSupplementDTO.getObjType()); | 
|---|
|  |  |  | multifile.setObjId(scSupplementDTO.getId()); | 
|---|
|  |  |  | multifile.setFileurl(scSupplementDTO.getFileUrl()); | 
|---|
|  |  |  | multifile.setName(scSupplementDTO.getFileUrl().substring(scSupplementDTO.getFileUrl().lastIndexOf("/") + 1)); | 
|---|
|  |  |  | multifile.setName(scSupplementDTO.getFileName()); | 
|---|
|  |  |  | multifile.setType(scSupplementDTO.getFileType()); | 
|---|
|  |  |  | multifileJoinMapper.insert(multifile); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | .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){ | 
|---|
|  |  |  | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getCode, pageWrap.getModel().getCode()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getStatus() != null) { | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getStatus, pageWrap.getModel().getStatus()); | 
|---|
|  |  |  | if(pageWrap.getModel().getStatus().equals(Constants.ZERO)){ | 
|---|
|  |  |  | queryWrapper.in(SettleClaims::getStatus, Constants.SettleClaimsStatus.WAIT_ACCEPTANCE.getKey() | 
|---|
|  |  |  | ,Constants.SettleClaimsStatus.DEAL_ING.getKey() | 
|---|
|  |  |  | ,Constants.SettleClaimsStatus.CONFIRM_INFORMATION.getKey()); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getStatus, pageWrap.getModel().getStatus()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getType() != null) { | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getType, pageWrap.getModel().getType()); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (pageWrap.getModel().getInsuranceApplyId() != null) { | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getInsuranceApplyId, pageWrap.getModel().getInsuranceApplyId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | queryWrapper.orderByAsc(SettleClaims::getCreateDate); | 
|---|
|  |  |  | queryWrapper.orderByDesc(SettleClaims::getCreateDate); | 
|---|
|  |  |  | /*for(PageWrap.SortData sortData: pageWrap.getSorts()) { | 
|---|
|  |  |  | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { | 
|---|
|  |  |  | queryWrapper.orderByDesc(sortData.getProperty()); | 
|---|
|  |  |  | 
|---|
|  |  |  | 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(CompensationFeeDTO compensationFeeDTO){ | 
|---|
|  |  |  | if(Objects.isNull(compensationFeeDTO) | 
|---|
|  |  |  | || Objects.isNull(compensationFeeDTO.getType()) | 
|---|
|  |  |  | ){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.BAD_REQUEST); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | SettleClaims settleClaims = null; | 
|---|
|  |  |  | if(Objects.nonNull(compensationFeeDTO.getId())){ | 
|---|
|  |  |  | settleClaims = settleClaimsMapper.selectById(compensationFeeDTO.getId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<CompensationVO> modelList = new ArrayList<>(); | 
|---|
|  |  |  | if (Objects.nonNull(settleClaims)) { | 
|---|
|  |  |  | if(Constants.equalsInteger(compensationFeeDTO.getType(),Constants.ONE)&&StringUtils.isNotBlank(settleClaims.getAccountContent())){ | 
|---|
|  |  |  | modelList = JSONArray.parseArray(settleClaims.getAccountContent(),CompensationVO.class); | 
|---|
|  |  |  | }else if(Constants.equalsInteger(compensationFeeDTO.getType(),Constants.TWO)&&StringUtils.isNotBlank(settleClaims.getHpAccountContent())){ | 
|---|
|  |  |  | modelList = JSONArray.parseArray(settleClaims.getHpAccountContent(),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(dto.getCompensationJson(),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(dto.getCompensationJson(),CompensationVO.class); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SettleClaims update = new SettleClaims(); | 
|---|
|  |  |  | update.setEditDate(new Date()); | 
|---|
|  |  |  | update.setEditor(loginUserInfo.getId()); | 
|---|
|  |  |  | update.setHpAccountContent(dto.getCompensationJson()); | 
|---|
|  |  |  | update.setHpAccount(modelList.stream().map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add)); | 
|---|
|  |  |  | 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.getHpAccountContent(),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(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.CONFIRM_FEE.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.CLOSE_CASE.getKey()); | 
|---|
|  |  |  | update.setId(settleClaims.getId()); | 
|---|
|  |  |  | settleClaimsMapper.updateById(update); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(CollectionUtils.isNotEmpty(dto.getMultifileList())){ | 
|---|
|  |  |  | List<Multifile> fileList = dto.getMultifileList(); | 
|---|
|  |  |  | 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_PAY_FILE.getKey()); | 
|---|
|  |  |  | multifile.setSortnum(i+1); | 
|---|
|  |  |  | multifileJoinMapper.insert(multifile); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //存储日志 | 
|---|
|  |  |  | this.saveSettleClaimsLog(settleClaims, | 
|---|
|  |  |  | Constants.SettleClaimsLogType.PLATFORM_FINISH, | 
|---|
|  |  |  | dto.getDescribe()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|