ソースを参照

消息,待办

xuefy 3 年 前
コミット
8aad12ef0f

+ 80 - 4
sc-service/src/main/java/com/huyi/service/credit/controller/CreditHandleController.java

@@ -18,6 +18,7 @@ import com.tianhu.common.log.enums.BusinessType;
 import com.tianhu.common.security.annotation.PreAuthorize;
 import com.tianhu.common.security.service.TokenService;
 import com.tianhu.system.api.RemoteConfigService;
+import com.tianhu.system.api.RemoteSystemService;
 import com.tianhu.system.api.domain.SysUser;
 import com.tianhu.system.api.model.LoginUser;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -75,6 +76,12 @@ public class CreditHandleController extends BaseController {
     //审批服务类
     @Autowired
     private ApprovalService approvalService;
+    //经办人服务类
+    @Autowired
+    private ISysUserCompanyRelService sysUserCompanyRelService;
+    //消息待办服务类
+    @Autowired
+    private  RemoteSystemService remoteSystemService;
 
     /**
      * 融信确权
@@ -88,6 +95,11 @@ public class CreditHandleController extends BaseController {
     @PutMapping
     public AjaxResult approve(@RequestBody Map<String,Object> map)throws Exception
     {
+        //查询当前操作员
+        LoginUser userInfo = tokenService.getLoginUser();
+        SysUser use = userInfo.getSysUser();
+        //获取企业
+        String companyId = use.getCompanyId();
         //获取融信编号
         String  zfiId = CommonUtil.objToString(map.get("zfiId"));
         //获取融信类型
@@ -164,15 +176,49 @@ public class CreditHandleController extends BaseController {
                 //签收日期
                 financeInf.setZfiSignDate(createTime);
             }
-            approvalService.coreConfirmationApproval(map);
 
         }else if("01".equals(flag)){//拒绝
             //已失效
-            //TODo 给融资方经办人添加失效消息
-
             financeInf.setZfiStatus("03");
         }
         financeInfService.updateById(financeInf);
+
+        if("01".equals(flag)){//拒绝
+            //给融资方经办人添加失效消息
+            //获取融资方信息
+            String zfiSupplierId = CommonUtil.objToString(map.get("zfiSupplierId"));
+            //查询该企业的经办人
+            LambdaQueryWrapper<SysUserCompanyRel> companyRelLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            companyRelLambdaQueryWrapper.eq(SysUserCompanyRel::getSucrCompanyId,zfiSupplierId);
+            companyRelLambdaQueryWrapper.eq(SysUserCompanyRel::getSucrHandler,"1");
+            List<SysUserCompanyRel> companyRelList = sysUserCompanyRelService.findSysUserCompanyRels(companyRelLambdaQueryWrapper);
+            if(companyRelList.size() < 1){
+                throw  new Exception("获取经办人失败");
+            }
+            //经办人
+            String handler = CommonUtil.objToString(companyRelList.get(0).getSucrUserId());
+            //融信编号
+            String zfiNumber = CommonUtil.objToString(map.get("zfiNumber"));
+            //融信金额
+            String zfiAmount = CommonUtil.objToString(map.get("zfiAmount"));
+            //金额大写
+            String bigAmt = AmtUtil.convert(AmtUtil.moneyFormat(zfiAmount));
+            //核心企业
+            String zfiCoreId = CommonUtil.objToString(map.get("zfiCoreId"));
+            SysCompany coreCompany =  companyService.getById(zfiCoreId);
+            //核心企业名称
+            String coreName = "";
+            if(coreCompany != null){
+                coreName = coreCompany.getScyName();
+            }
+            //给融资方经办人添加失效消息
+            String title = "【确权失败】您提交于"+coreName+"的【"+zfiNumber+"】,融信金额【"+AmtUtil.moneyFormat(zfiAmount)+"】,(大写:"+bigAmt+"),确权失败,该融信已失效";
+            remoteSystemService.sendNotice(zfiSupplierId,zfiId,title,"01","03","","0",handler,"");
+
+        }else if("00".equals(flag)){
+            //调确权审批
+            approvalService.coreConfirmationApproval(map);
+        }
         return AjaxResult.success();
     }
 
@@ -335,7 +381,37 @@ public class CreditHandleController extends BaseController {
         //已失效
         financeInf.setZfiStatus("03");
         financeInfService.updateById(financeInf);
-        //TODO 核心企业开立时拒签 需要给核心企业经办人失效消息。
+        //核心企业开立时拒签 需要给核心企业经办人失效消息。
+        //获取核心企业
+        String zfiCoreId = CommonUtil.objToString(map.get("zfiCoreId"));
+        //查询该企业的经办人
+        LambdaQueryWrapper<SysUserCompanyRel> companyRelLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        companyRelLambdaQueryWrapper.eq(SysUserCompanyRel::getSucrCompanyId,zfiCoreId);
+        companyRelLambdaQueryWrapper.eq(SysUserCompanyRel::getSucrHandler,"1");
+        List<SysUserCompanyRel> companyRelList = sysUserCompanyRelService.findSysUserCompanyRels(companyRelLambdaQueryWrapper);
+        if(companyRelList.size() < 1){
+            throw  new Exception("获取经办人失败");
+        }
+        //经办人
+        String handler = CommonUtil.objToString(companyRelList.get(0).getSucrUserId());
+        //融信编号
+        String zfiNumber = CommonUtil.objToString(map.get("zfiNumber"));
+        //融信金额
+        String zfiAmount = CommonUtil.objToString(map.get("zfiAmount"));
+        //金额大写
+        String bigAmt = AmtUtil.convert(AmtUtil.moneyFormat(zfiAmount));
+        //融资企业
+        String zfiSupplierId = CommonUtil.objToString(map.get("zfiSupplierId"));
+        SysCompany supplierCompany =  companyService.getById(zfiSupplierId);
+        //融资企业名称
+        String supplierName = "";
+        if(supplierCompany != null){
+            supplierName = supplierCompany.getScyName();
+        }
+        //核心企业开立时拒签 需要给核心企业经办人失效消息
+        String title = "【融信拒签】您提交于"+supplierName+"的【"+zfiNumber+"】,融信金额【"+AmtUtil.moneyFormat(zfiAmount)+"】,(大写:"+bigAmt+"),融信拒签,该融信已失效";
+        remoteSystemService.sendNotice(zfiCoreId,zfiId,title,"01","03","","0",handler,"");
+
         return AjaxResult.success();
     }
 

+ 85 - 34
sc-service/src/main/java/com/huyi/service/credit/controller/OwnMessageController.java

@@ -7,6 +7,7 @@ import com.huyi.service.common.cfcaCommon.ICfcaFaceAuthService;
 import com.huyi.service.common.flowable.service.ApprovalService;
 import com.huyi.service.constant.FileConstants;
 import com.huyi.service.credit.service.OwnCreditService;
+import com.huyi.service.util.DocumentConstant;
 import com.keao.tianhu.core.util.AmtUtil;
 import com.spire.doc.Document;
 import com.spire.doc.FileFormat;
@@ -23,6 +24,7 @@ import com.tianhu.common.log.enums.BusinessType;
 import com.tianhu.common.security.service.TokenService;
 import com.tianhu.system.api.RemoteConfigService;
 import com.tianhu.system.api.RemoteFileService;
+import com.tianhu.system.api.RemoteSystemService;
 import com.tianhu.system.api.domain.SysUser;
 import com.tianhu.system.api.model.LoginUser;
 import org.apache.commons.io.IOUtils;
@@ -84,17 +86,18 @@ public class OwnMessageController extends BaseController {
     //融信和文件的关系服务类
     @Autowired
     private IZcFinanceFileRelService financeFileRelService;
-    //审批服务类
-    @Autowired
-    private ApprovalService approvalService;
     //系统参数服务类
     @Autowired
     private RemoteConfigService configService;
-
     //自写融信服务类
     @Autowired
     private OwnCreditService    ownCreditService;
-
+    //经办人服务类
+    @Autowired
+    private ISysUserCompanyRelService sysUserCompanyRelService;
+    //消息待办服务类
+    @Autowired
+    private RemoteSystemService remoteSystemService;
 
     /**
      * 发送短信
@@ -136,8 +139,11 @@ public class OwnMessageController extends BaseController {
         }
         //机构编号
         String institutionId = configService.selectConfigByKey("cfca_institution_id").getMsg();
+        //获取是否为生产环境
+        String isProduct = configService.selectConfigByKey("is_product").getMsg();
+        Boolean isPro = Boolean.getBoolean(isProduct);
         //发送短信验证码
-        JSONObject jsonObject =  CfcaUtil.sendSmsCode(false,institutionId,"",iphone,"");
+        JSONObject jsonObject =  CfcaUtil.sendSmsCode(isPro,institutionId,"",iphone,"");
         Boolean success = jsonObject.has("Status");
         if(success){
             //获取结果
@@ -205,7 +211,10 @@ public class OwnMessageController extends BaseController {
         }
         //机构编号
         String institutionId = configService.selectConfigByKey("cfca_institution_id").getMsg();
-        JSONObject   jsonObject =   CfcaUtil.checkSmsCode(false,institutionId,iphone,validCode,"");
+        //获取是否为生产环境
+        String isProduct = configService.selectConfigByKey("is_product").getMsg();
+        Boolean isPro = Boolean.getBoolean(isProduct);
+        JSONObject   jsonObject =   CfcaUtil.checkSmsCode(isPro,institutionId,iphone,validCode,"");
 
 
         boolean success = jsonObject.has("Verification");
@@ -304,6 +313,8 @@ public class OwnMessageController extends BaseController {
         String zfiExpireDate = CommonUtil.objToString(map.get("zfiExpireDate"));
         //还款编号
         String zfiPaymentNumber = CommonUtil.objToString(map.get("zfiPaymentNumber"));
+        //融信编号
+        String zfiNumber = CommonUtil.objToString(map.get("zfiNumber"));
         //获取开立方
         String openName = "";
         //获取开立方的社会统一码
@@ -448,33 +459,33 @@ public class OwnMessageController extends BaseController {
                 //往word中填充数据
                 Map<String,Object> ps = new HashMap<>();
                 //开立方
-                ps.put("openName",openName);
+                ps.put(DocumentConstant.OPEN_NAME,openName);
                 //开立方社会统一代码
-                ps.put("openCode",openCode);
+                ps.put(DocumentConstant.OPEN_CODE,openCode);
                 //开立方银行
-                ps.put("openBank",openBank);
+                ps.put(DocumentConstant.OPEN_BANK,openBank);
                 //开立方账号
-                ps.put("openAccount",openAccount);
+                ps.put(DocumentConstant.OPEN_ACCOUNT,openAccount);
                 //接收方
-                ps.put("receiverName",receiverName);
+                ps.put(DocumentConstant.RECEIVER_NAME,receiverName);
                 //接收方社会统一代码
-                ps.put("receiverCode",receiverCode);
+                ps.put(DocumentConstant.RECEIVER_CODE,receiverCode);
                 //接收方银行
-                ps.put("receiverBank",receiverBank);
+                ps.put(DocumentConstant.RECEIVER_BANK,receiverBank);
                 //接收方账号
-                ps.put("receiverAccount",receiverAccount);
+                ps.put(DocumentConstant.RECEIVER_ACCOUNT,receiverAccount);
                 //小写金额
-                ps.put("zfiAmount",AmtUtil.moneyFormat(zfiAmount));
+                ps.put(DocumentConstant.ZFI_AMOUNT,AmtUtil.moneyFormat(zfiAmount));
                 //大写金额
-                ps.put("zfiAmountBig",zfiAmountBig);
+                ps.put(DocumentConstant.ZFI_AMOUNT_BIG,zfiAmountBig);
                 //起止日期
-                ps.put("stopDate",stopDate);
+                ps.put(DocumentConstant.STOP_DATE,stopDate);
                 //当前日期
-                ps.put("currecntDate",currecntDate);
+                ps.put(DocumentConstant.CURRECNT_DATE,currecntDate);
                 //还款编号
-                ps.put("zfiPaymentNumber",zfiPaymentNumber);
+                ps.put(DocumentConstant.ZFI_PAYMENT_NUMBER,zfiPaymentNumber);
                 //承诺还款日
-                ps.put("expireDate",expireDateA);
+                ps.put(DocumentConstant.EXPIRE_DATE,expireDateA);
                 //调用替换word中的变量
                 WordUtil.wordTemplate(filePath,filePath,ps);
                 /**-------- word 变量替换 结束--------**/
@@ -629,6 +640,26 @@ public class OwnMessageController extends BaseController {
         //获取企业类型
         String companyType = tokenService.getLoginUser().getSysUser().getCompanyType();
         /**-------- 盖章完成修改融信状态并且发起审批 开始--------**/
+        //获取供应商的经办人
+        LambdaQueryWrapper<SysUserCompanyRel> relLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        relLambdaQueryWrapper.eq(SysUserCompanyRel::getSucrCompanyId,zfiSupplierId);
+        relLambdaQueryWrapper.eq(SysUserCompanyRel::getSucrHandler,"1");
+        List<SysUserCompanyRel>  supplierHanderList = sysUserCompanyRelService.findSysUserCompanyRels(relLambdaQueryWrapper);
+        //供应商经办人
+        String supplierHandler = "";
+        if(supplierHanderList.size() > 0){
+            supplierHandler = CommonUtil.objToString(supplierHanderList.get(0).getSucrUserId());
+        }
+        //获取核心企业的经办人
+        LambdaQueryWrapper<SysUserCompanyRel> coreLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        coreLambdaQueryWrapper.eq(SysUserCompanyRel::getSucrCompanyId,zfiCoreId);
+        coreLambdaQueryWrapper.eq(SysUserCompanyRel::getSucrHandler,"1");
+        List<SysUserCompanyRel>  coreHanderList = sysUserCompanyRelService.findSysUserCompanyRels(relLambdaQueryWrapper);
+        //核心经办人
+        String coreHandler = "";
+        if(coreHanderList.size() > 0){
+            coreHandler = CommonUtil.objToString(coreHanderList.get(0).getSucrUserId());
+        }
         //核心开立
         if("1".equals(createType)){
             //核心企业
@@ -643,7 +674,9 @@ public class OwnMessageController extends BaseController {
                 //修改人
                 finance.setUpdateBy(userId);
                 financeInfService.updateById(finance);
-                //TODO 给融资企业经办人添加一条签收待办
+                //给融资企业经办人添加一条签收待办
+                String title = "【融资签收】您提交于"+openName+"的【"+zfiNumber+"】,融信金额【"+AmtUtil.moneyFormat(zfiAmount)+"】,(大写:"+zfiAmountBig+"),融信待签收";
+                remoteSystemService.sendNotice(zfiSupplierId,zfiId,title,"00","","04","0",supplierHandler,"");
             }else if("02".equals(companyType)){
                 //融资企业
                 //修改融信状态
@@ -656,8 +689,12 @@ public class OwnMessageController extends BaseController {
                 //修改人
                 finance.setUpdateBy(userId);
                 financeInfService.updateById(finance);
-                //TODo 融资企业经办人生成一条去融资待办
-                //TODo 核心企业经办人生成一条已生效消息
+                // 融资企业经办人生成一条去融资待办
+                String title = "【融资待办】"+openName+"签发的融信【"+zfiNumber+"】已生效,融信金额【"+AmtUtil.moneyFormat(zfiAmount)+"】,(大写:"+zfiAmountBig+")";
+                remoteSystemService.sendNotice(zfiSupplierId,zfiId,title,"00","","05","0",supplierHandler,"");
+                // 核心企业经办人生成一条已生效消息
+                String  titleName = "【融信生效】您提交于"+receiverName+"的融信【"+zfiNumber+"】,融信金额【"+AmtUtil.moneyFormat(zfiAmount)+"】,(大写:"+zfiAmountBig+")承诺还款日期:"+expireDateA+"融信已生效";
+                remoteSystemService.sendNotice(zfiCoreId,zfiId,titleName,"01","04","","0",coreHandler,"");
             }
 
         }
@@ -682,9 +719,10 @@ public class OwnMessageController extends BaseController {
                 if(num != 1){
                     throw new Exception("盖章异常");
                 }
-                //TODo 给融资企业经办人生成签收待办
-                //融资企业签收审批
-                //approvalService.addSignApproval(map);
+                //给融资企业经办人生成签收待办
+                String title = "【融资签收】您提交于"+openName+"的【"+zfiNumber+"】,融信金额【"+AmtUtil.moneyFormat(zfiAmount)+"】,(大写:"+zfiAmountBig+"),融信待签收";
+                remoteSystemService.sendNotice(zfiSupplierId,zfiId,title,"00","","04","0",supplierHandler,"");
+
             }else if("02".equals(companyType)){
                 //融资企业
                 //修改融信状态
@@ -701,7 +739,9 @@ public class OwnMessageController extends BaseController {
                 //修改人
                 finance.setUpdateBy(userId);
                 financeInfService.updateById(finance);
-                //TODO 给融资企业生成去融资待办
+                //给融资企业生成去融资待办
+                String title = "【融资待办】"+openName+"签发的融信【"+zfiNumber+"】已生效,融信金额【"+AmtUtil.moneyFormat(zfiAmount)+"】,(大写:"+zfiAmountBig+")";
+                remoteSystemService.sendNotice(zfiSupplierId,zfiId,title,"00","","05","0",supplierHandler,"");
             }
 
         }
@@ -720,8 +760,12 @@ public class OwnMessageController extends BaseController {
                 //修改人
                 finance.setUpdateBy(userId);
                 financeInfService.updateById(finance);
-                //TODO  给融资企业经办人生成一条去融资待办
-                //TODo 给融资企业经办人生成一条生效消息
+                //给融资企业经办人生成一条去融资待办
+                String title = "【融资待办】"+openName+"签发的融信【"+zfiNumber+"】已生效,融信金额【"+AmtUtil.moneyFormat(zfiAmount)+"】,(大写:"+zfiAmountBig+")";
+                remoteSystemService.sendNotice(zfiSupplierId,zfiId,title,"00","","05","0",supplierHandler,"");
+                //给融资企业经办人生成一条生效消息
+                String  titleName = "【融信生效】您提交于"+openName+"的融信【"+zfiNumber+"】,融信金额【"+AmtUtil.moneyFormat(zfiAmount)+"】,(大写:"+zfiAmountBig+")承诺还款日期:"+expireDateA+"融信已生效";
+                remoteSystemService.sendNotice(zfiSupplierId,zfiId,titleName,"01","04","","0",supplierHandler,"");
             }else if("02".equals(companyType)){
                 //融资企业
                 //修改融信状态
@@ -734,8 +778,9 @@ public class OwnMessageController extends BaseController {
                 //修改人
                 finance.setUpdateBy(userId);
                 financeInfService.updateById(finance);
-                //TODo 给核心企业经办人生成一条确权待办
-
+                //给核心企业经办人生成一条确权待办
+                String  title = "【融信待确权】由"+receiverName+"提交的融信【"+zfiNumber+"】,融信金额【"+AmtUtil.moneyFormat(zfiAmount)+"】,(大写:"+zfiAmountBig+"),融信待确权";
+                remoteSystemService.sendNotice(zfiCoreId,zfiId,title,"00","","02","0",coreHandler,"");
             }
 
         }
@@ -789,7 +834,10 @@ public class OwnMessageController extends BaseController {
         String publicName = configService.selectConfigByKey("face_public_name").getMsg();
         //机构编号
         String institutionId = configService.selectConfigByKey("cfca_institution_id").getMsg();
-        Map<String,String>  m  = faceAuthService.faceAuth(false,institutionId,name,"0",idCard,backFrontUrl,backFrontUrl,"",publicName);
+        //获取是否为生产环境
+        String isProduct = configService.selectConfigByKey("is_product").getMsg();
+        Boolean isPro = Boolean.getBoolean(isProduct);
+        Map<String,String>  m  = faceAuthService.faceAuth(isPro,institutionId,name,"0",idCard,backFrontUrl,backFrontUrl,"",publicName);
         String fileUrl= m.get("fileUrl");
         //源流水号
         String originalTxSN = m.get("originalTxSN");
@@ -810,8 +858,10 @@ public class OwnMessageController extends BaseController {
     public AjaxResult checkFaceAuth (@RequestParam(required=false) String originalTxSN) throws Exception {
         //机构编号
         String institutionId = configService.selectConfigByKey("cfca_institution_id").getMsg();
+        String isProduct = configService.selectConfigByKey("is_product").getMsg();
+        Boolean isPro = Boolean.getBoolean(isProduct);
         //人脸识别结果查证
-        JSONObject jsonObject = CfcaUtil.checkFaceAuth(false,institutionId,originalTxSN,"0","");
+        JSONObject jsonObject = CfcaUtil.checkFaceAuth(isPro,institutionId,originalTxSN,"0","");
         String Verification = "";
         String Message = "";
         try {
@@ -882,4 +932,5 @@ public class OwnMessageController extends BaseController {
         }
         return f.getAbsolutePath();
     }
+
 }