From 3244b550596e0330031b3f4547356927df83b0ad Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期一, 19 五月 2025 11:48:35 +0800
Subject: [PATCH] 修改bug
---
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java | 11 +--
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderInvoiceMapper.xml | 6 +-
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java | 6 +-
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml | 111 ++++++++++++++++++------------------
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java | 12 +--
5 files changed, 71 insertions(+), 75 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 55acfaa..754743b 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
@@ -158,7 +158,7 @@
// 指定发送邮件的主机为
String host = "smtp.163.com";
Properties properties = new Properties();
- properties.put("mail.smtp.host", "smtp.163.com");
+ properties.put("mail.smtp.host", host);
properties.put("mail.smtp.socketFactory.port", "465");
properties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
properties.put("mail.smtp.auth", "true");
@@ -170,7 +170,7 @@
public javax.mail.PasswordAuthentication getPasswordAuthentication()
{
//发件人邮件用户名、授权码,换成自己的发件箱及授权码
- return new PasswordAuthentication("13281306557@163.com", "NUSdxDQqadYvVek2");
+ return new PasswordAuthentication(from, "NUSdxDQqadYvVek2");
}
});
@@ -180,7 +180,7 @@
// Set From,设置发件人
InternetAddress fromMail = new InternetAddress(from);
//设置发件人名称,TODO 换成自己的发件箱
- fromMail.setPersonal(MimeUtility.encodeText("明星新能源科技有限公司<13281306557@163.com>"));
+ fromMail.setPersonal(MimeUtility.encodeText("明星新能源科技有限公司<" + from + ">"));
message.setFrom(fromMail);
// Set To: 设置收件人
InternetAddress toMail = new InternetAddress(to);
diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java
index bdf4a07..52fb479 100644
--- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java
+++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java
@@ -39,6 +39,7 @@
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
+import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -66,9 +67,9 @@
private final TChargingPileService chargingPileService;
private final TChargingGunService chargingGunService;
-
+
@Resource
- private RedisService redisService;
+ private RedisTemplate redisTemplate;
@Resource
private TFaultMessageService faultMessageService;
@@ -246,16 +247,14 @@
String gun_code = vo.getGun_code();
//0:正常,1:故障,2=插枪
Integer status = vo.getStatus();
- Map<String, Object> charging_pile_online = redisService.getCacheMap("charging_gun_online");
- Long time = (Long) charging_pile_online.get(pile_code + gun_code);
+ Long time = (Long) redisTemplate.opsForHash().get("charging_gun_online", (pile_code + gun_code));
//小于1分钟才处理数据,防止频繁查询数据
if(null != time && (System.currentTimeMillis() - time) < 60000){
return;
}
TChargingGun tChargingGun = chargingGunService.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getFullNumber, (pile_code + gun_code)).eq(TChargingGun::getDelFlag, 0));
if(null != tChargingGun){
- charging_pile_online.put(tChargingGun.getFullNumber(), System.currentTimeMillis());
- redisService.setCacheMap("charging_gun_online", charging_pile_online);
+ redisTemplate.opsForHash().put("charging_gun_online", tChargingGun.getFullNumber(), System.currentTimeMillis());
TChargingPile chargingPile = chargingPileService.getById(tChargingGun.getChargingPileId());
//枪处于离线或者故障,返回状态为正常,则修改其状态
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 ac9279c..0d43f0f 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
@@ -42,6 +42,7 @@
import com.ruoyi.system.api.feignClient.SysUserClient;
import com.ruoyi.system.api.feignClient.SysUserRoleClient;
import com.ruoyi.system.api.model.SysUserRoleVo;
+import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -104,7 +105,7 @@
private IotInterfaceClient iotInterfaceClient;
@Resource
- private RedisService redisService;
+ private RedisTemplate redisTemplate;
@Resource
private TFaultMessageService faultMessageService;
@@ -701,14 +702,9 @@
*/
@Override
public void updateStatus() {
- Map<String, Object> charging_gun_online = redisService.getCacheMap("charging_gun_online");
- Set<String> keySet = charging_gun_online.keySet();
- List<TChargingGun> list = new ArrayList<>();
- if(keySet.size() > 0){
- list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getDelFlag, 0).in(TChargingGun::getFullNumber, keySet));
- }
+ List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getDelFlag, 0));
for (TChargingGun chargingGun : list) {
- Long time = (Long) charging_gun_online.get(chargingGun.getFullNumber());
+ Long time = (Long) redisTemplate.opsForHash().get("charging_gun_online", chargingGun.getFullNumber());
//判断设备是否真的离线3分钟(2分钟+代码中的60秒间隔处理存储)
if(null != time && System.currentTimeMillis() - time > 180000){
TChargingGun chargingGun1 = new TChargingGun();
diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
index 193d5fb..c8284c3 100644
--- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
+++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
@@ -240,68 +240,69 @@
</select>
<select id="getRefundList" resultType="com.ruoyi.order.api.model.TChargingOrderRefund">
-
- select * from (SELECT re.id,
- re.`code`,
- re.refund_code,
- re.refund_title,
- re.refund_reason,
- re.refund_amount,
- re.refund_total_amount,
- re.refund_time,
- re.pay_type,
- re.pay_amount,
- re.refund_remark,
- co.recharge_serial_number as serail_number,
- co.payment_amount,
- co.create_time as pay_time,
- co.id as order_id,
- co.app_user_id as user_id,
- 1 as type
+ select * from (
+ SELECT
+ re.id,
+ re.`code`,
+ re.refund_code,
+ re.refund_title,
+ re.refund_reason,
+ re.refund_amount,
+ re.refund_total_amount,
+ re.refund_time,
+ re.pay_type,
+ re.pay_amount,
+ re.refund_remark,
+ co.recharge_serial_number as serail_number,
+ co.payment_amount,
+ co.create_time as pay_time,
+ co.id as order_id,
+ co.app_user_id as user_id,
+ 1 as type
FROM t_charging_order_refund re
LEFT JOIN t_charging_order co ON re.charging_order_id = co.id
UNION ALL
- SELECT re.id,
- re.`code`,
- re.refund_code,
- re.refund_title,
- re.refund_reason,
- re.refund_amount,
- re.refund_total_amount,
- re.refund_time,
- re.pay_type,
- re.pay_amount,
- re.refund_remark,
- so.serial_number,
- so.payment_amount,
- so.create_time as pay_time,
- so.id as order_id,
- so.app_user_id as user_id,
- 2 as type
+ SELECT
+ re.id,
+ re.`code`,
+ re.refund_code,
+ re.refund_title,
+ re.refund_reason,
+ re.refund_amount,
+ re.refund_total_amount,
+ re.refund_time,
+ re.pay_type,
+ re.pay_amount,
+ re.refund_remark,
+ so.serial_number,
+ so.payment_amount,
+ so.create_time as pay_time,
+ so.id as order_id,
+ so.app_user_id as user_id,
+ 2 as type
FROM t_shopping_order_refund re
LEFT JOIN t_shopping_order so on re.shopping_order_id = so.id
UNION ALL
- SELECT vr.id,
- vr.`code`,
- vr.refund_code,
- vr.refund_title,
- vr.refund_reason,
- vr.refund_amount,
- vr.refund_total_amount,
- vr.refund_time,
- vr.pay_type,
- vr.pay_amount,
- vr.refund_remark,
- vo.serial_number,
- vo.payment_amount,
- vo.create_time as pay_time,
- vo.id as order_id,
- vo.app_user_id as user_id,
- 3 as type
+ SELECT
+ vr.id,
+ vr.`code`,
+ vr.refund_code,
+ vr.refund_title,
+ vr.refund_reason,
+ vr.refund_amount,
+ vr.refund_total_amount,
+ vr.refund_time,
+ vr.pay_type,
+ vr.pay_amount,
+ vr.refund_remark,
+ vo.serial_number,
+ vo.payment_amount,
+ vo.create_time as pay_time,
+ vo.id as order_id,
+ vo.app_user_id as user_id,
+ 3 as type
FROM t_vip_order_refund vr
LEFT JOIN t_vip_order vo on vr.vip_order_id = vo.id
-
-
) o
<where>
<if test="data.code != null and data.code != ''">
@@ -1626,7 +1627,7 @@
tc.name as name,
cp.name AS siteName
FROM
- `charging_pile_order`.`t_charging_order` co
+ (select site_id,create_time,charging_gun_id, charging_pile_id, current, (CASE WHEN need_elec = 0 THEN `current` ELSE need_elec END) as need_elec from `charging_pile_order`.`t_charging_order`) co
LEFT JOIN `charging_pile_service`.`t_charging_gun` tc ON co.charging_gun_id = tc.id
LEFT JOIN `charging_pile_service`.`t_charging_pile` cp ON tc.charging_pile_id = cp.id
<where>
diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderInvoiceMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderInvoiceMapper.xml
index f9050e6..88cea85 100644
--- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderInvoiceMapper.xml
+++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderInvoiceMapper.xml
@@ -65,7 +65,7 @@
AND toi.create_time BETWEEN #{query.startTime} AND #{query.endTime}
</if>
<if test="query.userIds != null and query.userIds.size()>0">
- AND toi.billing_user_id IN
+ AND toi.app_user_id IN
<foreach collection="query.userIds" close=")" open="(" item="userId" separator=",">
#{userId}
</foreach>
@@ -102,7 +102,7 @@
AND toi.billing_time BETWEEN #{query.startTime} AND #{query.endTime}
</if>
<if test="query.userIds != null and query.userIds.size()>0">
- AND toi.billing_user_id IN
+ AND toi.app_user_id IN
<foreach collection="query.userIds" close=")" open="(" item="userId" separator=",">
#{userId}
</foreach>
@@ -138,7 +138,7 @@
AND toi.billing_time BETWEEN #{query.startTime} AND #{query.endTime}
</if>
<if test="query.userIds != null and query.userIds.size()>0">
- AND toi.billing_user_id IN
+ AND toi.app_user_id IN
<foreach collection="query.userIds" close=")" open="(" item="userId" separator=",">
#{userId}
</foreach>
--
Gitblit v1.7.1