From ae42d2da37fe9d161e7058b51367b95f24c3d97a Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期二, 13 六月 2023 15:11:36 +0800
Subject: [PATCH] optimize

---
 service-common/src/main/java/com/java110/common/cmd/chargeMachine/ListChargeMachineCmd.java |   31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/service-common/src/main/java/com/java110/common/cmd/chargeMachine/ListChargeMachineCmd.java b/service-common/src/main/java/com/java110/common/cmd/chargeMachine/ListChargeMachineCmd.java
index 88cab4e..78e250c 100644
--- a/service-common/src/main/java/com/java110/common/cmd/chargeMachine/ListChargeMachineCmd.java
+++ b/service-common/src/main/java/com/java110/common/cmd/chargeMachine/ListChargeMachineCmd.java
@@ -18,15 +18,14 @@
 import com.alibaba.fastjson.JSONObject;
 import com.java110.common.charge.IChargeCore;
 import com.java110.core.annotation.Java110Cmd;
-import com.java110.core.annotation.Java110Transactional;
 import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
-import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.dto.chargeMachine.ChargeRuleFeeDto;
 import com.java110.dto.smallWeChat.SmallWeChatDto;
 import com.java110.intf.common.IChargeMachineV1InnerServiceSMO;
+import com.java110.intf.common.IChargeRuleFeeV1InnerServiceSMO;
 import com.java110.intf.store.ISmallWeChatInnerServiceSMO;
-import com.java110.po.chargeMachine.ChargeMachinePo;
 import com.java110.utils.cache.UrlCache;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
@@ -65,6 +64,9 @@
     private ISmallWeChatInnerServiceSMO smallWeChatInnerServiceSMOImpl;
 
     @Autowired
+    private IChargeRuleFeeV1InnerServiceSMO chargeRuleFeeV1InnerServiceSMOImpl;
+
+    @Autowired
     private IChargeCore chargeCoreImpl;
 
     @Override
@@ -88,6 +90,9 @@
 
             // todo  鏌ヨ璁惧鏄惁鍦ㄧ嚎
             queryMachineState(chargeMachineDtos);
+
+            // todo 鍒峰叆绠楄垂瑙勫垯
+            queryChargeRuleFee(chargeMachineDtos);
         } else {
             chargeMachineDtos = new ArrayList<>();
         }
@@ -99,10 +104,24 @@
         cmdDataFlowContext.setResponseEntity(responseEntity);
     }
 
+    private void queryChargeRuleFee(List<ChargeMachineDto> chargeMachineDtos) {
+        if (chargeMachineDtos == null || chargeMachineDtos.size() != 1) {
+            return;
+        }
+
+        ChargeRuleFeeDto chargeRuleFeeDto = new ChargeRuleFeeDto();
+        chargeRuleFeeDto.setRuleId(chargeMachineDtos.get(0).getRuleId());
+        chargeRuleFeeDto.setCommunityId(chargeMachineDtos.get(0).getCommunityId());
+        List<ChargeRuleFeeDto> fees = chargeRuleFeeV1InnerServiceSMOImpl.queryChargeRuleFees(chargeRuleFeeDto);
+
+        chargeMachineDtos.get(0).setFees(fees);
+
+    }
+
     private void queryMachineState(List<ChargeMachineDto> chargeMachineDtos) {
 
-        if(chargeMachineDtos == null || chargeMachineDtos.size() < 1 || chargeMachineDtos.size() > 10){
-            return ;
+        if (chargeMachineDtos == null || chargeMachineDtos.size() < 1 || chargeMachineDtos.size() > 10) {
+            return;
         }
 
         chargeCoreImpl.queryChargeMachineState(chargeMachineDtos);
@@ -124,7 +143,7 @@
         smallWeChatDto.setWeChatType(SmallWeChatDto.WECHAT_TYPE_PUBLIC);
         List<SmallWeChatDto> smallWeChatDtos = smallWeChatInnerServiceSMOImpl.querySmallWeChats(smallWeChatDto);
         String appId = "";
-        if (smallWeChatDtos != null || smallWeChatDtos.size() > 0) {
+        if (smallWeChatDtos != null && smallWeChatDtos.size() > 0) {
             appId = smallWeChatDtos.get(0).getAppId();
         }
         String ownerUrl = UrlCache.getOwnerUrl();

--
Gitblit v1.8.0