Browse Source

发起审批,通过审批,拒绝审批接口

ch 3 years ago
parent
commit
b89bcfa749

+ 272 - 21
sc-service/src/main/java/com/huyi/service/common/flowable/controller/FlowableController.java

@@ -3,7 +3,12 @@ package com.huyi.service.common.flowable.controller;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.huyi.service.base.entity.PubApprovalProcess;
+import com.huyi.service.base.entity.ZcFinanceInf;
+import com.huyi.service.base.entity.ZcFinanceRecord;
 import com.huyi.service.base.service.IPubApprovalProcessService;
+import com.huyi.service.base.service.IZcFinanceInfService;
+import com.huyi.service.base.service.IZcFinanceRecordService;
+import com.huyi.service.common.flowable.service.ApprovalService;
 import com.keao.tianhu.starter.mybatis.plus.entity.QueryRequest;
 import com.tianhu.common.core.utils.CommonUtil;
 import com.tianhu.common.core.utils.DateUtils;
@@ -14,14 +19,17 @@ import com.tianhu.common.log.annotation.Log;
 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.RemoteCommonService;
 import com.tianhu.system.api.model.LoginUser;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cglib.beans.BeanMap;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import java.lang.reflect.InvocationTargetException;
 import java.text.ParseException;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -44,9 +52,18 @@ public class  FlowableController extends BaseController
     @Autowired
     private TokenService tokenService;
 
+    @Autowired
+    private RemoteCommonService remoteCommonService;
+    @Autowired
+    private ApprovalService approvalService;
+    @Autowired
+    private IZcFinanceRecordService zcFinanceRecordService;
+    // 开始流程
+    public final static String STRART_FLOW = "flow/strartFlow";
+
     //自动生成的合同服务类
-//    @Autowired
-//    private IWcContractInfService wcContractInfService;
+    @Autowired
+    private IZcFinanceInfService zcFinanceInfService;
 
 
 
@@ -84,17 +101,159 @@ public class  FlowableController extends BaseController
             @RequestParam("id") String id,
             @RequestParam("menuId") String menuId,
             @RequestParam("companyId") String companyId) throws Exception {
-        //合同审批通过
-        /*if("1000000000".equals(menuId)){
-            LambdaQueryWrapper<WcContractInf> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+        //核心企业融信开立审批
+        if("1000000000".equals(menuId)){
+            ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
+            //主键
+            zcFinanceInf.setZfiId(id);
+            //审批通过
+            zcFinanceInf.setZfiCoreStatus("01");
+            zcFinanceInf.setZfiSupplierStatus("00");
+            //待签收
+            zcFinanceInf.setZfiStatus("01");
+            zcFinanceInfService.updateById(zcFinanceInf);
+        //核心企业确权审批
+        }else if("1000000007".equals(menuId)){
+            ZcFinanceInf zcFinanceInf = zcFinanceInfService.getById(id);
+            String type = zcFinanceInf.getZfiCreateType();
+            if("0".equals(type)){
+                approvalService.addSignApproval(CommonUtil.entityToMap(zcFinanceInf));
+            }else if("2".equals(type)){
+                approvalService.addFinancingApproval(CommonUtil.entityToMap(zcFinanceInf));
+            }
+        }
+        //融资企业融信申请审批通过
+        else if("1000000002".equals(menuId)){
+            LambdaQueryWrapper<ZcFinanceInf> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+            String [] arr = id.split("\\|");
+            String zfiId = arr[0];
+            lambdaQueryWrapper.eq(ZcFinanceInf::getZfiId,zfiId);
+            //lambdaQueryWrapper.eq(WcContractInf::getCifCompanyId,arr[1]);
+            ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
+            //审批通过
+            zcFinanceInf.setZfiSupplierStatus("01");
+            zcFinanceInfService.update(zcFinanceInf,lambdaQueryWrapper);
+            //调用平台审批接口
+            ZcFinanceInf inf = zcFinanceInfService.getById(zfiId);
+            Map map = new HashMap();
+            //实体类转map
+            BeanMap beanMap = BeanMap.create(inf);
+            for (Object key : beanMap.keySet()) {
+                map.put(key + "", beanMap.get(key));
+            }
+            map.put("zfiId",zfiId);
+            approvalService.addPlatformApproval(map);
+        }//融资企业融信开立审批通过
+        else if("1000000001".equals(menuId)){
+            LambdaQueryWrapper<ZcFinanceInf> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+            String [] arr = id.split("\\|");
+            String zfiId = arr[0];
+            lambdaQueryWrapper.eq(ZcFinanceInf::getZfiId,zfiId);
+            //lambdaQueryWrapper.eq(WcContractInf::getCifCompanyId,arr[1]);
+            ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
+            //审批通过
+            zcFinanceInf.setZfiSupplierStatus("01");
+            zcFinanceInfService.update(zcFinanceInf,lambdaQueryWrapper);
+            //调用平台审批接口
+            ZcFinanceInf inf = zcFinanceInfService.getById(zfiId);
+            Map map = new HashMap();
+            //实体类转map
+            BeanMap beanMap = BeanMap.create(inf);
+            for (Object key : beanMap.keySet()) {
+                map.put(key + "", beanMap.get(key));
+            }
+            map.put("zfiId",zfiId);
+            approvalService.addPlatformApproval(map);
+        }//融资企业补充资料审批通过
+        else if("1000000003".equals(menuId)){
+            LambdaQueryWrapper<ZcFinanceInf> wrapper = new LambdaQueryWrapper<>();
+            String [] arr = id.split("\\|");
+            //融信id
+            String zfiId = arr[0];
+            wrapper.eq(ZcFinanceInf::getZfiId,zfiId);
+            ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
+            zcFinanceInf.setZfiSupplierStatus("01");
+            zcFinanceInfService.update(zcFinanceInf,wrapper);
+            //融信id查询融资产品
+            ZcFinanceInf inf = zcFinanceInfService.getById(zfiId);
+            //融资产品
+            String zfiProductId = inf.getZfiProductId();
+            //调用平台审批
+            //查询当前操作员
+            LoginUser user = tokenService.getLoginUser();
+            String userName = user.getUsername();
+            Map map = new HashMap();
+            if (inf != null) {
+                BeanMap beanMap = BeanMap.create(inf);
+                for (Object key : beanMap.keySet()) {
+                    map.put(key + "", beanMap.get(key));
+                }
+            }
+            //调用平台审批
+            approvalService.addPlatformApproval(map);
+        } //平台审批通过
+        else if("1000000004".equals(menuId)){
+            LambdaQueryWrapper<ZcFinanceInf> wrapper = new LambdaQueryWrapper<>();
             String [] arr = id.split("\\|");
-            lambdaQueryWrapper.eq(WcContractInf::getCifId,arr[0]);
-            lambdaQueryWrapper.eq(WcContractInf::getCifCompanyId,arr[1]);
-            WcContractInf wcContractInf = new WcContractInf();
+            //融信id
+            String zfiId = arr[0];
+            //融信id查询融信创建(0:供应商申请, 1:核心企业开立, 2:供应商开立)
+            ZcFinanceInf inf = zcFinanceInfService.getById(zfiId);
+            //融信创建(0:供应商申请, 1:核心企业开立, 2:供应商开立)
+            String zfiCreateType = inf.getZfiCreateType();
+            wrapper.eq(ZcFinanceInf::getZfiId,zfiId);
+            ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
+            //平台审批状态(00:审批中, 01:审批通过, 02:审批拒绝, 03:暂存)
+            zcFinanceInf.setZfiPlatformStatus("01");
+            //融资方审批状态(00:审批中, 01:审批通过, 02:审批拒绝, 03:暂存)
+            zcFinanceInf.setZfiSupplierStatus("01");
+            Map map = new HashMap();
+            if (inf != null) {
+                BeanMap beanMap = BeanMap.create(inf);
+                for (Object key : beanMap.keySet()) {
+                    map.put(key + "", beanMap.get(key));
+                }
+            }
+            if ("1".equals(zfiCreateType)) {
+                //融信状态(00:待确权 01:待签收 02:已生效 03:已失效 04:融资中 05:已融资 06:平台退回)
+                zcFinanceInf.setZfiStatus("02");
+                zcFinanceInfService.update(zcFinanceInf,wrapper);
+                //调用融资审批
+
+            }else if ("0".equals(zfiCreateType) || "2".equals(zfiCreateType)){
+                //融信状态(00:待确权 01:待签收 02:已生效 03:已失效 04:融资中 05:已融资 06:平台退回)
+                zcFinanceInf.setZfiStatus("00");
+                zcFinanceInfService.update(zcFinanceInf,wrapper);
+                //调用核心企业确权审批
+                //approvalService.coreConfirmationApproval(map);
+            }
+        }
+        //融资审批通过
+        else if("1000000005".equals(menuId)){
+            LambdaQueryWrapper<ZcFinanceInf> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+            lambdaQueryWrapper.eq(ZcFinanceInf::getZfiId,id);
+            ZcFinanceInf zcfInf = new ZcFinanceInf();
             //审批通过
-            wcContractInf.setCifState("02");
-            wcContractInfService.update(wcContractInf,lambdaQueryWrapper);
-        }*/
+            zcfInf.setZfiStatus("02");
+            zcFinanceInfService.update(zcfInf,lambdaQueryWrapper);
+        }
+        //融资审批通过
+        else if("1000000006".equals(menuId)){
+            LambdaQueryWrapper<ZcFinanceInf> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+            lambdaQueryWrapper.eq(ZcFinanceInf::getZfiId,id);
+            ZcFinanceInf zcfInf = new ZcFinanceInf();
+            //审批通过
+            zcfInf.setZfiStatus("04");
+            zcFinanceInfService.update(zcfInf,lambdaQueryWrapper);
+            LambdaQueryWrapper<ZcFinanceRecord> zcFinanceRecordLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            zcFinanceRecordLambdaQueryWrapper.eq(ZcFinanceRecord::getZfrFinanceId,id);
+            ZcFinanceRecord zcFinanceRecord = new ZcFinanceRecord();
+            //审批通过
+            zcFinanceRecord.setZfrStatus("00");
+            zcFinanceRecord.setZfrApproveStt("01");
+            zcFinanceRecordService.update(zcFinanceRecord,zcFinanceRecordLambdaQueryWrapper);
+        }
+
         return AjaxResult.success();
     }
 
@@ -110,23 +269,115 @@ public class  FlowableController extends BaseController
                                      @RequestParam("menuId") String menuId,
                                      @RequestParam("companyId") String companyId,
                                      @RequestParam("state") String state) throws Exception {
-        //合同
-        /*if("1000000000".equals(menuId)){
-            LambdaQueryWrapper<WcContractInf> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+        //核心企业融信开立审批
+        if("1000000000".equals(menuId)){
+            ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
+            //审批拒绝
+            if("delete".equals(state)){
+                zcFinanceInf.setZfiId(id);
+                zcFinanceInf.setZfiCoreStatus("02");
+            }else if("recall".equals(state)){
+                zcFinanceInf.setZfiId(id);
+                zcFinanceInf.setZfiCoreStatus("03");
+            }
+            zcFinanceInfService.updateById(zcFinanceInf);
+            //核心企业确权审批
+        }else if("1000000007".equals(menuId)){
+            ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
+            //审批拒绝
+            if("delete".equals(state)){
+                zcFinanceInf.setZfiId(id);
+                zcFinanceInf.setZfiStatus("02");
+            }else if("recall".equals(state)){
+                zcFinanceInf.setZfiId(id);
+                zcFinanceInf.setZfiStatus("02");
+            }
+            zcFinanceInfService.updateById(zcFinanceInf);
+        }
+        //融资企业融信申请拒绝
+        else if("1000000002".equals(menuId)){
+            LambdaQueryWrapper<ZcFinanceInf> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+            String [] arr = id.split("\\|");
+            lambdaQueryWrapper.eq(ZcFinanceInf::getZfiId,arr[0]);
+            //lambdaQueryWrapper.eq(WcContractInf::getCifCompanyId,arr[1]);
+            ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
+            //审批拒绝
+            if("delete".equals(state)){
+                zcFinanceInf.setZfiSupplierStatus("02");
+            }else if("recall".equals(state)){
+                //撤回
+                //更改为保存状态
+                zcFinanceInf.setZfiSupplierStatus("03");
+            }
+            zcFinanceInfService.update(zcFinanceInf,lambdaQueryWrapper);
+        }//融资企业融信开立拒绝
+        else if("1000000001".equals(menuId)){
+            LambdaQueryWrapper<ZcFinanceInf> lambdaQueryWrapper = new LambdaQueryWrapper<>();
             String [] arr = id.split("\\|");
-            lambdaQueryWrapper.eq(WcContractInf::getCifId,arr[0]);
-            lambdaQueryWrapper.eq(WcContractInf::getCifCompanyId,arr[1]);
-            WcContractInf wcContractInf = new WcContractInf();
+            lambdaQueryWrapper.eq(ZcFinanceInf::getZfiId,arr[0]);
+            //lambdaQueryWrapper.eq(WcContractInf::getCifCompanyId,arr[1]);
+            ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
             //审批拒绝
             if("delete".equals(state)){
-                wcContractInf.setCifState("01");
+                zcFinanceInf.setZfiSupplierStatus("02");
             }else if("recall".equals(state)){
                 //撤回
                 //更改为保存状态
-                wcContractInf.setCifState("03");
+                zcFinanceInf.setZfiSupplierStatus("03");
+            }
+            zcFinanceInfService.update(zcFinanceInf,lambdaQueryWrapper);
+        }//融资企业补充资料审批拒绝
+        else if("1000000003".equals(menuId)){
+            LambdaQueryWrapper<ZcFinanceInf> wrapper = new LambdaQueryWrapper<>();
+            String [] arr = id.split("\\|");
+            wrapper.eq(ZcFinanceInf::getZfiId,arr[0]);
+            ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
+            //审批拒绝
+            if("delete".equals(state)){
+                zcFinanceInf.setZfiSupplierStatus("02");
+            }
+            zcFinanceInfService.update(zcFinanceInf,wrapper);
+        }
+        //平台审批拒绝
+        else if("1000000004".equals(menuId)){
+            LambdaQueryWrapper<ZcFinanceInf> wrapper = new LambdaQueryWrapper<>();
+            String [] arr = id.split("\\|");
+            wrapper.eq(ZcFinanceInf::getZfiId,arr[0]);
+            ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
+            //审批拒绝
+            if("delete".equals(state)){
+                //平台审批状态(00:审批中, 01:审批通过, 02:审批拒绝, 03:暂存)
+                zcFinanceInf.setZfiPlatformStatus("02");
+                //融资方审批状态(00:审批中, 01:审批通过, 02:审批拒绝, 03:暂存)
+                zcFinanceInf.setZfiSupplierStatus("02");
+                //融信状态(00:待确权 01:待签收 02:已生效 03:已失效 04:融资中 05:已融资 06:平台退回)
+                zcFinanceInf.setZfiStatus("06");
+            }
+            zcFinanceInfService.update(zcFinanceInf,wrapper);
+        }//融资企业签收审批
+        else if("1000000005".equals(menuId)){
+            LambdaQueryWrapper<ZcFinanceInf> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+            lambdaQueryWrapper.eq(ZcFinanceInf::getZfiId,id);
+            ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
+            //审批拒绝
+            zcFinanceInf.setZfiStatus("03");
+            zcFinanceInfService.update(zcFinanceInf,lambdaQueryWrapper);
+        }//融资审批
+        else if("1000000006".equals(menuId)){
+                LambdaQueryWrapper<ZcFinanceInf> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+                lambdaQueryWrapper.eq(ZcFinanceInf::getZfiId,id);
+                ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
+                //审批拒绝
+                zcFinanceInf.setZfiStatus("03");
+                zcFinanceInfService.update(zcFinanceInf,lambdaQueryWrapper);
+                LambdaQueryWrapper<ZcFinanceRecord> zcFinanceRecordLambdaQueryWrapper = new LambdaQueryWrapper<>();
+                zcFinanceRecordLambdaQueryWrapper.eq(ZcFinanceRecord::getZfrFinanceId,id);
+                ZcFinanceRecord zcFinanceRecord = new ZcFinanceRecord();
+                //审批拒绝
+                zcFinanceRecord.setZfrStatus("02");
+                zcFinanceRecord.setZfrApproveStt("02");
+                zcFinanceRecordService.update(zcFinanceRecord,zcFinanceRecordLambdaQueryWrapper);
             }
-            wcContractInfService.update(wcContractInf,lambdaQueryWrapper);
-        }*/
 
         return AjaxResult.success();
     }

+ 230 - 11
sc-service/src/main/java/com/huyi/service/credit/controller/CreditApproveController.java

@@ -1,21 +1,30 @@
 package com.huyi.service.credit.controller;
 
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.huyi.service.base.entity.SysCompany;
 import com.huyi.service.base.entity.ZcFinanceInf;
+import com.huyi.service.base.service.ISysCompanyService;
 import com.huyi.service.base.service.IZcFinanceInfService;
+import com.huyi.service.common.flowable.service.ApprovalService;
+import com.huyi.service.util.FlowableService;
 import com.tianhu.common.core.domain.R;
 import com.tianhu.common.core.utils.CommonUtil;
+import com.tianhu.common.core.utils.DateUtils;
 import com.tianhu.common.core.web.controller.BaseController;
 import com.tianhu.common.core.web.domain.AjaxResult;
 import com.tianhu.common.security.annotation.PreAuthorize;
 import com.tianhu.common.security.service.TokenService;
 import com.tianhu.system.api.RemoteCommonService;
-import org.apache.poi.ss.formula.functions.T;
+import com.tianhu.system.api.model.LoginUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PutMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -32,31 +41,241 @@ public class CreditApproveController extends BaseController {
     private RemoteCommonService remoteCommonService;
     @Autowired
     private IZcFinanceInfService zcFinanceInfService;
+    @Autowired
+    private FlowableService flowableService;
+    @Autowired
+    private ApprovalService approvalService;
+    @Autowired
+    private ISysCompanyService iSysCompanyService;
+    // 开始流程
+    public final static String STRART_FLOW = "flow/strartFlow";
     /**
      * 融资企业申请融信提交审批
      * @param map
      * @return
      * @throws Exception
      */
-    @PreAuthorize(hasPermi = "service:financeApply:approval")
+    @PreAuthorize(hasPermi = "credit:credit:approval")
     @PutMapping("/submitApproval")
     public AjaxResult submitApproval(@RequestBody Map<String,Object> map ) throws Exception {
-        //WaLeaveInf wal = waLeaveInfService.getById(waLeaveInf.getWliId());
-        R<T> r = this.remoteCommonService.leaveStart(map);
-        if (200 != (r.getCode())) {
-            if("300".equals(r.getMsg())){
-                return AjaxResult.success();
-            }
-            throw new Exception(r.getMsg());
+        Map<String, Object> flowParam = new HashMap<String, Object>();
+		//查询当前操作员
+		LoginUser user = tokenService.getLoginUser();
+		String userName = user.getUsername();
+		flowParam.put("menuId", "1000000002");
+		flowParam.put("companyId", user.getSysUser().getCompanyId());
+		//主键
+		flowParam.put("businessKey", CommonUtil.objToString(map.get("zfiId")));
+		//员工编号
+		flowParam.put("sessionUserId", user.getSysUser().getUserId());
+		String ZfiNumber = CommonUtil.objToString(map.get("ZfiNumber"));
+		if(CommonUtil.isNotEmpty(ZfiNumber)){
+			flowParam.put("name",userName + "在" + DateUtils.getTime() + "发起融资企业融信申请审批,融信编号为:" + ZfiNumber);
+		}else {
+			flowParam.put("name",userName + "在" + DateUtils.getTime() + "发起融资企业融信申请审批.");
+		}
+		JSONObject jsonObj=new JSONObject(map);
+		flowParam.put("paras", jsonObj.toString());
+		Map<String, Object> resMap = flowableService.apiPost(STRART_FLOW, flowParam);
+		//未开启流程实例
+		if("300".equals(resMap.get("code"))){
+		    //修改状态为通过
+            ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
+            //融信编号
+			zcFinanceInf.setZfiId(CommonUtil.objToString(map.get("zfiId")));
+//            //公司编号
+//            contract.setCifCompanyId( CommonUtil.objToString(map.get("cifCompanyId")));
+            //审核通过
+			zcFinanceInf.setZfiSupplierStatus("01");
+			zcFinanceInfService.updateById(zcFinanceInf);
+			//调用平台审批
+            approvalService.addPlatformApproval(map);
+        }else if("200".equals(resMap.get("code"))){
+            //修改状态为审批中
+            ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
+            //融信编号
+            zcFinanceInf.setZfiId(CommonUtil.objToString(map.get("zfiId")));
+//            //公司编号
+//            contract.setCifCompanyId( CommonUtil.objToString(map.get("cifCompanyId")));
+            //审核中
+            zcFinanceInf.setZfiSupplierStatus("00");
+            zcFinanceInfService.updateById(zcFinanceInf);
+        }else if("450".equals(resMap.get("code"))){
+            throw new Exception("未配置审批流程!");
+        }else if (!"200".equals(resMap.get("code"))) {
+            throw new Exception(resMap.get("message").toString());
+        }
+		return AjaxResult.success();
+    }
+    /**
+     * 融资企业开立融信提交审批
+     * @param map
+     * @return
+     * @throws Exception
+     */
+    @PreAuthorize(hasPermi = "credit:finance:approval")
+    @PutMapping("/financeApproval")
+    public AjaxResult financeApproval(@RequestBody Map<String,Object> map ) throws Exception {
+        Map<String, Object> flowParam = new HashMap<String, Object>();
+        //查询当前操作员
+        LoginUser user = tokenService.getLoginUser();
+        String userName = user.getUsername();
+        flowParam.put("menuId", "1000000001");
+        flowParam.put("companyId", user.getSysUser().getCompanyId());
+        //主键
+        flowParam.put("businessKey", CommonUtil.objToString(map.get("zfiId")));
+        //员工编号
+        flowParam.put("sessionUserId", user.getSysUser().getUserId());
+        String ZfiNumber = CommonUtil.objToString(map.get("ZfiNumber"));
+        if(CommonUtil.isNotEmpty(ZfiNumber)){
+            flowParam.put("name",userName + "在" + DateUtils.getTime() + "发起融资企业开立融信审批,融信编号为:" + ZfiNumber);
+        }else {
+            flowParam.put("name",userName + "在" + DateUtils.getTime() + "发起融资企业开立融信审批.");
+        }
+        JSONObject jsonObj=new JSONObject(map);
+        flowParam.put("paras", jsonObj.toString());
+        Map<String, Object> resMap = flowableService.apiPost(STRART_FLOW, flowParam);
+        //未开启流程实例
+        if("300".equals(resMap.get("code"))){
+            //修改状态为通过
+            ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
+            //融信编号
+            zcFinanceInf.setZfiId(CommonUtil.objToString(map.get("zfiId")));
+//            //公司编号
+//            contract.setCifCompanyId( CommonUtil.objToString(map.get("cifCompanyId")));
+            //审核通过
+            zcFinanceInf.setZfiSupplierStatus("01");
+            zcFinanceInfService.updateById(zcFinanceInf);
+            //调用平台审批
+            approvalService.addPlatformApproval(map);
+        }else if("200".equals(resMap.get("code"))){
+            //修改状态为审批中
+            ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
+            //融信编号
+            zcFinanceInf.setZfiId(CommonUtil.objToString(map.get("zfiId")));
+//            //公司编号
+//            contract.setCifCompanyId( CommonUtil.objToString(map.get("cifCompanyId")));
+            //审核中
+            zcFinanceInf.setZfiSupplierStatus("00");
+            zcFinanceInfService.updateById(zcFinanceInf);
+        }else if("450".equals(resMap.get("code"))){
+            throw new Exception("未配置审批流程!");
+        }else if (!"200".equals(resMap.get("code"))) {
+            throw new Exception(resMap.get("message").toString());
+        }
+        return AjaxResult.success();
+    }
+    /**
+     * 融资企业补充资料提交审批
+     * @param map
+     * @return
+     * @throws Exception
+     */
+    @PreAuthorize(hasPermi = "credit:information:approval")
+    @PutMapping("/informationApproval")
+    public AjaxResult informationApproval(@RequestBody Map<String,Object> map ) throws Exception {
+        Map<String, Object> flowParam = new HashMap<String, Object>();
+        //查询当前操作员
+        LoginUser user = tokenService.getLoginUser();
+        String userName = user.getUsername();
+        flowParam.put("menuId", "1000000003");
+        flowParam.put("companyId", user.getSysUser().getCompanyId());
+        //双主键
+        flowParam.put("businessKey", CommonUtil.objToString(map.get("zfiId")));
+        //员工id
+        flowParam.put("sessionUserId", user.getSysUser().getUserId());
+        //融信编号
+        String zfiNumber = CommonUtil.objToString(map.get("zfiNumber"));
+        if(CommonUtil.isNotEmpty(zfiNumber)) {
+            flowParam.put("name", userName + "在" + DateUtils.getTime() + "发起补充资料审批,融信编号为:" + CommonUtil.objToString(map.get("zfiNumber")));
         }else {
+            flowParam.put("name",userName + "在" + DateUtils.getTime() + "发起补充资料审批");
+        }
+        JSONObject jsonObj=new JSONObject(map);
+        flowParam.put("paras", jsonObj.toString());
+        Map<String, Object> resMap = flowableService.apiPost(STRART_FLOW, flowParam);
+        if ("200".equals(resMap.get("code"))){
+            //融信id
             String zfiId = CommonUtil.objToString(map.get("zfiId"));
             ZcFinanceInf zfi = new ZcFinanceInf();
             zfi.setZfiId(zfiId);
-            //修改融资企业申请融信审核中
+            //融资方审批状态(00:审批中, 01:审批通过, 02:审批拒绝, 03:暂存)
             zfi.setZfiSupplierStatus("00");
+            //状态(00:待确权 01:待签收 02:已生效 03:已失效 04:融资中 05:已融资 06:平台退回)
+            zfi.setZfiStatus("01");
             zcFinanceInfService.updateById(zfi);
         }
+        //未开启流程实例
+        else if("300".equals(resMap.get("code"))){
+            //修改融资方审批状态为通过
+            ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
+            //融信id
+            zcFinanceInf.setZfiId(CommonUtil.objToString(map.get("zfiId")));
+            //融资方审批状态(00:审批中, 01:审批通过, 02:审批拒绝, 03:暂存)
+            zcFinanceInf.setZfiSupplierStatus("01");
+            zcFinanceInfService.updateById(zcFinanceInf);
+            //调用平台审批
+            approvalService.addPlatformApproval(map);
+        }else if ("450".equals(resMap.get("code"))){
+            throw new Exception("未配置审批流程!");
+        }else if (!"200".equals(resMap.get("code"))) {
+            throw new Exception(resMap.get("message").toString());
+        }
         return AjaxResult.success();
     }
-
+    /**
+     * 核心企业开立融信提交审批
+     * @param map
+     * @return
+     * @throws Exception
+     */
+    @PreAuthorize(hasPermi = "service:financeApply:coreApproval")
+    @PutMapping("/coreApproval")
+    public R coreApproval(@RequestBody Map<String,Object> map ) throws Exception {
+        Map<String, Object> flowParam = new HashMap<String, Object>();
+        //核心企业Id
+        String zfiCoreId = 	CommonUtil.objToString(map.get("zfiCoreId"));
+        LambdaQueryWrapper<SysCompany> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(SysCompany::getScyId,zfiCoreId);
+        List<SysCompany> list = iSysCompanyService.findSysCompanys(queryWrapper);
+        //查询当前操作员
+        LoginUser user = tokenService.getLoginUser();
+        flowParam.put("menuId", "1000000000");
+        flowParam.put("companyId", user.getSysUser().getCompanyId());
+        //双主键
+        flowParam.put("businessKey", CommonUtil.objToString(map.get("zfiId")));
+        //员工编号
+        flowParam.put("sessionUserId", user.getSysUser().getUserId());
+        if (!CommonUtil.isEmpty(list.get(0).getScyName())){
+            flowParam.put("name",list.get(0).getScyName() + "在" + DateUtils.getDate() + "发起融信开立审批");
+        }
+        JSONObject jsonObj = new JSONObject(map);
+        flowParam.put("paras", jsonObj.toString());
+        Map<String, Object> resMap = flowableService.apiPost(STRART_FLOW, flowParam);
+        if("200".equals(resMap.get("code"))){
+            ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
+            zcFinanceInf.setZfiId(CommonUtil.objToString(map.get("zfiId")));
+            zcFinanceInf.setZfiCoreStatus("00");
+            zcFinanceInfService.updateById(zcFinanceInf);
+        }else
+            //未开启流程实例
+            if("300".equals(resMap.get("code")) || "350".equals(resMap.get("code"))){
+                //修改状态为通过
+                ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
+                //融信Id
+                zcFinanceInf.setZfiId(CommonUtil.objToString(map.get("zfiId")));
+                //核心企业融资状态(审批通过)
+                zcFinanceInf.setZfiCoreStatus("01");
+                //审核通过(待签收)
+                zcFinanceInf.setZfiStatus("01");
+                zcFinanceInf.setUpdateBy(String.valueOf(user.getSysUser().getUserId()));
+                zcFinanceInf.setUpdateTime(DateUtils.getNowDate());
+                zcFinanceInfService.updateById(zcFinanceInf);
+            }else if ("450".equals(resMap.get("code"))) {
+                throw new Exception("未配置审批流程");
+            }else if (!"200".equals(resMap.get("code"))) {
+                throw new Exception(resMap.get("message").toString());
+            }
+        return R.ok();
+    }
 }

+ 14 - 14
sc-service/src/main/java/com/huyi/service/financeProduct/controller/FinanceProductControllers.java

@@ -165,10 +165,10 @@ public class FinanceProductControllers extends BaseController {
         String zfpShortestPeriod = CommonUtil.objToString(map.get("zfpShortestPeriod"));
         if(CommonUtil.isEmpty(zfpShortestPeriod)){
             return AjaxResult.error("最短融资账期不能为空");
-        }else{
-            if(CommonUtil.compare(zfpShortestPeriod,"14") == -1){
-                return AjaxResult.error("最短融资账期最短14天");
-            }
+//        }else{
+//            if(CommonUtil.compare(zfpShortestPeriod,"14") == -1){
+//                return AjaxResult.error("最短融资账期最短14天");
+//            }
         }
         //服务费是否可退
         String zfpCharge = CommonUtil.objToString(map.get("zfpCharge"));
@@ -197,9 +197,9 @@ public class FinanceProductControllers extends BaseController {
         }
         //记账簿托管方式
         String zfpBookkeeping = CommonUtil.objToString(map.get("zfpBookkeeping"));
-        if(CommonUtil.isEmpty(zfpBookkeeping)){
-            return AjaxResult.error("记账簿托管方式不能为空");
-        }
+//        if(CommonUtil.isEmpty(zfpBookkeeping)){
+//            return AjaxResult.error("记账簿托管方式不能为空");
+//        }
         //是否支持部分融资
         String zfpPart = CommonUtil.objToString(map.get("zfpPart"));
         if(CommonUtil.isEmpty(zfpPart)){
@@ -324,10 +324,10 @@ public class FinanceProductControllers extends BaseController {
         String zfpShortestPeriod = CommonUtil.objToString(map.get("zfpShortestPeriod"));
         if(CommonUtil.isEmpty(zfpShortestPeriod)){
             return AjaxResult.error("最短融资账期不能为空");
-        }else{
-            if(CommonUtil.compare(zfpShortestPeriod,"14") == -1){
-                return AjaxResult.error("最短融资账期最短14天");
-            }
+//        }else{
+//            if(CommonUtil.compare(zfpShortestPeriod,"14") == -1){
+//                return AjaxResult.error("最短融资账期最短14天");
+//            }
         }
         //服务费是否可退
         String zfpCharge = CommonUtil.objToString(map.get("zfpCharge"));
@@ -356,9 +356,9 @@ public class FinanceProductControllers extends BaseController {
         }
         //记账簿托管方式
         String zfpBookkeeping = CommonUtil.objToString(map.get("zfpBookkeeping"));
-        if(CommonUtil.isEmpty(zfpBookkeeping)){
-            return AjaxResult.error("记账簿托管方式不能为空");
-        }
+//        if(CommonUtil.isEmpty(zfpBookkeeping)){
+//            return AjaxResult.error("记账簿托管方式不能为空");
+//        }
         //是否支持部分融资
         String zfpPart = CommonUtil.objToString(map.get("zfpPart"));
         if(CommonUtil.isEmpty(zfpPart)){