From 5df71ce306067c00a02e712433f7c8cf2be339c7 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期四, 09 一月 2025 16:13:36 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralRuleController.java                  |   21 +++++++
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java              |   19 ------
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java                   |   26 ++++----
 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java |    3 
 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderEvaluateMapper.xml                               |    2 
 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/produce/IotMessageProduce.java   |   20 ++----
 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java |   45 +++++++-------
 7 files changed, 65 insertions(+), 71 deletions(-)

diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
index 1d17e96..d808e07 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
@@ -1120,43 +1120,41 @@
         if (count==0){
             R<TIntegralRule> set = integralRuleClient.getSet();
             TIntegralRule data = set.getData();
-            JSONObject jsonObject = JSON.parseObject(data.getAddVehiclesEarnsPoints());
-
-
-            Integer point = 0;
-            //增加车牌50分,必填
+            if(null != data){
+                JSONObject jsonObject = JSON.parseObject(data.getAddVehiclesEarnsPoints());
+                Integer point = 0;
+                //增加车牌50分,必填
                 point = point+jsonObject.getInteger("num1");
                 if (doubleVip){
                     point = point+jsonObject.getInteger("num1");
                 }
-            //增加车型分
+                //增加车型分
                 if (StringUtils.isNotEmpty(appUserCar.getVehicleModel())){
                     point = point+jsonObject.getInteger("num2");
                     if (doubleVip){
                         point = point+jsonObject.getInteger("num2");
                     }
                 }
-            //增加车辆用途分
+                //增加车辆用途分
                 if (StringUtils.isNotEmpty(appUserCar.getVehicleUse())){
                     point = point+jsonObject.getInteger("num3");
                     if (doubleVip){
                         point = point+jsonObject.getInteger("num3");
                     }
                 }
-            //增加续航分
+                //增加续航分
                 if (StringUtils.isNotEmpty(appUserCar.getEndurance())){
                     point = point+jsonObject.getInteger("num4");
                     if (doubleVip){
                         point = point+jsonObject.getInteger("num4");
                     }
                 }
-
-            //增加积分记录
-            pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()+point,5,userId,appUserCar.getLicensePlate(),"","");
-            byId.setPoints(byId.getPoints()+point);
+    
+                //增加积分记录
+                pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()+point,5,userId,appUserCar.getLicensePlate(),"","");
+                byId.setPoints(byId.getPoints()+point);
+            }
             byId.setFirstAdd(1);
-
-
         }
         CarNumDto carNumDto = CarUtil.carNum(appUserCar.getLicensePlate());
         if (carNumDto==null){
diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java
index aacc202..d9a0da3 100644
--- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java
+++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java
@@ -263,32 +263,33 @@
 			return AjaxResult.error("设备编号已存在");
 		}
 		TChargingPile tChargingPile = this.getById(chargingPile.getId());
-		ShowDeviceResp showDeviceResp = iotInterfaceClient.showDeviceRequest(tChargingPile.getCode()).getData();
-		if(null != showDeviceResp){
-			DeleteDeviceResp deleteDeviceResp = iotInterfaceClient.deleteDevice(tChargingPile.getCode()).getData();
-			if(null == deleteDeviceResp || (deleteDeviceResp.getHttpStatusCode() != 200 && deleteDeviceResp.getHttpStatusCode() != 201 && deleteDeviceResp.getHttpStatusCode() != 204)){
-				return AjaxResult.error("删除设备异常,请查看华为设备管理");
+		//桩号不相同,需要重新绑定设备
+		if(!tChargingPile.getCode().equals(chargingPile.getCode())){
+			ShowDeviceResp showDeviceResp = iotInterfaceClient.showDeviceRequest(tChargingPile.getCode()).getData();
+			if(null != showDeviceResp){
+				DeleteDeviceResp deleteDeviceResp = iotInterfaceClient.deleteDevice(tChargingPile.getCode()).getData();
+				if(null == deleteDeviceResp || (deleteDeviceResp.getHttpStatusCode() != 200 && deleteDeviceResp.getHttpStatusCode() != 201 && deleteDeviceResp.getHttpStatusCode() != 204)){
+					return AjaxResult.error("删除设备异常,请查看华为设备管理");
+				}
 			}
-		}
-
-
-		//调用华为Iot创建设备
-		AddDevice addDevice = new AddDevice();
-		addDevice.setProductId("66da68d21837002b28b34ec0");
-		addDevice.setNodeId(chargingPile.getCode());
-		addDevice.setDeviceName(chargingPile.getName());
-		addDevice.setDescription(chargingPile.getNumber().toString());
-		AddDeviceResp deviceResp = iotInterfaceClient.addDevice(addDevice).getData();
-		if(null != deviceResp){
-			int httpStatusCode = deviceResp.getHttpStatusCode();
-			if(httpStatusCode == 201){
-				chargingPile.setIotdDeviceId(deviceResp.getDeviceId());
+			//调用华为Iot创建设备
+			AddDevice addDevice = new AddDevice();
+			addDevice.setProductId("66da68d21837002b28b34ec0");
+			addDevice.setNodeId(chargingPile.getCode());
+			addDevice.setDeviceName(chargingPile.getName());
+			addDevice.setDescription(chargingPile.getNumber().toString());
+			AddDeviceResp deviceResp = iotInterfaceClient.addDevice(addDevice).getData();
+			if(null != deviceResp){
+				int httpStatusCode = deviceResp.getHttpStatusCode();
+				if(httpStatusCode == 201){
+					chargingPile.setIotdDeviceId(deviceResp.getDeviceId());
+				}else{
+					log.error("华为创建设备失败" + JSON.toJSONString(deviceResp));
+					return AjaxResult.error("华为创建设备失败");
+				}
 			}else{
-				log.error("华为创建设备失败" + JSON.toJSONString(deviceResp));
 				return AjaxResult.error("华为创建设备失败");
 			}
-		}else{
-			return AjaxResult.error("华为创建设备失败");
 		}
 		this.updateById(chargingPile);
 		
diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java
index 82a0a95..595b2b0 100644
--- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java
+++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java
@@ -99,8 +99,7 @@
                 pong.setCharging_pile_code(pingMessage.getCharging_pile_code());
                 pong.setCharging_gun_code(pingMessage.getCharging_gun_code());
                 pong.setCharging_gun_status(0);
-                result = iotMessageProduce.sendMessage(pong.getCharging_pile_code(), ServiceIdMenu.PONG.getKey(), messageUtil.pong(pong));
-                log.info("充电桩心跳包-返回结果:{}",result);
+                iotMessageProduce.sendMessage(pong.getCharging_pile_code(), ServiceIdMenu.PONG.getKey(), messageUtil.pong(pong));
                 sendResult = enhanceProduce.chargingMessage(chargingMessage);
                 break;
             case SendTagConstant.END_CHARGE:
diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/produce/IotMessageProduce.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/produce/IotMessageProduce.java
index 6e7aa8d..3659dbc 100644
--- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/produce/IotMessageProduce.java
+++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/produce/IotMessageProduce.java
@@ -1,5 +1,6 @@
 package com.ruoyi.integration.iotda.utils.produce;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson2.JSONObject;
 import com.huaweicloud.sdk.core.exception.ConnectionException;
 import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
@@ -41,8 +42,6 @@
     public String sendMessage(String code, String name, JSONObject message){
         log.info("消息下发至设备:code={},name={},message={}", code, name, message);
         CreateMessageRequest request = new CreateMessageRequest();
-        System.err.println(code);
-        System.err.println(JSONObject.toJSONString(config));
         request.withDeviceId(code);
         DeviceMessageRequest body = new DeviceMessageRequest();
         body.withMessageId(UUID.randomUUID().toString());
@@ -51,19 +50,14 @@
         request.withBody(body);
         try {
             CreateMessageResponse response = iotBuilder.buildIot().createMessage(request);
-            System.out.println(response.toString());
-        } catch (ConnectionException e) {
+            log.info("消息下发至设备结果:{}", JSON.toJSONString(response));
+            return JSON.toJSONString(response);
+        } catch (Exception e) {
             e.printStackTrace();
-        } catch (RequestTimeoutException e) {
-            e.printStackTrace();
-        } catch (ServiceResponseException e) {
-            e.printStackTrace();
-            System.out.println(e.getHttpStatusCode());
-            System.out.println(e.getRequestId());
-            System.out.println(e.getErrorCode());
-            System.out.println(e.getErrorMsg());
+            log.info("消息下发至设备异常:code---{},msg---{}", code, e.getMessage());
+            log.error("消息下发至设备异常:code---{},msg---{}", code, e.getMessage());
+            return e.getMessage();
         }
-        return null;
     }
 
 }
\ No newline at end of file
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java
index c79a059..84b6550 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java
@@ -291,25 +291,6 @@
                     siteIds = data;
                 }
             }
-        }else{
-            siteIds.add(pageList.getSiteId());
-        }
-        if (siteIds.isEmpty()){
-            siteIds.add(-1);
-        }else{
-            List<Integer> integers = new ArrayList<>();
-            for (Integer siteId : siteIds) {
-                // 校验有没有这个站点的权限
-                List<Boolean> t1= partnerClient.chargeEvaluation(sysUser.getObjectId(),siteId).getData();
-                Boolean b = t1.get(0);
-                if (b){
-                    integers.add(siteId);
-                }
-            }
-            siteIds = integers;
-        }
-        if (siteIds.isEmpty()){
-            siteIds.add(-1);
         }
         List<GetOrderEvaluatePageListDTO> list = this.baseMapper.getPageList(pageList, evaluationTagIds, siteIds, pageInfo);
         for (GetOrderEvaluatePageListDTO dto : list) {
diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderEvaluateMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderEvaluateMapper.xml
index 8bdfc50..8107295 100644
--- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderEvaluateMapper.xml
+++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderEvaluateMapper.xml
@@ -114,7 +114,7 @@
         <if test="null != query.content and '' != query.content">
             and a.content like CONCAT('%', #{query.content}, '%')
         </if>
-        <if test="null != query.evaluateType">
+        <if test="null != evaluationTagIds and evaluationTagIds.size() > 0">
             and a.id in (select order_evaluate_id from t_order_evaluate_tag where evaluation_tag_id in
             <foreach collection="evaluationTagIds" item="item" index="index" open="(" separator="," close=")">
                 #{item}
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralRuleController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralRuleController.java
index 16bdb03..cbb81d3 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralRuleController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralRuleController.java
@@ -140,6 +140,27 @@
     }
     
     
+    @GetMapping("/getInfo1")
+    @ApiOperation(tags = {"小程序-积分管理"},value = "type 1=积分规则说明," +
+            "2=会员折扣说明," +
+            "3=优惠券说明," +
+            "4=双倍积分说明," +
+            "5=商城专享价说明," +
+            "6=会员协议," +
+            "7=用户协议," +
+            "8=隐私协议," +
+            "9=邀请好友说明," +
+            "10=资质证明," +
+            "11=开票说明")
+    public R<String> getInfo1(Integer type) {
+        THtml g = htmlService.getOne(new QueryWrapper<THtml>().eq("type",type));
+        if (g == null){
+            return R.ok("");
+        }
+        return R.ok(g.getContent());
+    }
+    
+    
     
     @RequiresPermissions(value = {"/vipSetting/html"}, logical = Logical.OR)
     @PostMapping("/saveInfo")

--
Gitblit v1.7.1