k94314517
2025-01-18 32929606943fedfca286b052bcb280193a3e0222
server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java
@@ -3,6 +3,7 @@
import cn.hutool.core.util.IdcardUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.api.R;
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.core.annotation.excel.ExcelExporter;
import com.doumee.core.constants.ResponseStatus;
@@ -991,6 +992,9 @@
        Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_COMPANY_COMMIT;
        ApplyLog log = new ApplyLog(applyChange,applyLogType.getName(),"",applyChange.getId(),applyLogType.getKey(), null, null);
        applyLogMapper.insert(log);
//        if(1==1){
//            throw new BusinessException(ResponseStatus.DATA_EMPTY );
//        }
        return applyChange.getId();
    }
@@ -1292,18 +1296,35 @@
                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "减保人员【" + applyChagneDetail.getMemberName() + "】已出险无法进行减保");
            };
            //2024-10-29 15:17:54 查询人员是否已减保 已减保后无法再次减保
            if(applyChangeDetailJoinMapper.selectJoinCount(new MPJLambdaWrapper<ApplyChagneDetail>()
//            if(applyChangeDetailJoinMapper.selectJoinCount(new MPJLambdaWrapper<ApplyChagneDetail>()
//                    .leftJoin(ApplyChange.class,ApplyChange::getId,ApplyChagneDetail::getApplyChangeId)
//                    .eq(ApplyChagneDetail::getType,Constants.ONE)
//                    .eq(ApplyChange::getApplyId,applyChange.getApplyId())
//                            .eq(ApplyChagneDetail::getMemberId,applyChagneDetail.getMemberId())
//                    .notIn(ApplyChange::getStatus,Constants.ApplyChangeStatus.CLOSE.getKey()
//                            ,Constants.ApplyChangeStatus.PALTFORM_CHECK_PASS_NO.getKey()
//                    )
//            )>Constants.ZERO){
//                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "减保人员【" + applyChagneDetail.getMemberName() + "】已减保无法再次进行减保");
//            };
            //2025-1-16 09:11:14 根据查询当前人员最后一次的加减保记录 如果最后一条记录是加保进入 则可以减保 如果最后一条记录是减保记录 则不可以减保 如果为空 这可以进行操作
            ApplyChagneDetail lastApplyChagneDetail = applyChangeDetailJoinMapper.selectJoinOne(ApplyChagneDetail.class,
                    new MPJLambdaWrapper<ApplyChagneDetail>()
                    .leftJoin(ApplyChange.class,ApplyChange::getId,ApplyChagneDetail::getApplyChangeId)
                    .eq(ApplyChagneDetail::getType,Constants.ONE)
                    .ne(ApplyChagneDetail::getType,Constants.TWO)
                    .eq(ApplyChange::getApplyId,applyChange.getApplyId())
                            .eq(ApplyChagneDetail::getMemberId,applyChagneDetail.getMemberId())
                    .eq(ApplyChagneDetail::getMemberId,applyChagneDetail.getMemberId())
                    .notIn(ApplyChange::getStatus,Constants.ApplyChangeStatus.CLOSE.getKey()
                            ,Constants.ApplyChangeStatus.PALTFORM_CHECK_PASS_NO.getKey()
                            ,Constants.ApplyChangeStatus.PALTFORM_CHECK_PASS_NO.getKey()
                    )
            )>Constants.ZERO){
                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "减保人员【" + applyChagneDetail.getMemberName() + "】已减保无法再次进行减保");
            };
                    .orderByDesc(ApplyChagneDetail::getId)
                    .last(" limit 1 ")
            );
            if(Objects.nonNull(lastApplyChagneDetail)){
                if(Constants.equalsInteger(lastApplyChagneDetail.getType(),Constants.ONE)){
                    throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "减保人员【" + applyChagneDetail.getMemberName() + "】已减保无法再次进行减保");
                }
            }
            //查询减保人员是否存在 冲突的 保单明细数据
            if(applyDetailJoinMapper.selectCount(new QueryWrapper<ApplyDetail>()
                    .lambda()
@@ -2280,18 +2301,18 @@
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询方案信息");
        }
        String fileUrl = null;
//        if(Constants.equalsObject(model.getType(), Constants.ONE)){
//              fileUrl = ExcelExporter.build(ApplyChange.class).exportChangeUnitExcelToPdf(model,"换厂申请表","投保企业");
//        }else{
//            fileUrl = ExcelExporter.build(ApplyChange.class).exportJiajianBaoExcelToPdf(model,"加减保申请表","投保企业");
//        }
        if(Constants.equalsObject(model.getType(), Constants.ONE)){
              fileUrl = ExcelExporter.build(ApplyChange.class).exportChangeUnitExcelToPdf(model,"换厂申请表","投保企业");
        }else{
            fileUrl = ExcelExporter.build(ApplyChange.class).exportJiajianBaoExcelToPdf(model,"加减保申请表","投保企业");
        }
        String notifyUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode();
//        notifyUrl = notifyUrl.replace("${type}","0").replace("${id}",model.getId().toString());
//        String applyNo = signService.applySignLocalFile(company.getName(),company.getName(),fileUrl,company.getCode(),company.getEmail(),"投保企业签章",company.getSignId(),notifyUrl);
        notifyUrl = notifyUrl.replace("${type}","0").replace("${id}",model.getId().toString());
        String applyNo = signService.applySignLocalFileByParam(company.getName(),company.getName(),fileUrl,company.getCode(),company.getEmail(),"投保企业签章",company.getSignId(),notifyUrl,new Float(0.7));
        //临时使用
        fileUrl =
                "https://yybred.oss-cn-hangzhou.aliyuncs.com/apply/20241120/1c80f0d7-ab35-4355-b9fe-944464643115.pdf";
        String applyNo = signService.applySign(companyName,fileUrl,companyName,creditCode,email,"人员名单签章",null,notifyUrl);
//        fileUrl =
//                "https://yybred.oss-cn-hangzhou.aliyuncs.com/apply/20241120/1c80f0d7-ab35-4355-b9fe-944464643115.pdf";
//        String applyNo = signService.applySign(companyName,fileUrl,companyName,creditCode,email,"人员名单签章",null,notifyUrl);
        if(StringUtils.isBlank(applyNo) ){
            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"对不起,获取在线签章地址失败,请稍后重试!");
        }
@@ -2538,19 +2559,19 @@
            if(!Constants.equalsInteger(Constants.ZERO,model.getStatus())){
                throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,该申请状态已流转,当前不支持签章操作!");
            }
//            if(Constants.equalsObject(model.getType(), Constants.ONE)){
//                fileUrl = ExcelExporter.build(ApplyChange.class).exportChangeUnitExcelToPdf(model,"换厂申请表","被保险人");
//            }else{
//                fileUrl = ExcelExporter.build(ApplyChange.class).exportJiajianBaoExcelToPdf(model,"加减保申请表","被保险人");
//            }
            if(Constants.equalsObject(model.getType(), Constants.ONE)){
                fileUrl = ExcelExporter.build(ApplyChange.class).exportChangeUnitExcelToPdf(model,"换厂申请表","被保险人");
            }else{
                fileUrl = ExcelExporter.build(ApplyChange.class).exportJiajianBaoExcelToPdf(model,"加减保申请表","被保险人");
            }
            String notifyUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode();
            notifyUrl = notifyUrl.replace("${type}","0").replace("${id}",model.getId().toString());
            //临时使用
            fileUrl =  "https://yybred.oss-cn-hangzhou.aliyuncs.com/apply/20241230/a0d128f2-ba6c-4ad4-b86b-b2610a513d41.pdf";
            String applyNo = signService.applySignDoByParam(company.getName(),fileUrl,company.getName(),company.getCode(),company.getEmail(),"人员名单签章",company.getSignId(),notifyUrl,new Float(0.7));
//            fileUrl =  "https://yybred.oss-cn-hangzhou.aliyuncs.com/apply/20241230/a0d128f2-ba6c-4ad4-b86b-b2610a513d41.pdf";
//            String applyNo = signService.applySignDoByParam(company.getName(),fileUrl,company.getName(),company.getCode(),company.getEmail(),"人员名单签章",company.getSignId(),notifyUrl,new Float(0.7));
//            String applyNo = signService.applySignLocalFile(company.getName(),company.getName(),fileUrl,company.getCode(),company.getEmail(),"人员名单签章",company.getSignId(),notifyUrl);
            String applyNo = signService.applySignLocalFileByParam(company.getName(),company.getName(),fileUrl,company.getCode(),company.getEmail(),"人员名单签章",company.getSignId(),notifyUrl,new Float(0.7));
            if(StringUtils.isBlank(applyNo) ){
                throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"对不起,获取在线签章地址失败,请稍后重试!");
            }
@@ -2656,16 +2677,16 @@
                throw  new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到保单数据");
            }
            SaveUnionChangeDTO saveUnionChangeDTO = new SaveUnionChangeDTO();
            saveUnionChangeDTO.setApplyDate(update.getApplyStartTime());
//            saveUnionChangeDTO.setApplyDate(update.getApplyStartTime());
            saveUnionChangeDTO.setApplyDate(model.getValidTime());
            List<Integer> applyIds = new ArrayList<>();
            applyIds.add(model.getId());
            saveUnionChangeDTO.setApplyIds(applyIds);
            saveUnionChangeDTO.setApplyChange(model);
            saveUnionChangeDTO.setUnionApplyId(insuranceApply.getUnionApplyId());
            saveUnionChangeDTO.setBusinessType(model.getType());
            if(Constants.equalsInteger(model.getType(),Constants.ONE)){
                saveUnionChangeDTO.setApplyDate(model.getApplyStartTime());
            }
//            if(Constants.equalsInteger(model.getType(),Constants.ONE)){
//            }
            if(Constants.equalsInteger(user.getType(),Constants.TWO)){
                saveUnionChangeDTO.setShopId(user.getCompanyId());
            }else{
@@ -2676,8 +2697,15 @@
                saveUnionChangeDTO.setShopId(companySolution.getShopId());
            }
//            if(1==1){
//                throw new BusinessException(ResponseStatus.DATA_EMPTY);
//            }
            unionChangeService.merge(saveUnionChangeDTO);
        }
//        if(1==1){
//            throw new BusinessException(ResponseStatus.DATA_EMPTY);
//        }
        return  1;
    }