jiangping
2024-01-23 5db66ef6fb108de06df182189d822f3f5ebdd557
开发业务接口
已修改8个文件
524 ■■■■■ 文件已修改
server/platform/src/main/java/com/doumee/api/business/SettleClaimsController.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/core/utils/Constants.java 58 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/dao/business/model/ApplyLog.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/dao/business/model/SettleClaims.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/dao/business/model/SettleClaimsLog.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/SettleClaimsService.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java 328 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/platform/src/main/java/com/doumee/api/business/SettleClaimsController.java
@@ -3,6 +3,8 @@
import com.doumee.api.BaseController;
import com.doumee.core.annotation.excel.ExcelExporter;
import com.doumee.core.annotation.pr.PreventRepeat;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.ApiResponse;
import com.doumee.core.model.PageWrap;
import com.doumee.core.model.PageData;
@@ -37,7 +39,51 @@
    public ApiResponse create(@RequestBody SettleClaims settleClaims) {
        return ApiResponse.success(settleClaimsService.create(settleClaims));
    }
    @ApiOperation("添加报案号")
    @PostMapping("/addCode")
    @RequiresPermissions("business:settleclaims:addCode")
    public ApiResponse addCode(@RequestBody SettleClaims settleClaims) {
        return ApiResponse.success(settleClaimsService.addCode(settleClaims));
    }
    @ApiOperation("理赔处理")
    @PostMapping("/dealBiz")
    @RequiresPermissions("business:settleclaims:dealBiz")
    public ApiResponse dealBiz(@RequestBody SettleClaims settleClaims) {
        return ApiResponse.success(settleClaimsService.dealBiz(settleClaims));
    }
    @ApiOperation("结案提交")
    @PostMapping("/doneCommit")
    @RequiresPermissions("business:settleclaims:doneCommit")
    public ApiResponse doneCommit(@RequestBody SettleClaims settleClaims) {
        return ApiResponse.success(settleClaimsService.doneCommit(settleClaims));
    }
    @ApiOperation("撤销申请")
    @PostMapping("/back")
    @RequiresPermissions("business:settleclaims:back")
    public ApiResponse back(@RequestBody SettleClaims settleClaims) {
        return ApiResponse.success(settleClaimsService.back(settleClaims));
    }
    @ApiOperation("备注标签")
    @PostMapping("/remark")
    @RequiresPermissions("business:settleclaims:remark")
    public ApiResponse remark(@RequestBody SettleClaims settleClaims) {
        return ApiResponse.success(settleClaimsService.remark(settleClaims));
    }
    @ApiOperation("资料确认")
    @PostMapping("/confirm")
    @RequiresPermissions("business:settleclaims:confirm")
    public ApiResponse confirm(@RequestBody SettleClaims settleClaims) {
        return ApiResponse.success(settleClaimsService.confirm(settleClaims));
    }
    @ApiOperation("资料下载")
    @PostMapping("/exportFiles")
    @RequiresPermissions("business:locks:exportExcel")
    public void exportExcel(@RequestParam Integer id,HttpServletResponse response) {
        if(id == null){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        settleClaimsService.exportFiles(id,response);
    }
    @ApiOperation("根据ID删除")
    @GetMapping("/delete/{id}")
    @RequiresPermissions("business:settleclaims:delete")
@@ -84,7 +130,7 @@
    @ApiOperation("根据ID查询")
    @GetMapping("/{id}")
    @RequiresPermissions("business:settleclaims:query")
    public ApiResponse findById(@PathVariable Integer id) {
        return ApiResponse.success(settleClaimsService.findById(id));
    public ApiResponse<SettleClaims> findById(@PathVariable Integer id) {
        return ApiResponse.success(settleClaimsService.getSettleClaimsDetail(id));
    }
}
server/service/src/main/java/com/doumee/core/utils/Constants.java
@@ -7,7 +7,11 @@
import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.net.URL;
import java.net.URLDecoder;
import java.util.*;
import java.util.Date;
@@ -844,8 +848,9 @@
    public  enum SettleClaimsStatus {
        WAIT_ACCEPTANCE(0, "待受理"),
        RETURN_ACCEPTANCE(1, "退回受理"),
        CONFIRM_INFORMATION(2, "确认资料"),
        FINISH_ACCEPTANCE(3, "完成受理"),
        DEAL_ING(2, "受理中"),
        CONFIRM_INFORMATION(3, "确认资料"),
        FINISH_ACCEPTANCE(4, "完成受理"),
        ;
        // 成员变量
        private String name;
@@ -888,15 +893,15 @@
    public  enum SettleClaimsLogType {
        UPLOAD(0, "提交报案","提交意见:${param}"),
        PLATFORM_RETURN(1, "平台退回","提交意见:${param}"),
        CONFIRM_INFORMATION(2, "平台确认资料","提交意见:${param}"),
        PLATFORM_CONFIRM_INFORMATION(2, "平台确认资料",""),
        PLATFORM_FINISH(3, "平台完成受理","提交意见:${param}"),
        UPDATE_DATA(4, "修改信息","提交意见:${param}"),
        SUPPLEMENT(5, "补充说明","提交意见:${param}"),
        COMPANY_APPLY_RETURN(6, "平台理赔处理","提交意见:${param}"),
        COMPANY_APPLY_CLOSE(7, "平台备注标签",""),
        PLATFORM_AGREE_BACK(8, "平台添加报案号",""),
        PLATFORM_LP_DEAL(6, "平台理赔处理","提交意见:${param}"),
        PLATFORM_REMARK(7, "平台备注标签",""),
        PLATFORM_ADDCODE(8, "平台添加报案号",""),
        PLATFORM_UN_AGREE_BACK(9, "企业下载资料",""),
        COMPANY_EDIT(10, "平台下载资料",""),
        PLATFORM_DOWNLOAD(10, "平台下载资料",""),
        PLATFORM_CHECK_PASS(11, "平台上传资料",""),
        ;
        // 成员变量
@@ -1208,4 +1213,43 @@
            this.des = des;
        }
    }
    public static File getFileByNetFile(String url,String fileName)   {
        //对本地文件命名
        File file = null;
        try {
            URL urlfile;
            InputStream inStream = null;
            OutputStream os = null;
            try {
                file = File.createTempFile("", fileName);
                //下载
                urlfile = new URL(url);
                inStream = urlfile.openStream();
                os = new FileOutputStream(file);
                int bytesRead = 0;
                byte[] buffer = new byte[8192];
                while ((bytesRead = inStream.read(buffer, 0, 8192)) != -1) {
                    os.write(buffer, 0, bytesRead);
                }
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                try {
                    if (null != os) {
                        os.close();
                    }
                    if (null != inStream) {
                        inStream.close();
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }catch (Exception e){
        }
        return file;
    }
}
server/service/src/main/java/com/doumee/dao/business/model/ApplyLog.java
@@ -28,7 +28,7 @@
        this.content=content;
        this.applyId = apply.getId();
        this.createDate =apply.getEditDate();
        this.editor =apply.getEditor();
        this.creator =apply.getEditor();
        this.status = apply.getStatus();
        this.objId=objId;
        this.objType = objType;
@@ -40,7 +40,7 @@
        this.content=content;
        this.applyId = apply.getId();
        this.createDate =apply.getEditDate();
        this.editor =apply.getEditor();
        this.creator =apply.getEditor();
        this.status = apply.getStatus();
        this.objId=objId;
        this.objType = objType;
server/service/src/main/java/com/doumee/dao/business/model/SettleClaims.java
@@ -90,7 +90,10 @@
    @ApiModelProperty(value = "费用", example = "1")
    @ExcelColumn(name="费用")
    private BigDecimal fee;
    @ApiModelProperty(value = "审核时间")
    @ExcelColumn(name="审核时间")
    private Date checkDate;
    @ApiModelProperty(value = "最近操作备注")
    @ExcelColumn(name="最近操作备注")
    private String checkInfo;
server/service/src/main/java/com/doumee/dao/business/model/SettleClaimsLog.java
@@ -20,7 +20,19 @@
@ApiModel("理賠操作历史表")
@TableName("`settle_claims_log`")
public class SettleClaimsLog {
    public SettleClaimsLog(){
    }
    public SettleClaimsLog(SettleClaims  apply,String title,String content,Integer objId,Integer objType, String before,String after){
        this.title =title;
        this.content=content;
        this.createDate =apply.getEditDate();
        this.creator =apply.getEditor();
        this.objId=objId;
        this.objType = objType;
        this.beforeContent=before;
        this.afterContent=after;
    }
    @TableId(type = IdType.AUTO)
    @ApiModelProperty(value = "主键", example = "1")
    @ExcelColumn(name="主键")
server/service/src/main/java/com/doumee/service/business/SettleClaimsService.java
@@ -4,6 +4,9 @@
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.dto.SCSupplementDTO;
import com.doumee.dao.business.model.SettleClaims;
import io.swagger.models.auth.In;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
@@ -111,4 +114,18 @@
    long count(SettleClaims settleClaims);
    SettleClaims getSettleClaimsDetail(Integer id);
    void exportFiles(Integer id, HttpServletResponse response);
    Integer addCode(SettleClaims settleClaims);
    Integer dealBiz(SettleClaims settleClaims);
    Integer doneCommit(SettleClaims settleClaims);
    Integer remark(SettleClaims settleClaims);
    Integer confirm(SettleClaims settleClaims);
    Integer back(SettleClaims settleClaims);
}
server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java
@@ -158,9 +158,13 @@
        multifileMapper.insert(param.getPidanFile());
        update.setApplyId(model.getApplyId());
        long times =  param.getApplyStartTime().getTime() - model.getValidTime().getTime();
        //处理加减保明细数据
        dealDetailsValidTime(update,times);
        if(Constants.equalsInteger(model.getType(),Constants.ZERO)){
            //如果是加减保申请 处理加减保明细数据
            dealDetailsValidTime(update);
        }else{
            //如果是换厂申请 处理明细数据
            dealDetailsDUdata(update);
        }
        Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_PLATFORM_APPROVE;
@@ -234,9 +238,45 @@
    /**
     * 处理加减保明细数据
     * @param update
     * @param times
     */
    private void dealDetailsValidTime(ApplyChange update,long times) {
    private void dealDetailsDUdata(ApplyChange update ) {
        List<ApplyChagneDetail> detailList = applyChagneDetailJoinMapper.selectJoinList(ApplyChagneDetail.class,
                new MPJLambdaWrapper<ApplyChagneDetail>()
                        .selectAll(ApplyChagneDetail.class)
                        .selectAs(Solutions::getTimeUnit,ApplyChagneDetail::getSolutionTimeUnit)
                        .selectAs(Solutions::getPrice,ApplyChagneDetail::getSolutionPrice)
                  .leftJoin(ApplyChange.class, ApplyChange::getId, ApplyChagneDetail::getApplyChangeId)
                  .leftJoin(Solutions.class, Solutions::getId, ApplyChange::getSolutionsId)
                  .eq(ApplyChagneDetail::getApplyChangeId,update.getId())
                  .eq(ApplyChagneDetail::getIsdeleted,Constants.ZERO) );
        if(detailList ==null || detailList.size()==0){
            return;
        }
        for(ApplyChagneDetail detail : detailList){
            //查询员工是在主单下 是否存在生效中的数据
            ApplyDetail oldModel = applyDetailJoinMapper.selectOne(new QueryWrapper<ApplyDetail>().lambda()
                    .eq(ApplyDetail::getApplyId, update.getApplyId())
                    .eq(ApplyDetail::getMemberId, detail.getMemberId())
                    .orderByDesc(ApplyDetail::getCreateDate)
                    .last("limit 1"));
            if(oldModel == null  ){
                throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"对不起,用户【"+detail.getMemberName()+"】原保单信息有误,当前申请不支持减保处理!");
            }
            applyDetailJoinMapper.update(null, new UpdateWrapper<ApplyDetail>().lambda()
                    .set(ApplyDetail::getEditor,update.getEditor())
                    .set(ApplyDetail::getWorktypeId,detail.getWorktypeId())
                    .set(ApplyDetail::getDuId,detail.getDuId())
                    .set(ApplyDetail::getEditDate,update.getEditDate())
                    .eq(ApplyDetail::getId,oldModel.getApplyId())
            );
        }
    }
    /**
     * 处理加减保明细数据
     * @param update
     */
    private void dealDetailsValidTime(ApplyChange update ) {
        List<ApplyChagneDetail> detailList = applyChagneDetailJoinMapper.selectJoinList(ApplyChagneDetail.class,
                new MPJLambdaWrapper<ApplyChagneDetail>()
                        .selectAll(ApplyChagneDetail.class)
server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java
@@ -1,5 +1,8 @@
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;
@@ -22,13 +25,20 @@
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.util.*;
import java.util.stream.Collectors;
/**
@@ -44,6 +54,8 @@
    @Autowired
    private SettleClaimsLogMapper settleClaimsLogMapper;
    @Autowired
    private SystemDictDataBiz systemDictDataBiz;
    @Autowired
    private MultifileMapper multifileMapper;
@@ -54,6 +66,246 @@
    @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.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());
        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.DEAL_ING.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.DEAL_ING.getKey())
              ||Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.CONFIRM_INFORMATION.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.DEAL_ING.getKey())
              ||Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.CONFIRM_INFORMATION.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());
        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.DEAL_ING.getKey())
              ||Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.CONFIRM_INFORMATION.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();
@@ -113,6 +365,76 @@
        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){