|  |  | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |     @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); | 
 |  |  |                 return; | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             //委托保 加减保企业签署 | 
 |  |  |             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); | 
 |  |  |                 return; | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             //投保合并单 商户签署保单 | 
 |  |  |             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); | 
 |  |  |                 return; | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             /** | 
 |  |  |              *合并加减保换厂 签署业务 | 
 |  |  |              */ | 
 |  |  |             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; | 
 |  |  |                 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+"状态已流转,不做处理"; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  |         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); |