From d9a9d8a2dad1d1e57b184bf8f972a03d654d883a Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期五, 22 七月 2022 15:07:01 +0800
Subject: [PATCH] 优化

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/C3ChargingService.java |  276 +++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 216 insertions(+), 60 deletions(-)

diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/C3ChargingService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/C3ChargingService.java
index b179dcf..6ae4861 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/C3ChargingService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/C3ChargingService.java
@@ -6,7 +6,9 @@
 import com.sandu.common.execption.BusinessException;
 import com.sandu.common.object.BaseConditionVO;
 import com.sandu.common.service.impl.BaseServiceImpl;
+import com.sandu.common.util.SpringContextHolder;
 import com.sandu.ximon.admin.config.C3mRedisConfig;
+import com.sandu.ximon.admin.dto.ChargingDto;
 import com.sandu.ximon.admin.manager.iot.frame.A5Frame;
 import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5C3HeartbeatReportInnerFrame;
 import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5C3OperationReportInnerFrame;
@@ -18,24 +20,27 @@
 import com.sandu.ximon.admin.manager.iot.rrpc.mainboard.MainBoardInvokeSyncService;
 import com.sandu.ximon.admin.param.C3ChargingAddParam;
 import com.sandu.ximon.admin.param.C3ChargingParam;
-import com.sandu.ximon.admin.param.PoleBindingParam;
 import com.sandu.ximon.admin.security.SecurityUtils;
 import com.sandu.ximon.admin.utils.LogUtils;
 import com.sandu.ximon.admin.utils.RedisUtils;
+import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils;
+import com.sandu.ximon.admin.vo.EquipmentInfomation;
 import com.sandu.ximon.dao.bo.C3ChargingBo;
 import com.sandu.ximon.dao.domain.C3mCharging;
 import com.sandu.ximon.dao.domain.C3mChargingCharge;
-import com.sandu.ximon.dao.domain.Pole;
+import com.sandu.ximon.dao.domain.C3mOrder;
 import com.sandu.ximon.dao.domain.PoleBinding;
+import com.sandu.ximon.dao.enums.OrderStatus;
+import com.sandu.ximon.dao.domain.*;
 import com.sandu.ximon.dao.mapper.C3mChargingMapper;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 
 /**
  * @author ZZQ
@@ -57,17 +62,11 @@
      * @return 鏄惁鎴愬姛
      */
     public boolean updateReportState(String deviceName, String c3Mac, String statusBit, String deviceTemperature) {
-        C3mCharging one = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, c3Mac));
+        C3mCharging one = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getC3Mac, c3Mac));
         if (one != null) {
-//            one.setStatusBit(Integer.valueOf(statusBit));
             one.setDeviceTemperature(deviceTemperature);
             one.setPoleDevicesCode(deviceName);
             one.setC3Mac(c3Mac);
-
-//            List<C3mChargingCharge> list = c3mChargingChargeService.list(Wrappers.lambdaQuery(C3mChargingCharge.class).eq(C3mChargingCharge::getC3Id, one.getC3Id()));
-//            if (list.size() == 0) {//璐圭巼琛ㄤ腑娌℃湁姝ゅ厖鐢垫々鏁版嵁鏃�  娣诲姞榛樿璐圭巼
-//                c3mChargingChargeService.initCharge((one.getC3Id()).intValue());
-//            }
             return updateById(one);
         } else {
             return false;
@@ -89,42 +88,35 @@
             c3mCharging.setPoleDevicesCode(deviceName);
             c3mCharging.setC3Mac(c3Mac);
             flag = save(c3mCharging);
-            //璁剧疆璐圭巼
-            C3mCharging c3mCharging1 = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, mcuUdid));
-            List<C3mChargingCharge> list = c3mChargingChargeService.list(Wrappers.lambdaQuery(C3mChargingCharge.class).eq(C3mChargingCharge::getC3Id, c3mCharging1.getC3Id()));
-            if (list.size() == 0) {//璐圭巼琛ㄤ腑娌℃湁姝ゅ厖鐢垫々鏁版嵁鏃�  娣诲姞榛樿璐圭巼
-                c3mChargingChargeService.initCharge((c3mCharging1.getC3Id()).intValue());
-            }
-
         } else {
             //灏嗚澶囦俊鎭坊鍔犲埌鍏呯數妗╄澶囪〃
             one.setPoleDevicesCode(deviceName);
             one.setC3Mac(c3Mac);
             flag = updateById(one);
-            //璁剧疆璐圭巼
-            C3mCharging c3mCharging1 = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, mcuUdid));
-            List<C3mChargingCharge> list = c3mChargingChargeService.list(Wrappers.lambdaQuery(C3mChargingCharge.class).eq(C3mChargingCharge::getC3Id, c3mCharging1.getC3Id()));
-            if (list.size() == 0) {//璐圭巼琛ㄤ腑娌℃湁姝ゅ厖鐢垫々鏁版嵁鏃�  娣诲姞榛樿璐圭巼
-                c3mChargingChargeService.initCharge((c3mCharging1.getC3Id()).intValue());
-            }
         }
-        /**
-         * 娣诲姞缁戝畾鍏崇郴寮�濮�
-         */
-        Pole pole = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getDeviceCode, deviceName));
-        if (pole == null) {
-            Pole pole1 = new Pole();
-            pole1.setDeviceCode(deviceName);
-            pole1.setPoleName(deviceName);
-            pole1.setPoleCode(poleService.generatePoleCode());
-            poleService.save(pole1);
+        //璁剧疆璐圭巼
+        C3mCharging c3mCharging1 = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, mcuUdid));
+        List<C3mChargingCharge> list = c3mChargingChargeService.list(Wrappers.lambdaQuery(C3mChargingCharge.class).eq(C3mChargingCharge::getC3Id, c3mCharging1.getC3Id()));
+        if (list.size() == 0) {//璐圭巼琛ㄤ腑娌℃湁姝ゅ厖鐢垫々鏁版嵁鏃�  娣诲姞榛樿璐圭巼
+            c3mChargingChargeService.initCharge((c3mCharging1.getC3Id()).intValue());
         }
-
-        Long poleId = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getDeviceCode, deviceName)).getId();
-        PoleBindingParam poleBindingParam = new PoleBindingParam();
-        poleBindingParam.setDeviceType(2);
-        poleBindingParam.setDeviceCode(mcuUdid);
-        bindingService.bindPole(poleId, poleBindingParam);
+//        /**
+//         * 娣诲姞缁戝畾鍏崇郴寮�濮�
+//         */
+//        Pole pole = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getDeviceCode, deviceName));
+//        if (pole == null) {
+//            Pole pole1 = new Pole();
+//            pole1.setDeviceCode(deviceName);
+//            pole1.setPoleName(deviceName);
+//            pole1.setPoleCode(poleService.generatePoleCode());
+//            poleService.save(pole1);
+//        }
+//
+//        Long poleId = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getDeviceCode, deviceName)).getId();
+//        PoleBindingParam poleBindingParam = new PoleBindingParam();
+//        poleBindingParam.setDeviceType(2);
+//        poleBindingParam.setDeviceCode(mcuUdid);
+//        bindingService.bindPole(poleId, poleBindingParam);
 
         /**
          * 娣诲姞缁戝畾鍏崇郴缁撴潫
@@ -220,24 +212,98 @@
     }
 
     /**
-     * 鏌ヨ鍏呯數妗�
+     * 鑾峰彇鍏呯數妗╄鎯�
      *
      * @return
      */
-    public C3mCharging getByC3Mac(String udid) {
-        C3mCharging one = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, udid));
-        String s = RedisUtils.getBean().get(C3mRedisConstant.C3_STATUS.getCode() + one.getC3Mac());
-        if (s != null) {
-            try {
-                A5C3HeartbeatReportInnerFrame.HeartBeatDataPackage beatDataPackage = JSON.parseObject(s, A5C3HeartbeatReportInnerFrame.HeartBeatDataPackage.class);
-                one.setStatusBit((Integer.valueOf(beatDataPackage.getStatusBit())));
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        } else {
-            one.setStatusBit(0);
+    public ChargingDto getChargingInfo(String poleId) {
+        if (poleId == null) {
+            throw new BusinessException("鐏潌ID涓嶈兘涓虹┖锛�");
         }
-        return one;
+
+        Pole pole = SpringContextHolder.getBean(PoleService.class).
+                getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getId, poleId));
+        if (pole == null) {
+            throw new BusinessException("鍏呯數妗╃粦瀹氱殑鐏潌涓嶅瓨鍦紒");
+        }
+
+        C3mCharging one = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getPoleDevicesCode, pole.getDeviceCode()));
+        ChargingDto chargingDto = new ChargingDto();
+
+        if (one == null) {
+            throw new BusinessException("鍏呯數妗╀俊鎭笉瀛樺湪锛�");
+        }
+        A5C3HeartbeatReportInnerFrame.HeartBeatDataPackage beatDataPackage = ReadTheHeartbeatPackage(one.getC3Mac());
+        if (beatDataPackage != null) {
+            //鍏呯數妗㊣D
+            chargingDto.setC3Id(one.getC3Id());
+            //C3Mac
+            chargingDto.setC3Mac(one.getC3Mac());
+            //鍦ㄧ嚎鐘舵��
+            chargingDto.setStatusBit(Integer.valueOf(beatDataPackage.getStatusBit()));
+            //鐢靛帇
+            chargingDto.setGridVoltage(beatDataPackage.getGridVoltage());
+            //鐢垫祦
+            chargingDto.setGridCurrent(beatDataPackage.getGridCurrent());
+            //娓╁害
+            chargingDto.setDeviceTemperature(beatDataPackage.getDeviceTemperature());
+            //鐏潌ID
+            chargingDto.setPoleId(pole.getId());
+        }
+
+        return chargingDto;
+    }
+
+    /**
+     * 棣栭〉鐏潌缁戝畾淇℃伅
+     *
+     * @return
+     */
+    public EquipmentInfomation getByC3MacInfo(String udid) {
+        EquipmentInfomation equipmentInfo = new EquipmentInfomation();
+        equipmentInfo.setEquipmentType("C3鍏呯數妗�");
+        if (udid == null || udid.trim().length() == 0) {
+            return equipmentInfo;
+        }
+        C3mCharging one = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, udid));
+        if (one != null) {
+            String s = RedisUtils.getBean().get(C3mRedisConstant.C3_STATUS.getCode() + one.getC3Mac());
+            if (s != null) {
+                try {
+                    A5C3HeartbeatReportInnerFrame.HeartBeatDataPackage beatDataPackage = JSON.parseObject(s, A5C3HeartbeatReportInnerFrame.HeartBeatDataPackage.class);
+                    switch (beatDataPackage.getStatusBit()) {
+                        case "1":
+                            equipmentInfo.setEquipmentState("绌洪棽");
+                            break;
+                        case "2":
+                            equipmentInfo.setEquipmentState("鍏呯數涓�");
+                            break;
+                        case "3":
+                            equipmentInfo.setEquipmentState("鍏呯數涓柇锛岀瓑寰呮湇鍔″櫒纭");
+                            break;
+                        case "4":
+                            equipmentInfo.setEquipmentState("鍏呯數缁撴潫锛岀瓑寰呮湇鍔″櫒纭");
+                            break;
+                        case "5":
+                            equipmentInfo.setEquipmentState("鏈夋晠闅�");
+                            break;
+                        case "6":
+                            equipmentInfo.setEquipmentState("涓庡厖鐢垫々瀵规帴涓�");
+                            break;
+                        default:
+                            equipmentInfo.setEquipmentState("鏈煡");
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            } else {
+                equipmentInfo.setEquipmentState("绂荤嚎");
+            }
+            equipmentInfo.setEquipmentCreateTime(one.getUpdateTime());
+            equipmentInfo.setEquipmentMac(one.getMcuUdid());
+            equipmentInfo.setEquipmentName(one.getC3Name());
+        }
+        return equipmentInfo;
     }
 
 
@@ -260,6 +326,7 @@
             throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
         }
         CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+        StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-寮�濮嬪厖鐢�", a5Frame, commonFrame);
         System.out.println(commonFrame + "            -----commonFrame");
 
 
@@ -281,7 +348,23 @@
      *
      * @param c3Mac
      */
-    public String finishCharging(String c3Mac) {
+    @Transactional(rollbackFor = Exception.class)
+    public String finishCharging(String c3Mac, String openId) {
+        //鏌ヨ
+        if (openId.isEmpty()) {
+            throw new BusinessException("openId涓嶈兘涓虹┖");
+        }
+        //鏌ヨ璇ュ厖鐢垫々鏈�杩戠殑璁㈠崟
+        C3mOrder order = SpringContextHolder.getBean(C3mOrderService.class).getOne(Wrappers.lambdaQuery(C3mOrder.class)
+                .eq(C3mOrder::getC3Mac, c3Mac).eq(C3mOrder::getChargingStates, 0).last("limit 1"));
+
+        if (order == null) {
+            throw new BusinessException("鍏呯數妗╂病鏈夎繘琛屼腑鐨勮鍗�");
+        }
+        if (!openId.equals(order.getOrderId())) {
+            throw new BusinessException("涓嶈兘鎿嶄綔涓嶅睘浜庢偍鐨勮鍗�");
+        }
+
         C3FinishChargingReqInnerFrame c3FinishChargingReqInnerFrame =
                 new C3FinishChargingReqInnerFrame(c3Mac);
 
@@ -293,11 +376,28 @@
             throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
         }
         CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
-
+        StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-缁撴潫鍏呯數", a5Frame, commonFrame);
         System.out.println(commonFrame + "            -----commonFrame");
 
         A5C3OperationReportInnerFrame operationReportInnerFrame = new A5C3OperationReportInnerFrame().transformFrame(commonFrame.getPayload());
 
+        //缁撴潫鍏呯數 鏇存敼璁㈠崟鐘舵��
+        C3mOrder lastOrderByC3Mac = SpringContextHolder.getBean(C3mOrderService.class).getLastOrderByC3Mac(c3Mac);
+        if (lastOrderByC3Mac != null) {
+            //璁剧疆璁㈠崟鐘舵�佷负宸插畬鎴�
+            lastOrderByC3Mac.setOrderStatus(OrderStatus.COMPLETE.getStatus());
+
+            BigDecimal actualChargingCapacity = BigDecimal.valueOf(lastOrderByC3Mac.getActualChargingCapacity());
+            BigDecimal actualChargingCapacityHide = BigDecimal.valueOf(lastOrderByC3Mac.getActualChargingCapacityHide());
+            //璁剧疆瀹為檯鍏呯數鐢甸噺
+            lastOrderByC3Mac.setActualChargingCapacity(actualChargingCapacity.add(actualChargingCapacityHide).doubleValue());
+            //璁剧疆璁㈠崟缁撴潫鏃堕棿
+            lastOrderByC3Mac.setStopChargingTimestamp(System.currentTimeMillis());
+            lastOrderByC3Mac.setActualChargingCapacity(0.00);
+            //璁剧疆璁㈠崟鐘舵�佷负鍏呯數缁撴潫
+            lastOrderByC3Mac.setChargingStates(1);
+            SpringContextHolder.getBean(C3mOrderService.class).updateById(lastOrderByC3Mac);
+        }
         if (operationReportInnerFrame.isValidate()) {
             return operationReportInnerFrame.getState();
         } else {
@@ -323,6 +423,8 @@
             throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
         }
         CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+        StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-鍚屾缁撴潫", a5Frame, commonFrame);
+
 
         System.out.println(commonFrame + "            -----commonFrame");
 
@@ -351,6 +453,8 @@
             throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
         }
         CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+        StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-浜岀淮鐮�", a5Frame, commonFrame);
+
 
         System.out.println(commonFrame + "            -----commonFrame");
 
@@ -380,6 +484,8 @@
             throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
         }
         CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+        StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-鐗堟湰鏌ヨ", a5Frame, commonFrame);
+
 
         System.out.println(commonFrame + "            -----commonFrame");
 
@@ -409,6 +515,7 @@
             throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
         }
         CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+        StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-鏌ヨ蹇冭烦鍖呴棿闅旀椂闂�", a5Frame, commonFrame);
 
         System.out.println(commonFrame + "            -----commonFrame");
 
@@ -438,6 +545,8 @@
             throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
         }
         CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+        StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-鏌ヨ鐢靛帇/鐢垫祦甯告暟", a5Frame, commonFrame);
+
 
         System.out.println(commonFrame + "            -----commonFrame");
 
@@ -467,6 +576,8 @@
             throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
         }
         CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+        StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-鏌ヨ鍦板潃", a5Frame, commonFrame);
+
 
         System.out.println(commonFrame + "            -----commonFrame");
 
@@ -496,6 +607,8 @@
             throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
         }
         CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+        StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-鏌ヨ鏁呴殰鐮�", a5Frame, commonFrame);
+
 
         System.out.println(commonFrame + "            -----commonFrame");
 
@@ -525,6 +638,8 @@
             throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
         }
         CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+        StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-璇诲彇蹇冭烦鍖�", a5Frame, commonFrame);
+
 
         System.out.println(commonFrame + "            -----commonFrame");
 
@@ -558,6 +673,8 @@
             throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
         }
         CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+        StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-璁剧疆蹇冭烦鍖呴棿闅旀椂闂�", a5Frame, commonFrame);
+
 
         System.out.println(commonFrame + "            -----commonFrame");
 
@@ -589,6 +706,8 @@
             throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
         }
         CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+        StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-璁剧疆鐢靛帇/鐢垫祦甯告暟", a5Frame, commonFrame);
+
 
         System.out.println(commonFrame + "            -----commonFrame");
 
@@ -629,6 +748,8 @@
 
 
         CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+        StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-璁剧疆鍦板潃", a5Frame, commonFrame);
+
 
         System.out.println(commonFrame + "            -----commonFrame");
 
@@ -666,6 +787,7 @@
             throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
         }
         CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+        StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-璁剧疆鏃ュ巻", a5Frame, commonFrame);
 
         System.out.println(commonFrame + "            -----commonFrame");
 
@@ -697,6 +819,7 @@
             throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
         }
         CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+        StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-娓呴櫎鏁呴殰鐮佷笂鎶�", a5Frame, commonFrame);
 
         System.out.println(commonFrame + "            -----commonFrame");
 
@@ -728,6 +851,7 @@
             throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
         }
         CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+        StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-鎭㈠鍑哄巶璁剧疆", a5Frame, commonFrame);
 
         System.out.println(commonFrame + "            -----commonFrame");
 
@@ -756,7 +880,8 @@
             throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
         }
         CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
-//        CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC("32313243305008ff1a06ffff", a5Frame);
+        StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-杞噸鍚�", a5Frame, commonFrame);
+
 
         System.out.println(commonFrame + "            -----commonFrame");
 
@@ -784,7 +909,23 @@
             c3mCharging.setC3Name(c3ChargingAddParam.getC3Name());
         }
         c3mCharging.setC3Mac(c3ChargingAddParam.getC3Mac());
-        return save(c3mCharging);
+        /**
+         * 娣诲姞鍏呯數妗� 鏃ュ織璁板綍寮�濮�
+         */
+        List<String> listCode = new ArrayList<>(1);
+        listCode.add(c3mCharging.getMcuUdid());
+        String content = "{璁惧code锛�" + c3mCharging.getMcuUdid() + "璁惧鍚�:" + c3mCharging.getC3Name() +
+                "}";
+
+        StoreOperationRecordsUtils.storeOperationData(listCode, null, "娣诲姞鍏呯數妗�", content);
+        /**
+         * 娣诲姞鍏呯數妗� 鏃ュ織璁板綍缁撴潫
+         */
+
+        return
+
+                save(c3mCharging);
+
     }
 
     public boolean updateC3ChargingName(C3ChargingAddParam c3ChargingAddParam) {
@@ -799,6 +940,21 @@
         C3mCharging c3mCharging = new C3mCharging();
         c3mCharging.setC3Id(c3ChargingAddParam.getC3Id());
         c3mCharging.setC3Name(c3ChargingAddParam.getC3Name());
+
+        /**
+         * 淇敼鍏呯數妗� 鏃ュ織璁板綍寮�濮�
+         */
+        List<String> listCode = new ArrayList<>(1);
+        listCode.add(c3mCharging.getMcuUdid());
+        String content = "{璁惧code锛�" + c3mCharging.getMcuUdid() + "璁惧鍘熷悕:" + one.getC3Name() + "鏇存敼鍚庣殑璁惧鍚�:" + c3mCharging.getC3Name() +
+                "}";
+
+        StoreOperationRecordsUtils.storeOperationData(listCode, null, "缂栬緫鍏呯數妗�", content);
+        /**
+         * 淇敼鍏呯數妗� 鏃ュ織璁板綍缁撴潫
+         */
+
+
         return updateById(c3mCharging);
     }
 
@@ -807,7 +963,7 @@
         if (one == null) {
             throw new BusinessException("鏈壘鍒扮粦瀹氬叧绯�");
         }
-        return getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getC3Mac, one.getDeviceCode()));
+        return getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, one.getDeviceCode()));
     }
 
 

--
Gitblit v1.9.3