k94314517
2024-04-01 0c1ac49f859a0570a19f267d6def82100cb39860
server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
@@ -103,6 +103,8 @@
    private NoticesMapper noticesMapper;
    @Autowired
    private UnionApplyJoinMapper unionApplyJoinMapper;
    @Autowired
    private UnionChangeJoinMapper unionChangeJoinMapper;
    @Override
    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
@@ -751,15 +753,6 @@
        update.setId(model.getId());
        unionApplyJoinMapper.updateById(update);
        //存储待办信息
//        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()));
//        Notices notices = new Notices(noticeObjectType,Constants.ZERO,model.getId(),model.getSolutionsName(),model.getCompanyId(),Constants.NoticeType.TWO);
//        noticesMapper.insert(notices);
        Multifile f = new Multifile();
        f.setIsdeleted(Constants.ZERO);
        f.setCreator(model.getCreator());
@@ -772,14 +765,45 @@
        f.setInfo("商户签署投保单");
        f.setName("商户签署投保单.pdf");
        multifileMapper.insert(f);
//        Constants.ApplyLogType applyLogType = Constants.ApplyLogType.SIGNATURE;
//        ApplyLog log = new ApplyLog(update,applyLogType.getName(), null,update.getId(),applyLogType.getKey(),JSONObject.toJSONString(model), JSONObject.toJSONString(update));
//        applyLogMapper.insert(log);
//
//        startSendEmail(f, model.getCompanyName(),model.getSolutionsName(),model.getSolutionEmail());
        Constants.ApplyLogType applyLogType = Constants.ApplyLogType.IA_HBD_SIGNATURE_TBD;
        ApplyLog log = new ApplyLog(model,applyLogType.getName(), null
                ,model.getId(),applyLogType.getKey(),null, JSONObject.toJSONString(model));
        applyLogMapper.insert(log);
        return  f;
    }
    /**
     * 商户合并单(加减保/换厂) 商户签署投保申请单
     * @param model
     * @param fileurl
     * @param fullUrl
     * @return
     */
    public Multifile   uploadUnionChangeSignedFileDo(UnionChange model,String fileurl,String fullUrl) {
        UnionChange update = new UnionChange();
        update.setEditDate(new Date());
        update.setEditor(model.getCreator());
        update.setStatus(Constants.UnionChangeStatus.UPLOAD_INSURANCE_POLICY.getKey());
        update.setId(model.getId());
        unionChangeJoinMapper.updateById(update);
        Multifile f = new Multifile();
        f.setIsdeleted(Constants.ZERO);
        f.setCreator(model.getCreator());
        f.setObjId(update.getId());
        f.setCreateDate(update.getEditDate());
        f.setObjType(Constants.MultiFile.WTB_CA_TBD_PDF.getKey());
        f.setType(Constants.TWO);
        f.setFileurl(fileurl);
        f.setFileurlFull(fullUrl);
        f.setInfo("委托加减保/换厂业务 -投保单");
        f.setName("委托加减保/换厂业务 -投保单.pdf");
        multifileMapper.insert(f);
        Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_HBD_SIGNATURE_TBD;
        ApplyLog log = new ApplyLog(model,applyLogType.getName(), null
                ,model.getId(),applyLogType.getKey(),null, JSONObject.toJSONString(model));
        applyLogMapper.insert(log);
@@ -1012,11 +1036,32 @@
                    continue;
                }
                uploadUnionApplySignedFileDo(model,fileUrl,path+fileUrl);
//                return;
            }
        }
        /**
         *合并加减保换厂 签署业务
         */
        List<UnionChange> unionChangeList = unionChangeJoinMapper.selectJoinList(UnionChange.class,
                new MPJLambdaWrapper<UnionChange>()
                        .selectAll(UnionChange.class)
                        .eq(UnionChange::getStatus,Constants.UnionChangeStatus.MERGE.getKey())
                        .isNotNull(UnionChange::getSignApplyNo));
        if(unionChangeList !=null && unionChangeList.size()>0 ){
            for(UnionChange model : unionChangeList){
                String status = signService.linkFileStatus(model.getSignApplyNo());
                if(!StringUtils.equals(status,"3")){
                    continue;
                }
                String link = signService.linkFile(model.getSignApplyNo());
                String fileUrl = uploadSignFile(link);
                if(StringUtils.isBlank(fileUrl)){
                    //如果下载失败,清除合同,下次签章重新生成新合同
                    continue;
                }
                uploadUnionChangeSignedFileDo(model,fileUrl,path+fileUrl);
            }
        }
@@ -1187,6 +1232,27 @@
                }
                uploadUnionApplySignedFileDo(unionApply,fileUrl,path+fileUrl);
            }
            /**
             *合并加减保换厂 签署业务
             */
            UnionChange unionChange = unionChangeJoinMapper.selectOne(
                    new MPJLambdaWrapper<UnionChange>()
                            .selectAll(UnionChange.class)
                            .eq(UnionChange::getSignApplyNo,data.getApplyNo())
                            .last(" limit 1 "));
            if(unionChange != null &&Constants.equalsInteger(unionChange.getStatus(),Constants.UnionChangeStatus.MERGE.getKey())){
                String link = signService.linkFile(model.getSignApplyNo());
                String fileUrl = uploadSignFile(link);
                if(StringUtils.isBlank(fileUrl)){
                    //如果下载失败,清除合同,下次签章重新生成新合同
                    return;
                }
                uploadUnionChangeSignedFileDo(unionChange,fileUrl,path+fileUrl);
            }
        }else if(Constants.equalsInteger(data.getSignStatus(), Constants.TWO )){
            //如果已拒签,清除合同,下次签章重新生成新合同
            insuranceApplyMapper.update(null,new UpdateWrapper<InsuranceApply>().lambda()
@@ -1207,6 +1273,9 @@
            applyChangeMapper.update(null,new UpdateWrapper<ApplyChange>().lambda()
                    .set(ApplyChange::getSignMemberListNo,null)
                    .eq(ApplyChange::getSignMemberListNo,data.getApplyNo()));
            unionChangeJoinMapper.update(null,new UpdateWrapper<UnionChange>().lambda()
                    .set(UnionChange::getSignApplyNo,null)
                    .eq(UnionChange::getSignApplyNo,data.getApplyNo()));
        }
    }
@@ -2185,11 +2254,11 @@
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非企业端用户无法进行该操作");
        }
        MPJLambdaWrapper<ApplyDetail> lambdaWrapper = new MPJLambdaWrapper<ApplyDetail>();
        lambdaWrapper.selectAll(Member.class)
        lambdaWrapper.select(ApplyDetail::getId)
                .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyDetail::getApplyId)
                .and(i->i.eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey()).or().eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.WTB_DONE.getKey()))
                .eq(InsuranceApply::getCompanyId,loginUserInfo.getCompanyId())
                .apply(" now() betwwen t.START_TIME and t.END_TIME ");
                .apply(" now() between t.START_TIME and t.END_TIME ");
         Integer count = applyDetailJoinMapper.selectJoinCount(lambdaWrapper);
        return count;
@@ -2378,7 +2447,7 @@
                .leftJoin(Worktype.class,Worktype::getId,ApplyDetail::getWorktypeId)
                .leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyDetail::getDuId)
                .isNull(ApplyDetail::getFromId)
                .eq(ApplyDetail::getId,model.getId())
                .eq(ApplyDetail::getApplyId,model.getId())
        );
        model.setApplyDetailList(applyDetailList);
        return model;