jiangping
2024-01-25 0d6bb65549a15f9681710c283f21927ff861aa56
开发业务接口
已修改3个文件
133 ■■■■■ 文件已修改
server/service/src/main/java/com/doumee/core/utils/Constants.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/core/utils/Constants.java
@@ -406,8 +406,9 @@
        BD_SIGNED_PDF(9, "签署后保单申请表PDF", "签署后保单申请表PDF"),
        COM_SING_IMG(10, "企业印章", "企业印章"),
        BD_DONE_PDF(11, "最终报单", "最终报单"),
        CA_PD_PDF(12, "最终报单", "最终报单"),
        CA_APPLY_JIAJIAN_SIGN(13, "加减保申请签章文件", "加减保申请签章文件"),
        CA_APPLY_CHANGEUNIT_SIGN(14, "换厂申请签章文件", "换厂申请签章文件"),
        ;
@@ -683,6 +684,9 @@
        CA_PALTFORM_REFUSE_APPLY(20, "驳回退回申请",""),
        CA_PALTFORM_EDIT_PIDAN(21, "修改批单","修改原因:${param}"),
        PALTFORM_EDIT_BD(22, "修改保单","修改原因:${param}"),
        CA_CHANGUNIT_APPLY_SIGN(24, "换成申请企业签章",""),
        CA_JIAJIAN_APPLY_SIGN(23, "加减保申请企业签章",""),
        ;
        // 成员变量
        private String name;
server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
@@ -10,6 +10,7 @@
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.DateUtil;
import com.doumee.core.utils.Utils;
import com.doumee.core.utils.aliyun.ALiYunUtil;
import com.doumee.dao.business.*;
import com.doumee.dao.business.dto.InsuranceApplyOptDTO;
import com.doumee.dao.business.dto.InsuranceApplyQueryDTO;
@@ -331,23 +332,122 @@
        insuranceApplyMapper.updateById(update);
        return  link;
    }
    public String uploadSignFile(String link){
        try {
            String bucketName = systemDictDataBiz.queryByCode(Constants.OSS,Constants.BUCKETNAME).getCode();
            String access_id= systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_ID).getCode();
            String access_key= systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_KEY).getCode();
            String endpoint = systemDictDataBiz.queryByCode(Constants.OSS,Constants.ENDPOINT).getCode();
            String folder = systemDictDataBiz.queryByCode(Constants.OSS,Constants.APPLY_FILE).getCode();
            String tempFileName =  DateUtil.getNowShortDate() + "/" + UUID.randomUUID().toString() + ".pdf";
            String key = folder + tempFileName;// 文件名
            ALiYunUtil obs = new ALiYunUtil(endpoint,access_id, access_key);
            if (obs.uploadOnlineObject(link,bucketName, key,null)) {
                // 移动成功,返回文件名
                return tempFileName;
            }
        }catch (Exception e){
        }
        return  null;
    }
    public Integer uploadSignedFileDo(InsuranceApply model,String fileurl) {
        InsuranceApply update = new InsuranceApply();
        update.setEditDate(new Date());
        update.setEditor(model.getCreator());
        update.setStatus(Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey());
        update.setCheckDate(update.getEditDate());
        update.setCheckInfo("企业完成签署");
        update.setCheckUserId(model.getCreator());
        update.setId(model.getId());
        insuranceApplyMapper.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.BD_SIGNED_PDF.getKey());
        f.setType(Constants.TWO);
        f.setFileurl(fileurl);
        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);
        return  1;
    }
    public Integer uploadChangeSignedFileDo(ApplyChange model,String fileurl) {
        ApplyChange update = new ApplyChange();
        update.setEditDate(new Date());
        update.setEditor(model.getCreator());
        update.setStatus(Constants.ApplyChangeStatus.SIGNATURE.getKey());
        update.setCheckDate(update.getEditDate());
        update.setCheckInfo("企业完成签署");
        update.setCheckUserId(model.getCreator());
        update.setId(model.getId());
        applyChangeMapper.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.equalsInteger(Constants.ZERO,model.getType())?Constants.MultiFile.CA_APPLY_JIAJIAN_SIGN.getKey() : Constants.MultiFile.CA_APPLY_CHANGEUNIT_SIGN.getKey());
        f.setType(Constants.TWO);
        f.setFileurl(fileurl);
        f.setName("签章申请表.pdf");
        multifileMapper.insert(f);
        Constants.ApplyLogType applyLogType =Constants.equalsInteger(Constants.ZERO,model.getType())? Constants.ApplyLogType.CA_JIAJIAN_APPLY_SIGN: Constants.ApplyLogType.CA_CHANGUNIT_APPLY_SIGN;
        ApplyLog log = new ApplyLog(update,applyLogType.getName(), null,update.getId(),applyLogType.getKey(),JSONObject.toJSONString(model), JSONObject.toJSONString(update));
        applyLogMapper.insert(log);
        return  1;
    }
    @Override
    public   void dealSignResult(NotifyDataReq data){
        if(data.getApplyNo() == null ){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        InsuranceApply model = insuranceApplyMapper.selectOne(new QueryWrapper<InsuranceApply>().lambda().eq(InsuranceApply::getSignApplyNo,data.getApplyNo()).last("limit 1" ));
        if(model != null ){
            //-----------------TUDO--------完善签约完成业务------
        }else{
            ApplyChange applyChange = applyChangeMapper.selectOne(new QueryWrapper<ApplyChange>().lambda().eq(ApplyChange::getSignApplyNo,data.getApplyNo()).last("limit 1" ));
            if(applyChange == null){
                throw  new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"系统未找到匹配合同号!");
        if(Constants.equalsInteger(data.getSignStatus(), Constants.THREE )){
            //如果已保全,可下载签约附件
            InsuranceApply model = insuranceApplyMapper.selectOne(new QueryWrapper<InsuranceApply>().lambda().eq(InsuranceApply::getSignApplyNo,data.getApplyNo()).last("limit 1" ));
            if(model != null && Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_WAIT_SIGNATURE.getKey())){
                //完成签署已完成操作
                String link = signService.linkFile(data.getApplyNo());
                String fileUrl = uploadSignFile(link);
                if(StringUtils.isBlank(fileUrl)){
                    //如果下载失败,清除合同,下次签章重新生成新合同
                    return;
                }
                uploadSignedFileDo(model,fileUrl);
                return;
            }
            //-----------------TUDO-------完善签约完成-------
        }
            ApplyChange applyChange = applyChangeMapper.selectOne(new QueryWrapper<ApplyChange>().lambda().eq(ApplyChange::getSignApplyNo,data.getApplyNo()).last("limit 1" ));
            if(applyChange != null &&Constants.equalsInteger(applyChange.getStatus(),Constants.ApplyChangeStatus.UPLOAD.getKey())){
                String link = signService.linkFile(data.getApplyNo());
                String fileUrl = uploadSignFile(link);
                if(StringUtils.isBlank(fileUrl)){
                    //如果下载失败,清除合同,下次签章重新生成新合同
                    return;
                }
                uploadChangeSignedFileDo(applyChange,fileUrl);
            }
        }else if(Constants.equalsInteger(data.getSignStatus(), Constants.TWO )){
            //如果已拒签,清除合同,下次签章重新生成新合同
            insuranceApplyMapper.update(null,new UpdateWrapper<InsuranceApply>().lambda()
                    .set(InsuranceApply::getSignApplyNo,null)
                    .eq(InsuranceApply::getSignApplyNo,data.getApplyNo()));
            //如果已拒签,清除合同,下次签章重新生成新合同
            applyChangeMapper.update(null,new UpdateWrapper<ApplyChange>().lambda()
                    .set(ApplyChange::getSignApplyNo,null)
                    .eq(ApplyChange::getSignApplyNo,data.getApplyNo()));
        }
    }
    @Override
server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java
@@ -229,7 +229,12 @@
    }
    @Override
    public Solutions findById(Integer id) {
        Solutions model = solutionsMapper.selectById(id);
        MPJLambdaWrapper<Solutions> queryWrapper = new MPJLambdaWrapper<>();
        queryWrapper.selectAll(Solutions.class);
        queryWrapper.selectAs(Insurance::getName,Solutions::getInsuranceName);
        queryWrapper.leftJoin(Insurance.class,Insurance::getId,Solutions::getInsuranceId);
        queryWrapper.eq(Solutions::getId,id);
        Solutions model = solutionsJoinMapper.selectJoinOne(Solutions.class,queryWrapper);
        if(model == null  || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
            throw  new BusinessException(ResponseStatus.DATA_EMPTY );
        }