From 99de1af0add8cb4eb0d09add255c2fa0ff518376 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 26 一月 2024 11:25:44 +0800
Subject: [PATCH] 开发业务接口
---
server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java | 593 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 590 insertions(+), 3 deletions(-)
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java
index 1b934fd..09ea8da 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java
@@ -1,20 +1,45 @@
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.PageData;
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.SettleClaimsLogMapper;
import com.doumee.dao.business.SettleClaimsMapper;
-import com.doumee.dao.business.model.SettleClaims;
+import com.doumee.dao.business.dto.SCSupplementDTO;
+import com.doumee.dao.business.join.SettleClaimsJoinMapper;
+import com.doumee.dao.business.join.SettleClaimsLogJoinMapper;
+import com.doumee.dao.business.model.*;
+import com.doumee.service.business.SettleClaimsLogService;
import com.doumee.service.business.SettleClaimsService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.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 org.springframework.util.CollectionUtils;
-import java.util.List;
+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.util.*;
+import java.util.stream.Collectors;
/**
* 鐞嗚禂鐢宠琛⊿ervice瀹炵幇
@@ -27,13 +52,575 @@
@Autowired
private SettleClaimsMapper settleClaimsMapper;
+ @Autowired
+ private SettleClaimsLogMapper settleClaimsLogMapper;
+ @Autowired
+ private SystemDictDataBiz systemDictDataBiz;
+
+ @Autowired
+ private MultifileMapper multifileMapper;
+
+ @Autowired
+ private SettleClaimsJoinMapper settleClaimsJoinMapper;
+
+ @Autowired
+ private SettleClaimsLogJoinMapper settleClaimsLogJoinMapper;
+
+ /**
+ * 閫�鍥炵敵璇�
+ * @param param
+ * @return
+ */
+ @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.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
+ ||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.CONFIRM_INFORMATION.getKey());
+ settleClaimsMapper.updateById(update);
+
+ 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(param.getCheckInfo());
+ 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}", 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 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.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.getCode()) ){
+ 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.WAIT_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.setCode(param.getCode());
+ settleClaimsMapper.updateById(update);
+
+ Constants.SettleClaimsLogType applyLogType = Constants.SettleClaimsLogType.PLATFORM_ADDCODE;
+ SettleClaimsLog log = new SettleClaimsLog(update,applyLogType.getName(), null,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();
+ if(Objects.isNull(settleClaims)
+ || Objects.isNull(settleClaims.getMemberId())
+ || Objects.isNull(settleClaims.getSolutionId())
+ || Objects.isNull(settleClaims.getDuId())
+ || Objects.isNull(settleClaims.getWorktypeId())
+ || Objects.isNull(settleClaims.getHappenTime())
+ || Objects.isNull(settleClaims.getType())
+ || Objects.isNull(settleClaims.getInHospital())
+ || Objects.isNull(settleClaims.getMedicalInsurance())
+ || Objects.isNull(settleClaims.getContent())
+ || Objects.isNull(settleClaims.getInformantName())
+ || Objects.isNull(settleClaims.getInformantPhone())
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ if(!loginUserInfo.getType().equals(Constants.ONE)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炰紒涓氬憳宸ユ棤娉曡繘琛岃鎿嶄綔");
+ }
+ //鏌ヨ鏄惁瀛樺湪宸叉彁鎶ョ殑鏁版嵁 鏍规嵁浜哄憳鍜屼繚闄╂柟妗堣繘琛岃繃婊� 鏄惁瀛樺湪杩涜涓殑鏁版嵁
+ if(settleClaimsMapper.selectCount(new QueryWrapper<SettleClaims>().lambda()
+ .eq(SettleClaims::getSolutionId,settleClaims.getSolutionId())
+ .eq(SettleClaims::getMemberId,loginUserInfo.getId())
+ .in(SettleClaims::getStatus,Constants.SettleClaimsStatus.WAIT_ACCEPTANCE.getKey(),
+ Constants.SettleClaimsStatus.CONFIRM_INFORMATION.getKey())
+ )>Constants.ZERO){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀛樺湪鎻愭姤涓殑鎶ユ鏁版嵁!");
+ }
+ settleClaims.setCreateDate(new Date());
+ settleClaims.setIsdeleted(Constants.ZERO);
+ settleClaims.setCreator(loginUserInfo.getId());
+ settleClaims.setCheckUserId(loginUserInfo.getId());
settleClaimsMapper.insert(settleClaims);
+
+ List<Multifile> reportVideo = settleClaims.getReportFileList();
+ if(CollectionUtils.isNotEmpty(reportVideo)){
+ for (int i = 0; i < reportVideo.size(); i++) {
+ Multifile multifile = reportVideo.get(i);
+ if(Objects.isNull(multifile.getFileurl())
+ || Objects.isNull(multifile.getType())
+ ){
+ 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);
+ multifileMapper.insert(multifile);
+ }
+ }
+ //璁板綍鏃ュ織
+ this.saveSettleClaimsLog(settleClaims,Constants.SettleClaimsLogType.UPLOAD,null);
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 = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda()
+ .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(),
+ }))
+ );
+ 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();
+ for(Multifile l : multifileList){
+ File f = Constants.getFileByNetFile(path + l.getFileurl(),StringUtils.defaultString(l.getName(),"鏈懡鍚�"));
+ if(f !=null && f.isFile()){
+ fileList.add(f);
+ }
+ }
+ if(fileList == null || fileList.size() == 0){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ String fileName = model.getInformantName() +"鐞嗚禂璧勬枡涓媉"+System.currentTimeMillis()+".zip" ;
+ String encodeFileName = URLEncoder.encode(fileName);
+ response.setHeader("Content-Disposition","attachment;filename=" + encodeFileName);
+ response.setContentType("application/octet-stream");
+ response.setHeader("eva-opera-type", "download");
+ response.setHeader("eva-download-filename", encodeFileName);
+ packFilesToZip(fileList,response.getOutputStream());
+ } catch (IOException e) {
+ throw new BusinessException(ResponseStatus.EXPORT_EXCEL_ERROR, e);
+ }
+ }
+
+
+ public static void packFilesToZip(List<File> files, ServletOutputStream os) throws IOException {
+ try (ZipArchiveOutputStream zipOutputStream = new ZipArchiveOutputStream(os)) {
+ for (File file : files) {
+ ZipArchiveEntry entry = new ZipArchiveEntry(file.getName());
+ zipOutputStream.putArchiveEntry(entry);
+ try (FileInputStream fileInputStream = new FileInputStream(file)) {
+ byte[] buffer = new byte[1024];
+ int length;
+ while ((length = fileInputStream.read(buffer)) > 0) {
+ zipOutputStream.write(buffer, 0, length);
+ }
+ }
+ zipOutputStream.closeArchiveEntry();
+ }
+ }
+ }
+
+ @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)
+ .leftJoin(Worktype.class,Worktype::getId,SettleClaims::getWorktypeId)
+ .eq(SettleClaims::getId,id)
+ .last(" limit 1 ")
+ );
+
+ List<Multifile> multifileList = multifileMapper.selectList(new QueryWrapper<Multifile>()
+ .lambda().eq(Multifile::getObjId,id)
+ .eq(Multifile::getIsdeleted,Constants.ZERO)
+ .orderByAsc(Multifile::getCreateDate)
+ );
+ 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(Member::getName,SettleClaimsLog::getCreatorName)
+ .selectAs(Company::getName,SettleClaimsLog::getCompanyName)
+ .leftJoin(Member.class,Member::getId,SettleClaimsLog::getCreator)
+ .leftJoin(Company.class,Company::getId,Member::getCompanyId)
+ .eq(SettleClaimsLog::getSettleClainmsId,settleClaims.getId())
+ .orderByAsc(SettleClaimsLog::getCreateDate)
+ );
+
+ settleClaims.setSettleClaimsLogList(settleClaimsLogList);
+ return settleClaims;
+ }
+
+
+
+ @Override
+ public Integer updateForCompany(SettleClaims settleClaims) {
+ LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ if(Objects.isNull(settleClaims)
+ || Objects.isNull(settleClaims.getId())
+ || Objects.isNull(settleClaims.getMemberId())
+ || Objects.isNull(settleClaims.getSolutionId())
+ || Objects.isNull(settleClaims.getDuId())
+ || Objects.isNull(settleClaims.getWorktypeId())
+ || Objects.isNull(settleClaims.getType())
+ || Objects.isNull(settleClaims.getInHospital())
+ || Objects.isNull(settleClaims.getMedicalInsurance())
+ || Objects.isNull(settleClaims.getInformantName())
+ || Objects.isNull(settleClaims.getInformantPhone())
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ if(!loginUserInfo.getType().equals(Constants.ONE)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炰紒涓氬憳宸ユ棤娉曡繘琛岃鎿嶄綔");
+ }
+ SettleClaims oldSettleClaims = settleClaimsMapper.selectById(settleClaims.getId());
+ if(Objects.isNull(oldSettleClaims)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌淇敼鏁版嵁");
+ }
+ 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))){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"褰撳墠鐘舵�佹棤娉曡繘琛岃鎿嶄綔");
+ }
+ oldSettleClaims.setEditor(loginUserInfo.getId());
+ oldSettleClaims.setEditDate(new Date());
+ oldSettleClaims.setDuId(settleClaims.getDuId());
+ oldSettleClaims.setWorktypeId(settleClaims.getWorktypeId());
+ oldSettleClaims.setInHospital(settleClaims.getInHospital());
+ oldSettleClaims.setMedicalInsurance(settleClaims.getMedicalInsurance());
+ oldSettleClaims.setAreaId(settleClaims.getAreaId());
+ oldSettleClaims.setAreaInfo(settleClaims.getAreaInfo());
+ oldSettleClaims.setType(settleClaims.getType());
+ oldSettleClaims.setInformantName(settleClaims.getInformantName());
+ oldSettleClaims.setInformantPhone(settleClaims.getInformantPhone());
+ oldSettleClaims.setCheckUserId(loginUserInfo.getId());
+ settleClaimsMapper.updateById(oldSettleClaims);
+ //璁板綍鏃ュ織
+ Constants.SettleClaimsLogType settleClaimsLogType = Constants.SettleClaimsLogType.UPDATE_DATA;
+ this.saveSettleClaimsLog(settleClaims,settleClaimsLogType,null);
+ return oldSettleClaims.getId();
+ }
+
+ @Override
+ public void supplement(SCSupplementDTO scSupplementDTO){
+ LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ if(Objects.isNull(scSupplementDTO)
+ || Objects.isNull(scSupplementDTO.getId())
+ || Objects.isNull(scSupplementDTO.getSupplement())
+ || Objects.isNull(scSupplementDTO.getObjType())
+ || !(scSupplementDTO.getObjType().equals(Constants.ZERO))
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ if(!loginUserInfo.getType().equals(Constants.ONE)){
+ 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))){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"褰撳墠鐘舵�佹棤娉曡繘琛岃鎿嶄綔");
+ }
+ settleClaims.setEditor(loginUserInfo.getId());
+ settleClaims.setEditDate(new Date());
+ settleClaims.setCheckUserId(loginUserInfo.getId());
+ settleClaims.setCheckInfo(scSupplementDTO.getSupplement());
+ settleClaimsMapper.updateById(settleClaims);
+
+ Constants.SettleClaimsLogType settleClaimsLogType = Constants.SettleClaimsLogType.SUPPLEMENT;
+ String content = settleClaimsLogType.getInfo().replace("${param}", scSupplementDTO.getSupplement());
+ this.saveSettleClaimsLog(settleClaims,settleClaimsLogType,content);
+ }
+
+
+
+
+ @Override
+ public void claimsUploadFile(SCSupplementDTO scSupplementDTO){
+ 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))){
+ 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.setObjId(scSupplementDTO.getId());
+ multifile.setName(scSupplementDTO.getFileUrl().substring(scSupplementDTO.getFileUrl().lastIndexOf("/") + 1));
+ multifile.setType(scSupplementDTO.getFileType());
+ multifileMapper.insert(multifile);
+ }
+
+
+
+
+ public void saveSettleClaimsLog(SettleClaims settleClaims, Constants.SettleClaimsLogType settleClaimsLogType, String content){
+ LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ SettleClaimsLog settleClaimsLog = new SettleClaimsLog();
+ settleClaimsLog.setCreateDate(new Date());
+ settleClaimsLog.setCreator(loginUserInfo.getId());
+ settleClaimsLog.setIsdeleted(Constants.ZERO);
+ settleClaimsLog.setSettleClainmsId(settleClaims.getId());
+ settleClaimsLog.setTitle(settleClaimsLogType.getName());
+ settleClaimsLog.setContent(content);
+ settleClaimsLog.setObjType(settleClaimsLogType.getKey());
+ settleClaimsLog.setObjId(settleClaims.getId());
+ settleClaimsLogMapper.insert(settleClaimsLog);
+ }
+
+ @Override
public void deleteById(Integer id) {
settleClaimsMapper.deleteById(id);
}
--
Gitblit v1.9.3