Pu Zhibing
2024-10-08 516a44e6c32811d47668c5106ecef8154e86c8cc
Merge remote-tracking branch 'origin/master'

# Conflicts:
# ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/controller/SendMessageController.java
7个文件已修改
12个文件已添加
330 ■■■■■ 已修改文件
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/model/QrCodeDelivery.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/model/QrCodeDeliveryReply.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/model/SecurityDetection.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserAddressController.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/constant/SendTagConstant.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/controller/SendMessageController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/enums/ServiceIdMenu.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/tools/MessageUtil.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/QrCodeDeliveryReplyService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/QrCodeDeliveryService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/SecurityDetectionService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/QrCodeDeliveryReplyServiceImpl.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/QrCodeDeliveryServiceImpl.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/SecurityDetectionServiceImpl.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/QrCodeDeliveryMessage.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/QrCodeDeliveryReplyMessage.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/SecurityDetectionMessage.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/produce/EnhanceProduce.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/model/QrCodeDelivery.java
New file
@@ -0,0 +1,20 @@
package com.ruoyi.integration.api.model;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
@Data
@Document(collection = "qr_code_delivery") //指定要对应的文档名(表名)
@Accessors(chain = true)
public class QrCodeDelivery {
    @Id
    private String charging_pile_code; // 桩编码
    private Integer code_format; // "0:第一种前缀+桩编号  1:第二种前缀+桩编号+枪编号"
    private Integer prefix_length; // 二维码前缀长度长度最大不超过200 字节
    private String code_prefix; // 如:“www.baidu.com?No=”
    private String qr_code; // 二维码内容,如:“www.baidu.com?No=3422000100023301”
}
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/model/QrCodeDeliveryReply.java
New file
@@ -0,0 +1,17 @@
package com.ruoyi.integration.api.model;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
@Data
@Document(collection = "qr_code_delivery_reply") //指定要对应的文档名(表名)
@Accessors(chain = true)
public class QrCodeDeliveryReply {
    @Id
    private String charging_pile_code; // 桩编码
    private Integer delivery_result; // 设置结果(0:成功,1:失败)
}
ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/model/SecurityDetection.java
New file
@@ -0,0 +1,20 @@
package com.ruoyi.integration.api.model;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
@Data
@Document(collection = "security_detection") //指定要对应的文档名(表名)
@Accessors(chain = true)
public class SecurityDetection {
    @Id
    private String charging_pile_code; // 桩编码
    private String charging_gun_code; // 抢号
    private Integer secure_connection; // 车枪连接(0=未连接,1=连接)
    private Integer nsulation_detection; // 绝缘检测(0=安全,1=不安全)
    private Integer electronic_lock_lock; // 电磁锁状态(0=未锁,1=已锁)
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserAddressController.java
@@ -125,7 +125,9 @@
    @ApiOperation(tags = {"小程序-用户地址"},value = "查询用户地址详情")
    @GetMapping(value = "/getDetailById")
    public R<TAppUserAddress> getDetailById(@RequestParam(value = "id")Long id) {
        return R.ok(appUserAddressService.getById(id));
        TAppUserAddress appUserAddress = appUserAddressService.getById(id);
        appUserAddress.setUid(appUserAddress.getId().toString());
        return R.ok(appUserAddress);
    }
    /**
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/constant/SendTagConstant.java
@@ -118,4 +118,12 @@
     * 远程更新应答
     */
    public final static String PLATFORM_REMOTE_UPDATE_REPLY ="platform_remote_update_reply";
    /**
     * 二维码下发应答
     */
    public final static String QR_CODE_DELIVERY_REPLY ="qr_code_delivery_reply";
    /**
     * 安全监测
     */
    public final static String SECURITY_DETECTION ="security_detection";
}
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/controller/SendMessageController.java
@@ -228,5 +228,14 @@
    public String platformRemoteUpdate(@RequestBody PlatformRemoteUpdate platformRemoteUpdate){
        return  iotMessageProduce.sendMessage(platformRemoteUpdate.getCharging_pile_code(), ServiceIdMenu.PLATFORM_REMOTE_UPDATE.getKey(),messageUtil.platformRemoteUpdate(platformRemoteUpdate));
    }
    /**
     * 二维码下发
     * @param qrCodeDelivery 实体对象
     * @return
     */
    @PostMapping("/qrCodeDelivery")
    public String qrCodeDelivery(@RequestBody QrCodeDelivery qrCodeDelivery){
        return  iotMessageProduce.sendMessage(qrCodeDelivery.getCharging_pile_code(), ServiceIdMenu.QR_CODE_DELIVERY.getKey(),messageUtil.qrCodeDelivery(qrCodeDelivery));
    }
    
}
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/enums/ServiceIdMenu.java
@@ -90,6 +90,10 @@
     * 远程更新
     */
     PLATFORM_REMOTE_UPDATE ("远程更新","platform_remote_update"),
    /**
     * 二维码下发
     */
    QR_CODE_DELIVERY ("二维码下发","qr_code_delivery"),
    ;
    private String key;
    private String value;
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java
@@ -266,6 +266,16 @@
                sendResult = enhanceProduce.platformRestartReplyMessage(platformRestartReplyMessage);
                // 响应硬件
                break;
            case SendTagConstant.QR_CODE_DELIVERY_REPLY:
                QrCodeDeliveryReplyMessage qrCodeDeliveryReplyMessage = JSON.parseObject(content.toJSONString(),QrCodeDeliveryReplyMessage.class);
                sendResult = enhanceProduce.qrCodeDeliveryReplyMessage(qrCodeDeliveryReplyMessage);
                // 响应硬件
                break;
            case SendTagConstant.SECURITY_DETECTION:
                SecurityDetectionMessage securityDetectionMessage = JSON.parseObject(content.toJSONString(),SecurityDetectionMessage.class);
                sendResult = enhanceProduce.securityDetectionMessage(securityDetectionMessage);
                // 响应硬件
                break;
            default:
                PlatformRemoteUpdateReplyMessage platformRemoteUpdateReplyMessage = JSON.parseObject(content.toJSONString(),PlatformRemoteUpdateReplyMessage.class);
                sendResult = enhanceProduce.platformRemoteUpdateReplyMessage(platformRemoteUpdateReplyMessage);
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/tools/MessageUtil.java
@@ -55,6 +55,8 @@
    private PlatformRestartService platformRestartService;
    @Autowired
    private PlatformRemoteUpdateService platformRemoteUpdateService;
    @Autowired
    private QrCodeDeliveryService qrCodeDeliveryService;
    /**
     * 登录认证应答
@@ -264,6 +266,16 @@
    }
    /**
     * 二维码下发
     * @param qrCodeDelivery 实体对象
     * @return
     */
    public JSONObject qrCodeDelivery(QrCodeDelivery qrCodeDelivery){
        qrCodeDeliveryService.create(qrCodeDelivery);
        return  getMessageJsonString(qrCodeDelivery, ServiceIdMenu.QR_CODE_DELIVERY.getValue());
    }
    /**
     * 统一封装消息
     * @param object 实体对象
     * @param serviceId 服务ID
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/QrCodeDeliveryReplyService.java
New file
@@ -0,0 +1,11 @@
package com.ruoyi.integration.mongodb.service;
import com.ruoyi.integration.api.model.QrCodeDelivery;
import com.ruoyi.integration.api.model.QrCodeDeliveryReply;
import com.ruoyi.integration.mongodb.base.BaseService;
/**
 */
public interface QrCodeDeliveryReplyService extends BaseService<QrCodeDeliveryReply> {
}
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/QrCodeDeliveryService.java
New file
@@ -0,0 +1,11 @@
package com.ruoyi.integration.mongodb.service;
import com.ruoyi.integration.api.model.Pong;
import com.ruoyi.integration.api.model.QrCodeDelivery;
import com.ruoyi.integration.mongodb.base.BaseService;
/**
 */
public interface QrCodeDeliveryService extends BaseService<QrCodeDelivery> {
}
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/SecurityDetectionService.java
New file
@@ -0,0 +1,11 @@
package com.ruoyi.integration.mongodb.service;
import com.ruoyi.integration.api.model.QrCodeDelivery;
import com.ruoyi.integration.api.model.SecurityDetection;
import com.ruoyi.integration.mongodb.base.BaseService;
/**
 */
public interface SecurityDetectionService extends BaseService<SecurityDetection> {
}
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/QrCodeDeliveryReplyServiceImpl.java
New file
@@ -0,0 +1,36 @@
package com.ruoyi.integration.mongodb.service.impl;
import com.ruoyi.integration.api.model.QrCodeDeliveryReply;
import com.ruoyi.integration.iotda.constant.IotConstant;
import com.ruoyi.integration.mongodb.service.QrCodeDeliveryReplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * 心跳包应答实现类
 **/
@Service
public class QrCodeDeliveryReplyServiceImpl implements QrCodeDeliveryReplyService {
    @Autowired
    private MongoTemplate mongoTemplate;
    @Override
    public int create(QrCodeDeliveryReply qrCodeDeliveryReply) {
        mongoTemplate.save(qrCodeDeliveryReply);
        return IotConstant.SUCCESS;
    }
    @Override
    public QrCodeDeliveryReply findById(String id) {
        return mongoTemplate.findById(id, QrCodeDeliveryReply.class);
    }
    @Override
    public List<QrCodeDeliveryReply> findAll() {
        return mongoTemplate.findAll(QrCodeDeliveryReply.class);
    }
}
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/QrCodeDeliveryServiceImpl.java
New file
@@ -0,0 +1,36 @@
package com.ruoyi.integration.mongodb.service.impl;
import com.ruoyi.integration.api.model.QrCodeDelivery;
import com.ruoyi.integration.iotda.constant.IotConstant;
import com.ruoyi.integration.mongodb.service.QrCodeDeliveryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * 心跳包应答实现类
 **/
@Service
public class QrCodeDeliveryServiceImpl implements QrCodeDeliveryService {
    @Autowired
    private MongoTemplate mongoTemplate;
    @Override
    public int create(QrCodeDelivery qrCodeDelivery) {
        mongoTemplate.save(qrCodeDelivery);
        return IotConstant.SUCCESS;
    }
    @Override
    public QrCodeDelivery findById(String id) {
        return mongoTemplate.findById(id, QrCodeDelivery.class);
    }
    @Override
    public List<QrCodeDelivery> findAll() {
        return mongoTemplate.findAll(QrCodeDelivery.class);
    }
}
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/SecurityDetectionServiceImpl.java
New file
@@ -0,0 +1,36 @@
package com.ruoyi.integration.mongodb.service.impl;
import com.ruoyi.integration.api.model.SecurityDetection;
import com.ruoyi.integration.iotda.constant.IotConstant;
import com.ruoyi.integration.mongodb.service.SecurityDetectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * 心跳包应答实现类
 **/
@Service
public class SecurityDetectionServiceImpl implements SecurityDetectionService {
    @Autowired
    private MongoTemplate mongoTemplate;
    @Override
    public int create(SecurityDetection securityDetection) {
        mongoTemplate.save(securityDetection);
        return IotConstant.SUCCESS;
    }
    @Override
    public SecurityDetection findById(String id) {
        return mongoTemplate.findById(id, SecurityDetection.class);
    }
    @Override
    public List<SecurityDetection> findAll() {
        return mongoTemplate.findAll(SecurityDetection.class);
    }
}
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/QrCodeDeliveryMessage.java
New file
@@ -0,0 +1,21 @@
package com.ruoyi.integration.rocket.model;
import com.ruoyi.integration.rocket.base.BaseMessage;
import lombok.Data;
/**
 *
 **/
@Data
public class QrCodeDeliveryMessage extends BaseMessage {
    private String charging_pile_code; // 桩编码
    private Integer code_format; // "0:第一种前缀+桩编号  1:第二种前缀+桩编号+枪编号"
    private Integer prefix_length; // 二维码前缀长度长度最大不超过200 字节
    private String code_prefix; // 如:“www.baidu.com?No=”
    private String qr_code; // 二维码内容,如:“www.baidu.com?No=3422000100023301”
}
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/QrCodeDeliveryReplyMessage.java
New file
@@ -0,0 +1,18 @@
package com.ruoyi.integration.rocket.model;
import com.ruoyi.integration.rocket.base.BaseMessage;
import lombok.Data;
/**
 *
 **/
@Data
public class QrCodeDeliveryReplyMessage extends BaseMessage {
    private String charging_pile_code; // 桩编码
    private Integer delivery_result; // 设置结果(0:成功,1:失败)
}
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/SecurityDetectionMessage.java
New file
@@ -0,0 +1,21 @@
package com.ruoyi.integration.rocket.model;
import com.ruoyi.integration.rocket.base.BaseMessage;
import lombok.Data;
/**
 *
 **/
@Data
public class SecurityDetectionMessage extends BaseMessage {
    private String charging_pile_code; // 桩编码
    private String charging_gun_code; // 抢号
    private Integer secure_connection; // 车枪连接(0=未连接,1=连接)
    private Integer nsulation_detection; // 绝缘检测(0=安全,1=不安全)
    private Integer electronic_lock_lock; // 电磁锁状态(0=未锁,1=已锁)
}
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/produce/EnhanceProduce.java
@@ -4,6 +4,8 @@
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.integration.api.model.ErrorMessage;
import com.ruoyi.integration.api.model.ParameterSetting;
import com.ruoyi.integration.api.model.QrCodeDeliveryReply;
import com.ruoyi.integration.api.model.SecurityDetection;
import com.ruoyi.integration.iotda.constant.SendTagConstant;
import com.ruoyi.integration.rocket.model.*;
import com.ruoyi.integration.rocket.util.RocketMQEnhanceTemplate;
@@ -318,4 +320,27 @@
        message.setSource(SendTagConstant.PLATFORM_REMOTE_UPDATE_REPLY);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.PLATFORM_REMOTE_UPDATE_REPLY, SendTagConstant.PLATFORM_REMOTE_UPDATE_REPLY, message);
    }
    /**
     * 二维码下发应答
     */
    public SendResult qrCodeDeliveryReplyMessage(QrCodeDeliveryReplyMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.QR_CODE_DELIVERY_REPLY);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.QR_CODE_DELIVERY_REPLY, SendTagConstant.QR_CODE_DELIVERY_REPLY, message);
    }
    /**
     * 安全监测
     */
    public SendResult securityDetectionMessage(SecurityDetectionMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagConstant.SECURITY_DETECTION);
        return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.SECURITY_DETECTION, SendTagConstant.SECURITY_DETECTION, message);
    }
}