Browse Source

feat(chargeOrder): 添加充电设备接口编号及优化相关逻辑

- 在ChargeOrderInfoExportDTO中新增connectorId字段
- ChargeOrderInfoMapper.xml查询中增加connector_id字段
- ChargingReceptionServiceImpl中使用fastjson2替换JSONObject实现JSON序列化
- 修正ThirdPartyEquipmentInfo查询中设备ID字段名称错误
- ChargeOrderInfoServiceImpl中完善渠道手机号设置逻辑
- 各业务Mapper XML添加is_deleted=0过滤条件并按创建时间倒序排序
- 添加fastjson2依赖至pom.xml文件
wzq 6 ngày trước cách đây
mục cha
commit
7a5cb5c0e1

+ 6 - 0
pom.xml

@@ -230,6 +230,12 @@
             <version>${fastexcel.version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.alibaba.fastjson2</groupId>
+            <artifactId>fastjson2</artifactId>
+            <version>2.0.57</version>
+        </dependency>
+
         <!-- MinIO 对象存储 -->
         <dependency>
             <groupId>io.minio</groupId>

+ 3 - 0
src/main/java/com/zsElectric/boot/business/model/dto/ChargeOrderInfoExportDTO.java

@@ -36,6 +36,9 @@ public class ChargeOrderInfoExportDTO {
     @ExcelProperty(value = "充电桩编号")
     private String equipmentId;
 
+    @ExcelProperty(value = "充电设备接口编号")
+    private String connectorId;
+
     @ExcelProperty(value = "充电开始时间")
     private String startTime;
 

+ 4 - 1
src/main/java/com/zsElectric/boot/business/service/impl/ChargeOrderInfoServiceImpl.java

@@ -215,7 +215,6 @@ public class ChargeOrderInfoServiceImpl extends ServiceImpl<ChargeOrderInfoMappe
                 throw new BusinessException("您有正在进行中的订单,请先停止充电");
             }
             //生成系统充电订单号及互联互通充电订单号 startChargeSeq equipAuthSeq (格式"运营商ID+唯一编号")
-            assert userId != null;
             String chargeOrderNo = generateNo(ORDER_NO_PREFIX, userId);
             String seq = ConnectivityConstants.OPERATOR_ID + chargeOrderNo;
 
@@ -324,6 +323,10 @@ public class ChargeOrderInfoServiceImpl extends ServiceImpl<ChargeOrderInfoMappe
         chargeOrderInfo.setStartChargeSeq(seq);
         chargeOrderInfo.setPhoneNum(formData.getChannelUserPhone());
         chargeOrderInfo.setThirdPartyStationId(formData.getStationId());
+        //渠道手机号
+        if(ObjectUtil.isNotEmpty(formData.getChannelUserPhone())){
+            chargeOrderInfo.setPhoneNum(formData.getChannelUserPhone());
+        }
         //预支付金额
         chargeOrderInfo.setPreAmt(formData.getChannelPreAmt());
 

+ 4 - 4
src/main/java/com/zsElectric/boot/charging/service/impl/ChargingReceptionServiceImpl.java

@@ -3,7 +3,7 @@ package com.zsElectric.boot.charging.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjUtil;
 import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.json.JSON;
+import com.alibaba.fastjson2.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fasterxml.jackson.databind.JsonNode;
@@ -185,7 +185,7 @@ public class ChargingReceptionServiceImpl implements ChargingReceptionService {
                             Map<String, Object> map = objectMapper.convertValue(jsonNode, Map.class);
                             map.put("chargeOrderNo", chargeOrderInfo.getChargeOrderNo());
                             FirmInfo firmInfo = firmInfoMapper.selectById(chargeOrderInfo.getFirmId());
-                            String requestBody = new JSONObject(map).toString();
+                            String requestBody = com.alibaba.fastjson2.JSONObject.toJSONString(map);
                             if (ObjectUtil.isNotNull(firmInfo)) {
                                 try {
                                     JsonNode response = okHttpUtil.doPostJson(firmInfo.getChannelUrl() + "/notification_charge_order_info", requestBody, null);
@@ -460,7 +460,7 @@ public class ChargingReceptionServiceImpl implements ChargingReceptionService {
                     map.put("connectorId", chargeOrderInfo.getConnectorId());
                     map.put("jsonNode", jsonNode);
                     String url = firmInfo.getChannelUrl() + "/notification_start_charge_result";
-                    String requestBody = new JSONObject(map).toString();
+                    String requestBody = com.alibaba.fastjson2.JSONObject.toJSONString(map);
 
                     try {
                         JsonNode response = okHttpUtil.doPostJson(url, requestBody, null);
@@ -898,7 +898,7 @@ public class ChargingReceptionServiceImpl implements ChargingReceptionService {
             // 获取设备信息
             ThirdPartyEquipmentInfo equipmentInfo = thirdPartyEquipmentInfoMapper.selectOne(
                     Wrappers.<ThirdPartyEquipmentInfo>lambdaQuery()
-                            .eq(ThirdPartyEquipmentInfo::getEquipmentId, chargeOrderInfo.getEquipmentId())
+                            .eq(ThirdPartyEquipmentInfo::getId, chargeOrderInfo.getEquipmentId())
                             .eq(ThirdPartyEquipmentInfo::getIsDeleted, 0));
             
             if (equipmentInfo == null) {

+ 1 - 0
src/main/resources/mapper/business/ChargeOrderInfoMapper.xml

@@ -248,6 +248,7 @@
         ELSE '未知'
         END AS order_type_name,
         psi.station_name,
+        pci.connector_id,
         pci.connector_name,
         a.equipment_id,
         a.start_time,

+ 2 - 0
src/main/resources/mapper/business/CouponMapper.xml

@@ -25,7 +25,9 @@
         FROM
         c_coupon
         <where>
+        is_deleted = 0
         </where>
+        ORDER BY create_time DESC
     </select>
     <select id="getUserCouponPage" resultType="com.zsElectric.boot.business.model.vo.CouponVO">
         SELECT

+ 1 - 0
src/main/resources/mapper/business/DiscountsActivityMapper.xml

@@ -21,6 +21,7 @@
         <where>
             is_deleted = 0
         </where>
+        ORDER BY create_time DESC
     </select>
 
 </mapper>

+ 1 - 0
src/main/resources/mapper/business/RechargeLevelMapper.xml

@@ -20,6 +20,7 @@
         <where>
             is_deleted = 0
         </where>
+        ORDER BY create_time DESC
     </select>
 
 </mapper>

+ 2 - 0
src/main/resources/mapper/business/UserAccountLogMapper.xml

@@ -17,7 +17,9 @@
         FROM
             c_user_account_log
         <where>
+        is_deleted = 0
         </where>
+        ORDER BY create_time DESC
     </select>
 
 </mapper>

+ 2 - 0
src/main/resources/mapper/business/UserAccountMapper.xml

@@ -18,7 +18,9 @@
         FROM
             c_user_account
         <where>
+        is_deleted = 0
         </where>
+        ORDER BY create_time DESC
     </select>
 
 </mapper>

+ 2 - 0
src/main/resources/mapper/business/UserExchangeIntegralRuleMapper.xml

@@ -18,7 +18,9 @@
         FROM
             c_user_exchange_integral_rule
         <where>
+        is_deleted = 0
         </where>
+        ORDER BY create_time DESC
     </select>
 
 </mapper>

+ 2 - 0
src/main/resources/mapper/business/UserInfoIntegralLogMapper.xml

@@ -21,7 +21,9 @@
         FROM
             c_user_info_integral_log
         <where>
+        is_deleted = 0
         </where>
+        ORDER BY create_time DESC
     </select>
 
 </mapper>