ソースを参照

前端数据字段

skyline 2 年 前
コミット
b925ad63b2

+ 2 - 0
entity/src/main/java/com/kym/entity/admin/vo/StationVo.java

@@ -10,6 +10,7 @@ import com.kym.entity.BaseEntity;
 import com.kym.entity.enplus.EnEquipmentInfo;
 import lombok.Getter;
 import lombok.Setter;
+import lombok.experimental.Accessors;
 
 import java.io.Serializable;
 import java.util.List;
@@ -24,6 +25,7 @@ import java.util.List;
  */
 @Getter
 @Setter
+@Accessors(chain = true)
 public class StationVo extends BaseEntity implements Serializable {
 
     private static final long serialVersionUID = 1L;

+ 7 - 0
entity/src/main/java/com/kym/entity/enplus/EnEquipmentInfo.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson2.JSONObject;
 import com.alibaba.fastjson2.annotation.JSONCreator;
 import com.alibaba.fastjson2.annotation.JSONField;
 import lombok.Data;
+import lombok.experimental.Accessors;
 
 import java.util.List;
 
@@ -14,6 +15,7 @@ import java.util.List;
  * @date 2023-07-31 15:21
  */
 @Data
+@Accessors(chain = true)
 public class EnEquipmentInfo {
 
     /**
@@ -27,6 +29,11 @@ public class EnEquipmentInfo {
      */
     private String shortId;
 
+    /**
+     * 车位编号
+     */
+    private String parkingNo;
+
     /**
      * 设备生产商组织机构代码
      */

+ 9 - 1
service/src/main/java/com/kym/service/admin/impl/StationServiceImpl.java

@@ -63,7 +63,15 @@ public class StationServiceImpl extends ServiceImpl<StationMapper, Station> impl
         var response = enPlusService.enPlusPost(EnPlusApi.EN_PLUS_QUERY_STATION_INFO.getApi(), enPlusService.buildParams(param));
         var enStations = JSONObject.parseObject(AESUtil.decrypt(response.getData()));
         var stationList = enStations.getJSONArray("StationInfos").toJavaList(StationVo.class);
-        stationList.forEach(station -> station.getEquipmentInfos().forEach(enEquipmentInfo -> enEquipmentInfo.setShortId(kymCache.getShortId(enEquipmentInfo.getEquipmentId()))));
+        // 我方station表数据
+        var stations = list();
+        stationList.forEach(station -> {
+            station.getEquipmentInfos().forEach(enEquipmentInfo ->
+                    enEquipmentInfo.setShortId(kymCache.getShortId(enEquipmentInfo.getEquipmentId()))
+                            .setParkingNo(kymCache.getParkNoByEquipmentId(enEquipmentInfo.getEquipmentId())));
+            station.setPictures(stations.stream().filter(item -> item.getStationId().equals(station.getStationId())).toList().get(0).getPictures());
+        });
+
         stationList.forEach(vo -> vo.setEquipmentInfos(vo.getEquipmentInfos().stream().sorted(Comparator.comparing(EnEquipmentInfo::getShortId)).toList()));
         return stationList;
 

+ 14 - 3
service/src/main/java/com/kym/service/utils/KymCache.java

@@ -2,9 +2,11 @@ package com.kym.service.utils;
 
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.kym.entity.admin.AdminUserStation;
+import com.kym.entity.admin.EquipmentInfo;
 import com.kym.entity.admin.EquipmentRelation;
 import com.kym.entity.admin.Station;
 import com.kym.service.admin.AdminUserStationService;
+import com.kym.service.admin.EquipmentInfoService;
 import com.kym.service.admin.EquipmentRelationService;
 import com.kym.service.admin.StationService;
 import lombok.Data;
@@ -27,19 +29,24 @@ public class KymCache {
     private static ConcurrentHashMap<String, String> CONNECTOR_STATION_MAPPING = new ConcurrentHashMap<>();
     private static ConcurrentHashMap<String, String> STATION_MAPPING = new ConcurrentHashMap<>();
     private static ConcurrentHashMap<Long, String> ADMIN_USER_STATION = new ConcurrentHashMap<>();
+    private static ConcurrentHashMap<String, String> EQUIPMENT_ID_PARKING_NO_MAPPING = new ConcurrentHashMap<>();
     private final EquipmentRelationService relationService;
     private final StationService stationService;
     private final AdminUserStationService adminUserStationService;
+    private final EquipmentInfoService equipmentInfoService;
 
-    public KymCache(EquipmentRelationService relationService, StationService stationService, AdminUserStationService adminUserStationService) {
+    public KymCache(EquipmentRelationService relationService, StationService stationService, AdminUserStationService adminUserStationService, EquipmentInfoService equipmentInfoService) {
         this.relationService = relationService;
         this.stationService = stationService;
         this.adminUserStationService = adminUserStationService;
+        this.equipmentInfoService = equipmentInfoService;
+
+        SHORT_ID_MAPPING.putAll( relationService.list().stream().collect(Collectors.toMap(EquipmentRelation::getEquipmentId, EquipmentRelation::getShortId)));
+        CONNECTOR_STATION_MAPPING.putAll( relationService.list().stream().collect(Collectors.toMap(EquipmentRelation::getConnectorId, EquipmentRelation::getStationId)));
 
-        SHORT_ID_MAPPING.putAll(relationService.list().stream().collect(Collectors.toMap(EquipmentRelation::getEquipmentId, EquipmentRelation::getShortId)));
-        CONNECTOR_STATION_MAPPING.putAll(relationService.list().stream().collect(Collectors.toMap(EquipmentRelation::getConnectorId, EquipmentRelation::getStationId)));
         STATION_MAPPING.putAll(stationService.list().stream().collect(Collectors.toMap(Station::getStationId, Station::getStationName)));
         ADMIN_USER_STATION.putAll(adminUserStationService.list().stream().collect(Collectors.toMap(AdminUserStation::getAdminUserId, AdminUserStation::getStationId)));
+        EQUIPMENT_ID_PARKING_NO_MAPPING.putAll(equipmentInfoService.list().stream().collect(Collectors.toMap(EquipmentInfo::getEquipmentId, EquipmentInfo::getParkingNo)));
     }
 
     @DS("db-admin")
@@ -115,4 +122,8 @@ public class KymCache {
         }
         return res;
     }
+
+    public String getParkNoByEquipmentId(String equipmentId){
+        return EQUIPMENT_ID_PARKING_NO_MAPPING.get(equipmentId);
+    }
 }

+ 0 - 1
service/src/main/java/com/kym/service/wechat/impl/WxPayServiceImpl.java

@@ -558,7 +558,6 @@ public class WxPayServiceImpl implements WxPayService {
                         .set(WalletDetail::getStatus, WalletDetail.STATUS_已确认)
                         .set(WalletDetail::getTransactionId, refundNotification.getTransactionId())
                         .set(WalletDetail::getTransactionTime, successTime)
-                        .set(WalletDetail::getCurrency, refundNotification.getAmount().getCurrency())
                         .set(WalletDetail::getAmount, refundNotification.getAmount().getRefund().intValue())
                         .set(WalletDetail::getTransactionTime, successTime)
                         .eq(WalletDetail::getId, walletDetail.getId()).update();