| | |
| | | |
| | | 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; |
| | |
| | | |
| | | @Autowired |
| | | private MemberMapper memberMapper; |
| | | @Autowired |
| | | private MemberJoinMapper memberJoinMapper; |
| | | @Autowired |
| | | private DuSolutionMapper duSolutionMapper; |
| | | @Autowired |
| | |
| | | |
| | | } |
| | | @Override |
| | | public void dealSignResult(NotifyDataReq data){ |
| | | public String dealSignResult(NotifyDataReq data){ |
| | | if(data.getApplyNo() == null ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | if(Constants.equalsInteger(data.getSignStatus(), Constants.THREE )){ |
| | | if(Constants.equalsInteger(data.getSignStatus(), Constants.THREE ) |
| | | || Constants.equalsInteger(data.getSignStatus(), Constants.TWO )){ |
| | | //如果已保全,可下载签约附件 |
| | | String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+ |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.APPLY_FILE).getCode(); |
| | | //直保 投保申请 |
| | | InsuranceApply model = insuranceApplyJoinMapper.selectJoinOne(InsuranceApply.class, |
| | | new MPJLambdaWrapper<InsuranceApply>() |
| | | .selectAll(InsuranceApply.class) |
| | | .selectAs(Solutions::getName,InsuranceApply::getSolutionsName) |
| | | .selectAs(Solutions::getEmail,InsuranceApply::getSolutionEmail) |
| | | .selectAs(Company::getName,InsuranceApply::getCompanyName) |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId) |
| | | .eq(Solutions::getType,Constants.ZERO) |
| | | .eq(InsuranceApply::getSignApplyNo,data.getApplyNo()) |
| | | .last("limit 1" )); |
| | | if(model != null && Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.WAIT_SIGNATURE.getKey())){ |
| | | String r = dealXBTBBiz(path,data,"直保-投保申请签署"); |
| | | if(StringUtils.isNotBlank(r)){ |
| | | return r; |
| | | } |
| | | r = dealWTBQYQRSBiz(path,data,"委托保-企业方案确认书签署"); |
| | | if(StringUtils.isNotBlank(r)){ |
| | | return r; |
| | | } |
| | | r = dealWTBQYRYMQDBiz(path,data,"委托保-企业人员名单签署"); |
| | | if(StringUtils.isNotBlank(r)){ |
| | | return r; |
| | | } |
| | | r = dealWTBTBSQBiz(path,data,"委托保-投保申请书签署"); |
| | | if(StringUtils.isNotBlank(r)){ |
| | | return r; |
| | | } |
| | | r = dealZBJJBQYBiz(path,data,"直保-加减保企业签署"); |
| | | if(StringUtils.isNotBlank(r)){ |
| | | return r; |
| | | } |
| | | r = dealWTBJJBQYBiz(path,data,"委托保-加减保企业签署"); |
| | | if(StringUtils.isNotBlank(r)){ |
| | | return r; |
| | | } |
| | | r = dealHBDSHBiz(path,data,"投保合并单-商户签署签署"); |
| | | if(StringUtils.isNotBlank(r)){ |
| | | return r; |
| | | } |
| | | r = dealHBCHANGEQYBiz(path,data,"合并加减保/换厂签署"); |
| | | if(StringUtils.isNotBlank(r)){ |
| | | return r; |
| | | } |
| | | } |
| | | return "无处理数据"; |
| | | } |
| | | |
| | | private String dealHBCHANGEQYBiz(String path, NotifyDataReq data, String title) { |
| | | UnionChange unionChange = unionChangeJoinMapper.selectOne( |
| | | new MPJLambdaWrapper<UnionChange>() |
| | | .selectAll(UnionChange.class) |
| | | .eq(UnionChange::getSignApplyNo,data.getApplyNo()) |
| | | .last(" limit 1 ")); |
| | | if(unionChange == null){ |
| | | return null; |
| | | } |
| | | if( Constants.equalsInteger(unionChange.getStatus(),Constants.UnionChangeStatus.MERGE.getKey())){ |
| | | if(Constants.equalsInteger(data.getSignStatus(), Constants.THREE )){ |
| | | //完成签署已完成操作 |
| | | String link = signService.linkFile(data.getApplyNo()); |
| | | String link = signService.linkFile(unionChange.getSignApplyNo()); |
| | | String fileUrl = uploadSignFile(link); |
| | | if(StringUtils.isBlank(fileUrl)){ |
| | | //如果下载失败,清除合同,下次签章重新生成新合同 |
| | | return; |
| | | } |
| | | uploadSignedFileDo(model,fileUrl,path+fileUrl); |
| | | return; |
| | | } |
| | | //委托保 企业方案确认书 |
| | | InsuranceApply modelTBQRS = insuranceApplyJoinMapper.selectJoinOne(InsuranceApply.class, |
| | | new MPJLambdaWrapper<InsuranceApply>() |
| | | .selectAll(InsuranceApply.class) |
| | | .selectAs(Solutions::getName,InsuranceApply::getSolutionsName) |
| | | .selectAs(Solutions::getEmail,InsuranceApply::getSolutionEmail) |
| | | .selectAs(Company::getName,InsuranceApply::getCompanyName) |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId) |
| | | .eq(Solutions::getType,Constants.ONE) |
| | | .eq(InsuranceApply::getSignQrsNo,data.getApplyNo()) |
| | | .last("limit 1" )); |
| | | if(modelTBQRS != null && Constants.equalsInteger(modelTBQRS.getStatus(),Constants.InsuranceApplyStatus.WTB_UPLOAD.getKey())){ |
| | | //完成签署已完成操作 |
| | | String link = signService.linkFile(data.getApplyNo()); |
| | | String fileUrl = uploadSignFile(link); |
| | | if(StringUtils.isBlank(fileUrl)){ |
| | | //如果下载失败,清除合同,下次签章重新生成新合同 |
| | | return; |
| | | } |
| | | uploadFAQRSSignedFileDo(modelTBQRS,fileUrl,path+fileUrl); |
| | | return; |
| | | } |
| | | |
| | | |
| | | |
| | | //委托保 企业签署人员名单 |
| | | InsuranceApply modelMemberList = insuranceApplyJoinMapper.selectJoinOne(InsuranceApply.class, |
| | | new MPJLambdaWrapper<InsuranceApply>() |
| | | .selectAll(InsuranceApply.class) |
| | | .selectAs(Solutions::getName,InsuranceApply::getSolutionsName) |
| | | .selectAs(Solutions::getEmail,InsuranceApply::getSolutionEmail) |
| | | .selectAs(Company::getName,InsuranceApply::getCompanyName) |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId) |
| | | .eq(Solutions::getType,Constants.ONE) |
| | | .eq(InsuranceApply::getSignMemberListNo,data.getApplyNo()) |
| | | .last("limit 1" )); |
| | | if(modelMemberList != null && Constants.equalsInteger(modelMemberList.getStatus(),Constants.InsuranceApplyStatus.WTB_COMPANY_APPLY_SIGNATURE.getKey())){ |
| | | //完成签署已完成操作 |
| | | String link = signService.linkFile(data.getApplyNo()); |
| | | String fileUrl = uploadSignFile(link); |
| | | if(StringUtils.isBlank(fileUrl)){ |
| | | //如果下载失败,清除合同,下次签章重新生成新合同 |
| | | return; |
| | | } |
| | | uploadApplyMemberListSignedFileDo(modelMemberList,fileUrl,path+fileUrl); |
| | | return; |
| | | } |
| | | |
| | | |
| | | //委托保 投保申请书签署 |
| | | InsuranceApply modelTBQSQ = insuranceApplyJoinMapper.selectJoinOne(InsuranceApply.class, |
| | | new MPJLambdaWrapper<InsuranceApply>() |
| | | .selectAll(InsuranceApply.class) |
| | | .selectAs(Solutions::getName,InsuranceApply::getSolutionsName) |
| | | .selectAs(Solutions::getEmail,InsuranceApply::getSolutionEmail) |
| | | .selectAs(Company::getName,InsuranceApply::getCompanyName) |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId) |
| | | .eq(Solutions::getType,Constants.ONE) |
| | | .eq(InsuranceApply::getApplyTbdNo,data.getApplyNo()) |
| | | .last("limit 1" )); |
| | | if(modelTBQRS != null && Constants.equalsInteger(modelTBQSQ.getUnionApplyTbdStatus(),Constants.ONE)){ |
| | | //完成签署已完成操作 |
| | | String link = signService.linkFile(data.getApplyNo()); |
| | | String fileUrl = uploadSignFile(link); |
| | | if(StringUtils.isBlank(fileUrl)){ |
| | | //如果下载失败,清除合同,下次签章重新生成新合同 |
| | | return; |
| | | } |
| | | uploadTBSQSSignedFileDo(modelTBQSQ,fileUrl,path+fileUrl); |
| | | return; |
| | | } |
| | | |
| | | //直保 加减保企业签署 |
| | | ApplyChange applyChange = applyChangeMapper.selectJoinOne(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) |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId) |
| | | .eq(Solutions::getType,Constants.ZERO) |
| | | .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,path+fileUrl); |
| | | } |
| | | |
| | | //委托保 加减保企业签署 |
| | | ApplyChange applyChangeMemberList = applyChangeMapper.selectJoinOne(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) |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId) |
| | | .eq(Solutions::getType,Constants.ONE) |
| | | .eq(ApplyChange::getSignMemberListNo,data.getApplyNo()).last("limit 1" )); |
| | | if(applyChangeMemberList != null &&Constants.equalsInteger(applyChangeMemberList.getStatus(),Constants.ApplyChangeStatus.UPLOAD.getKey())){ |
| | | String link = signService.linkFile(data.getApplyNo()); |
| | | String fileUrl = uploadSignFile(link); |
| | | if(StringUtils.isBlank(fileUrl)){ |
| | | //如果下载失败,清除合同,下次签章重新生成新合同 |
| | | return; |
| | | } |
| | | uploadChangeMemberListSignedFileDo(applyChangeMemberList,fileUrl,path+fileUrl); |
| | | } |
| | | |
| | | |
| | | //投保合并单 商户签署保单 |
| | | UnionApply unionApply = unionApplyJoinMapper.selectOne(new QueryWrapper<UnionApply>() |
| | | .lambda().eq(UnionApply::getSignApplyNo,data.getApplyNo()).last(" limit 1 ")); |
| | | if(unionApply != null &&Constants.equalsInteger(unionApply.getStatus(),Constants.UnionApplyStatus.WAIT_SIGNATURE.getKey())){ |
| | | String link = signService.linkFile(data.getApplyNo()); |
| | | String fileUrl = uploadSignFile(link); |
| | | if(StringUtils.isBlank(fileUrl)){ |
| | | //如果下载失败,清除合同,下次签章重新生成新合同 |
| | | return; |
| | | } |
| | | 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; |
| | | return title+"合同下载失败,等待下次推送处理"; |
| | | } |
| | | uploadUnionChangeSignedFileDo(unionChange,fileUrl,path+fileUrl); |
| | | return title+"状态处理成功"; |
| | | }else{ |
| | | //如果已拒签,清除合同,下次签章重新生成新合同 |
| | | unionChangeJoinMapper.update(null,new UpdateWrapper<UnionChange>().lambda() |
| | | .set(UnionChange::getSignApplyNo,null) |
| | | .eq(UnionChange::getSignApplyNo,data.getApplyNo())); |
| | | return title+"合同拒签处理成功"; |
| | | } |
| | | } |
| | | return title+"状态已流转,不做处理"; |
| | | } |
| | | |
| | | private String dealHBDSHBiz(String path, NotifyDataReq data, String title) { |
| | | //投保合并单 商户签署保单 |
| | | UnionApply unionApply = unionApplyJoinMapper.selectOne(new QueryWrapper<UnionApply>() |
| | | .lambda().eq(UnionApply::getSignApplyNo,data.getApplyNo()).last(" limit 1 ")); |
| | | if(unionApply == null){ |
| | | return null; |
| | | } |
| | | if( Constants.equalsInteger(unionApply.getStatus(),Constants.UnionApplyStatus.WAIT_SIGNATURE.getKey())){ |
| | | if(Constants.equalsInteger(data.getSignStatus(), Constants.THREE )){ |
| | | //完成签署已完成操作 |
| | | String link = signService.linkFile(data.getApplyNo()); |
| | | String fileUrl = uploadSignFile(link); |
| | | if(StringUtils.isBlank(fileUrl)){ |
| | | //如果下载失败,清除合同,下次签章重新生成新合同 |
| | | return title+"合同下载失败,等待下次推送处理"; |
| | | } |
| | | uploadUnionApplySignedFileDo(unionApply,fileUrl,path+fileUrl); |
| | | return title+"状态处理成功"; |
| | | }else{ |
| | | //如果已拒签,清除合同,下次签章重新生成新合同 |
| | | unionApplyJoinMapper.update(null,new UpdateWrapper<UnionApply>().lambda() |
| | | .set(UnionApply::getSignApplyNo,null) |
| | | .eq(UnionApply::getSignApplyNo,data.getApplyNo())); |
| | | return title+"合同拒签处理成功"; |
| | | } |
| | | } |
| | | return title+"状态已流转,不做处理"; |
| | | |
| | | } |
| | | |
| | | private String dealWTBJJBQYBiz(String path, NotifyDataReq data, String title) { |
| | | //委托保 加减保企业签署 |
| | | ApplyChange applyChangeMemberList = applyChangeMapper.selectJoinOne(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) |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId) |
| | | .eq(Solutions::getType,Constants.ONE) |
| | | .eq(ApplyChange::getSignMemberListNo,data.getApplyNo()).last("limit 1" )); |
| | | if(applyChangeMemberList == null){ |
| | | return null; |
| | | } |
| | | if( Constants.equalsInteger(applyChangeMemberList.getStatus(),Constants.ApplyChangeStatus.UPLOAD.getKey())){ |
| | | if(Constants.equalsInteger(data.getSignStatus(), Constants.THREE )){ |
| | | //完成签署已完成操作 |
| | | String link = signService.linkFile(data.getApplyNo()); |
| | | String fileUrl = uploadSignFile(link); |
| | | if(StringUtils.isBlank(fileUrl)){ |
| | | //如果下载失败,清除合同,下次签章重新生成新合同 |
| | | return title+"合同下载失败,等待下次推送处理"; |
| | | } |
| | | uploadChangeMemberListSignedFileDo(applyChangeMemberList,fileUrl,path+fileUrl); |
| | | return title+"状态处理成功"; |
| | | }else{ |
| | | //如果已拒签,清除合同,下次签章重新生成新合同 |
| | | applyChangeMapper.update(null,new UpdateWrapper<ApplyChange>().lambda() |
| | | .set(ApplyChange::getSignMemberListNo,null) |
| | | .eq(ApplyChange::getSignMemberListNo,data.getApplyNo())); |
| | | return title+"合同拒签处理成功"; |
| | | } |
| | | } |
| | | return title+"状态已流转,不做处理"; |
| | | } |
| | | |
| | | private String dealZBJJBQYBiz(String path, NotifyDataReq data, String title) { |
| | | //直保 加减保企业签署 |
| | | ApplyChange applyChange = applyChangeMapper.selectJoinOne(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) |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId) |
| | | .eq(Solutions::getType,Constants.ZERO) |
| | | .eq(ApplyChange::getSignApplyNo,data.getApplyNo()).last("limit 1" )); |
| | | if(applyChange == null){ |
| | | return null; |
| | | } |
| | | if( Constants.equalsInteger(applyChange.getStatus(),Constants.ApplyChangeStatus.UPLOAD.getKey())){ |
| | | if(Constants.equalsInteger(data.getSignStatus(), Constants.THREE )){ |
| | | //完成签署已完成操作 |
| | | String link = signService.linkFile(data.getApplyNo()); |
| | | String fileUrl = uploadSignFile(link); |
| | | if(StringUtils.isBlank(fileUrl)){ |
| | | //如果下载失败,清除合同,下次签章重新生成新合同 |
| | | return title+"合同下载失败,等待下次推送处理"; |
| | | } |
| | | uploadChangeSignedFileDo(applyChange,fileUrl,path+fileUrl); |
| | | return title+"状态处理成功"; |
| | | }else{ |
| | | //如果已拒签,清除合同,下次签章重新生成新合同 |
| | | applyChangeMapper.update(null,new UpdateWrapper<ApplyChange>().lambda() |
| | | .set(ApplyChange::getSignApplyNo,null) |
| | | .eq(ApplyChange::getSignApplyNo,data.getApplyNo())); |
| | | return title+"合同拒签处理成功"; |
| | | } |
| | | } |
| | | |
| | | return title+"状态已流转,不做处理"; |
| | | } |
| | | |
| | | private String dealWTBTBSQBiz(String path, NotifyDataReq data, String title) { |
| | | //委托保 投保申请书签署 |
| | | InsuranceApply modelTBQSQ = insuranceApplyJoinMapper.selectJoinOne(InsuranceApply.class, |
| | | new MPJLambdaWrapper<InsuranceApply>() |
| | | .selectAll(InsuranceApply.class) |
| | | .selectAs(Solutions::getName,InsuranceApply::getSolutionsName) |
| | | .selectAs(Solutions::getEmail,InsuranceApply::getSolutionEmail) |
| | | .selectAs(Company::getName,InsuranceApply::getCompanyName) |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId) |
| | | .eq(Solutions::getType,Constants.ONE) |
| | | .eq(InsuranceApply::getApplyTbdNo,data.getApplyNo()) |
| | | .last("limit 1" )); |
| | | if(modelTBQSQ == null){ |
| | | return null; |
| | | } |
| | | if( Constants.equalsInteger(modelTBQSQ.getUnionApplyTbdStatus(),Constants.ONE)){ |
| | | if(Constants.equalsInteger(data.getSignStatus(), Constants.THREE )){ |
| | | //完成签署已完成操作 |
| | | String link = signService.linkFile(data.getApplyNo()); |
| | | String fileUrl = uploadSignFile(link); |
| | | if(StringUtils.isBlank(fileUrl)){ |
| | | //如果下载失败,清除合同,下次签章重新生成新合同 |
| | | return title+"合同下载失败,等待下次推送处理"; |
| | | } |
| | | uploadTBSQSSignedFileDo(modelTBQSQ,fileUrl,path+fileUrl); |
| | | return title+"状态处理成功"; |
| | | }else{ |
| | | //如果已拒签,清除合同,下次签章重新生成新合同 |
| | | insuranceApplyJoinMapper.update(null,new UpdateWrapper<InsuranceApply>().lambda() |
| | | .set(InsuranceApply::getApplyTbdNo,null) |
| | | .eq(InsuranceApply::getApplyTbdNo,data.getApplyNo())); |
| | | return title+"合同拒签处理成功"; |
| | | } |
| | | } |
| | | return title+"状态已流转,不做处理"; |
| | | } |
| | | |
| | | private String dealWTBQYRYMQDBiz(String path, NotifyDataReq data, String title) { |
| | | //委托保 企业签署人员名单 |
| | | InsuranceApply modelMemberList = insuranceApplyJoinMapper.selectJoinOne(InsuranceApply.class, |
| | | new MPJLambdaWrapper<InsuranceApply>() |
| | | .selectAll(InsuranceApply.class) |
| | | .selectAs(Solutions::getName,InsuranceApply::getSolutionsName) |
| | | .selectAs(Solutions::getEmail,InsuranceApply::getSolutionEmail) |
| | | .selectAs(Company::getName,InsuranceApply::getCompanyName) |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId) |
| | | .eq(Solutions::getType,Constants.ONE) |
| | | .eq(InsuranceApply::getSignMemberListNo,data.getApplyNo()) |
| | | .last("limit 1" )); |
| | | if(modelMemberList == null){ |
| | | return null; |
| | | } |
| | | if( Constants.equalsInteger(modelMemberList.getStatus(),Constants.InsuranceApplyStatus.WTB_COMPANY_APPLY_SIGNATURE.getKey())){ |
| | | if(Constants.equalsInteger(data.getSignStatus(), Constants.THREE )){ |
| | | //完成签署已完成操作 |
| | | String link = signService.linkFile(data.getApplyNo()); |
| | | String fileUrl = uploadSignFile(link); |
| | | if(StringUtils.isBlank(fileUrl)){ |
| | | //如果下载失败,清除合同,下次签章重新生成新合同 |
| | | return title+"合同下载失败,等待下次推送处理"; |
| | | } |
| | | uploadApplyMemberListSignedFileDo(modelMemberList,fileUrl,path+fileUrl); |
| | | return title+"状态处理成功"; |
| | | }else{ |
| | | //如果已拒签,清除合同,下次签章重新生成新合同 |
| | | insuranceApplyMapper.update(null,new UpdateWrapper<InsuranceApply>().lambda() |
| | | .set(InsuranceApply::getSignMemberListNo,null) |
| | | .eq(InsuranceApply::getSignMemberListNo,data.getApplyNo())); |
| | | return title+"合同拒签处理成功"; |
| | | } |
| | | } |
| | | return title+"状态已流转,不做处理"; |
| | | } |
| | | |
| | | private String dealWTBQYQRSBiz(String path, NotifyDataReq data, String title) { |
| | | //委托保 企业方案确认书 |
| | | InsuranceApply modelTBQRS = insuranceApplyJoinMapper.selectJoinOne(InsuranceApply.class, |
| | | new MPJLambdaWrapper<InsuranceApply>() |
| | | .selectAll(InsuranceApply.class) |
| | | .selectAs(Solutions::getName,InsuranceApply::getSolutionsName) |
| | | .selectAs(Solutions::getEmail,InsuranceApply::getSolutionEmail) |
| | | .selectAs(Company::getName,InsuranceApply::getCompanyName) |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId) |
| | | .eq(Solutions::getType,Constants.ONE) |
| | | .eq(InsuranceApply::getSignQrsNo,data.getApplyNo()) |
| | | .last("limit 1" )); |
| | | if(modelTBQRS == null){ |
| | | return null; |
| | | } |
| | | if( Constants.equalsInteger(modelTBQRS.getStatus(),Constants.InsuranceApplyStatus.WTB_UPLOAD.getKey())){ |
| | | if(Constants.equalsInteger(data.getSignStatus(), Constants.THREE )){ |
| | | //完成签署已完成操作 |
| | | String link = signService.linkFile(data.getApplyNo()); |
| | | String fileUrl = uploadSignFile(link); |
| | | if(StringUtils.isBlank(fileUrl)){ |
| | | //如果下载失败,清除合同,下次签章重新生成新合同 |
| | | return title+"合同下载失败,等待下次推送处理"; |
| | | } |
| | | uploadFAQRSSignedFileDo(modelTBQRS,fileUrl,path+fileUrl); |
| | | return title+"状态处理成功"; |
| | | }else{ |
| | | //如果已拒签,清除合同,下次签章重新生成新合同 |
| | | insuranceApplyMapper.update(null,new UpdateWrapper<InsuranceApply>().lambda() |
| | | .set(InsuranceApply::getSignQrsNo,null) |
| | | .eq(InsuranceApply::getSignQrsNo,data.getApplyNo())); |
| | | return title+"合同拒签处理成功"; |
| | | } |
| | | |
| | | |
| | | }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())); |
| | | insuranceApplyMapper.update(null,new UpdateWrapper<InsuranceApply>().lambda() |
| | | .set(InsuranceApply::getSignQrsNo,null) |
| | | .eq(InsuranceApply::getSignQrsNo,data.getApplyNo())); |
| | | insuranceApplyMapper.update(null,new UpdateWrapper<InsuranceApply>().lambda() |
| | | .set(InsuranceApply::getSignMemberListNo,null) |
| | | .eq(InsuranceApply::getSignMemberListNo,data.getApplyNo())); |
| | | unionApplyJoinMapper.update(null,new UpdateWrapper<UnionApply>().lambda() |
| | | .set(UnionApply::getSignApplyNo,null) |
| | | .eq(UnionApply::getSignApplyNo,data.getApplyNo())); |
| | | 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())); |
| | | } |
| | | return title+"状态已流转,不做处理"; |
| | | } |
| | | |
| | | /** |
| | | * 投保直保申请签署 |
| | | * @param path |
| | | * @param data |
| | | * @return |
| | | */ |
| | | private String dealXBTBBiz(String path, NotifyDataReq data,String title) { |
| | | InsuranceApply model = insuranceApplyJoinMapper.selectJoinOne(InsuranceApply.class, |
| | | new MPJLambdaWrapper<InsuranceApply>() |
| | | .selectAll(InsuranceApply.class) |
| | | .selectAs(Solutions::getName,InsuranceApply::getSolutionsName) |
| | | .selectAs(Solutions::getEmail,InsuranceApply::getSolutionEmail) |
| | | .selectAs(Company::getName,InsuranceApply::getCompanyName) |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId) |
| | | .eq(Solutions::getType,Constants.ZERO) |
| | | .eq(InsuranceApply::getSignApplyNo,data.getApplyNo()) |
| | | .last("limit 1" )); |
| | | if(model == null){ |
| | | return null; |
| | | } |
| | | if( Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.WAIT_SIGNATURE.getKey())){ |
| | | //完成签署已完成操作 |
| | | if(Constants.equalsInteger(data.getSignStatus(), Constants.THREE )){ |
| | | String link = signService.linkFile(data.getApplyNo()); |
| | | String fileUrl = uploadSignFile(link); |
| | | if(StringUtils.isBlank(fileUrl)){ |
| | | //如果下载失败,清除合同,下次签章重新生成新合同 |
| | | return title + "合同下载失败,等待下次推送处理"; |
| | | } |
| | | uploadSignedFileDo(model,fileUrl,path+fileUrl); |
| | | return title +"状态处理成功"; |
| | | }else{ |
| | | //如果已拒签,清除合同,下次签章重新生成新合同 |
| | | insuranceApplyMapper.update(null,new UpdateWrapper<InsuranceApply>().lambda() |
| | | .set(InsuranceApply::getSignApplyNo,null) |
| | | .eq(InsuranceApply::getSignApplyNo,data.getApplyNo())); |
| | | return title+"合同拒签处理成功"; |
| | | } |
| | | |
| | | } |
| | | return title+"状态已流转,不做处理"; |
| | | } |
| | | |
| | | |
| | |
| | | .apply(" t1.BASE_ID in ( select du.id from dispatch_unit du where du.STATUS = 0 and du.ISDELETED = 0 ) ") |
| | | ); |
| | | if(!CollectionUtils.isNotEmpty(duSolutionList)){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"数据异常:保险方案下未查询到派遣单位"); |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,保险方案下未查询到派遣单位信息,请确保派遣单位和工作配置并审核通过!"); |
| | | } |
| | | //查询所有派遣单位下的工种 |
| | | List<Integer> duSolutionIdList = duSolutionList.stream().map(i->i.getId()).collect(Collectors.toList()); |
| | |
| | | .eq(checkNewData,Worktype::getDataType,Constants.TWO) |
| | | .in(DuWorktype::getDuSolutionId,duSolutionIdList)); |
| | | if(!CollectionUtils.isNotEmpty(duWorktypeList)){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"数据异常:保险方案下未查询到工种信息"); |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,保险方案下未查询到工种信息,请确保派遣单位和工作配置并审核通过!"); |
| | | } |
| | | |
| | | if(CollectionUtils.isNotEmpty(applyDetailList)){ |
| | | List<Member> memberList = memberMapper.selectList(new QueryWrapper<Member>().lambda() |
| | | .eq(Member::getCompanyId,insuranceApply.getCompanyId()) |
| | | .eq(Member::getIsdeleted,Constants.ZERO)); |
| | | |
| | | List<Member> addMemberList = new ArrayList<>(); |
| | | for (int i = 0; i < applyDetailList.size(); i++) { |
| | | ApplyDetail applyDetail = applyDetailList.get(i); |
| | | Member member = null; |
| | | if(CollectionUtils.isNotEmpty(memberList)){ |
| | | Optional<Member> optional = memberList.stream().filter(m->m.getIdcardNo().equals(applyDetail.getIdcardNo())).findFirst(); |
| | | if(optional.isPresent()){ |
| | | member = optional.get(); |
| | | } |
| | | } |
| | | if(Objects.isNull(member)){ |
| | | member = new Member(); |
| | | member.setCreateDate(new Date()); |
| | | member.setCreator(loginUserInfo.getId()); |
| | | member.setIsdeleted(Constants.ZERO); |
| | | member.setName(applyDetail.getMemberName()); |
| | | member.setCompanyId(insuranceApply.getCompanyId()); |
| | | member.setSex(Constants.getSexByIdCard(applyDetail.getIdcardNo())); |
| | | if(!IdcardUtil.isValidCard(applyDetail.getIdcardNo())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,投保员工【"+member.getName()+"】身份证信息【"+applyDetail.getIdcardNo()+"】错误"); |
| | | } |
| | | member.setIdcardNo(applyDetail.getIdcardNo()); |
| | | member.setApplyId(insuranceApply.getId()); |
| | | member.setStartTime(applyDetail.getStartTime()); |
| | | member.setEndTime(applyDetail.getEndTime()); |
| | | member.setDuId(applyDetail.getDuId()); |
| | | member.setWorktypeId(applyDetail.getWorktypeId()); |
| | | addMemberList.add(member); |
| | | } |
| | | } |
| | | if(CollectionUtils.isNotEmpty(addMemberList)){ |
| | | memberJoinMapper.insertBatchSomeColumn(addMemberList); |
| | | } |
| | | memberList.addAll(addMemberList); |
| | | for (int i = 0; i < applyDetailList.size(); i++) { |
| | | ApplyDetail applyDetail = applyDetailList.get(i); |
| | | if(Objects.isNull(applyDetail) |
| | |
| | | ||Objects.isNull(applyDetail.getDuId()) |
| | | ||Objects.isNull(applyDetail.getWorktypeId()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"投保员工信息数据缺失"); |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,投保员工信息数据缺失,请按照要求填写员工的有效信息!"); |
| | | } |
| | | applyDetail.setCreateDate(new Date()); |
| | | applyDetail.setCreator(loginUserInfo.getId()); |
| | |
| | | applyDetail.setEndTime(insuranceApply.getApplyEndTime()); |
| | | applyDetail.setSortnum(i); |
| | | applyDetail.setApplyId(insuranceApply.getId()); |
| | | Member member = new Member(); |
| | | Member member = null; |
| | | if(Objects.isNull(applyDetail.getMemberId())){ |
| | | //查询是否存在该用户 |
| | | member = memberMapper.selectOne(new QueryWrapper<Member>().lambda() |
| | | .eq(Member::getCompanyId,insuranceApply.getCompanyId()) |
| | | .eq(Member::getIsdeleted,Constants.ZERO) |
| | | .eq(Member::getIdcardNo,applyDetail.getIdcardNo()) |
| | | .last(" limit 1") |
| | | ); |
| | | if(Objects.isNull(member)){ |
| | | member = new Member(); |
| | | member.setCreateDate(new Date()); |
| | | member.setCreator(loginUserInfo.getId()); |
| | | member.setIsdeleted(Constants.ZERO); |
| | | member.setName(applyDetail.getMemberName()); |
| | | member.setCompanyId(insuranceApply.getCompanyId()); |
| | | member.setSex(Constants.getSexByIdCard(applyDetail.getIdcardNo())); |
| | | if(!IdcardUtil.isValidCard(applyDetail.getIdcardNo())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"投保员工信息身份证信息错误["+member.getName()+"]"); |
| | | if(CollectionUtils.isNotEmpty(memberList)){ |
| | | Optional<Member> optional = memberList.stream().filter(m->m.getIdcardNo().equals(applyDetail.getIdcardNo())).findFirst(); |
| | | if(optional.isPresent()){ |
| | | member = optional.get(); |
| | | } |
| | | member.setIdcardNo(applyDetail.getIdcardNo()); |
| | | member.setApplyId(insuranceApply.getId()); |
| | | member.setStartTime(applyDetail.getStartTime()); |
| | | member.setEndTime(applyDetail.getEndTime()); |
| | | member.setDuId(applyDetail.getDuId()); |
| | | member.setWorktypeId(applyDetail.getWorktypeId()); |
| | | |
| | | memberMapper.insert(member); |
| | | }else{ |
| | | } |
| | | //查询是否存在该用户 |
| | | if(!Objects.isNull(member)){ |
| | | member.setApplyId(insuranceApply.getId()); |
| | | member.setDuId(applyDetail.getDuId()); |
| | | member.setWorktypeId(applyDetail.getWorktypeId()); |
| | |
| | | //获取计算总天数 |
| | | Integer maxDays = DateUtil.calculateBetween(applyDetail.getStartTime(),applyDetail.getEndTime(),0); |
| | | if(Constants.equalsInteger(maxDays,0)||Objects.isNull(applyDetail.getFee())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"投保信息异常:总天数与总金额错误"); |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"投保信息异常:投保总天数与总金额错误"); |
| | | } |
| | | applyDetail.setPrice( |
| | | applyDetail.getFee().divide(new BigDecimal(maxDays),7,RoundingMode.HALF_UP) |
| | | ); |
| | | //验证派遣单位信息是否存在 |
| | | if(duSolutionList.stream().filter(d->d.getDispatchUnitId().equals(applyDetail.getDuId())).collect(Collectors.toList()).size()<=Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"【"+applyDetail.getMemberName()+"】员工派遣单位未查询到!"); |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"【"+applyDetail.getMemberName()+applyDetail.getIdcardNo()+"】员工派遣单位未查询到!"); |
| | | } |
| | | if(duWorktypeList.stream().filter(d->d.getWorkTypeId().equals(applyDetail.getWorktypeId())) |
| | | .collect(Collectors.toList()).size()<=Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"【"+applyDetail.getMemberName()+"】员工工种信息未查询到!"); |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"【"+applyDetail.getMemberName()+applyDetail.getIdcardNo()+"】员工工种信息未查询到!"); |
| | | } |
| | | } |
| | | applyDetailJoinMapper.insertBatchSomeColumn(applyDetailList); |
| | |
| | | queryWrapper.selectAs(Solutions::getPrice,InsuranceApply::getPrice); |
| | | queryWrapper.selectAs(Solutions::getTimeUnit,InsuranceApply::getTimeUnit); |
| | | queryWrapper.select(" DATEDIFF( t.END_TIME ,now() ) AS loseEfficacyDays "); |
| | | queryWrapper.select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad where ad.apply_id = t.id ) as insureNum"); |
| | | queryWrapper.select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad where ad.apply_id = t.id ) as insureNum"); |
| | | queryWrapper.select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad where ad.apply_id = t.id and ad.END_TIME > now() ) as guaranteeNum"); |
| | | if(!Objects.isNull(pageWrap.getModel())&&!Objects.isNull(pageWrap.getModel().getType())){ |
| | | queryWrapper.select(" ifnull(( 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 ),0) 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 = 1 and td.INSURANCE_APPLY_ID = t.id order by td.CREATE_DATE desc limit 1 ) as taxesLast "); |
| | |
| | | .selectAs(Company::getName,InsuranceApply::getCompanyName) |
| | | .select(" ( select max(ac.APPLY_START_TIME) from apply_change ac where ac.apply_id = t.id and ac.status = 2 ) as lastChangeDate") |
| | | .select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad where ad.apply_id = t.id ) as insureNum") |
| | | .select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad where ad.apply_id = t.id and ad.END_TIME > now() ) as guaranteeNum") |
| | | .select(" t3.name as shopName") |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId) |
| | |
| | | .selectAs(Solutions::getName,InsuranceApply::getSolutionsName) |
| | | .selectAs(Solutions::getType,InsuranceApply::getSolutionType) |
| | | .selectAs(Company::getName,InsuranceApply::getCompanyName) |
| | | .select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad where ad.apply_id = t.id and ad.END_TIME > now() ) as guaranteeNum") |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId) |
| | | .eq(InsuranceApply::getId,model.getId()) |
| | |
| | | .selectAs(DispatchUnit::getName,ApplyDetail::getDuName) |
| | | .leftJoin(Worktype.class,Worktype::getId,ApplyDetail::getWorktypeId) |
| | | .leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyDetail::getDuId) |
| | | .ge(ApplyDetail::getEndTime,DateUtil.getPlusTime2(new Date())) |
| | | .eq(ApplyDetail::getApplyId,model.getId()); |
| | | //查询明细 |
| | | List<ApplyDetail> detailList =applyDetailJoinMapper.selectJoinList(ApplyDetail.class,wrapper1); |
| | |
| | | .leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyDetail::getDuId) |
| | | .isNull(ApplyDetail::getFromId) |
| | | .eq(ApplyDetail::getApplyId,model.getId()) |
| | | .orderByAsc(ApplyDetail::getId) |
| | | ); |
| | | model.setApplyDetailList(applyDetailList); |
| | | return model; |