|  |  |  | 
|---|
|  |  |  | package com.doumee.service.business.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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.LoginUserInfo; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.doumee.core.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.core.utils.Utils; | 
|---|
|  |  |  | import com.doumee.dao.business.MultifileMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.NoticesMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.SettleClaimsLogMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.SettleClaimsMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.dto.SCSupplementDTO; | 
|---|
|  |  |  | import com.doumee.dao.business.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.system.model.SystemUser; | 
|---|
|  |  |  | import com.doumee.service.business.SettleClaimsLogService; | 
|---|
|  |  |  | import com.doumee.service.business.SettleClaimsService; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.github.xiaoymin.knife4j.core.util.CollectionUtils; | 
|---|
|  |  |  | import com.github.yulichang.wrapper.MPJLambdaWrapper; | 
|---|
|  |  |  | 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.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Objects; | 
|---|
|  |  |  | import javax.servlet.ServletOutputStream; | 
|---|
|  |  |  | import javax.servlet.http.HttpServletResponse; | 
|---|
|  |  |  | import java.io.File; | 
|---|
|  |  |  | import java.io.FileInputStream; | 
|---|
|  |  |  | import java.io.IOException; | 
|---|
|  |  |  | import java.net.URLEncoder; | 
|---|
|  |  |  | import java.nio.charset.Charset; | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  | import java.util.stream.Collectors; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 理赔申请表Service实现 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SettleClaimsLogMapper settleClaimsLogMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemDictDataBiz systemDictDataBiz; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private MultifileMapper multifileMapper; | 
|---|
|  |  |  | private MultifileJoinMapper multifileJoinMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SettleClaimsJoinMapper settleClaimsJoinMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SettleClaimsLogJoinMapper settleClaimsLogJoinMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private NoticesMapper noticesMapper; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 删除附件 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public  Integer delFile(Integer id,Integer fileId){ | 
|---|
|  |  |  | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); | 
|---|
|  |  |  | return   multifileJoinMapper.update(null,new UpdateWrapper<Multifile>().lambda() | 
|---|
|  |  |  | .set(Multifile::getIsdeleted,Constants.ONE) | 
|---|
|  |  |  | .set(Multifile::getEditDate,new Date()) | 
|---|
|  |  |  | .set(Multifile::getEditor,user.getId()) | 
|---|
|  |  |  | .eq(Multifile::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .eq(Multifile::getObjId,id) | 
|---|
|  |  |  | .eq(Multifile::getId,fileId) | 
|---|
|  |  |  | .in(Multifile::getObjType,Arrays.asList(new Integer[]{ | 
|---|
|  |  |  | 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(), | 
|---|
|  |  |  | }))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public      Integer back(SettleClaims  param){ | 
|---|
|  |  |  | if(param.getId() == null | 
|---|
|  |  |  | ||StringUtils.isBlank( param.getCheckInfo()) ){ | 
|---|
|  |  |  | 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.FINISH_ACCEPTANCE.getKey()) | 
|---|
|  |  |  | ||Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.RETURN_ACCEPTANCE.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(param.getCheckInfo()); | 
|---|
|  |  |  | update.setCheckUserId(user.getId()); | 
|---|
|  |  |  | update.setId(model.getId()); | 
|---|
|  |  |  | 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()); | 
|---|
|  |  |  | SettleClaimsLog log = new SettleClaimsLog(update,applyLogType.getName(), info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update)); | 
|---|
|  |  |  | settleClaimsLogMapper.insert(log); | 
|---|
|  |  |  | return  1; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 资料确认 | 
|---|
|  |  |  | * @param param | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public      Integer confirm(SettleClaims  param){ | 
|---|
|  |  |  | if(param.getId() == null ){ | 
|---|
|  |  |  | 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.FINISH_ACCEPTANCE.getKey()) | 
|---|
|  |  |  | ||Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.RETURN_ACCEPTANCE.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(param.getCheckInfo()); | 
|---|
|  |  |  | update.setCheckUserId(user.getId()); | 
|---|
|  |  |  | 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(); | 
|---|
|  |  |  | //        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; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 理赔备注标签 | 
|---|
|  |  |  | * @param param | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public       Integer remark(SettleClaims param){ | 
|---|
|  |  |  | if(param.getId() == null | 
|---|
|  |  |  | ||StringUtils.isBlank( param.getCheckInfo()) ){ | 
|---|
|  |  |  | 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.FINISH_ACCEPTANCE.getKey()) | 
|---|
|  |  |  | ||Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.RETURN_ACCEPTANCE.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.getCheckInfo()); | 
|---|
|  |  |  | SettleClaimsLog log = new SettleClaimsLog(update,applyLogType.getName(), info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update)); | 
|---|
|  |  |  | settleClaimsLogMapper.insert(log); | 
|---|
|  |  |  | return  1; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 理赔结案提交 | 
|---|
|  |  |  | * @param param | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public    Integer doneCommit(SettleClaims param){ | 
|---|
|  |  |  | if(param.getId() == null | 
|---|
|  |  |  | ||StringUtils.isBlank( param.getCheckInfo()) ){ | 
|---|
|  |  |  | 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.FINISH_ACCEPTANCE.getKey()) | 
|---|
|  |  |  | ||Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.RETURN_ACCEPTANCE.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(param.getCheckInfo()); | 
|---|
|  |  |  | update.setCheckUserId(user.getId()); | 
|---|
|  |  |  | update.setStatus(Constants.SettleClaimsStatus.FINISH_ACCEPTANCE.getKey()); | 
|---|
|  |  |  | update.setId(model.getId()); | 
|---|
|  |  |  | update.setYlClaimAccount(Constants.formatBigdecimal(param.getYlClaimAccount())); | 
|---|
|  |  |  | update.setSwClaimAccount(Constants.formatBigdecimal(param.getSwClaimAccount())); | 
|---|
|  |  |  | update.setWgClaimAccount(Constants.formatBigdecimal(param.getWgClaimAccount())); | 
|---|
|  |  |  | update.setScClaimAccount(Constants.formatBigdecimal(param.getScClaimAccount())); | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 理赔处理 | 
|---|
|  |  |  | * @param param | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Integer dealBiz(SettleClaims  param){ | 
|---|
|  |  |  | if(param.getId() == null | 
|---|
|  |  |  | ||StringUtils.isBlank( param.getCheckInfo()) ){ | 
|---|
|  |  |  | 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.RETURN_ACCEPTANCE.getKey()) | 
|---|
|  |  |  | ||Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.FINISH_ACCEPTANCE.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(param.getCheckInfo()); | 
|---|
|  |  |  | update.setCheckUserId(user.getId()); | 
|---|
|  |  |  | update.setId(model.getId()); | 
|---|
|  |  |  | settleClaimsMapper.updateById(update); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Constants.SettleClaimsLogType applyLogType = Constants.SettleClaimsLogType.PLATFORM_LP_DEAL; | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 添加备案号 | 
|---|
|  |  |  | * @param param | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Integer addCode(SettleClaims 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.FINISH_ACCEPTANCE.getKey()) | 
|---|
|  |  |  | ||Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.RETURN_ACCEPTANCE.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()); | 
|---|
|  |  |  | update.setStatus(Constants.SettleClaimsStatus.DEAL_ING.getKey()); | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | public Integer create(SettleClaims settleClaims) { | 
|---|
|  |  |  | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | settleClaims.setCreateDate(new Date()); | 
|---|
|  |  |  | settleClaims.setIsdeleted(Constants.ZERO); | 
|---|
|  |  |  | settleClaims.setCompanyId(loginUserInfo.getCompanyId()); | 
|---|
|  |  |  | settleClaims.setStatus(Constants.SettleClaimsStatus.WAIT_ACCEPTANCE.getKey()); | 
|---|
|  |  |  | settleClaims.setCreator(loginUserInfo.getId()); | 
|---|
|  |  |  | settleClaims.setCheckUserId(loginUserInfo.getId()); | 
|---|
|  |  |  | settleClaimsMapper.insert(settleClaims); | 
|---|
|  |  |  | 
|---|
|  |  |  | 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.setObjId(settleClaims.getId()); | 
|---|
|  |  |  | multifile.setObjType(Constants.ONE); | 
|---|
|  |  |  | multifile.setSortnum(i+1); | 
|---|
|  |  |  | multifileMapper.insert(multifile); | 
|---|
|  |  |  | multifileJoinMapper.insert(multifile); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //记录日志 | 
|---|
|  |  |  | 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(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public  void exportFiles(Integer id, HttpServletResponse response) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | SettleClaims model = settleClaimsMapper.selectById(id); | 
|---|
|  |  |  | if(model == null){ | 
|---|
|  |  |  | throw  new BusinessException(ResponseStatus.DATA_EMPTY); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); | 
|---|
|  |  |  | SettleClaims update = new SettleClaims(); | 
|---|
|  |  |  | update.setEditDate(new Date()); | 
|---|
|  |  |  | update.setEditor(loginUserInfo.getId()); | 
|---|
|  |  |  | Constants.SettleClaimsLogType applyLogType = Constants.SettleClaimsLogType.PLATFORM_DOWNLOAD; | 
|---|
|  |  |  | String info =applyLogType.getInfo(); | 
|---|
|  |  |  | SettleClaimsLog log = new SettleClaimsLog(update,applyLogType.getName(), info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update)); | 
|---|
|  |  |  | settleClaimsLogMapper.insert(log); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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_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(), | 
|---|
|  |  |  | })) | 
|---|
|  |  |  | .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(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(); | 
|---|
|  |  |  | 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 (Exception e) { | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.EXPORT_EXCEL_ERROR, e); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public SettleClaims getSettleClaimsDetail(Integer id){ | 
|---|
|  |  |  | SettleClaims settleClaims = settleClaimsJoinMapper.selectJoinOne(SettleClaims.class,new MPJLambdaWrapper<SettleClaims>() | 
|---|
|  |  |  | .selectAll(SettleClaims.class) | 
|---|
|  |  |  | .leftJoin(Member.class,Member::getId,SettleClaims::getMemberId) | 
|---|
|  |  |  | .leftJoin(InsuranceApply.class,InsuranceApply::getId,SettleClaims::getInsuranceApplyId) | 
|---|
|  |  |  | .leftJoin(DispatchUnit.class,DispatchUnit::getId,SettleClaims::getDuId) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | MPJLambdaWrapper<SettleClaims>  queryWrapper =    new MPJLambdaWrapper<SettleClaims>(); | 
|---|
|  |  |  | queryWrapper.selectAll(SettleClaims.class) | 
|---|
|  |  |  | .selectAs(Company::getName,SettleClaims::getCompanyName) | 
|---|
|  |  |  | .selectAs(Solutions::getName,SettleClaims::getSolutionName) | 
|---|
|  |  |  | .selectAs(Member::getName,SettleClaims::getMemberName) | 
|---|
|  |  |  | .selectAs(Member::getIdcardNo,SettleClaims::getMemberIdcardNo) | 
|---|
|  |  |  | .selectAs(InsuranceApply::getCode,SettleClaims::getApplyCode) | 
|---|
|  |  |  | .selectAs(Worktype::getName,SettleClaims::getWorktypeName) | 
|---|
|  |  |  | .selectAs(InsuranceApply::getStartTime,SettleClaims::getBaoxianStartTime) | 
|---|
|  |  |  | .selectAs(InsuranceApply::getEndTime,SettleClaims::getBaoxianEndTime) | 
|---|
|  |  |  | .selectAs(DispatchUnit::getName,SettleClaims::getDuName) | 
|---|
|  |  |  | .leftJoin(Company.class,Company::getId,SettleClaims::getCompanyId) | 
|---|
|  |  |  | .leftJoin(Member.class,Member::getId,SettleClaims::getMemberId) | 
|---|
|  |  |  | .leftJoin(DispatchUnit.class,DispatchUnit::getId,SettleClaims::getDuId) | 
|---|
|  |  |  | .leftJoin(Worktype.class,Worktype::getId,SettleClaims::getWorktypeId) | 
|---|
|  |  |  | .leftJoin(InsuranceApply.class,InsuranceApply::getId,SettleClaims::getInsuranceApplyId) | 
|---|
|  |  |  | .leftJoin(Solutions.class,Solutions::getId,SettleClaims::getSolutionId) | 
|---|
|  |  |  | .eq(SettleClaims::getId,id); | 
|---|
|  |  |  | SettleClaims settleClaims = settleClaimsJoinMapper.selectJoinOne(SettleClaims.class,queryWrapper); | 
|---|
|  |  |  | if(settleClaims == null){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EMPTY); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<Multifile> multifileList = multifileJoinMapper.selectJoinList(Multifile.class, | 
|---|
|  |  |  | new MPJLambdaWrapper<Multifile>() | 
|---|
|  |  |  | .selectAll(Multifile.class) | 
|---|
|  |  |  | .selectAs(SystemUser::getRealname,Multifile::getCreatorName) | 
|---|
|  |  |  | .leftJoin(SystemUser.class,SystemUser::getId,Multifile::getCreator) | 
|---|
|  |  |  | .eq(Multifile::getObjId,id) | 
|---|
|  |  |  | .eq(Multifile::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .orderByAsc(Multifile::getCreateDate) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | String rPath = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode(); | 
|---|
|  |  |  | String path = rPath+ systemDictDataBiz.queryByCode(Constants.OSS,Constants.SETTLE_FILE).getCode(); | 
|---|
|  |  |  | if(multifileList!=null){ | 
|---|
|  |  |  | for(Multifile f : multifileList){ | 
|---|
|  |  |  | if(f!=null&& StringUtils.isNotBlank(f.getFileurl())){ | 
|---|
|  |  |  | f.setFileurlFull(path+f.getFileurl()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Multifile baoxiandanFile = multifileJoinMapper.selectOne(new QueryWrapper<Multifile>() | 
|---|
|  |  |  | .lambda().eq(Multifile::getObjId,settleClaims.getInsuranceApplyId()) | 
|---|
|  |  |  | .eq(Multifile::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .eq(Multifile::getObjType,Constants.MultiFile.BD_DONE_PDF.getKey()) | 
|---|
|  |  |  | .last("limit 1")); | 
|---|
|  |  |  | if(baoxiandanFile!=null&& StringUtils.isNotBlank(baoxiandanFile.getFileurl())){ | 
|---|
|  |  |  | path = rPath+ systemDictDataBiz.queryByCode(Constants.OSS,Constants.APPLY_FILE).getCode(); | 
|---|
|  |  |  | baoxiandanFile.setFileurlFull(path+baoxiandanFile.getFileurl()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | settleClaims.setBaoxiandanFile(baoxiandanFile);//保险单 | 
|---|
|  |  |  | if(CollectionUtils.isNotEmpty(multifileList)){ | 
|---|
|  |  |  | settleClaims.setReportFileList(multifileList.stream().filter(m->m.getObjType().equals(Constants.MultiFile.LP_SGXC_FILE.getKey())).collect(Collectors.toList())); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | settleClaims.setRelationFileList(multifileList.stream().filter(m->m.getObjType().equals(Constants.MultiFile.LP_YGGX_FILE.getKey())).collect(Collectors.toList())); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | settleClaims.setOutpatientFileList(multifileList.stream().filter(m->m.getObjType().equals(Constants.MultiFile.LP_MZCL_FILE.getKey())).collect(Collectors.toList())); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | settleClaims.setHospitalFileList(multifileList.stream().filter(m->m.getObjType().equals(Constants.MultiFile.LP_ZYCL_FILE.getKey())).collect(Collectors.toList())); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //查询操作记录 | 
|---|
|  |  |  | List<SettleClaimsLog> settleClaimsLogList = settleClaimsLogJoinMapper.selectJoinList(SettleClaimsLog.class, | 
|---|
|  |  |  | new MPJLambdaWrapper<SettleClaimsLog>() | 
|---|
|  |  |  | .selectAll(SettleClaimsLog.class) | 
|---|
|  |  |  | .selectAs(SystemUser::getRealname,SettleClaimsLog::getCreatorName) | 
|---|
|  |  |  | .selectAs(SystemUser::getType,SettleClaimsLog::getCreatorType) | 
|---|
|  |  |  | .selectAs(Company::getName,SettleClaimsLog::getCompanyName) | 
|---|
|  |  |  | .leftJoin(SystemUser.class,SystemUser::getId,SettleClaimsLog::getCreator) | 
|---|
|  |  |  | .leftJoin(Company.class,Company::getId,SystemUser::getCompanyId) | 
|---|
|  |  |  | .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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | if(!oldSettleClaims.getSolutionId().equals(settleClaims.getSolutionId())){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"无法修改方案信息"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(!(oldSettleClaims.getStatus().equals(Constants.SettleClaimsStatus.WAIT_ACCEPTANCE) | 
|---|
|  |  |  | || oldSettleClaims.getStatus().equals(Constants.SettleClaimsStatus.CONFIRM_INFORMATION))){ | 
|---|
|  |  |  | 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(),"当前状态无法进行该操作"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | oldSettleClaims.setEditor(loginUserInfo.getId()); | 
|---|
|  |  |  | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非企业员工无法进行该操作"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | SettleClaims settleClaims  = settleClaimsMapper.selectById(scSupplementDTO.getId()); | 
|---|
|  |  |  | if(!(settleClaims.getStatus().equals(Constants.SettleClaimsStatus.WAIT_ACCEPTANCE) | 
|---|
|  |  |  | || settleClaims.getStatus().equals(Constants.SettleClaimsStatus.CONFIRM_INFORMATION))){ | 
|---|
|  |  |  | 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(),"当前状态无法进行该操作"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | settleClaims.setEditor(loginUserInfo.getId()); | 
|---|
|  |  |  | 
|---|
|  |  |  | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); | 
|---|
|  |  |  | if(Objects.isNull(scSupplementDTO) | 
|---|
|  |  |  | || Objects.isNull(scSupplementDTO.getId()) | 
|---|
|  |  |  | || Objects.isNull(scSupplementDTO.getSupplement()) | 
|---|
|  |  |  | || Objects.isNull(scSupplementDTO.getObjType()) | 
|---|
|  |  |  | || Objects.isNull(scSupplementDTO.getFileUrl()) | 
|---|
|  |  |  | || Objects.isNull(scSupplementDTO.getFileType()) | 
|---|
|  |  |  | || scSupplementDTO.getObjType().equals(Constants.ZERO) | 
|---|
|  |  |  | ){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.BAD_REQUEST); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SettleClaims settleClaims  = settleClaimsMapper.selectById(scSupplementDTO.getId()); | 
|---|
|  |  |  | if(!(settleClaims.getStatus().equals(Constants.SettleClaimsStatus.WAIT_ACCEPTANCE) | 
|---|
|  |  |  | || settleClaims.getStatus().equals(Constants.SettleClaimsStatus.CONFIRM_INFORMATION))){ | 
|---|
|  |  |  | 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 multifile = new Multifile(); | 
|---|
|  |  |  | if(loginUserInfo.getType().equals(Constants.ONE)){ | 
|---|
|  |  |  | multifile.setCompanyId(loginUserInfo.getCompanyId()); | 
|---|
|  |  |  | 
|---|
|  |  |  | multifile.setCreator(loginUserInfo.getId()); | 
|---|
|  |  |  | multifile.setCreateDate(new Date()); | 
|---|
|  |  |  | multifile.setIsdeleted(Constants.ZERO); | 
|---|
|  |  |  | multifile.setObjType(scSupplementDTO.getObjType()); | 
|---|
|  |  |  | multifile.setObjId(scSupplementDTO.getId()); | 
|---|
|  |  |  | multifile.setName(scSupplementDTO.getFileUrl().substring(scSupplementDTO.getFileUrl().lastIndexOf("/") + 1)); | 
|---|
|  |  |  | multifile.setFileurl(scSupplementDTO.getFileUrl()); | 
|---|
|  |  |  | multifile.setName(scSupplementDTO.getFileName()); | 
|---|
|  |  |  | multifile.setType(scSupplementDTO.getFileType()); | 
|---|
|  |  |  | multifileMapper.insert(multifile); | 
|---|
|  |  |  | multifileJoinMapper.insert(multifile); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public SettleClaims findById(Integer id) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return settleClaimsMapper.selectById(id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public PageData<SettleClaims> findPage(PageWrap<SettleClaims> pageWrap) { | 
|---|
|  |  |  | IPage<SettleClaims> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); | 
|---|
|  |  |  | QueryWrapper<SettleClaims> queryWrapper = new QueryWrapper<>(); | 
|---|
|  |  |  | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); | 
|---|
|  |  |  | Utils.MP.blankToNull(pageWrap.getModel()); | 
|---|
|  |  |  | MPJLambdaWrapper<SettleClaims>  queryWrapper =    new MPJLambdaWrapper<SettleClaims>(); | 
|---|
|  |  |  | queryWrapper.selectAll(SettleClaims.class) | 
|---|
|  |  |  | .selectAs(Company::getName,SettleClaims::getCompanyName) | 
|---|
|  |  |  | .selectAs(Solutions::getName,SettleClaims::getSolutionName) | 
|---|
|  |  |  | .selectAs(Member::getName,SettleClaims::getMemberName) | 
|---|
|  |  |  | .selectAs(Member::getIdcardNo,SettleClaims::getMemberIdcardNo) | 
|---|
|  |  |  | .selectAs(Worktype::getName,SettleClaims::getWorktypeName) | 
|---|
|  |  |  | .selectAs(InsuranceApply::getStartTime,SettleClaims::getBaoxianStartTime) | 
|---|
|  |  |  | .selectAs(DispatchUnit::getName,SettleClaims::getDuName) | 
|---|
|  |  |  | .leftJoin(Company.class,Company::getId,SettleClaims::getCompanyId) | 
|---|
|  |  |  | .leftJoin(Member.class,Member::getId,SettleClaims::getMemberId) | 
|---|
|  |  |  | .leftJoin(DispatchUnit.class,DispatchUnit::getId,SettleClaims::getDuId) | 
|---|
|  |  |  | .leftJoin(Worktype.class,Worktype::getId,SettleClaims::getWorktypeId) | 
|---|
|  |  |  | .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(Company::getId,-1);//设置无效访问 | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | queryWrapper. in(Company::getId, user.getCompanyIdList()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else  { | 
|---|
|  |  |  | //企业用户只看自己的数据 | 
|---|
|  |  |  | pageWrap.getModel().setCompanyId(user.getCompanyId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | queryWrapper.like(StringUtils.isNotBlank(pageWrap.getModel().getMemberName()),Member::getName, pageWrap.getModel().getMemberName()); | 
|---|
|  |  |  | queryWrapper.like(StringUtils.isNotBlank(pageWrap.getModel().getMemberIdcardNo()),Member::getIdcardNo, pageWrap.getModel().getMemberIdcardNo()); | 
|---|
|  |  |  | queryWrapper.like(StringUtils.isNotBlank(pageWrap.getModel().getDuName()),DispatchUnit::getName, pageWrap.getModel().getDuName()); | 
|---|
|  |  |  | queryWrapper.eq(pageWrap.getModel().getBaseSolutionId()!=null,Solutions::getBaseId, pageWrap.getModel().getBaseSolutionId()); | 
|---|
|  |  |  | queryWrapper.eq(pageWrap.getModel().getBaseDuId()!=null,DispatchUnit::getBaseId, pageWrap.getModel().getBaseDuId()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (pageWrap.getModel().getId() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getId, pageWrap.getModel().getId()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getId, pageWrap.getModel().getId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getCreator() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getCreator, pageWrap.getModel().getCreator()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getCreator, pageWrap.getModel().getCreator()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getCreateDate() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().ge(SettleClaims::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); | 
|---|
|  |  |  | queryWrapper.lambda().le(SettleClaims::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); | 
|---|
|  |  |  | queryWrapper.ge(SettleClaims::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); | 
|---|
|  |  |  | queryWrapper.le(SettleClaims::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getEditor() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getEditor, pageWrap.getModel().getEditor()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getEditor, pageWrap.getModel().getEditor()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getEditDate() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().ge(SettleClaims::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); | 
|---|
|  |  |  | queryWrapper.lambda().le(SettleClaims::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); | 
|---|
|  |  |  | queryWrapper.ge(SettleClaims::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); | 
|---|
|  |  |  | queryWrapper.le(SettleClaims::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getIsdeleted() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getIsdeleted, pageWrap.getModel().getIsdeleted()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getIsdeleted, pageWrap.getModel().getIsdeleted()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getRemark() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getRemark, pageWrap.getModel().getRemark()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getRemark, pageWrap.getModel().getRemark()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getSortnum() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getSortnum, pageWrap.getModel().getSortnum()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getSortnum, pageWrap.getModel().getSortnum()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getSolutionId() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getSolutionId, pageWrap.getModel().getSolutionId()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getSolutionId, pageWrap.getModel().getSolutionId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getCompanyId() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getCompanyId, pageWrap.getModel().getCompanyId()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getCompanyId, pageWrap.getModel().getCompanyId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getMemberId() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getMemberId, pageWrap.getModel().getMemberId()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getMemberId, pageWrap.getModel().getMemberId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getHappenTime() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getHappenTime, pageWrap.getModel().getHappenTime()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getHappenTime, pageWrap.getModel().getHappenTime()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getIdcardNo() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().ge(SettleClaims::getIdcardNo, Utils.Date.getStart(pageWrap.getModel().getIdcardNo())); | 
|---|
|  |  |  | queryWrapper.lambda().le(SettleClaims::getIdcardNo, Utils.Date.getEnd(pageWrap.getModel().getIdcardNo())); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getIdcardNo, pageWrap.getModel().getIdcardNo()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getDuId() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getDuId, pageWrap.getModel().getDuId()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getDuId, pageWrap.getModel().getDuId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getWorktypeId() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getWorktypeId, pageWrap.getModel().getWorktypeId()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getWorktypeId, pageWrap.getModel().getWorktypeId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getFee() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getFee, pageWrap.getModel().getFee()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getFee, pageWrap.getModel().getFee()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getCheckInfo() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getCheckInfo, pageWrap.getModel().getCheckInfo()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getCheckInfo, pageWrap.getModel().getCheckInfo()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getCheckUserId() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getCheckUserId, pageWrap.getModel().getCheckUserId()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getCheckUserId, pageWrap.getModel().getCheckUserId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getCode() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getCode, pageWrap.getModel().getCode()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getCode, pageWrap.getModel().getCode()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getStatus() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().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.lambda().eq(SettleClaims::getType, pageWrap.getModel().getType()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getType, pageWrap.getModel().getType()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getInHospital() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getInHospital, pageWrap.getModel().getInHospital()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getInHospital, pageWrap.getModel().getInHospital()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getMedicalInsurance() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getMedicalInsurance, pageWrap.getModel().getMedicalInsurance()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getMedicalInsurance, pageWrap.getModel().getMedicalInsurance()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getContent() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getContent, pageWrap.getModel().getContent()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getContent, pageWrap.getModel().getContent()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getInformantName() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getInformantName, pageWrap.getModel().getInformantName()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getInformantName, pageWrap.getModel().getInformantName()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getInformantPhone() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getInformantPhone, pageWrap.getModel().getInformantPhone()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getInformantPhone, pageWrap.getModel().getInformantPhone()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getAreaId() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getAreaId, pageWrap.getModel().getAreaId()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getAreaId, pageWrap.getModel().getAreaId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getAreaInfo() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getAreaInfo, pageWrap.getModel().getAreaInfo()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getAreaInfo, pageWrap.getModel().getAreaInfo()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getReportNum() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getReportNum, pageWrap.getModel().getReportNum()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getReportNum, pageWrap.getModel().getReportNum()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getInsuranceApplyId() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SettleClaims::getInsuranceApplyId, pageWrap.getModel().getInsuranceApplyId()); | 
|---|
|  |  |  | queryWrapper.eq(SettleClaims::getInsuranceApplyId, pageWrap.getModel().getInsuranceApplyId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for(PageWrap.SortData sortData: pageWrap.getSorts()) { | 
|---|
|  |  |  | queryWrapper.orderByDesc(SettleClaims::getCreateDate); | 
|---|
|  |  |  | /*for(PageWrap.SortData sortData: pageWrap.getSorts()) { | 
|---|
|  |  |  | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { | 
|---|
|  |  |  | queryWrapper.orderByDesc(sortData.getProperty()); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | queryWrapper.orderByAsc(sortData.getProperty()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return PageData.from(settleClaimsMapper.selectPage(page, queryWrapper)); | 
|---|
|  |  |  | }*/ | 
|---|
|  |  |  | PageData<SettleClaims> pageData = PageData.from(settleClaimsJoinMapper.selectJoinPage(page,SettleClaims.class, queryWrapper)); | 
|---|
|  |  |  | return pageData; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|