From bb198fb66045329b6dc47a031f202aabc6b8a1dd Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期日, 31 五月 2020 21:33:01 +0800
Subject: [PATCH] 优化代码
---
Api/src/main/java/com/java110/api/bmo/org/impl/OrgBMOImpl.java | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 106 insertions(+), 0 deletions(-)
diff --git a/Api/src/main/java/com/java110/api/bmo/org/impl/OrgBMOImpl.java b/Api/src/main/java/com/java110/api/bmo/org/impl/OrgBMOImpl.java
index c0fbc3a..968f86f 100644
--- a/Api/src/main/java/com/java110/api/bmo/org/impl/OrgBMOImpl.java
+++ b/Api/src/main/java/com/java110/api/bmo/org/impl/OrgBMOImpl.java
@@ -1,8 +1,20 @@
package com.java110.api.bmo.org.impl;
+import com.alibaba.fastjson.JSONObject;
import com.java110.api.bmo.ApiBaseBMO;
import com.java110.api.bmo.org.IOrgBMO;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.smo.org.IOrgInnerServiceSMO;
+import com.java110.dto.org.OrgDto;
+import com.java110.po.community.OrgCommunityPo;
+import com.java110.po.org.OrgPo;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+
+import java.util.List;
/**
* @ClassName OrgBMOImpl
@@ -14,4 +26,98 @@
**/
@Service("orgBMOImpl")
public class OrgBMOImpl extends ApiBaseBMO implements IOrgBMO {
+ @Autowired
+ private IOrgInnerServiceSMO orgInnerServiceSMOImpl;
+
+ /**
+ * 娣诲姞灏忓尯淇℃伅
+ *
+ * @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+ * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+ * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+ */
+ public void deleteOrgCommunity(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+ OrgCommunityPo orgCommunityPo = BeanConvertUtil.covertBean(paramInJson, OrgCommunityPo.class);
+ super.delete(dataFlowContext, orgCommunityPo, BusinessTypeConstant.BUSINESS_TYPE_DELETE_ORG_COMMUNITY);
+ }
+
+ /**
+ * 娣诲姞灏忓尯淇℃伅
+ *
+ * @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+ * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+ * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+ */
+ public void deleteOrg(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+ OrgPo orgPo = BeanConvertUtil.covertBean(paramInJson, OrgPo.class);
+ super.delete(dataFlowContext, orgPo, BusinessTypeConstant.BUSINESS_TYPE_DELETE_ORG);
+
+ }
+
+ /**
+ * 娣诲姞灏忓尯淇℃伅
+ *
+ * @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+ * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+ * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+ */
+ public void addOrgCommunity(JSONObject paramInJson, JSONObject communityObj, int seq, DataFlowContext dataFlowContext) {
+
+ JSONObject businessOrg = new JSONObject();
+ businessOrg.putAll(paramInJson);
+ businessOrg.put("orgCommunityId", "-1");
+ businessOrg.put("communityId", communityObj.getString("communityId"));
+ businessOrg.put("communityName", communityObj.getString("communityName"));
+
+ OrgCommunityPo orgCommunityPo = BeanConvertUtil.covertBean(businessOrg, OrgCommunityPo.class);
+ super.insert(dataFlowContext, orgCommunityPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_ORG_COMMUNITY);
+
+ }
+
+ /**
+ * 娣诲姞灏忓尯淇℃伅
+ *
+ * @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+ * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+ * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+ */
+ public void addOrg(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+ JSONObject businessOrg = new JSONObject();
+ businessOrg.putAll(paramInJson);
+ businessOrg.put("orgId", "-1");
+ businessOrg.put("allowOperation", "T");
+ businessOrg.put("belongCommunityId", "");
+
+ OrgPo orgPo = BeanConvertUtil.covertBean(businessOrg, OrgPo.class);
+ super.insert(dataFlowContext, orgPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_ORG);
+
+ }
+
+
+ /**
+ * 娣诲姞缁勭粐绠$悊淇℃伅
+ *
+ * @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+ * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+ * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+ */
+ public void updateOrg(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+ OrgDto orgDto = new OrgDto();
+ orgDto.setOrgId(paramInJson.getString("orgId"));
+ orgDto.setStoreId(paramInJson.getString("storeId"));
+ List<OrgDto> orgDtos = orgInnerServiceSMOImpl.queryOrgs(orgDto);
+
+ Assert.listOnlyOne(orgDtos, "鏈煡璇㈠埌缁勭粐淇℃伅 鎴栨煡璇㈠埌澶氭潯鏁版嵁");
+
+ JSONObject businessOrg = new JSONObject();
+ businessOrg.putAll(paramInJson);
+ businessOrg.put("allowOperation", orgDtos.get(0).getAllowOperation());
+ businessOrg.put("belongCommunityId", orgDtos.get(0).getBelongCommunityId());
+ OrgPo orgPo = BeanConvertUtil.covertBean(businessOrg, OrgPo.class);
+ super.insert(dataFlowContext, orgPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_ORG);
+
+ }
}
--
Gitblit v1.8.0