k94314517
2024-04-02 11927cefa1347d192105c9b0bc08d1b91badf18c
server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
@@ -519,6 +519,13 @@
                .eq(Notices::getObjId,model.getId()));
        Notices notices = new Notices(noticeObjectType,Constants.ZERO,model.getId(),model.getSolutionsName(),model.getCompanyId(),Constants.NoticeType.TWO);
        noticesMapper.insert(notices);
        Solutions solutions = solutionsMapper.selectById(model.getSolutionId());
        if(Objects.nonNull(solutions)&&Objects.nonNull(solutions.getShopId())){
            Notices shopNotices = new Notices(noticeObjectType,Constants.TWO,model.getId(),model.getSolutionsName(),solutions.getShopId(),Constants.NoticeType.TWO);
            noticesMapper.insert(shopNotices);
        }
        Multifile f = new Multifile();
        f.setIsdeleted(Constants.ZERO);
@@ -601,7 +608,7 @@
        f.setCreator(model.getCreator());
        f.setObjId(update.getId());
        f.setCreateDate(update.getEditDate());
        f.setObjType(Constants.MultiFile.COMPANY_TBD_SIGNED_PDF.getKey());
        f.setObjType(Constants.MultiFile.BD_SIGNED_PDF.getKey());
        f.setType(Constants.TWO);
        f.setFileurl(fileurl);
        f.setFileurlFull(fullUrl);
@@ -648,10 +655,24 @@
        multifileMapper.insert(f);
        //数据日志
        Constants.ApplyLogType applyLogType = Constants.ApplyLogType.WTB_FINISH_MEMBER_LIST;
        ApplyLog log = new ApplyLog(update,applyLogType.getName(), null
                ,update.getId(),applyLogType.getKey(),JSONObject.toJSONString(model), JSONObject.toJSONString(update));
        applyLogMapper.insert(log);
        Solutions solutions = solutionsMapper.selectById(model.getSolutionId());
        //待办通知
        if(Objects.nonNull(solutions)&&Objects.nonNull(solutions.getShopId())){
            Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.INSURANCE_APPLY;
            Notices notices = new Notices(noticeObjectType,Constants.TWO,model.getId(),model.getSolutionsName(),
                    solutions.getShopId(), Constants.NoticeType.SEVEN);
            notices.setParam1(model.getId().toString());
            noticesMapper.insert(notices);
        }
        return  f;
    }
    
@@ -681,6 +702,15 @@
                companyId, Constants.NoticeType.TWO);
        notices.setParam1(model.getApplyId().toString());
        noticesMapper.insert(notices);
        Solutions solutions = solutionsMapper.selectById(model.getSolutionsId());
        //商户待办
        if(Objects.nonNull(solutions)&&Objects.nonNull(solutions.getShopId())){
            Notices shopNotices = new Notices(noticeObjectType,Constants.TWO,
                    model.getId(),solutions.getName(),solutions.getShopId(),Constants.NoticeType.TWO);
            notices.setParam1(model.getApplyId().toString());
            noticesMapper.insert(shopNotices);
        }
        Multifile f = new Multifile();
        f.setIsdeleted(Constants.ZERO);
@@ -732,6 +762,19 @@
        ApplyLog log = new ApplyLog(update,applyLogType.getName(), null,update.getId(),applyLogType.getKey(),JSONObject.toJSONString(model), JSONObject.toJSONString(update));
        applyLogMapper.insert(log);
        Solutions solutions = solutionsMapper.selectById(model.getSolutionsId());
        //待办通知
        if(Objects.nonNull(solutions)&&Objects.nonNull(solutions.getShopId())){
            Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.APPLY_CHANGE;
            if(model.getType().equals(Constants.ONE)){
                noticeObjectType = Constants.NoticeObjectType.CHANGE_FACTORY;
            }
            Notices notices = new Notices(noticeObjectType,Constants.TWO,model.getId(),model.getSolutionsName(),
                    solutions.getShopId(), Constants.NoticeType.SEVEN);
            notices.setParam1(model.getApplyId().toString());
            noticesMapper.insert(notices);
        }
        return f;
    }
@@ -958,6 +1001,7 @@
                .selectAll(ApplyChange.class)
                .selectAs(Solutions::getName,InsuranceApply::getSolutionsName)
                .selectAs(Solutions::getEmail,InsuranceApply::getSolutionEmail)
                .selectAs(Solutions::getId,ApplyChange::getSolutionsId)
                .selectAs(Company::getName,InsuranceApply::getCompanyName)
                .selectAs(InsuranceApply::getCompanyId,ApplyChange::getCompanyId)
                .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyChange::getApplyId)
@@ -983,11 +1027,13 @@
            }
        }
        //委托保 加减保/换厂 签署人员名单
        chagneList = applyChangeMapper.selectJoinList(ApplyChange.class,
                new MPJLambdaWrapper<ApplyChange>()
                        .selectAll(ApplyChange.class)
                        .selectAs(Solutions::getName,InsuranceApply::getSolutionsName)
                        .selectAs(Solutions::getEmail,InsuranceApply::getSolutionEmail)
                        .selectAs(Solutions::getId,ApplyChange::getSolutionsId)
                        .selectAs(Company::getName,InsuranceApply::getCompanyName)
                        .selectAs(InsuranceApply::getCompanyId,ApplyChange::getCompanyId)
                        .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyChange::getApplyId)
@@ -1179,6 +1225,7 @@
                            .selectAll(ApplyChange.class)
                            .selectAs(Solutions::getName,InsuranceApply::getSolutionsName)
                            .selectAs(Solutions::getEmail,InsuranceApply::getSolutionEmail)
                            .selectAs(Solutions::getId,ApplyChange::getSolutionsId)
                            .selectAs(Company::getName,InsuranceApply::getCompanyName)
                            .selectAs(InsuranceApply::getCompanyId,ApplyChange::getCompanyId)
                            .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyChange::getApplyId)
@@ -1202,6 +1249,7 @@
                            .selectAll(ApplyChange.class)
                            .selectAs(Solutions::getName,InsuranceApply::getSolutionsName)
                            .selectAs(Solutions::getEmail,InsuranceApply::getSolutionEmail)
                            .selectAs(Solutions::getId,ApplyChange::getSolutionsId)
                            .selectAs(Company::getName,InsuranceApply::getCompanyName)
                            .selectAs(InsuranceApply::getCompanyId,ApplyChange::getCompanyId)
                            .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyChange::getApplyId)
@@ -1413,10 +1461,20 @@
        //存储待办信息
        Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.INSURANCE_APPLY;
        //删除其他待办
        noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey())
                .ne(Notices::getType,Constants.NoticeType.SIX.getStatus())
                .eq(Notices::getObjId,model.getId()));
        if(Constants.equalsObject(solutions.getType(),Constants.ZERO)) {
            //删除其他待办
            noticesMapper.delete(new QueryWrapper<Notices>().lambda()
                    .eq(Notices::getObjType, noticeObjectType.getKey())
                    .ne(Notices::getType, Constants.NoticeType.SIX.getStatus())
                    .eq(Notices::getObjId, model.getId()));
        }else{
            //删除全部待办
            noticesMapper.delete(new QueryWrapper<Notices>().lambda()
                    .eq(Notices::getObjType, noticeObjectType.getKey())
                    .eq(Notices::getObjId, model.getId()));
        }
        String info =applyLogType.getInfo();
        if(StringUtils.isNotBlank(update.getCheckInfo())){
            info = info.replace("${param}", update.getCheckInfo());
@@ -1475,6 +1533,7 @@
        insuranceApply.setCurrentFee(BigDecimal.ZERO);
        insuranceApply.setCheckUserId(loginUserInfo.getId());
        insuranceApply.setStatus(insuranceApplyStatus.getKey());
        insuranceApply.setUnionApplyTbdStatus(Constants.ZERO);
        CountCyclePriceDTO countCyclePriceDTO = new CountCyclePriceDTO();
        countCyclePriceDTO.setSolutionsId(insuranceApply.getSolutionId());
@@ -1497,17 +1556,25 @@
//        info = info.replace("${param}", update.getCheckInfo());
        ApplyLog log = new ApplyLog(insuranceApply,applyLogType.getName(),info,insuranceApply.getId(),applyLogType.getKey(),null, null);
        applyLogMapper.insert(log);
        //发送待办业务
        //存储待办信息
        Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.INSURANCE_APPLY;
        //删除其他待办
        noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey())
                .ne(Notices::getType,Constants.NoticeType.SIX.getStatus())
                .eq(Notices::getObjId,insuranceApply.getId()));
        Notices notices = new Notices(noticeObjectType,Constants.ZERO,insuranceApply.getId(),solutions.getName(),insuranceApply.getCompanyId(),Constants.NoticeType.ZERO);
        noticesMapper.insert(notices);
        //直保业务发送待办
        if(Constants.equalsInteger(solutions.getType(),Constants.ZERO)){
            //存储待办信息
            Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.INSURANCE_APPLY;
            //删除其他待办
            noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey())
                    .ne(Notices::getType,Constants.NoticeType.SIX.getStatus())
                    .eq(Notices::getObjId,insuranceApply.getId()));
            //存储平台待办
            Notices notices = new Notices(noticeObjectType,Constants.ZERO,insuranceApply.getId(),solutions.getName(),insuranceApply.getCompanyId(),Constants.NoticeType.ZERO);
            noticesMapper.insert(notices);
            //商户待办
            if(Objects.nonNull(solutions.getShopId())){
                Notices shopNotices = new Notices(noticeObjectType,Constants.TWO,
                        insuranceApply.getId(),solutions.getName(),solutions.getShopId(),Constants.NoticeType.ZERO);
                noticesMapper.insert(shopNotices);
            }
        }
        return insuranceApply.getId();
    }
@@ -1821,6 +1888,7 @@
        queryWrapper.eq(InsuranceApply::getIsdeleted,Constants.ZERO);
        queryWrapper.eq(pageWrap.getModel().getBaseSolutionId()!=null,Solutions::getBaseId,pageWrap.getModel().getBaseSolutionId());
        queryWrapper.in(statusList.size()>0,InsuranceApply::getStatus,statusList);
        queryWrapper.like(StringUtils.isNotBlank(pageWrap.getModel().getSolutionName()),Solutions::getName,pageWrap.getModel().getSolutionName());
        if(Constants.equalsInteger(pageWrap.getModel().getStatusCollect(),Constants.THREE) ){
            queryWrapper.eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey());
            queryWrapper.lt(InsuranceApply::getEndTime, Utils.Date.getStart(new Date()));
@@ -1926,6 +1994,7 @@
        queryWrapper.selectAs(Company::getName,InsuranceApply::getCompanyName);
        queryWrapper.selectAs(Solutions::getName,InsuranceApply::getSolutionsName);
        queryWrapper.selectAs(Solutions::getType,InsuranceApply::getSolutionType);
        queryWrapper.select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad  where ad.apply_id = t.id ) as insureNum");
        queryWrapper.select(" ( select max(ac.APPLY_START_TIME) from apply_change ac  where ac.apply_id = t.id and ac.status = 2 ) as lastChangeDate");
        queryWrapper.select(" ( select sum(td.fee) from taxes ts inner join tax_detial td on td.TAX_ID = ts.id  where ts.status != 2 and td.INSURANCE_APPLY_ID = t.id ) as taxesMoney ");
        queryWrapper.select(" ( select td.CREATE_DATE from taxes ts inner join tax_detial td on td.TAX_ID = ts.id  where ts.status != 2 and td.INSURANCE_APPLY_ID = t.id order by td.CREATE_DATE desc limit 1 ) as taxesLast ");
@@ -2000,7 +2069,7 @@
        List<Integer> objList =  new ArrayList<>();
        if(list!=null && list.size()>0){
            for(InsuranceApply param : list){
                objList.get(param.getId());
                objList.add(param.getId());
            }
        }else{
            return;
@@ -2017,32 +2086,32 @@
        if(multifiles!=null && multifiles.size()>0){
            String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()
                    +systemDictDataBiz.queryByCode(Constants.OSS,Constants.APPLY_FILE).getCode();
                for(InsuranceApply model : list){
                    for(Multifile f : multifiles) {
                        if (StringUtils.isBlank(f.getFileurl())) {
                            continue;
                        }
                        f.setFileurlFull(path+f.getFileurl());
                        if(Constants.equalsInteger(f.getObjId(), model.getId()) ){
                            if (Constants.equalsInteger(f.getObjType(), Constants.MultiFile.BD_APPLY_PDF.getKey())) {
                                //签署前的投保单
                                model.setToubaodanFile(f);
                            } else if (Constants.equalsInteger(f.getObjType(), Constants.MultiFile.BD_SIGNED_PDF.getKey())) {
                                //签署后的投保单
                                model.setToubaodanSignedFile(f);
                            } else if (Constants.equalsInteger(f.getObjType(), Constants.MultiFile.BD_DONE_PDF.getKey())) {
                                //最終保险单
                                model.setBaoxiandanFile(f);
                            } else if (Constants.equalsInteger(f.getObjType(), Constants.MultiFile.MEMBER_LIST_LATTER.getKey())) {
                                //申请单
                                model.setShenqingdanFile(f);
                            } else if (Constants.equalsInteger(f.getObjType(), Constants.MultiFile.WTB_CONFIRMATION_LATTER.getKey())) {
                                //签署后确认书
                                model.setFanganFile(f);
                            }
            for(InsuranceApply model : list){
                for(Multifile f : multifiles) {
                    if (StringUtils.isBlank(f.getFileurl())) {
                        continue;
                    }
                    f.setFileurlFull(path+f.getFileurl());
                    if(Constants.equalsInteger(f.getObjId(), model.getId()) ){
                        if (Constants.equalsInteger(f.getObjType(), Constants.MultiFile.BD_APPLY_PDF.getKey())) {
                            //签署前的投保单
                            model.setToubaodanFile(f);
                        } else if (Constants.equalsInteger(f.getObjType(), Constants.MultiFile.BD_SIGNED_PDF.getKey())) {
                            //签署后的投保单
                            model.setToubaodanSignedFile(f);
                        } else if (Constants.equalsInteger(f.getObjType(), Constants.MultiFile.BD_DONE_PDF.getKey())) {
                            //最終保险单
                            model.setBaoxiandanFile(f);
                        } else if (Constants.equalsInteger(f.getObjType(), Constants.MultiFile.MEMBER_LIST_LATTER.getKey())) {
                            //申请单
                            model.setShenqingdanFile(f);
                        } else if (Constants.equalsInteger(f.getObjType(), Constants.MultiFile.WTB_CONFIRMATION_LATTER.getKey())) {
                            //签署后确认书
                            model.setFanganFile(f);
                        }
                    }
                }
            }
        }
    }
@@ -2270,8 +2339,12 @@
            Notices notices = new Notices(noticeObjectType,Constants.ZERO,insuranceApply.getId(),solutions.getName(),
                    insuranceApply.getCompanyId(), Constants.NoticeType.THREE);
            noticesMapper.insert(notices);
            //商户待办
            if(Objects.nonNull(solutions.getShopId())){
                Notices shopNotices = new Notices(noticeObjectType,Constants.TWO,
                        insuranceApply.getId(),solutions.getName(),solutions.getShopId(),Constants.NoticeType.THREE);
                noticesMapper.insert(shopNotices);
            }
        }else if(insuranceApplyOptDTO.getOptType().equals(Constants.TWO)){
            insuranceApplyStatus =  Constants.InsuranceApplyStatus.CLOSE;
            if(insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.CLOSE.getKey())){
@@ -2617,7 +2690,7 @@
        Constants.ApplyLogType applyLogType = null;
        String info = "";
        //如果是驳回,只能可驳回已签章状态下的退回申请状态进行操作
        if(!Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.WTB_UPLOAD.getKey())){
        if(!Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.WTB_TOUBAOING.getKey())){
            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该申请状态已流转,当前不支持该操作~");
        }
        Company company = user.getCompany();
@@ -2629,7 +2702,7 @@
        }
        Multifile f = multifileMapper.selectOne(new QueryWrapper<Multifile>().lambda()
                .eq(Multifile::getObjId,model.getId())
                .eq(Multifile::getObjType,Constants.MultiFile.COMPANY_TBD_SIGNED.getKey())
                .eq(Multifile::getObjType,Constants.MultiFile.BD_APPLY_PDF.getKey())
                .eq(Multifile::getIsdeleted,Constants.ZERO).last("limit 1"));
        if(f == null || StringUtils.isBlank(f.getFileurl())){
            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"对不起,获取确认书文件失败,请联系商户确认投保申请书是否正确!");