Merge remote-tracking branch 'origin/master'
# Conflicts:
# ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/controller/SendMessageController.java
New file |
| | |
| | | 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” |
| | | |
| | | } |
New file |
| | |
| | | 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:失败) |
| | | |
| | | } |
New file |
| | |
| | | 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=已锁) |
| | | |
| | | } |
| | |
| | | @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); |
| | | } |
| | | |
| | | /** |
| | |
| | | * 远程更新应答 |
| | | */ |
| | | 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"; |
| | | } |
| | |
| | | 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)); |
| | | } |
| | | |
| | | } |
| | |
| | | * 远程更新 |
| | | */ |
| | | PLATFORM_REMOTE_UPDATE ("远程更新","platform_remote_update"), |
| | | /** |
| | | * 二维码下发 |
| | | */ |
| | | QR_CODE_DELIVERY ("二维码下发","qr_code_delivery"), |
| | | ; |
| | | private String key; |
| | | private String value; |
| | |
| | | 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); |
| | |
| | | private PlatformRestartService platformRestartService; |
| | | @Autowired |
| | | private PlatformRemoteUpdateService platformRemoteUpdateService; |
| | | @Autowired |
| | | private QrCodeDeliveryService qrCodeDeliveryService; |
| | | |
| | | /** |
| | | * 登录认证应答 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 二维码下发 |
| | | * @param qrCodeDelivery 实体对象 |
| | | * @return |
| | | */ |
| | | public JSONObject qrCodeDelivery(QrCodeDelivery qrCodeDelivery){ |
| | | qrCodeDeliveryService.create(qrCodeDelivery); |
| | | return getMessageJsonString(qrCodeDelivery, ServiceIdMenu.QR_CODE_DELIVERY.getValue()); |
| | | } |
| | | |
| | | /** |
| | | * 统一封装消息 |
| | | * @param object 实体对象 |
| | | * @param serviceId 服务ID |
New file |
| | |
| | | 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> { |
| | | |
| | | } |
New file |
| | |
| | | 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> { |
| | | |
| | | } |
New file |
| | |
| | | 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> { |
| | | |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
| | | } |
New file |
| | |
| | | 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” |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | 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:失败) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | 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=已锁) |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | 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; |
| | |
| | | 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); |
| | | } |
| | | |
| | | } |