Merge remote-tracking branch 'origin/master'
| | |
| | | @ApiModelProperty(value = "设备状态(1=工作中,2=离线,3=故障)") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "iotd设备id") |
| | | @TableField("iotd_device_id") |
| | | private String iotdDeviceId; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.integration.api.feignClient.IotInterfaceClient; |
| | | import com.ruoyi.integration.api.feignClient.SwitchwayGateClient; |
| | | import com.ruoyi.integration.api.vo.AddDevice; |
| | | import com.ruoyi.integration.api.vo.AddDeviceResp; |
| | | import com.ruoyi.integration.api.vo.DeleteDeviceResp; |
| | | import com.ruoyi.integration.api.vo.SwitchwayGateReq; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 充电桩服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class IotInterfaceFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory<IotInterfaceClient> { |
| | | private static final Logger log = LoggerFactory.getLogger(IotInterfaceFallbackFactory.class); |
| | | |
| | | @Override |
| | | public IotInterfaceClient create(Throwable throwable) { |
| | | log.error("调用失败:{}", throwable.getMessage()); |
| | | return new IotInterfaceClient() { |
| | | |
| | | |
| | | @Override |
| | | public R<AddDeviceResp> addDevice(AddDevice addDevice) { |
| | | return R.fail("添加设备失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<DeleteDeviceResp> deleteDevice(String deviceId) { |
| | | return R.fail("删除设备失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.integration.api.feignClient.SecurityDetectionClient; |
| | | import com.ruoyi.integration.api.feignClient.SendMessageClient; |
| | | import com.ruoyi.integration.api.model.PlatformStartCharging; |
| | | import com.ruoyi.integration.api.model.PlatformStopCharging; |
| | | import com.ruoyi.integration.api.model.QrCodeDelivery; |
| | | import com.ruoyi.integration.api.model.SecurityDetection; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 充电桩服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class SecurityDetectionFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory<SecurityDetectionClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(SecurityDetectionFallbackFactory.class); |
| | | |
| | | @Override |
| | | public SecurityDetectionClient create(Throwable throwable) { |
| | | log.error("调用失败:{}", throwable.getMessage()); |
| | | return new SecurityDetectionClient() { |
| | | |
| | | @Override |
| | | public R<SecurityDetection> getSecurityDetection(String transactionSerialNumber) { |
| | | return R.fail("获取安全检测数据失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.integration.api.model.ChargingHandshake; |
| | | import com.ruoyi.integration.api.model.PlatformStartCharging; |
| | | import com.ruoyi.integration.api.model.PlatformStopCharging; |
| | | import com.ruoyi.integration.api.model.QrCodeDelivery; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | public String platformStopCharging(PlatformStopCharging platformStopCharging) { |
| | | return "远程停机失败"; |
| | | } |
| | | |
| | | @Override |
| | | public String qrCodeDelivery(QrCodeDelivery qrCodeDelivery) { |
| | | return "二维码下发失败"; |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.integration.api.factory.IotInterfaceFallbackFactory; |
| | | import com.ruoyi.integration.api.vo.AddDevice; |
| | | import com.ruoyi.integration.api.vo.AddDeviceResp; |
| | | import com.ruoyi.integration.api.vo.DeleteDeviceResp; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/10/8 10:24 |
| | | */ |
| | | @FeignClient(contextId = "IotInterfaceClient", value = ServiceNameConstants.INTEGRATION_SERVICE, fallbackFactory = IotInterfaceFallbackFactory.class) |
| | | public interface IotInterfaceClient { |
| | | |
| | | |
| | | /** |
| | | * 添加设备 |
| | | * @param addDevice |
| | | * @return |
| | | */ |
| | | @PostMapping("/iotInterface/addDevice") |
| | | R<AddDeviceResp> addDevice(@RequestBody AddDevice addDevice); |
| | | |
| | | |
| | | /** |
| | | * 删除设备 |
| | | * @param deviceId |
| | | * @return |
| | | */ |
| | | @PostMapping("/iotInterface/deleteDevice") |
| | | R<DeleteDeviceResp> deleteDevice(@RequestParam("deviceId") String deviceId); |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.integration.api.factory.SecurityDetectionFallbackFactory; |
| | | import com.ruoyi.integration.api.model.SecurityDetection; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/10/8 14:23 |
| | | */ |
| | | @FeignClient(contextId = "SecurityDetectionClient", value = ServiceNameConstants.INTEGRATION_SERVICE, fallbackFactory = SecurityDetectionFallbackFactory.class) |
| | | public interface SecurityDetectionClient { |
| | | |
| | | |
| | | /** |
| | | * 获取安全检测数据 |
| | | * @param transactionSerialNumber |
| | | * @return |
| | | */ |
| | | @PostMapping("/securityDetection/getSecurityDetection") |
| | | R<SecurityDetection> getSecurityDetection(@RequestParam("transactionSerialNumber") String transactionSerialNumber); |
| | | } |
| | |
| | | import com.ruoyi.integration.api.factory.SendMessageFallbackFactory; |
| | | import com.ruoyi.integration.api.model.PlatformStartCharging; |
| | | import com.ruoyi.integration.api.model.PlatformStopCharging; |
| | | import com.ruoyi.integration.api.model.QrCodeDelivery; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | */ |
| | | @PostMapping("/sendMessage/platformStopCharging") |
| | | String platformStopCharging(@RequestBody PlatformStopCharging platformStopCharging); |
| | | |
| | | |
| | | /** |
| | | * 二维码下发 |
| | | * @param qrCodeDelivery |
| | | * @return |
| | | */ |
| | | @PostMapping("/sendMessage/qrCodeDelivery") |
| | | String qrCodeDelivery(@RequestBody QrCodeDelivery qrCodeDelivery); |
| | | } |
| | |
| | | @Document(collection = "platform_start_charging_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformStartChargingReply extends BaseModel { |
| | | @Id |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | |
| | | @Document(collection = "security_detection") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class SecurityDetection { |
| | | |
| | | @Id |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer secure_connection; // 车枪连接(0=未连接,1=连接) |
New file |
| | |
| | | package com.ruoyi.integration.api.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/10/8 10:26 |
| | | */ |
| | | @Data |
| | | public class AddDevice { |
| | | /** |
| | | * 产品ID |
| | | */ |
| | | private String productId; |
| | | /** |
| | | * 设备标识码 设备编号 |
| | | */ |
| | | private String nodeId; |
| | | /** |
| | | * 设备名称 |
| | | */ |
| | | private String deviceName; |
| | | /** |
| | | * 设备描述 |
| | | */ |
| | | private String description; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.api.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/10/8 10:37 |
| | | */ |
| | | @Data |
| | | public class AddDeviceResp { |
| | | private int httpStatusCode; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("app_id") |
| | | private String appId; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("app_name") |
| | | private String appName; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("device_id") |
| | | private String deviceId; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("node_id") |
| | | private String nodeId; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("gateway_id") |
| | | private String gatewayId; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("device_name") |
| | | private String deviceName; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("node_type") |
| | | private String nodeType; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("description") |
| | | private String description; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("fw_version") |
| | | private String fwVersion; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("sw_version") |
| | | private String swVersion; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("device_sdk_version") |
| | | private String deviceSdkVersion; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("product_id") |
| | | private String productId; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("product_name") |
| | | private String productName; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("status") |
| | | private String status; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("create_time") |
| | | private String createTime; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("connection_status_update_time") |
| | | private String connectionStatusUpdateTime; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("active_time") |
| | | private String activeTime; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("extension_info") |
| | | private Object extensionInfo; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.api.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/10/8 10:40 |
| | | */ |
| | | @Data |
| | | public class DeleteDeviceResp { |
| | | @JsonIgnore |
| | | private int httpStatusCode; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("body") |
| | | private String body; |
| | | } |
| | |
| | | com.ruoyi.integration.api.factory.SendMessageFallbackFactory |
| | | com.ruoyi.integration.api.factory.PlatformStartChargingReplyFallbackFactory |
| | | com.ruoyi.integration.api.factory.PlatformStopChargingReplyFallbackFactory |
| | | com.ruoyi.integration.api.factory.SwitchwayGateFallbackFactory |
| | | com.ruoyi.integration.api.factory.SwitchwayGateFallbackFactory |
| | | com.ruoyi.integration.api.factory.IotInterfaceFallbackFactory |
| | | com.ruoyi.integration.api.factory.SecurityDetectionFallbackFactory |
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<Long> getCar() { |
| | | public R<Long> getCar(@PathVariable("id")String id) { |
| | | return R.fail("获取用户最近使用车辆充电的车辆id:" + throwable.getMessage()); |
| | | } |
| | | |
| | |
| | | * 获取用户最近使用车辆充电的车辆id |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/t-charging-order/getCar") |
| | | public R<Long> getCar(); |
| | | @GetMapping(value = "/t-charging-order/getCar/{id}") |
| | | public R<Long> getCar(@PathVariable("id")String id); |
| | | |
| | | |
| | | /** |
| | |
| | | spring: |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: dev |
| | | active: prod |
| | | application: |
| | | # 应用名称 |
| | | name: ruoyi-auth |
| | |
| | | type: nacos |
| | | nacos: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # server-addr: 192.168.110.169:8848 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | # group: DEFAULT_GROUP |
| | | # data-id: seata-server.properties |
| | | # username: nacos |
| | | # password: nacos |
| | | # 生产环境 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | registry: |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # server-addr: 192.168.110.169:8848 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | # group: DEFAULT_GROUP |
| | | # username: nacos |
| | | # password: nacos |
| | | # 生产环境 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | # group: DEFAULT_GROUP |
| | | # application: seata-server #Nacos 中 Seata 名称 |
| | | # username: nacos |
| | | # password: nacos |
| | | # 生产环境 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | sentinel: |
| | | transport: |
| | | dashboard: 127.0.0.1:8080 # Sentinel控制台地址 |
| | |
| | | allow-bean-definition-overriding: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: dev |
| | | active: prod |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | allow-bean-definition-overriding: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: dev |
| | | active: prod |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | type: nacos |
| | | nacos: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # server-addr: 192.168.110.169:8848 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | # group: DEFAULT_GROUP |
| | | # data-id: seata-server.properties |
| | | # username: nacos |
| | | # password: nacos |
| | | # 生产环境 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | registry: |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # server-addr: 192.168.110.169:8848 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | # group: DEFAULT_GROUP |
| | | # username: nacos |
| | | # password: nacos |
| | | # 生产环境 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | # group: DEFAULT_GROUP |
| | | # application: seata-server #Nacos 中 Seata 名称 |
| | | # username: nacos |
| | | # password: nacos |
| | | # 生产环境 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | sentinel: |
| | | transport: |
| | | dashboard: 127.0.0.1:8080 # Sentinel控制台地址 |
| | |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.springframework</groupId> |
| | | <artifactId>spring-mock</artifactId> |
| | | <version>2.0.8</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-order</artifactId> |
| | | </dependency> |
| | |
| | | List<TAppUserCar> cars = appUserCarService.list(new QueryWrapper<TAppUserCar>() |
| | | .eq("app_user_id",tokenService.getLoginUserApplet().getUserId()) |
| | | .orderByDesc("create_time")); |
| | | Long data1 = chargingOrderClient.getCar().getData(); |
| | | Long data1 = chargingOrderClient.getCar(tokenService.getLoginUserApplet().getUserId().toString()).getData(); |
| | | Integer data2 = otherClient.getAddCarIntegral().getData(); |
| | | data.setIntegral(data2); |
| | | if (!cars.isEmpty()){ |
| | |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.mock.web.MockMultipartFile; |
| | | //import org.springframework.mock.web.MockMultipartFile; |
| | | import org.springframework.util.LinkedMultiValueMap; |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | private WeixinProperties wxConfig; |
| | | @Autowired |
| | | private RestTemplate wxRestTemplate; |
| | | /** |
| | | * 上传文件存储在本地的根路径 |
| | | */ |
| | | @Value("${file.path}") |
| | | private String localFilePath; |
| | | // /** |
| | | // * 上传文件存储在本地的根路径 |
| | | // */ |
| | | // @Value("${file.path}") |
| | | // private String localFilePath; |
| | | @ApiOperation(value = "通过code获得openid,获取用户信息",tags = {"微信小程序登录"}) |
| | | @PostMapping("/openIdByJsCode") |
| | | public AjaxResult<Map<String, Object>> openIdByJsCode(@RequestBody AppletUserEncrypteData data) { |
| | |
| | | public AjaxResult<Map<String, Object>> openIdByJsCode(@RequestBody AppletUserDecodeData appletUserDecodeData) { |
| | | return AjaxResult.success(appUserService.wxLogin(appletUserDecodeData, null)); |
| | | } |
| | | public static MultipartFile convertInputStreamToMultipartFile(InputStream inputStream, String fileName, String contentType) throws IOException { |
| | | return new MockMultipartFile(fileName, fileName, contentType, inputStream); |
| | | } |
| | | // public static MultipartFile convertInputStreamToMultipartFile(InputStream inputStream, String fileName, String contentType) throws IOException { |
| | | // return new MockMultipartFile(fileName, fileName, contentType, inputStream); |
| | | // } |
| | | @ApiOperation(value = "获取微信小程序二维码",tags = {"获取微信小程序二维码"}) |
| | | @PostMapping("/getQRCode") |
| | | public AjaxResult getQRCode() { |
| | |
| | | System.err.println(Base64.encodeBase64String(result)); |
| | | inputStream = new ByteArrayInputStream(result); |
| | | String finalFileName = System.currentTimeMillis() + "" + new SecureRandom().nextInt(0x0400) + ".jpeg"; |
| | | MultipartFile multipartFile = convertInputStreamToMultipartFile(inputStream, finalFileName, "image/jpeg"); |
| | | String name = FileUploadUtils.upload(localFilePath, multipartFile); |
| | | System.err.println(name); |
| | | return AjaxResult.success(name); |
| | | // MultipartFile multipartFile = convertInputStreamToMultipartFile(inputStream, finalFileName, "image/jpeg"); |
| | | // String name = FileUploadUtils.upload(localFilePath, multipartFile); |
| | | // System.err.println(name); |
| | | return AjaxResult.success(null); |
| | | } catch (Exception e) { |
| | | System.err.println("调用小程序生成微信永久小程序码URL接口异常" + e); |
| | | } finally { |
| | |
| | | allow-circular-references: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: dev |
| | | active: prod |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | type: nacos |
| | | nacos: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # server-addr: 192.168.110.169:8848 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | # group: DEFAULT_GROUP |
| | | # data-id: seata-server.properties |
| | | # username: nacos |
| | | # password: nacos |
| | | # 生产环境 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | registry: |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # server-addr: 192.168.110.169:8848 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | # group: DEFAULT_GROUP |
| | | # username: nacos |
| | | # password: nacos |
| | | # 生产环境 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | # group: DEFAULT_GROUP |
| | | # application: seata-server #Nacos 中 Seata 名称 |
| | | # username: nacos |
| | | # password: nacos |
| | | # 生产环境 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | sentinel: |
| | | transport: |
| | | dashboard: 192.168.0.137:8080 # Sentinel控制台地址 |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.SendMessageClient; |
| | | import com.ruoyi.integration.api.model.QrCodeDelivery; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | |
| | | |
| | | @Resource |
| | | private SysUserRoleClient sysUserRoleClient; |
| | | |
| | | @Resource |
| | | private SendMessageClient sendMessageClient; |
| | | |
| | | |
| | | |
| | |
| | | return AjaxResult.error("接口编码已存在"); |
| | | } |
| | | this.save(dto); |
| | | TChargingPile chargingPile = chargingPileService.getById(dto.getChargingPileId()); |
| | | |
| | | //下发硬件充电二维码 |
| | | String code_prefix = "https://mxcd.zhinenganguan.com?No="; |
| | | QrCodeDelivery qrCodeDelivery = new QrCodeDelivery(); |
| | | qrCodeDelivery.setCharging_pile_code(chargingPile.getCode()); |
| | | qrCodeDelivery.setCode_format(1); |
| | | qrCodeDelivery.setPrefix_length(code_prefix.length()); |
| | | qrCodeDelivery.setCode_prefix(code_prefix); |
| | | qrCodeDelivery.setQr_code(code_prefix + chargingPile.getCode() + dto.getCode()); |
| | | sendMessageClient.qrCodeDelivery(qrCodeDelivery); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | return AjaxResult.error("接口编码已存在"); |
| | | } |
| | | this.updateById(dto); |
| | | TChargingPile chargingPile = chargingPileService.getById(dto.getChargingPileId()); |
| | | |
| | | //下发硬件充电二维码 |
| | | String code_prefix = "https://mxcd.zhinenganguan.com?No="; |
| | | QrCodeDelivery qrCodeDelivery = new QrCodeDelivery(); |
| | | qrCodeDelivery.setCharging_pile_code(chargingPile.getCode()); |
| | | qrCodeDelivery.setCode_format(1); |
| | | qrCodeDelivery.setPrefix_length(code_prefix.length()); |
| | | qrCodeDelivery.setCode_prefix(code_prefix); |
| | | qrCodeDelivery.setQr_code(code_prefix + chargingPile.getCode() + dto.getCode()); |
| | | sendMessageClient.qrCodeDelivery(qrCodeDelivery); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.IotInterfaceClient; |
| | | import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.vo.AddDevice; |
| | | import com.ruoyi.integration.api.vo.AddDeviceResp; |
| | | import com.ruoyi.integration.api.vo.DeleteDeviceResp; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderAccountingStrategyClient; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | |
| | | @Resource |
| | | private SysUserRoleClient sysUserRoleClient; |
| | | |
| | | @Resource |
| | | private IotInterfaceClient iotInterfaceClient; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | if(count > 0){ |
| | | return AjaxResult.error("设备编号已存在"); |
| | | } |
| | | this.save(chargingPile); |
| | | //调用华为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()); |
| | | this.save(chargingPile); |
| | | } |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public AjaxResult delChargingPile(Integer[] ids) { |
| | | //检查是否有关联数据 |
| | | //接口 |
| | | long count = chargingGunService.count(new LambdaQueryWrapper<TChargingGun>().in(TChargingGun::getChargingPileId, Arrays.asList(ids)) |
| | | .eq(TChargingGun::getDelFlag, 0)); |
| | | if(count > 0){ |
| | |
| | | } |
| | | for (Integer id : ids) { |
| | | TChargingPile chargingPile = this.getById(id); |
| | | this.removeById(chargingPile); |
| | | //调用华为Iot删除设备 |
| | | if(StringUtils.isNotEmpty(chargingPile.getIotdDeviceId())){ |
| | | DeleteDeviceResp deviceResp = iotInterfaceClient.deleteDevice(chargingPile.getIotdDeviceId()).getData(); |
| | | if(null != deviceResp && deviceResp.getHttpStatusCode() == 201){ |
| | | this.removeById(chargingPile); |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | allow-circular-references: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: dev |
| | | active: prod |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | type: nacos |
| | | nacos: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # server-addr: 192.168.110.169:8848 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | # group: DEFAULT_GROUP |
| | | # data-id: seata-server.properties |
| | | # username: nacos |
| | | # password: nacos |
| | | # 生产环境 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | registry: |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # server-addr: 192.168.110.169:8848 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | # group: DEFAULT_GROUP |
| | | # username: nacos |
| | | # password: nacos |
| | | # 生产环境 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | # group: DEFAULT_GROUP |
| | | # application: seata-server #Nacos 中 Seata 名称 |
| | | # username: nacos |
| | | # password: nacos |
| | | # 生产环境 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | sentinel: |
| | | transport: |
| | | dashboard: 127.0.0.1:8080 # Sentinel控制台地址 |
New file |
| | |
| | | package com.ruoyi.integration.controller; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.integration.api.model.SecurityDetection; |
| | | import com.ruoyi.integration.mongodb.service.SecurityDetectionService; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/10/8 14:25 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/securityDetection") |
| | | public class SecurityDetectionController { |
| | | |
| | | @Resource |
| | | private SecurityDetectionService securityDetectionService; |
| | | |
| | | /** |
| | | * 获取安全检测数据 |
| | | * @param transactionSerialNumber |
| | | * @return |
| | | */ |
| | | @PostMapping("/getSecurityDetection") |
| | | public R<SecurityDetection> getSecurityDetection(@RequestParam("transactionSerialNumber") String transactionSerialNumber){ |
| | | SecurityDetection securityDetection = securityDetectionService.getSecurityDetection(transactionSerialNumber); |
| | | return R.ok(securityDetection); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.iotda.controller; |
| | | |
| | | import com.huaweicloud.sdk.iotda.v5.model.AddDeviceResponse; |
| | | import com.huaweicloud.sdk.iotda.v5.model.DeleteDeviceResponse; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.integration.api.vo.AddDevice; |
| | | import com.ruoyi.integration.api.vo.AddDeviceResp; |
| | | import com.ruoyi.integration.api.vo.DeleteDeviceResp; |
| | | import com.ruoyi.integration.iotda.utils.api.IotInterfaceUtil; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/10/8 10:29 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/iotInterface") |
| | | public class IotInterfaceController { |
| | | |
| | | @Resource |
| | | private IotInterfaceUtil iotInterfaceUtil; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加设备 |
| | | * @return |
| | | */ |
| | | @PostMapping("/addDevice") |
| | | public R<AddDeviceResp> addDevice(@RequestBody AddDevice addDevice){ |
| | | return iotInterfaceUtil.addDeviceRequest(addDevice.getProductId(), addDevice.getNodeId(), addDevice.getDeviceName(), addDevice.getDescription()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除设备 |
| | | * @param deviceId |
| | | * @return |
| | | */ |
| | | @PostMapping("/deleteDevice") |
| | | public R<DeleteDeviceResp> deleteDevice(@RequestParam("deviceId") String deviceId){ |
| | | return iotInterfaceUtil.deleteDeviceRequest(deviceId); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.iotda.utils.api; |
| | | |
| | | import com.huaweicloud.sdk.core.auth.AbstractCredentials; |
| | | import com.huaweicloud.sdk.core.auth.ICredential; |
| | | import com.huaweicloud.sdk.core.exception.ConnectionException; |
| | | import com.huaweicloud.sdk.core.exception.RequestTimeoutException; |
| | | import com.huaweicloud.sdk.core.exception.ServiceResponseException; |
| | | import com.huaweicloud.sdk.iotda.v5.IoTDAClient; |
| | | import com.huaweicloud.sdk.iotda.v5.model.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.CodeGenerateUtils; |
| | | import com.ruoyi.common.core.utils.uuid.UUID; |
| | | import com.ruoyi.integration.api.vo.AddDeviceResp; |
| | | import com.ruoyi.integration.api.vo.DeleteDeviceResp; |
| | | import com.ruoyi.integration.iotda.builder.IotBuilder; |
| | | import com.ruoyi.integration.iotda.config.IotAccountConfig; |
| | | import com.ruoyi.integration.iotda.config.IotDAConfig; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.text.MessageFormat; |
| | | import java.util.ArrayList; |
| | |
| | | * iot接口调用工具类 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @Component |
| | | public class IotInterfaceUtil { |
| | | |
| | | private static final String dataFormat = "json"; |
| | |
| | | * @param description 设备描述 |
| | | * @return AddDeviceResponse |
| | | */ |
| | | public AddDeviceResponse addDeviceRequest(String productId,String nodeId,String deviceName,String description) { |
| | | public R<AddDeviceResp> addDeviceRequest(String productId,String nodeId,String deviceName,String description) { |
| | | AddDeviceRequest request = new AddDeviceRequest(); |
| | | AddDevice body = new AddDevice(); |
| | | body.withDeviceId(nodeId); |
| | |
| | | try { |
| | | AddDeviceResponse response = iotBuilder.buildIot().addDevice(request); |
| | | log.info("创建设备:{}",response.toString()); |
| | | return response; |
| | | |
| | | AddDeviceResp addDeviceResp = new AddDeviceResp(); |
| | | BeanUtils.copyProperties(response, addDeviceResp); |
| | | return R.ok(addDeviceResp); |
| | | } catch (ConnectionException e) { |
| | | e.printStackTrace(); |
| | | } catch (RequestTimeoutException e) { |
| | |
| | | System.out.println(e.getErrorCode()); |
| | | System.out.println(e.getErrorMsg()); |
| | | } |
| | | return null; |
| | | return R.fail(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param deviceId 设备ID 使用已有设备编号 |
| | | * @return DeleteDeviceResponse |
| | | */ |
| | | public DeleteDeviceResponse deleteDeviceRequest(String deviceId) { |
| | | public R<DeleteDeviceResp> deleteDeviceRequest(String deviceId) { |
| | | DeleteDeviceRequest request = new DeleteDeviceRequest(); |
| | | request.withDeviceId(deviceId); |
| | | try { |
| | | DeleteDeviceResponse response = iotBuilder.buildIot().deleteDevice(request); |
| | | log.info("删除设备:{}",response.toString()); |
| | | return response; |
| | | DeleteDeviceResp deleteDeviceResp = new DeleteDeviceResp(); |
| | | BeanUtils.copyProperties(response, deleteDeviceResp); |
| | | return R.ok(deleteDeviceResp); |
| | | } catch (ConnectionException e) { |
| | | e.printStackTrace(); |
| | | } catch (RequestTimeoutException e) { |
| | |
| | | System.out.println(e.getErrorCode()); |
| | | System.out.println(e.getErrorMsg()); |
| | | } |
| | | return null; |
| | | return R.fail(); |
| | | } |
| | | } |
| | |
| | | /** |
| | | */ |
| | | public interface SecurityDetectionService extends BaseService<SecurityDetection> { |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据业务流水号查询数据 |
| | | * @param transactionSerialNumber |
| | | * @return |
| | | */ |
| | | SecurityDetection getSecurityDetection(String transactionSerialNumber); |
| | | } |
| | |
| | | import com.ruoyi.integration.mongodb.service.SecurityDetectionService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | public List<SecurityDetection> findAll() { |
| | | return mongoTemplate.findAll(SecurityDetection.class); |
| | | } |
| | | |
| | | /** |
| | | * 根据业务流水号查询数据 |
| | | * @param transactionSerialNumber |
| | | * @return |
| | | */ |
| | | @Override |
| | | public SecurityDetection getSecurityDetection(String transactionSerialNumber) { |
| | | List<SecurityDetection> securityDetectionList = mongoTemplate.find(new Query().addCriteria(Criteria.where("transaction_serial_number") |
| | | .is(transactionSerialNumber)), SecurityDetection.class); |
| | | return securityDetectionList.size() > 0 ? securityDetectionList.get(0) : null; |
| | | } |
| | | } |
| | |
| | | allow-circular-references: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: dev |
| | | active: prod |
| | | |
| | | --- |
| | | spring: |
| | |
| | | type: nacos |
| | | nacos: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # server-addr: 192.168.110.169:8848 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | # group: DEFAULT_GROUP |
| | | # data-id: seata-server.properties |
| | | # username: nacos |
| | | # password: nacos |
| | | # 生产环境 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | registry: |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # server-addr: 192.168.110.169:8848 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | # group: DEFAULT_GROUP |
| | | # username: nacos |
| | | # password: nacos |
| | | # 生产环境 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | # group: DEFAULT_GROUP |
| | | # application: seata-server #Nacos 中 Seata 名称 |
| | | # username: nacos |
| | | # password: nacos |
| | | # 生产环境 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | sentinel: |
| | | transport: |
| | | dashboard: 127.0.0.1:8080 # Sentinel控制台地址 |
| | |
| | | * @param |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/getCar") |
| | | public R<Long> getCar() { |
| | | @GetMapping(value = "/getCar/{id}") |
| | | public R<Long> getCar(@PathVariable("id")String id) { |
| | | List<TChargingOrder> list = chargingOrderService.list(new LambdaQueryWrapper<TChargingOrder>() |
| | | .eq(TChargingOrder::getAppUserId, tokenService.getLoginUserApplet().getUserId()) |
| | | .eq(TChargingOrder::getAppUserId, id) |
| | | .isNotNull(TChargingOrder::getAppUserCarId)); |
| | | if (!list.isEmpty()){ |
| | | // 最近使用的车辆id |
| | |
| | | |
| | | @Resource |
| | | private AppUserTagClient appUserTagClient; |
| | | |
| | | @Resource |
| | | private SecurityDetectionClient securityDetectionClient; |
| | | |
| | | //计数器 |
| | | private Map<String, Integer> counter_map = new HashMap<>(); |
| | |
| | | //执行5分钟的定时任务检测 |
| | | ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); |
| | | scheduler.scheduleAtFixedRate(()->{ |
| | | //获取安全校验 |
| | | SecurityDetection securityDetection = securityDetectionClient.getSecurityDetection(chargingOrder.getCode()).getData(); |
| | | if(null != securityDetection){ |
| | | PreChargeCheck preChargeCheck1 = redisService.getCacheObject("AQJC_" + chargingOrder.getChargingGunId()); |
| | | if(null != preChargeCheck1){ |
| | | preChargeCheck1.setElectronicLockLock(preChargeCheck1.getElectronicLockLock()); |
| | | preChargeCheck1.setInsulationTesting(true); |
| | | preChargeCheck1.setSecureConnectionDetection(preChargeCheck1.getSecureConnectionDetection()); |
| | | preChargeCheck1.setStartupSuccess(1); |
| | | redisService.setCacheObject("AQJC_" + chargingOrder.getChargingGunId(), preChargeCheck1); |
| | | } |
| | | } |
| | | |
| | | List<PlatformStartChargingReply> data = platformStartChargingReplyClient.getPlatformStartChargingReply(code).getData(); |
| | | System.err.println("-------------------开始检查调起充电结果-------------------"); |
| | | System.err.println(data.toString()); |
| | |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: prod |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | username: nacos |
| | | password: nacos |
| | | ip: 192.168.110.85 |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 192.168.110.169:8848 |
| | |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: prod |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | username: nacos |
| | | password: nacos |
| | | ip: 192.168.110.85 |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 192.168.110.169:8848 |
| | |
| | | allow-circular-references: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: dev |
| | | active: prod |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | type: nacos |
| | | nacos: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # server-addr: 192.168.110.169:8848 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | # group: DEFAULT_GROUP |
| | | # data-id: seata-server.properties |
| | | # username: nacos |
| | | # password: nacos |
| | | # 生产环境 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | registry: |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # server-addr: 192.168.110.169:8848 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | # group: DEFAULT_GROUP |
| | | # username: nacos |
| | | # password: nacos |
| | | # 生产环境 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | # group: DEFAULT_GROUP |
| | | # application: seata-server #Nacos 中 Seata 名称 |
| | | # username: nacos |
| | | # password: nacos |
| | | # 生产环境 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | sentinel: |
| | | transport: |
| | | dashboard: 127.0.0.1:8080 # Sentinel控制台地址 |