From 4ee86eb0f4984bf3ede3196ad8c5fe95e8c5a504 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期三, 15 六月 2022 19:05:02 +0800
Subject: [PATCH] 优化代码

---
 service-api/src/main/java/com/java110/api/bmo/store/impl/StoreBMOImpl.java |  160 +++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 149 insertions(+), 11 deletions(-)

diff --git a/service-api/src/main/java/com/java110/api/bmo/store/impl/StoreBMOImpl.java b/service-api/src/main/java/com/java110/api/bmo/store/impl/StoreBMOImpl.java
old mode 100644
new mode 100755
index ecc526b..e24f324
--- a/service-api/src/main/java/com/java110/api/bmo/store/impl/StoreBMOImpl.java
+++ b/service-api/src/main/java/com/java110/api/bmo/store/impl/StoreBMOImpl.java
@@ -5,16 +5,15 @@
 import com.java110.api.bmo.ApiBaseBMO;
 import com.java110.api.bmo.store.IStoreBMO;
 import com.java110.core.factory.GenerateCodeFactory;
-import com.java110.core.smo.store.IStoreInnerServiceSMO;
-import com.java110.dto.store.StoreAttrDto;
+import com.java110.dto.account.AccountDto;
 import com.java110.dto.store.StoreDto;
+import com.java110.dto.workflow.WorkflowDto;
+import com.java110.intf.store.IStoreInnerServiceSMO;
+import com.java110.po.account.AccountPo;
 import com.java110.po.org.OrgPo;
 import com.java110.po.org.OrgStaffRelPo;
-import com.java110.po.store.StoreAttrPo;
-import com.java110.po.store.StoreCerdentialPo;
-import com.java110.po.store.StorePhotoPo;
-import com.java110.po.store.StorePo;
-import com.java110.po.store.StoreUserPo;
+import com.java110.po.store.*;
+import com.java110.po.workflow.WorkflowPo;
 import com.java110.utils.cache.MappingCache;
 import com.java110.utils.constant.BusinessTypeConstant;
 import com.java110.utils.constant.CommonConstant;
@@ -39,6 +38,7 @@
 public class StoreBMOImpl extends ApiBaseBMO implements IStoreBMO {
     @Autowired
     private IStoreInnerServiceSMO storeInnerServiceSMOImpl;
+
     /**
      * 娣诲姞鍟嗘埛
      *
@@ -92,13 +92,14 @@
         JSONObject businessStoreUser = new JSONObject();
         businessStoreUser.put("storeId", paramInJson.getString("storeId"));
         businessStoreUser.put("storeUserId", "-1");
-        businessStoreUser.put("userId", paramInJson.getJSONObject("businessStore").getString("userId"));
+        businessStoreUser.put("userId", paramInJson.getJSONObject(StorePo.class.getSimpleName()).getString("userId"));
         businessStoreUser.put("relCd", StoreUserRelConstant.REL_ADMIN);
         businessStoreUsers.add(businessStoreUser);
         business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(StoreUserPo.class.getSimpleName(), businessStoreUsers);
 
         return business;
     }
+
     /**
      * 瀵硅姹傛姤鏂囧鐞�
      *
@@ -175,7 +176,7 @@
         business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ + 3);
         business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
         JSONObject businessOrg = new JSONObject();
-        businessOrg.put("orgName", paramInJson.getJSONObject("businessStore").getString("name"));
+        businessOrg.put("orgName", paramInJson.getJSONObject(StorePo.class.getSimpleName()).getString("name"));
         businessOrg.put("orgLevel", "1");
         businessOrg.put("parentOrgId", orgId);
         businessOrg.put("belongCommunityId", "9999");
@@ -246,13 +247,13 @@
 
         JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
         business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_ORG_STAFF_REL);
-        business.put(CommonConstant.HTTP_SEQ,  DEFAULT_SEQ + 6);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ + 6);
         business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
         JSONArray businessOrgStaffRels = new JSONArray();
         JSONObject businessOrgStaffRel = new JSONObject();
         businessOrgStaffRel.put("relId", "-1");
         businessOrgStaffRel.put("storeId", paramInJson.getString("storeId"));
-        businessOrgStaffRel.put("staffId", paramInJson.getJSONObject("businessStore").getString("userId"));
+        businessOrgStaffRel.put("staffId", paramInJson.getJSONObject(StorePo.class.getSimpleName()).getString("userId"));
         businessOrgStaffRel.put("orgId", paramInJson.getString("levelThreeOrgId"));
         businessOrgStaffRel.put("relCd", StoreUserRelConstant.REL_ADMIN);
         businessOrgStaffRels.add(businessOrgStaffRel);
@@ -260,4 +261,141 @@
 
         return business;
     }
+
+    public JSONObject addPurchase(JSONObject paramInJson) {
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_WORKFLOW);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ + 7);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONArray businessOrgStaffRels = new JSONArray();
+        WorkflowPo workflowPo = new WorkflowPo();
+        workflowPo.setCommunityId("9999"); //鎵�鏈夊皬鍖�
+        workflowPo.setFlowId("-1");
+        workflowPo.setFlowName("閲囪喘娴佺▼");
+        workflowPo.setFlowType(WorkflowDto.FLOW_TYPE_PURCHASE);
+        workflowPo.setSkipLevel(WorkflowDto.DEFAULT_SKIP_LEVEL);
+        workflowPo.setStoreId(paramInJson.getString("storeId"));
+        businessOrgStaffRels.add(JSONObject.parseObject(JSONObject.toJSONString(workflowPo)));
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(WorkflowPo.class.getSimpleName(), businessOrgStaffRels);
+        return business;
+    }
+
+    public JSONObject addCollection(JSONObject paramInJson) {
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_WORKFLOW);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ + 8);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONArray businessOrgStaffRels = new JSONArray();
+        WorkflowPo workflowPo = new WorkflowPo();
+        workflowPo.setCommunityId("9999"); //鎵�鏈夊皬鍖�
+        workflowPo.setFlowId("-2");
+        workflowPo.setFlowName("鐗╁搧棰嗙敤");
+        workflowPo.setFlowType(WorkflowDto.FLOW_TYPE_COLLECTION);
+        workflowPo.setSkipLevel(WorkflowDto.DEFAULT_SKIP_LEVEL);
+        workflowPo.setStoreId(paramInJson.getString("storeId"));
+        businessOrgStaffRels.add(JSONObject.parseObject(JSONObject.toJSONString(workflowPo)));
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(WorkflowPo.class.getSimpleName(), businessOrgStaffRels);
+        return business;
+    }
+
+    /**
+     * 鍚堝悓鐢宠缁
+     *
+     * @param paramInJson
+     * @return
+     */
+    public JSONObject contractApply(JSONObject paramInJson) {
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_WORKFLOW);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ + 9);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONArray businessOrgStaffRels = new JSONArray();
+        WorkflowPo workflowPo = new WorkflowPo();
+        workflowPo.setCommunityId("9999"); //鎵�鏈夊皬鍖�
+        workflowPo.setFlowId("-3");
+        workflowPo.setFlowName("鍚堝悓鐢宠缁");
+        workflowPo.setFlowType(WorkflowDto.FLOW_TYPE_CONTRACT_APPLY);
+        workflowPo.setSkipLevel(WorkflowDto.DEFAULT_SKIP_LEVEL);
+        workflowPo.setStoreId(paramInJson.getString("storeId"));
+        businessOrgStaffRels.add(JSONObject.parseObject(JSONObject.toJSONString(workflowPo)));
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(WorkflowPo.class.getSimpleName(), businessOrgStaffRels);
+        return business;
+    }
+
+
+    /**
+     * 鍚堝悓鍙樻洿
+     *
+     * @param paramInJson
+     * @return
+     */
+    public JSONObject contractChange(JSONObject paramInJson) {
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_WORKFLOW);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ + 10);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONArray businessOrgStaffRels = new JSONArray();
+        WorkflowPo workflowPo = new WorkflowPo();
+        workflowPo.setCommunityId("9999"); //鎵�鏈夊皬鍖�
+        workflowPo.setFlowId("-4");
+        workflowPo.setFlowName("鍚堝悓鍙樻洿");
+        workflowPo.setFlowType(WorkflowDto.FLOW_TYPE_CONTRACT_CHANGE);
+        workflowPo.setSkipLevel(WorkflowDto.DEFAULT_SKIP_LEVEL);
+        workflowPo.setStoreId(paramInJson.getString("storeId"));
+        businessOrgStaffRels.add(JSONObject.parseObject(JSONObject.toJSONString(workflowPo)));
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(WorkflowPo.class.getSimpleName(), businessOrgStaffRels);
+        return business;
+    }
+
+    /**
+     * 璋冩嫧瀹℃牳
+     *
+     * @param paramInJson
+     * @return
+     */
+    public JSONObject allocationStorehouse(JSONObject paramInJson) {
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_WORKFLOW);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ + 11);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONArray businessOrgStaffRels = new JSONArray();
+        WorkflowPo workflowPo = new WorkflowPo();
+        workflowPo.setCommunityId("9999"); //鎵�鏈夊皬鍖�
+        workflowPo.setFlowId("-5");
+        workflowPo.setFlowName("鐗╁搧璋冩嫧");
+        workflowPo.setFlowType(WorkflowDto.FLOW_TYPE_ALLOCATION_STOREHOUSE);
+        workflowPo.setSkipLevel(WorkflowDto.DEFAULT_SKIP_LEVEL);
+        workflowPo.setStoreId(paramInJson.getString("storeId"));
+        businessOrgStaffRels.add(JSONObject.parseObject(JSONObject.toJSONString(workflowPo)));
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(WorkflowPo.class.getSimpleName(), businessOrgStaffRels);
+        return business;
+    }
+
+    @Override
+    public JSONObject addAccount(JSONObject paramInJson,String acctType) {
+        JSONObject businessStoreObj = paramInJson.getJSONObject(StorePo.class.getSimpleName());
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_ACCT);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ + 12);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONArray account = new JSONArray();
+        AccountPo accountPo = new AccountPo();
+        accountPo.setAcctId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_acctId));
+
+        accountPo.setAcctName(businessStoreObj.getString("name"));
+        accountPo.setAcctType(acctType);
+        accountPo.setAmount("0");
+        accountPo.setObjId(paramInJson.getString("storeId"));
+        accountPo.setObjType(AccountDto.OBJ_TYPE_STORE);
+        account.add(JSONObject.parseObject(JSONObject.toJSONString(accountPo)));
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(AccountPo.class.getSimpleName(), account);
+        return business;
+    }
+
+
 }

--
Gitblit v1.8.0