From 8f61316069a6ffffb0998ed3f498bd4e3acc77e4 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期二, 10 五月 2022 11:36:15 +0800
Subject: [PATCH] 优化 费用

---
 service-api/src/main/java/com/java110/api/bmo/community/impl/CommunityBMOImpl.java |  186 +++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 173 insertions(+), 13 deletions(-)

diff --git a/service-api/src/main/java/com/java110/api/bmo/community/impl/CommunityBMOImpl.java b/service-api/src/main/java/com/java110/api/bmo/community/impl/CommunityBMOImpl.java
old mode 100644
new mode 100755
index c6ece15..808b96f
--- a/service-api/src/main/java/com/java110/api/bmo/community/impl/CommunityBMOImpl.java
+++ b/service-api/src/main/java/com/java110/api/bmo/community/impl/CommunityBMOImpl.java
@@ -6,12 +6,16 @@
 import com.java110.api.bmo.community.ICommunityBMO;
 import com.java110.core.context.DataFlowContext;
 import com.java110.core.factory.GenerateCodeFactory;
-import com.java110.core.smo.community.ICommunityInnerServiceSMO;
 import com.java110.dto.CommunityMemberDto;
 import com.java110.dto.community.CommunityDto;
+import com.java110.dto.workflow.WorkflowDto;
+import com.java110.intf.common.IWorkflowInnerServiceSMO;
+import com.java110.intf.community.ICommunityInnerServiceSMO;
+import com.java110.po.community.CommunityAttrPo;
 import com.java110.po.community.CommunityMemberPo;
 import com.java110.po.community.CommunityPo;
 import com.java110.po.fee.PayFeeConfigPo;
+import com.java110.po.workflow.WorkflowPo;
 import com.java110.utils.cache.MappingCache;
 import com.java110.utils.constant.*;
 import com.java110.utils.exception.ListenerExecuteException;
@@ -22,6 +26,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Calendar;
 import java.util.List;
 import java.util.Map;
 
@@ -36,9 +41,11 @@
 @Service("communityBMOImpl")
 public class CommunityBMOImpl extends ApiBaseBMO implements ICommunityBMO {
 
-
     @Autowired
     private ICommunityInnerServiceSMO communityInnerServiceSMOImpl;
+
+    @Autowired
+    private IWorkflowInnerServiceSMO workflowInnerServiceSMOImpl;
 
     /**
      * 娣诲姞灏忓尯淇℃伅
@@ -94,6 +101,13 @@
      */
     public JSONObject addCommunityMember(JSONObject paramInJson) {
 
+        //鏌ヨ灏忓尯鏄惁瀛樺湪
+        CommunityDto communityDto = new CommunityDto();
+        communityDto.setCommunityId(paramInJson.getString("communityId"));
+        List<CommunityDto> communityDtos = communityInnerServiceSMOImpl.queryCommunitys(communityDto);
+
+        Assert.listOnlyOne(communityDtos, "灏忓尯涓嶅瓨鍦�");
+
         JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
         business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_MEMBER_JOINED_COMMUNITY);
         business.put(CommonConstant.HTTP_SEQ, 2);
@@ -103,13 +117,87 @@
         businessCommunityMember.put("communityId", paramInJson.getString("communityId"));
         businessCommunityMember.put("memberId", paramInJson.getString("memberId"));
         businessCommunityMember.put("memberTypeCd", paramInJson.getString("memberTypeCd"));
+        businessCommunityMember.put("startTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
+        Calendar endTime = Calendar.getInstance();
+        endTime.add(Calendar.MONTH, Integer.parseInt(communityDtos.get(0).getPayFeeMonth()));
+        businessCommunityMember.put("endTime", DateUtil.getFormatTimeString(endTime.getTime(), DateUtil.DATE_FORMATE_STRING_A));
         String auditStatusCd = MappingCache.getValue(MappingConstant.DOMAIN_COMMUNITY_MEMBER_AUDIT, paramInJson.getString("memberTypeCd"));
         auditStatusCd = StringUtils.isEmpty(auditStatusCd) ? StateConstant.AGREE_AUDIT : auditStatusCd;
         businessCommunityMember.put("auditStatusCd", auditStatusCd);
-        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessCommunityMember", businessCommunityMember);
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(CommunityMemberPo.class.getSimpleName(), businessCommunityMember);
 
         return business;
     }
+
+    /**
+     * 娣诲姞灏忓尯鎴愬憳
+     *
+     * @param paramInJson 鎺ュ彛璇锋眰鏁版嵁灏佽
+     * @return 灏佽濂界殑 data鏁版嵁
+     */
+    public JSONObject updateWorkflow(JSONObject paramInJson,String flowType) {
+        WorkflowDto workflowDto = new WorkflowDto();
+        workflowDto.setCommunityId(paramInJson.getString("communityId"));
+        workflowDto.setFlowType(flowType);
+        List<WorkflowDto> workflowDtos = workflowInnerServiceSMOImpl.queryWorkflows(workflowDto);
+
+        if (workflowDtos == null || workflowDtos.size() < 1) {
+            return null;
+        }
+        return getBusiness(paramInJson, workflowDtos);
+    }
+
+    /**
+     * 淇敼鐗╁搧棰嗙敤
+     *
+     * @param paramInJson
+     * @return
+     */
+    public JSONObject updateComplaint2(JSONObject paramInJson) {
+        WorkflowDto workflowDto = new WorkflowDto();
+        workflowDto.setCommunityId(paramInJson.getString("communityId"));
+        workflowDto.setFlowType(WorkflowDto.FLOW_TYPE_COLLECTION);
+        List<WorkflowDto> workflowDtos = workflowInnerServiceSMOImpl.queryWorkflows(workflowDto);
+
+        if (workflowDtos == null || workflowDtos.size() < 1) {
+            return null;
+        }
+        return getBusiness(paramInJson, workflowDtos);
+    }
+
+    /**
+     * 淇敼鐗╁搧琚皟鎷�
+     *
+     * @param paramInJson
+     * @return
+     */
+    public JSONObject updateComplaint3(JSONObject paramInJson) {
+        WorkflowDto workflowDto = new WorkflowDto();
+        workflowDto.setCommunityId(paramInJson.getString("communityId"));
+        workflowDto.setFlowType(WorkflowDto.FLOW_TYPE_ALLOCATION_STOREHOUSE_GO);
+        List<WorkflowDto> workflowDtos = workflowInnerServiceSMOImpl.queryWorkflows(workflowDto);
+
+        if (workflowDtos == null || workflowDtos.size() < 1) {
+            return null;
+        }
+        return getBusiness(paramInJson, workflowDtos);
+    }
+
+    public JSONObject getBusiness(JSONObject paramInJson, List<WorkflowDto> workflowDtos) {
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_WORKFLOW);
+        business.put(CommonConstant.HTTP_SEQ, 2);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessCommunityMember = new JSONObject();
+        businessCommunityMember.put("flowId", workflowDtos.get(0).getFlowId());
+        businessCommunityMember.put("communityId", paramInJson.getString("communityId"));
+        businessCommunityMember.put("storeId", paramInJson.getString("memberId"));
+        JSONArray data = new JSONArray();
+        data.add(businessCommunityMember);
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(WorkflowPo.class.getSimpleName(), data);
+        return business;
+    }
+
 
     /**
      * 娣诲姞灏忓尯鎴愬憳
@@ -125,7 +213,7 @@
         business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
         JSONObject businessCommunityMember = new JSONObject();
         businessCommunityMember.put("communityMemberId", paramInJson.getString("communityMemberId"));
-        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessCommunityMember", businessCommunityMember);
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(CommunityMemberPo.class.getSimpleName(), businessCommunityMember);
 
         return business;
     }
@@ -157,7 +245,7 @@
 
 
         businessCommunityMember.put("communityMemberId", communityMemberDtoList.get(0).getCommunityMemberId());
-        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessCommunityMember", businessCommunityMember);
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(CommunityMemberPo.class.getSimpleName(), businessCommunityMember);
 
         businesses.add(business);
 
@@ -179,7 +267,7 @@
 
 
         businessCommunityMember.put("communityMemberId", communityMemberDtoList.get(0).getCommunityMemberId());
-        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessCommunityMember", businessCommunityMember);
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(CommunityMemberPo.class.getSimpleName(), businessCommunityMember);
 
         businesses.add(business);
         //杩愮淮鍥㈤槦
@@ -200,7 +288,7 @@
 
 
         businessCommunityMember.put("communityMemberId", communityMemberDtoList.get(0).getCommunityMemberId());
-        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessCommunityMember", businessCommunityMember);
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(CommunityMemberPo.class.getSimpleName(), businessCommunityMember);
 
         businesses.add(business);
 
@@ -241,12 +329,44 @@
         businessFeeConfig.put("endTime", DateUtil.LAST_TIME);
         businessFeeConfig.put("computingFormula", "1001");
         businessFeeConfig.put("squarePrice", "0.00");
+        businessFeeConfig.put("paymentCd", "1200");
         businessFeeConfig.put("additionalAmount", "0.00");
         businessFeeConfig.put("communityId", paramInJson.getString("communityId"));
         businessFeeConfig.put("configId", paramInJson.getString("configId"));
         businessFeeConfig.put("billType", "002");//鎸夋湀鍑鸿处
+        businessFeeConfig.put("paymentCycle", "1");//鎸夋湀鍑鸿处
         businessFeeConfig.put("isDefault", "T");
         PayFeeConfigPo payFeeConfigPo = BeanConvertUtil.covertBean(businessFeeConfig, PayFeeConfigPo.class);
+        super.insert(dataFlowContext, payFeeConfigPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FEE_CONFIG);
+    }
+
+    /**
+     * 娣诲姞灏忓尯淇℃伅
+     *
+     * @param paramInJson     鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+     * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+     * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+     */
+    public void addFeeConfigRepair(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+        paramInJson.put("configId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_configId));
+        JSONObject businessFeeConfig = new JSONObject();
+        businessFeeConfig.putAll(paramInJson);
+        businessFeeConfig.put("feeTypeCd", FeeTypeConstant.FEE_TYPE_REPAIR);
+        businessFeeConfig.put("feeName", "鎶ヤ慨璐筟绯荤粺榛樿]");
+        businessFeeConfig.put("feeFlag", "2006012"); //涓�娆℃�ц垂鐢�
+        businessFeeConfig.put("startTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
+        businessFeeConfig.put("endTime", DateUtil.LAST_TIME);
+        businessFeeConfig.put("computingFormula", "4004");
+        businessFeeConfig.put("squarePrice", "0.00");
+        businessFeeConfig.put("additionalAmount", "0.00");
+        businessFeeConfig.put("communityId", paramInJson.getString("communityId"));
+        businessFeeConfig.put("configId", paramInJson.getString("configId"));
+        businessFeeConfig.put("billType", "003");//鎸夊ぉ鍑鸿处
+        businessFeeConfig.put("paymentCd", "2100");
+        businessFeeConfig.put("paymentCycle", "1");//鎸夋湀鍑鸿处
+        businessFeeConfig.put("isDefault", "T");
+        PayFeeConfigPo payFeeConfigPo = BeanConvertUtil.covertBean(businessFeeConfig, PayFeeConfigPo.class);
+
         super.insert(dataFlowContext, payFeeConfigPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FEE_CONFIG);
     }
 
@@ -261,7 +381,7 @@
         paramInJson.put("configId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_configId));
         JSONObject businessFeeConfig = new JSONObject();
         businessFeeConfig.putAll(paramInJson);
-        businessFeeConfig.put("feeTypeCd", FeeTypeConstant.FEE_TYPE_SELL_UP_PARKING_SPACE);
+        businessFeeConfig.put("feeTypeCd", FeeTypeConstant.FEE_TYPE_CAR);
         businessFeeConfig.put("feeName", "鍦颁笂鍑哄敭杞︿綅璐筟绯荤粺榛樿]");
         businessFeeConfig.put("feeFlag", "2006012");
         businessFeeConfig.put("startTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
@@ -272,6 +392,8 @@
         businessFeeConfig.put("communityId", paramInJson.getString("communityId"));
         businessFeeConfig.put("configId", paramInJson.getString("configId"));
         businessFeeConfig.put("billType", "003");//鎸夊ぉ鍑鸿处
+        businessFeeConfig.put("paymentCd", "1200");
+        businessFeeConfig.put("paymentCycle", "1");//鎸夋湀鍑鸿处
         businessFeeConfig.put("isDefault", "T");
         PayFeeConfigPo payFeeConfigPo = BeanConvertUtil.covertBean(businessFeeConfig, PayFeeConfigPo.class);
 
@@ -289,7 +411,7 @@
         paramInJson.put("configId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_configId));
         JSONObject businessFeeConfig = new JSONObject();
         businessFeeConfig.putAll(paramInJson);
-        businessFeeConfig.put("feeTypeCd", FeeTypeConstant.FEE_TYPE_SELL_DOWN_PARKING_SPACE);
+        businessFeeConfig.put("feeTypeCd", FeeTypeConstant.FEE_TYPE_CAR);
         businessFeeConfig.put("feeName", "鍦颁笅鍑哄敭杞︿綅璐筟绯荤粺榛樿]");
         businessFeeConfig.put("feeFlag", "2006012");
         businessFeeConfig.put("startTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
@@ -300,6 +422,8 @@
         businessFeeConfig.put("communityId", paramInJson.getString("communityId"));
         businessFeeConfig.put("configId", paramInJson.getString("configId"));
         businessFeeConfig.put("billType", "003");//鎸夊ぉ鍑鸿处
+        businessFeeConfig.put("paymentCd", "1200");
+        businessFeeConfig.put("paymentCycle", "1");//鎸夋湀鍑鸿处
         businessFeeConfig.put("isDefault", "T");
         PayFeeConfigPo payFeeConfigPo = BeanConvertUtil.covertBean(businessFeeConfig, PayFeeConfigPo.class);
 
@@ -317,7 +441,7 @@
         paramInJson.put("configId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_configId));
         JSONObject businessFeeConfig = new JSONObject();
         businessFeeConfig.putAll(paramInJson);
-        businessFeeConfig.put("feeTypeCd", FeeTypeConstant.FEE_TYPE_HIRE_UP_PARKING_SPACE);
+        businessFeeConfig.put("feeTypeCd", FeeTypeConstant.FEE_TYPE_CAR);
         businessFeeConfig.put("feeName", "鍦颁笂鍑虹杞︿綅璐筟绯荤粺榛樿]");
         businessFeeConfig.put("feeFlag", "1003006");
         businessFeeConfig.put("startTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
@@ -328,6 +452,8 @@
         businessFeeConfig.put("communityId", paramInJson.getString("communityId"));
         businessFeeConfig.put("configId", paramInJson.getString("configId"));
         businessFeeConfig.put("billType", "003");//鎸夊ぉ鍑鸿处
+        businessFeeConfig.put("paymentCd", "1200");
+        businessFeeConfig.put("paymentCycle", "1");//鎸夋湀鍑鸿处
         businessFeeConfig.put("isDefault", "T");
         PayFeeConfigPo payFeeConfigPo = BeanConvertUtil.covertBean(businessFeeConfig, PayFeeConfigPo.class);
 
@@ -345,7 +471,7 @@
         paramInJson.put("configId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_configId));
         JSONObject businessFeeConfig = new JSONObject();
         businessFeeConfig.putAll(paramInJson);
-        businessFeeConfig.put("feeTypeCd", FeeTypeConstant.FEE_TYPE_HIRE_DOWN_PARKING_SPACE);
+        businessFeeConfig.put("feeTypeCd", FeeTypeConstant.FEE_TYPE_CAR);
         businessFeeConfig.put("feeName", "鍦颁笅鍑虹杞︿綅璐筟绯荤粺榛樿]");
         businessFeeConfig.put("feeFlag", "1003006");
         businessFeeConfig.put("startTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
@@ -356,6 +482,9 @@
         businessFeeConfig.put("communityId", paramInJson.getString("communityId"));
         businessFeeConfig.put("configId", paramInJson.getString("configId"));
         businessFeeConfig.put("billType", "003");//鎸夊ぉ鍑鸿处
+
+        businessFeeConfig.put("paymentCd", "1200");
+        businessFeeConfig.put("paymentCycle", "1");//鎸夋湀鍑鸿处
         businessFeeConfig.put("isDefault", "T");
         PayFeeConfigPo payFeeConfigPo = BeanConvertUtil.covertBean(businessFeeConfig, PayFeeConfigPo.class);
 
@@ -384,6 +513,8 @@
         businessFeeConfig.put("communityId", paramInJson.getString("communityId"));
         businessFeeConfig.put("configId", paramInJson.getString("configId"));
         businessFeeConfig.put("billType", "004");//鎸夊ぉ鍑鸿处
+        businessFeeConfig.put("paymentCd", "1200");
+        businessFeeConfig.put("paymentCycle", "1");//鎸夋湀鍑鸿处
         businessFeeConfig.put("isDefault", "T");
         PayFeeConfigPo payFeeConfigPo = BeanConvertUtil.covertBean(businessFeeConfig, PayFeeConfigPo.class);
 
@@ -397,6 +528,7 @@
      * @return 灏忓尯鎴愬憳淇℃伅
      */
     public void addCommunityMembers(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
 
         JSONObject businessCommunityMember = new JSONObject();
         businessCommunityMember.put("communityMemberId", "-1");
@@ -440,6 +572,7 @@
 
         paramInJson.put("communityId", GenerateCodeFactory.getCommunityId());
         paramInJson.put("state", "1000");
+        paramInJson.put("communityArea", "0");
         CommunityPo communityPo = BeanConvertUtil.covertBean(paramInJson, CommunityPo.class);
         super.insert(dataFlowContext, communityPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_COMMUNITY_INFO);
 
@@ -452,12 +585,39 @@
      * @param dataFlowContext 鏁版嵁涓婁笅鏂�
      * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
      */
-    public void updateCommunityOne(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+    public void addAttr(JSONObject paramInJson, DataFlowContext dataFlowContext) {
 
+        paramInJson.put("attrId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_attrId));
+        CommunityAttrPo communityAttrPo = BeanConvertUtil.covertBean(paramInJson, CommunityAttrPo.class);
+        super.insert(dataFlowContext, communityAttrPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_COMMUNITY_INFO);
+
+    }
+
+    /**
+     * 娣诲姞灏忓尯淇℃伅
+     *
+     * @param paramInJson     鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+     * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+     * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+     */
+    public void updateAttr(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+        CommunityAttrPo communityAttrPo = BeanConvertUtil.covertBean(paramInJson, CommunityAttrPo.class);
+        super.insert(dataFlowContext, communityAttrPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_COMMUNITY_INFO);
+
+    }
+
+    /**
+     * 娣诲姞灏忓尯淇℃伅
+     *
+     * @param paramInJson     鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+     * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+     * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+     */
+    public void updateCommunityOne(JSONObject paramInJson, DataFlowContext dataFlowContext) {
 
         CommunityPo communityPo = BeanConvertUtil.covertBean(paramInJson, CommunityPo.class);
 
         super.update(dataFlowContext, communityPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_COMMUNITY_INFO);
-
     }
 }

--
Gitblit v1.8.0