|
@@ -0,0 +1,82 @@
|
|
|
+package com.huyi.service.common.flowable.service.service.impl;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.huyi.service.base.entity.ZcFinanceInf;
|
|
|
+import com.huyi.service.base.service.IZcFinanceInfService;
|
|
|
+import com.huyi.service.common.flowable.service.service.ApprovalService;
|
|
|
+import com.huyi.service.util.FlowableService;
|
|
|
+import com.tianhu.common.core.utils.CommonUtil;
|
|
|
+import com.tianhu.common.core.utils.DateUtils;
|
|
|
+import com.tianhu.system.api.model.LoginUser;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class ApprovalServiceImpl implements ApprovalService {
|
|
|
+ @Autowired
|
|
|
+ private FlowableService flowableService;
|
|
|
+ // 开始流程
|
|
|
+ public final static String STRART_FLOW = "flow/strartFlow";
|
|
|
+ @Autowired
|
|
|
+ private IZcFinanceInfService zcFinanceInfService;
|
|
|
+ /**
|
|
|
+ * 平台审批
|
|
|
+ * @param map
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void addPlatformApproval(@RequestBody Map map) throws Exception {
|
|
|
+ Map<String, Object> flowParam = new HashMap<String, Object>();
|
|
|
+ //查询当前操作员
|
|
|
+ flowParam.put("menuId", "1000000004");
|
|
|
+ flowParam.put("companyId", "000000");
|
|
|
+ //双主键
|
|
|
+ flowParam.put("businessKey", CommonUtil.objToString(map.get("zfiId")));
|
|
|
+ //员工id
|
|
|
+ flowParam.put("sessionUserId", "1");
|
|
|
+ //融信编号
|
|
|
+ String zfiNumber = CommonUtil.objToString(map.get("zfiNumber"));
|
|
|
+ if(CommonUtil.isNotEmpty(zfiNumber)) {
|
|
|
+ flowParam.put("name","管理员在" + DateUtils.getTime() + "发起审批,融信编号为:" + CommonUtil.objToString(map.get("zfiNumber")));
|
|
|
+ }else {
|
|
|
+ flowParam.put("name","管理员在" + 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"))){
|
|
|
+ ZcFinanceInf zfi = new ZcFinanceInf();
|
|
|
+ zfi.setZfiId(CommonUtil.objToString(map.get("zfiId")));
|
|
|
+ //平台审批状态(00:审批中, 01:审批通过, 02:审批拒绝, 03:暂存)
|
|
|
+ zfi.setZfiPlatformStatus("00");
|
|
|
+ zcFinanceInfService.updateById(zfi);
|
|
|
+ }
|
|
|
+ //未开启流程实例
|
|
|
+ if("300".equals(resMap.get("code"))){
|
|
|
+ //融信创建(0:供应商申请, 1:核心企业开立, 2:供应商开立)
|
|
|
+ String zfiCreateType = CommonUtil.objToString(map.get("zfiCreateType"));
|
|
|
+ //修改平台审批状态为通过/融信状态为已签收
|
|
|
+ ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
|
|
|
+ //融信id
|
|
|
+ zcFinanceInf.setZfiId(CommonUtil.objToString(map.get("zfiId")));
|
|
|
+ //平台审批状态(00:审批中, 01:审批通过, 02:审批拒绝, 03:暂存)
|
|
|
+ zcFinanceInf.setZfiPlatformStatus("01");
|
|
|
+ if ("1".equals(zfiCreateType)) {
|
|
|
+ //融信状态(00:待确权 01:待签收 02:已生效 03:已失效 04:融资中 05:已融资 06:平台退回)
|
|
|
+ zcFinanceInf.setZfiStatus("02");
|
|
|
+ }else if ("0".equals(zfiCreateType) || "2".equals(zfiCreateType)){
|
|
|
+ //融信状态(00:待确权 01:待签收 02:已生效 03:已失效 04:融资中 05:已融资 06:平台退回)
|
|
|
+ zcFinanceInf.setZfiStatus("00");
|
|
|
+ //核心企业确权审批
|
|
|
+ //coreConfirmationApproval(map);
|
|
|
+ }
|
|
|
+ zcFinanceInfService.updateById(zcFinanceInf);
|
|
|
+ }else if (!"200".equals(resMap.get("code"))) {
|
|
|
+ throw new Exception(resMap.get("message").toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|