Merge branch 'dev' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile into dev
36 文件已重命名
92个文件已删除
42个文件已添加
133个文件已修改
| | |
| | | <module>ruoyi-api-order</module> |
| | | <module>ruoyi-api-other</module> |
| | | <module>ruoyi-api-payment</module> |
| | | <module>ruoyi-api-jianguan</module> |
| | | </modules> |
| | | |
| | | <artifactId>ruoyi-api</artifactId> |
| | |
| | | |
| | | import com.ruoyi.account.api.feignClient.InviteUserClient; |
| | | import com.ruoyi.account.api.feignClient.JianGuanAccountClient; |
| | | import com.ruoyi.account.api.model.TInviteUser; |
| | | import com.ruoyi.account.api.vo.GetInviteUser; |
| | | import com.ruoyi.account.api.vo.GovernmentCloudAccountVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.slf4j.Logger; |
| | |
| | | package com.ruoyi.account.api.feignClient; |
| | | |
| | | import com.ruoyi.account.api.factory.InviteUserFallbackFactory; |
| | | import com.ruoyi.account.api.factory.JianGuanAccountFallbackFactory; |
| | | import com.ruoyi.account.api.model.TInviteUser; |
| | | import com.ruoyi.account.api.vo.GetInviteUser; |
| | | import com.ruoyi.account.api.vo.GovernmentCloudAccountVO; |
| | |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/4 17:54 |
| | | */ |
| | | @FeignClient(contextId = "JianGuanAccountClient", value = ServiceNameConstants.ACCOUNT_SERVICE, fallbackFactory = InviteUserFallbackFactory.class) |
| | | @FeignClient(contextId = "JianGuanAccountClient", value = ServiceNameConstants.ACCOUNT_SERVICE, fallbackFactory = JianGuanAccountFallbackFactory.class) |
| | | public interface JianGuanAccountClient { |
| | | /** |
| | | * 政务云查询数据接口 |
| | |
| | | return new IntegrationClient() { |
| | | |
| | | @Override |
| | | public R<String> onlineReply(OnlineReply onlineReply) { |
| | | return R.fail("登录认证应答调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> pong(Pong pong) { |
| | | return R.fail("心跳包应答调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> billingModeVerifyReply(BillingModeVerifyReply billingModeVerifyReply) { |
| | | return R.fail("计费模型验证请求应答调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> acquisitionBillingModeReply(AcquisitionBillingModeReply acquisitionBillingModeReply) { |
| | | return R.fail("计费模型验证请求应答调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> readRealTimeMonitoringData(ReadRealTimeMonitoringData readRealTimeMonitoringData) { |
| | | return R.fail("读取实时监测数据调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | // @Override |
| | | // public R<String> endCharge(EndCharge endCharge) { |
| | | // return R.fail("充电结束调用失败:" + throwable.getMessage()); |
| | | // } |
| | | |
| | | @Override |
| | | public R<String> platformConfirmationCharging(PlatformConfirmationCharging platformConfirmationCharging) { |
| | | return R.fail("运营平台确认启动充电调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> platformStartCharging(PlatformStartCharging platformStartCharging) { |
| | | return R.fail("运营平台远程控制启机调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> platformStopCharging(PlatformStopCharging platformStopCharging) { |
| | | return R.fail("运营平台远程停机调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> confirmTransactionRecord(ConfirmTransactionRecord confirmTransactionRecord) { |
| | | return R.fail("交易记录确认调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> updateBalance(UpdateBalance updateBalance) { |
| | | return R.fail("远程账户余额更新调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> synchronizeOfflineCard(SynchronizeOfflineCard synchronizeOfflineCard) { |
| | | return R.fail("离线卡数据同步调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> clearOfflineCard(ClearOfflineCard clearOfflineCard) { |
| | | return R.fail("离线卡数据清除调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> queryOfflineCard(QueryOfflineCard queryOfflineCard) { |
| | | return R.fail("离线卡数据查询调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> workingParameterSetting(WorkingParameterSetting workingParameterSetting) { |
| | | return R.fail("充电桩工作参数设置调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> timingSetting(TimingSetting timingSetting) { |
| | | return R.fail("对时设置调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> setupBillingModel(SetupBillingModel setupBillingModel) { |
| | | return R.fail("计费模型设置调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> openOrCloseGroundLock(OpenOrCloseGroundLock openOrCloseGroundLock) { |
| | | return R.fail("遥控地锁升锁与降锁命令 (下行)调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> platformRestart(PlatformRestart platformRestart) { |
| | | return R.fail("远程重启调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> platformRemoteUpdate(PlatformRemoteUpdate platformRemoteUpdate) { |
| | | return R.fail("远程更新调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> setupBillingModel1(String deviceId, String json) { |
| | | return R.fail("远程更新硬件:" + throwable.getMessage()); |
| | | } |
| | |
| | | package com.ruoyi.integration.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.integration.api.feignClient.ChargingHandshakeClient; |
| | | import com.ruoyi.integration.api.feignClient.SendMessageClient; |
| | | 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; |
| | |
| | | @Data |
| | | @Document(collection = "qr_code_delivery") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class QrCodeDelivery { |
| | | public class QrCodeDelivery extends BaseModel { |
| | | |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 枪编码 |
| | |
| | | com.ruoyi.integration.api.factory.IntegrationFallbackFactory |
| | | com.ruoyi.integration.api.factory.UploadRealTimeMonitoringDataFallbackFactory |
| | | com.ruoyi.integration.api.factory.ChargingHandshakeFallbackFactory |
| | | 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.IotInterfaceFallbackFactory |
| | | com.ruoyi.integration.api.factory.SecurityDetectionFallbackFactory |
| | | com.ruoyi.integration.api.factory.BmsDemandAndChargerExportationFallbackFactory |
| | | com.ruoyi.integration.api.factory.TCECClientFallbackFactory |
| | | com.ruoyi.integration.api.factory.TransactionRecordClientFallbackFactory |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api</artifactId> |
| | | <version>3.6.2</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>ruoyi-api-jianguan</artifactId> |
| | | |
| | | <description> |
| | | ruoyi-api-jianguan监管对接接口模块 |
| | | </description> |
| | | |
| | | <dependencies> |
| | | <!--mongodb--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-mongodb</artifactId> |
| | | </dependency> |
| | | <!-- RuoYi Common Core--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-common-core</artifactId> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>com.github.pagehelper</groupId> |
| | | <artifactId>pagehelper-spring-boot-starter</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.ruoyi.integration.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.integration.api.feignClient.ChargingMessageClient; |
| | | import com.ruoyi.integration.api.vo.ChargingOrderVo; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/12 10:17 |
| | | */ |
| | | public class ChargingMessageClientFallbackFactory implements FallbackFactory<ChargingMessageClient> { |
| | | @Override |
| | | public ChargingMessageClient create(Throwable cause) { |
| | | return new ChargingMessageClient(){ |
| | | |
| | | @Override |
| | | public R pushOrderInfo(ChargingOrderVo chargingOrder) { |
| | | return R.fail("推送充电订单信息失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R pushOrderStatus(ChargingOrderVo chargingOrder) { |
| | | return R.fail("推送充电订单状态失败:" + cause.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
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.ChargingMessageClientFallbackFactory; |
| | | import com.ruoyi.integration.api.vo.ChargingOrderVo; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/12 10:17 |
| | | */ |
| | | @FeignClient(contextId = "ChargingMessageClient", value = ServiceNameConstants.JIANGUAN_SERVICE, fallbackFactory = ChargingMessageClientFallbackFactory.class) |
| | | public interface ChargingMessageClient { |
| | | |
| | | |
| | | /** |
| | | * 推送充电订单信息 |
| | | * @param chargingOrder |
| | | * @return |
| | | */ |
| | | @PostMapping("/chargingMessage/pushOrderInfo") |
| | | R pushOrderInfo(@RequestBody ChargingOrderVo chargingOrder); |
| | | |
| | | |
| | | /** |
| | | * 推送充电订单状态 |
| | | * @param chargingOrder |
| | | * @return |
| | | */ |
| | | @PostMapping("/chargingMessage/pushOrderStatus") |
| | | R pushOrderStatus(@RequestBody ChargingOrderVo chargingOrder); |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.api.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/12 10:20 |
| | | */ |
| | | @Data |
| | | public class ChargingOrderVo extends BasePojo { |
| | | @ApiModelProperty(value = "主键") |
| | | private Long id; |
| | | @ApiModelProperty(value = "订单编号") |
| | | private String code; |
| | | @ApiModelProperty(value = "订单类型(1=充电订单(小程序),2=充电订单(刷卡))") |
| | | private Integer orderType; |
| | | @ApiModelProperty(value = "订单来源(1=自己平台,2=三方平台)") |
| | | private Integer orderSource; |
| | | @ApiModelProperty(value = "运营商id") |
| | | private Integer operatorId; |
| | | @ApiModelProperty(value = "三方平台名称") |
| | | private String tripartitePlatformName; |
| | | @ApiModelProperty(value = "三方平台充电订单号") |
| | | private String startChargeSeq; |
| | | @ApiModelProperty(value = "平台或其他第三分名字") |
| | | private String sourceName; |
| | | @ApiModelProperty(value = "手续费") |
| | | private BigDecimal commissionAmount; |
| | | @ApiModelProperty(value = "分佣") |
| | | private BigDecimal sharingAmount; |
| | | @ApiModelProperty(value = "订单分类(1=线上,2=线下)") |
| | | private Integer orderClassification; |
| | | @ApiModelProperty(value = "用户id") |
| | | private Long appUserId; |
| | | @ApiModelProperty(value = "充电车辆 id") |
| | | private Long appUserCarId; |
| | | @ApiModelProperty(value = "充电车辆车牌号") |
| | | private String plateNum; |
| | | @ApiModelProperty(value = "站点 id") |
| | | private Integer siteId; |
| | | @ApiModelProperty(value = "停车场id") |
| | | private Integer parkingLotId; |
| | | @ApiModelProperty(value = "充电桩id") |
| | | private Integer chargingPileId; |
| | | @ApiModelProperty(value = "充电枪id") |
| | | private Integer chargingGunId; |
| | | @ApiModelProperty(value = "充电总度数") |
| | | private BigDecimal chargingCapacity; |
| | | @ApiModelProperty(value = "充电功率") |
| | | private BigDecimal chargingPower; |
| | | @ApiModelProperty(value = "充电开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime startTime; |
| | | @ApiModelProperty(value = "充电结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime endTime; |
| | | @ApiModelProperty(value = "状态(0=未知,1=等待中/已插枪,2=启动中,3=充电中,4=停止中,5=已结束)") |
| | | private Integer status; |
| | | @ApiModelProperty(value = "结束方式(0=异常终止,1=主动终止,2=满电终止,3=费用不足终止)") |
| | | private Integer endMode; |
| | | @ApiModelProperty(value = "充值金额") |
| | | private BigDecimal rechargeAmount; |
| | | @ApiModelProperty(value = "充值支付方式(1=微信,2=支付宝)") |
| | | private Integer rechargePaymentType; |
| | | @ApiModelProperty(value = "充值支付状态(1=待支付,2=已支付)") |
| | | private Integer rechargePaymentStatus; |
| | | @ApiModelProperty(value = "充值支付第三方流水号") |
| | | private String rechargeSerialNumber; |
| | | @ApiModelProperty(value = "充电金额(传给硬件方的金额)") |
| | | private BigDecimal chargeAmount; |
| | | @ApiModelProperty(value = "剩余金额(用于前端展示)") |
| | | private BigDecimal residualAmount; |
| | | @ApiModelProperty(value = "订单金额(总金额)") |
| | | private BigDecimal orderAmount; |
| | | @ApiModelProperty(value = "优惠券id") |
| | | private Long appCouponId; |
| | | @ApiModelProperty(value = "优惠券抵扣金额") |
| | | private BigDecimal couponDiscountAmount; |
| | | @ApiModelProperty(value = "会员折扣") |
| | | private BigDecimal vipDiscount; |
| | | @ApiModelProperty(value = "会员优惠金额") |
| | | private BigDecimal vipDiscountAmount; |
| | | @ApiModelProperty(value = "支付金额(实付)") |
| | | private BigDecimal paymentAmount; |
| | | @ApiModelProperty(value = "退款流水号") |
| | | private String refundCode; |
| | | @ApiModelProperty(value = "标题") |
| | | private String title; |
| | | @ApiModelProperty(value = "退款金额") |
| | | private BigDecimal refundAmount; |
| | | @ApiModelProperty(value = "累计服务费") |
| | | private BigDecimal serviceCharge; |
| | | @ApiModelProperty(value = "累计电费") |
| | | private BigDecimal electrovalence; |
| | | @ApiModelProperty(value = "电流") |
| | | private BigDecimal current; |
| | | @ApiModelProperty(value = "电压") |
| | | private BigDecimal voltage; |
| | | @ApiModelProperty(value = "电量") |
| | | private BigDecimal electricity; |
| | | @ApiModelProperty(value = "功率") |
| | | private BigDecimal power; |
| | | @ApiModelProperty(value = "退款状态(1=退款中,2=退款成功)") |
| | | private Integer refundStatus; |
| | | @ApiModelProperty(value = "退款第三方流水号") |
| | | private String refundSerialNumber; |
| | | @ApiModelProperty(value = "退款成功时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime refundTime; |
| | | @ApiModelProperty(value = "总电量") |
| | | @TableField("total_electricity") |
| | | private BigDecimal totalElectricity; |
| | | @ApiModelProperty(value = "支付时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime payTime; |
| | | @ApiModelProperty(value = "实时需求电流") |
| | | private BigDecimal needElec; |
| | | } |
New file |
| | |
| | | com.ruoyi.integration.api.factory.ChargingMessageClientFallbackFactory |
| | |
| | | public R<GovernmentCloudOrderVO> listAll() { |
| | | return R.fail("政务云查询数据接口Order:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<GovernmentCloudOrderVO> listAll1() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<GovernmentCloudOrderVO> listAll2() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<GovernmentCloudOrderVO> listAll3() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<GovernmentCloudOrderVO> listAll4() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<GovernmentCloudOrderVO> listAll5() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<GovernmentCloudOrderVO> listAll6() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<GovernmentCloudOrderVO> listAll7() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<GovernmentCloudOrderVO> listAll8() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<GovernmentCloudOrderVO> listAll9() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<GovernmentCloudOrderVO> listAll10() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<GovernmentCloudOrderVO> listAll11() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<GovernmentCloudOrderVO> listAll12() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<GovernmentCloudOrderVO> listAll13() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<GovernmentCloudOrderVO> listAll14() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<GovernmentCloudOrderVO> listAll15() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<GovernmentCloudOrderVO> listAll16() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<GovernmentCloudOrderVO> listAll17() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<GovernmentCloudOrderVO> listAll18() { |
| | | return null; |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | @GetMapping("/t-charging-order/getSumDegreeBySiteIds") |
| | | R<BigDecimal> getSumDegreeBySiteIds(@RequestParam("siteIds") List<Integer> SiteIds); |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | @PostMapping("/governmentCloudOrder/listAll") |
| | | R<GovernmentCloudOrderVO> listAll(); |
| | | @PostMapping("/governmentCloudOrder/listAll1") |
| | | R<GovernmentCloudOrderVO> listAll1(); |
| | | @PostMapping("/governmentCloudOrder/listAll2") |
| | | R<GovernmentCloudOrderVO> listAll2(); |
| | | @PostMapping("/governmentCloudOrder/listAll3") |
| | | R<GovernmentCloudOrderVO> listAll3(); |
| | | @PostMapping("/governmentCloudOrder/listAll4") |
| | | R<GovernmentCloudOrderVO> listAll4(); |
| | | @PostMapping("/governmentCloudOrder/listAll5") |
| | | R<GovernmentCloudOrderVO> listAll5(); |
| | | @PostMapping("/governmentCloudOrder/listAll6") |
| | | R<GovernmentCloudOrderVO> listAll6(); |
| | | @PostMapping("/governmentCloudOrder/listAll7") |
| | | R<GovernmentCloudOrderVO> listAll7(); |
| | | @PostMapping("/governmentCloudOrder/listAll8") |
| | | R<GovernmentCloudOrderVO> listAll8(); |
| | | @PostMapping("/governmentCloudOrder/listAll9") |
| | | R<GovernmentCloudOrderVO> listAll9(); |
| | | @PostMapping("/governmentCloudOrder/listAll10") |
| | | R<GovernmentCloudOrderVO> listAll10(); |
| | | @PostMapping("/governmentCloudOrder/listAll11") |
| | | R<GovernmentCloudOrderVO> listAll11(); |
| | | @PostMapping("/governmentCloudOrder/listAll12") |
| | | R<GovernmentCloudOrderVO> listAll12(); |
| | | @PostMapping("/governmentCloudOrder/listAll13") |
| | | R<GovernmentCloudOrderVO> listAll13(); |
| | | @PostMapping("/governmentCloudOrder/listAll14") |
| | | R<GovernmentCloudOrderVO> listAll14(); |
| | | @PostMapping("/governmentCloudOrder/listAll15") |
| | | R<GovernmentCloudOrderVO> listAll15(); |
| | | @PostMapping("/governmentCloudOrder/listAll16") |
| | | R<GovernmentCloudOrderVO> listAll16(); |
| | | @PostMapping("/governmentCloudOrder/listAll17") |
| | | R<GovernmentCloudOrderVO> listAll17(); |
| | | @PostMapping("/governmentCloudOrder/listAll18") |
| | | R<GovernmentCloudOrderVO> listAll18(); |
| | | } |
| | |
| | | @ApiModelProperty(value = "主键") |
| | | @TableId(value = "id", type = IdType.NONE) |
| | | private Long id; |
| | | @TableField(exist = false) |
| | | private String idStr; |
| | | @ApiModelProperty(value = "序号") |
| | | @TableField(exist = false) |
| | | private Integer xuhao; |
| | |
| | | private List<TUserTag> userTags; |
| | | @ApiModelProperty(value = "会员") |
| | | private List<TVip> vips; |
| | | @ApiModelProperty(value = "用户站点") |
| | | private List<TUserSite> userSites; |
| | | @ApiModelProperty(value = "角色站点") |
| | | private List<TRoleSite> roleSites; |
| | | |
| | | |
| | | |
| | |
| | | import com.ruoyi.system.api.domain.SysOperLog; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.sun.javafx.tk.TKSystemMenu; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) { |
| | | recordLogService.recordLogininfor(request, null, username, Constants.LOGIN_FAIL_STATUS, "登录用户不存在"); |
| | | throw new ServiceException("登录用户:" + username + " 不存在"); |
| | | throw new ServiceException("用户名/密码错误"); |
| | | } |
| | | LoginUser userInfo = userResult.getData(); |
| | | SysUser user = userResult.getData().getSysUser(); |
| | |
| | | retryCount = retryCount + 1; |
| | | recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, String.format("密码输入错误%s次", retryCount)); |
| | | redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES); |
| | | throw new ServiceException("密码错误"); |
| | | throw new ServiceException("用户名/密码错误"); |
| | | } |
| | | else |
| | | { |
| | |
| | | String reqText = JSON.toJSONString(submitReq); |
| | | //加密 |
| | | String encode = Base64.encodeBase64String(reqText.getBytes()); |
| | | System.err.println(encode); |
| | | return encode; |
| | | } |
| | | /** |
| | |
| | | <if test="dictType != null and dictType != ''">#{dictType},</if> |
| | | <if test="sort != null">#{sort},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | sysdate() |
| | | now() |
| | | ) |
| | | </insert> |
| | | |
| | |
| | | <if test="dictType != null">dict_type = #{dictType},</if> |
| | | <if test="sort != null">sort = #{sort},</if> |
| | | <if test="updateBy != null">update_by = #{updateBy},</if> |
| | | update_time = sysdate() |
| | | update_time = now() |
| | | </set> |
| | | where column_id = #{columnId} |
| | | </update> |
| | |
| | | <if test="genPath != null and genPath != ''">#{genPath},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | sysdate() |
| | | now() |
| | | ) |
| | | </insert> |
| | | |
| | |
| | | <if test="options != null and options != ''">options = #{options},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | update_time = sysdate() |
| | | update_time = now() |
| | | </set> |
| | | where table_id = #{tableId} |
| | | </update> |
| | |
| | | <if test="jobMessage != null and jobMessage != ''">#{jobMessage},</if> |
| | | <if test="status != null and status != ''">#{status},</if> |
| | | <if test="exceptionInfo != null and exceptionInfo != ''">#{exceptionInfo},</if> |
| | | sysdate() |
| | | now() |
| | | ) |
| | | </insert> |
| | | |
| | |
| | | <if test="status !=null">status = #{status},</if> |
| | | <if test="remark != null and remark != ''">remark = #{remark},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | update_time = sysdate() |
| | | update_time = now() |
| | | </set> |
| | | where job_id = #{jobId} |
| | | </update> |
| | |
| | | <if test="status != null and status != ''">#{status},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | sysdate() |
| | | now() |
| | | ) |
| | | </insert> |
| | | |
| | |
| | | package com.ruoyi.system.controller; |
| | | |
| | | |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.domain.SysLoginLog; |
| | | import com.ruoyi.system.api.domain.SysOperLog; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | |
| | | @Autowired |
| | | private ISysUserService sysUserService; |
| | | |
| | | public static void main(String[] args) { |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | System.err.println( start); |
| | | System.err.println( end); |
| | | } |
| | | /** |
| | | * 政务云查询数据接口 |
| | | * @return |
| | | */ |
| | | @PostMapping("/listAll") |
| | | R<GovernmentCloudSystemVO> listAll() { |
| | | LocalDateTime end = LocalDateTime.now(); |
| | | LocalDateTime start = LocalDateTime.now().minusDays(1); |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudSystemVO governmentCloudAccountVO = new GovernmentCloudSystemVO(); |
| | | List<SysLoginLog> list1 = sysLoginLogService.lambdaQuery().between(SysLoginLog::getCreateTime, start, end).list(); |
| | | List<SysOperLog> list2 = sysOperLogService.lambdaQuery().between(SysOperLog::getOperTime, start, end).list(); |
| | | List<SysRole> list3 = sysRoleService.lambdaQuery().between(SysRole::getCreateTime, start, end).list(); |
| | | List<SysUser> list4 = sysUserService.lambdaQuery().between(SysUser::getCreateTime, start, end).list(); |
| | | List<SysLoginLog> list1 = sysLoginLogService.lambdaQuery() |
| | | .ge(SysLoginLog::getCreateTime,start) |
| | | .le(SysLoginLog::getCreateTime,end) .list(); |
| | | List<SysOperLog> list2 = sysOperLogService.lambdaQuery() |
| | | .ge(SysOperLog::getOperTime,start) |
| | | .le(SysOperLog::getOperTime,end) .list(); |
| | | List<SysRole> list3 = sysRoleService.lambdaQuery() |
| | | .ge(SysRole::getCreateTime,start) |
| | | .le(SysRole::getCreateTime,end) .list(); |
| | | List<SysUser> list4 = sysUserService.lambdaQuery() |
| | | .ge(SysUser::getCreateTime,start) |
| | | .le(SysUser::getCreateTime,end) .list(); |
| | | governmentCloudAccountVO.setLoginLogs(list1); |
| | | governmentCloudAccountVO.setSysOperLogs(list2); |
| | | governmentCloudAccountVO.setSysRoles(list3); |
| | |
| | | public R<LoginUser> info(@PathVariable("username") String username) { |
| | | SysUser sysUser = userService.selectUserByUserName(username); |
| | | if (StringUtils.isNull(sysUser)) { |
| | | return R.fail("用户名或密码错误"); |
| | | return R.fail("用户名/密码错误"); |
| | | } |
| | | // 角色集合 |
| | | Set<String> roles = permissionService.getRolePermission(sysUser); |
| | |
| | | <if test="configType != null and configType != ''">#{configType},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | sysdate() |
| | | now() |
| | | ) |
| | | </insert> |
| | | |
| | |
| | | <if test="configType != null and configType != ''">config_type = #{configType},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | update_time = sysdate() |
| | | update_time = now() |
| | | </set> |
| | | where config_id = #{configId} |
| | | </update> |
| | |
| | | <if test="email != null and email != ''">#{email},</if> |
| | | <if test="status != null">#{status},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | sysdate() |
| | | now() |
| | | ) |
| | | </insert> |
| | | |
| | |
| | | <if test="email != null">email = #{email},</if> |
| | | <if test="status != null and status != ''">status = #{status},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | update_time = sysdate() |
| | | update_time = now() |
| | | </set> |
| | | where dept_id = #{deptId} |
| | | </update> |
| | |
| | | <if test="status != null">status = #{status},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | update_time = sysdate() |
| | | update_time = now() |
| | | </set> |
| | | where dict_code = #{dictCode} |
| | | </update> |
| | |
| | | <if test="status != null">#{status},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | sysdate() |
| | | now() |
| | | ) |
| | | </insert> |
| | | |
| | |
| | | <if test="status != null">status = #{status},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | update_time = sysdate() |
| | | update_time = now() |
| | | </set> |
| | | where dict_id = #{dictId} |
| | | </update> |
| | |
| | | <if test="status != null">#{status},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | sysdate() |
| | | now() |
| | | ) |
| | | </insert> |
| | | |
| | |
| | | <if test="icon !=null and icon != ''">icon = #{icon},</if> |
| | | <if test="remark != null and remark != ''">remark = #{remark},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | update_time = sysdate() |
| | | update_time = now() |
| | | </set> |
| | | where menu_id = #{menuId} |
| | | </update> |
| | |
| | | <if test="icon != null and icon != ''">#{icon},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | sysdate() |
| | | now() |
| | | ) |
| | | </insert> |
| | | |
| | |
| | | <if test="status != null and status != ''">#{status}, </if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | sysdate() |
| | | now() |
| | | ) |
| | | </insert> |
| | | |
| | |
| | | <if test="noticeContent != null">notice_content = #{noticeContent}, </if> |
| | | <if test="status != null and status != ''">status = #{status}, </if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | update_time = sysdate() |
| | | update_time = now() |
| | | </set> |
| | | where notice_id = #{noticeId} |
| | | </update> |
| | |
| | | |
| | | <insert id="insertOperlog" parameterType="com.ruoyi.system.api.domain.SysOperLog"> |
| | | insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_param, json_result, status, error_msg, cost_time, oper_time) |
| | | values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime}, sysdate()) |
| | | values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime}, now()) |
| | | </insert> |
| | | |
| | | <select id="selectOperLogList" parameterType="com.ruoyi.system.api.domain.SysOperLog" resultMap="SysOperLogResult"> |
| | |
| | | <if test="status != null and status != ''">status = #{status},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | update_time = sysdate() |
| | | update_time = now() |
| | | </set> |
| | | where post_id = #{postId} |
| | | </update> |
| | |
| | | <if test="status != null and status != ''">#{status},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | sysdate() |
| | | now() |
| | | ) |
| | | </insert> |
| | | |
| | |
| | | <if test="status != null and status != ''">#{status},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | sysdate() |
| | | now() |
| | | ) |
| | | </insert> |
| | | |
| | |
| | | <if test="status != null and status != ''">status = #{status},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | update_time = sysdate() |
| | | update_time = now() |
| | | </set> |
| | | where role_id = #{roleId} |
| | | </update> |
| | |
| | | <if test="roleType != null and roleType != ''">roleType,</if> |
| | | <if test="remark != null and remark != ''">remark,</if> |
| | | <if test="objectId != null and objectId != ''">objectId,</if> |
| | | <if test="passWordUpdate != null and passWordUpdate != ''">passWordUpdate,</if> |
| | | create_time |
| | | )values( |
| | | <if test="userId != null and userId != ''">#{userId},</if> |
| | |
| | | <if test="roleType != null and roleType != ''">#{roleType},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="objectId != null and objectId != ''">#{objectId},</if> |
| | | sysdate() |
| | | <if test="passWordUpdate != null and passWordUpdate != ''">#{passWordUpdate},</if> |
| | | now() |
| | | ) |
| | | </insert> |
| | | |
| | |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="forbiddenRemark != null">forbidden_remark = #{forbiddenRemark},</if> |
| | | update_time = sysdate() |
| | | update_time = now() |
| | | </set> |
| | | where user_id = #{userId} |
| | | </update> |
| | |
| | | import com.ruoyi.account.api.vo.GovernmentCloudAccountVO; |
| | | import com.ruoyi.account.service.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private TInvoiceInformationService invoiceInformationService; |
| | | |
| | | |
| | | /** |
| | | * 政务云查询数据接口 |
| | | * @return |
| | | */ |
| | | @PostMapping("/listAll") |
| | | R<GovernmentCloudAccountVO> listAll() { |
| | | LocalDateTime end = LocalDateTime.now(); |
| | | LocalDateTime start = LocalDateTime.now().minusDays(1); |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudAccountVO governmentCloudAccountVO = new GovernmentCloudAccountVO(); |
| | | List<TAppCoupon> list1 = tAppCouponService.lambdaQuery().between(TAppCoupon::getCreateTime, start, end).list(); |
| | | List<TAppUser> list2 = appUserService.lambdaQuery().between(TAppUser::getCreateTime, start, end).list(); |
| | | List<TAppUserAddress> list3 = appUserAddressService.lambdaQuery().between(TAppUserAddress::getCreateTime, start, end).list(); |
| | | List<TAppUserCar> list4 = appUserCarService.lambdaQuery().between(TAppUserCar::getCreateTime, start, end).list(); |
| | | List<TAppUserIntegralChange> list5 = appUserIntegralChangeService.lambdaQuery().between(TAppUserIntegralChange::getCreateTime, start, end).list(); |
| | | List<TAppUserSign> list6 = appUserSignService.lambdaQuery().between(TAppUserSign::getCreateTime, start, end).list(); |
| | | List<TAppUserTag> list7 = appUserTagService.lambdaQuery().between(TAppUserTag::getCreateTime, start, end).list(); |
| | | List<TAppUserVipDetail> list8 = appUserVipDetailService.lambdaQuery().between(TAppUserVipDetail::getCreateTime, start, end).list(); |
| | | List<TInviteUser> list9 = inviteUserService.lambdaQuery().between(TInviteUser::getCreateTime, start, end).list(); |
| | | List<TInvoiceInformation> list10 = invoiceInformationService.lambdaQuery().between(TInvoiceInformation::getCreateTime, start, end).list(); |
| | | List<TAppCoupon> list1 = tAppCouponService.lambdaQuery() |
| | | .ge(TAppCoupon::getCreateTime, start) |
| | | .le(TAppCoupon::getCreateTime, end) |
| | | .list(); |
| | | List<TAppUser> list2 = appUserService.lambdaQuery() |
| | | .ge(TAppUser::getCreateTime, start) |
| | | .le(TAppUser::getCreateTime, end) |
| | | .list(); |
| | | List<TAppUserAddress> list3 = appUserAddressService.lambdaQuery() |
| | | .ge(TAppUserAddress::getCreateTime, start) |
| | | .le(TAppUserAddress::getCreateTime, end) |
| | | .list(); |
| | | List<TAppUserCar> list4 = appUserCarService.lambdaQuery() |
| | | .ge(TAppUserCar::getCreateTime, start) |
| | | .le(TAppUserCar::getCreateTime, end) |
| | | .list(); |
| | | List<TAppUserIntegralChange> list5 = appUserIntegralChangeService.lambdaQuery() |
| | | .ge(TAppUserIntegralChange::getCreateTime, start) |
| | | .le(TAppUserIntegralChange::getCreateTime, end) |
| | | .list(); |
| | | List<TAppUserSign> list6 = appUserSignService.lambdaQuery() |
| | | .ge(TAppUserSign::getCreateTime, start) |
| | | .le(TAppUserSign::getCreateTime, end) |
| | | .list(); |
| | | List<TAppUserTag> list7 = appUserTagService.lambdaQuery() |
| | | .ge(TAppUserTag::getCreateTime, start) |
| | | .le(TAppUserTag::getCreateTime, end) |
| | | .list(); |
| | | List<TAppUserVipDetail> list8 = appUserVipDetailService.lambdaQuery() |
| | | .ge(TAppUserVipDetail::getCreateTime, start) |
| | | .le(TAppUserVipDetail::getCreateTime, end) |
| | | .list(); |
| | | List<TInviteUser> list9 = inviteUserService.lambdaQuery() |
| | | .ge(TInviteUser::getCreateTime, start) |
| | | .le(TInviteUser::getCreateTime, end) |
| | | .list(); |
| | | List<TInvoiceInformation> list10 = invoiceInformationService.lambdaQuery() |
| | | .ge(TInvoiceInformation::getCreateTime, start) |
| | | .le(TInvoiceInformation::getCreateTime, end) |
| | | .list(); |
| | | for (TAppUserSign tAppUserSign : list6) { |
| | | tAppUserSign.setSignDay(null); |
| | | } |
| | | governmentCloudAccountVO.setAppCoupons(list1); |
| | | governmentCloudAccountVO.setAppUsers(list2); |
| | | governmentCloudAccountVO.setAppUserAddresses(list3); |
| | |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | // String reqStr1 = MsgUtil.codeMsg("19983174515", "123456"); |
| | | // String result1 = HttpUtils.post(MsgConstants.SEND_URL, reqStr1); |
| | | |
| | | String reqStr3 = MsgUtil.faultMsg("18398968484", "长河服务区充电站(遂", "123"); |
| | | String result3 = HttpUtils.post(MsgConstants.SEND_URL, reqStr3); |
| | | System.err.println(result3); |
| | | } |
| | | |
| | | |
| | | @Log(title = "【我的】退出登录", businessType = BusinessType.STOP,operatorType = OperatorType.MOBILE) |
| | |
| | | import com.ruoyi.account.api.model.TAppUserVipDetail; |
| | | import com.ruoyi.account.service.TAppUserService; |
| | | import com.ruoyi.account.service.TAppUserVipDetailService; |
| | | import org.springframework.boot.web.context.WebServerInitializedEvent; |
| | | import org.springframework.context.ApplicationListener; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | * 定时任务工具类 |
| | | */ |
| | | @Component |
| | | public class TaskUtil { |
| | | public class TaskUtil implements ApplicationListener<WebServerInitializedEvent> { |
| | | |
| | | @Resource |
| | | private TAppUserVipDetailService tAppUserVipDetailService; |
| | |
| | | @Resource |
| | | private TAppUserService appUserService; |
| | | |
| | | private Integer port = null; |
| | | |
| | | |
| | | /** |
| | | * 每隔一分钟去处理的定时任务 |
| | | */ |
| | | @Scheduled(fixedRate = 1000 * 60) |
| | | public void sendVipCoupon() { |
| | | if(null != port && port == 5200){ |
| | | try { |
| | | //会员优惠次数使用完后重新续次数 |
| | | LocalDateTime currentDate = LocalDateTime.now(); |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | @Scheduled(fixedRate = 1000 * 60) |
| | | public void changeVipId() { |
| | | if(null != port && port == 5200){ |
| | | LocalDateTime currentDate = LocalDateTime.now(); |
| | | List<TAppUserVipDetail> recentDetails = tAppUserVipDetailService.lambdaQuery() |
| | | .le(TAppUserVipDetail::getStartTime, currentDate) |
| | |
| | | appUserService.updateById(byId); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onApplicationEvent(WebServerInitializedEvent event) { |
| | | port = event.getWebServer().getPort(); |
| | | System.out.println("端口号:" + port); |
| | | } |
| | | } |
| | |
| | | <artifactId>javase</artifactId> |
| | | <version>3.3.0</version> |
| | | </dependency> |
| | | <!--mongodb--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-mongodb</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | import com.ruoyi.chargingPile.api.vo.GovernmentCloudChargingPileVO; |
| | | import com.ruoyi.chargingPile.service.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | @PostMapping("/listAll") |
| | | R<GovernmentCloudChargingPileVO> listAll() { |
| | | LocalDateTime end = LocalDateTime.now(); |
| | | LocalDateTime start = LocalDateTime.now().minusDays(1); |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudChargingPileVO governmentCloudAccountVO = new GovernmentCloudChargingPileVO(); |
| | | List<Partner> list1 = partnerService.lambdaQuery().between(Partner::getCreateTime, start, end).list(); |
| | | List<Site> list2 = siteService.lambdaQuery().between(Site::getCreateTime, start, end).list(); |
| | | List<TAccountingStrategyDetail> list3 = accountingStrategyDetailService.lambdaQuery().between(TAccountingStrategyDetail::getCreateTime, start, end).list(); |
| | | List<TAccountingStrategy> list4 = accountingStrategyService.lambdaQuery().between(TAccountingStrategy::getCreateTime, start, end).list(); |
| | | List<TApplyChargingPile> list5 = applyChargingPileService.lambdaQuery().between(TApplyChargingPile::getCreateTime, start, end).list(); |
| | | List<TCarport> list6 = carportService.lambdaQuery().between(TCarport::getCreateTime, start, end).list(); |
| | | List<TChargingGun> list7 = chargingGunService.lambdaQuery().between(TChargingGun::getCreateTime, start, end).list(); |
| | | List<TChargingPile> list8 = chargingPileService.lambdaQuery().between(TChargingPile::getCreateTime, start, end).list(); |
| | | List<TChargingPileNotification> list9 = chargingPileNotificationService.lambdaQuery().between(TChargingPileNotification::getCreateTime, start, end).list(); |
| | | List<TFaultMessage> list10 = faultMessageService.lambdaQuery().between(TFaultMessage::getCreateTime, start, end).list(); |
| | | List<TMonitoringEquipment> list11 = monitoringEquipmentService.lambdaQuery().between(TMonitoringEquipment::getCreateTime, start, end).list(); |
| | | List<TParkingLot> list12 = parkingLotService.lambdaQuery().between(TParkingLot::getCreateTime, start, end).list(); |
| | | List<TParkingRecord> list13 = parkingRecordService.lambdaQuery().between(TParkingRecord::getCreateTime, start, end).list(); |
| | | // List<TPartnerSite> list14 = invoiceInformationService.lambdaQuery().between(TPartnerSite::getCreateTime, start, end).list(); |
| | | List<TRepair> list15 = repairService.lambdaQuery().between(TRepair::getCreateTime, start, end).list(); |
| | | List<TVehicleRamp> list16 = vehicleRampService.lambdaQuery().between(TVehicleRamp::getCreateTime, start, end).list(); |
| | | // List<TSiteMenu> list17 = siteMenuService.lambdaQuery().between(TSiteMenu::getCreateTime, start, end).list(); |
| | | List<Partner> list1 = partnerService.lambdaQuery() |
| | | .ge(Partner::getCreateTime,start) |
| | | .le(Partner::getCreateTime,end) |
| | | .list(); |
| | | List<Site> list2 = siteService.lambdaQuery() |
| | | .ge(Site::getCreateTime,start) |
| | | .le(Site::getCreateTime,end) |
| | | .list(); |
| | | List<TAccountingStrategyDetail> list3 = accountingStrategyDetailService.lambdaQuery() |
| | | .ge(TAccountingStrategyDetail::getCreateTime,start) |
| | | .le(TAccountingStrategyDetail::getCreateTime,end) .list(); |
| | | List<TAccountingStrategy> list4 = accountingStrategyService.lambdaQuery() |
| | | .ge(TAccountingStrategy::getCreateTime,start) |
| | | .le(TAccountingStrategy::getCreateTime,end) .list(); |
| | | List<TApplyChargingPile> list5 = applyChargingPileService.lambdaQuery() |
| | | .ge(TApplyChargingPile::getCreateTime,start) |
| | | .le(TApplyChargingPile::getCreateTime,end) .list(); |
| | | List<TCarport> list6 = carportService.lambdaQuery() |
| | | .ge(TCarport::getCreateTime,start) |
| | | .le(TCarport::getCreateTime,end) .list(); |
| | | List<TChargingGun> list7 = chargingGunService.lambdaQuery() |
| | | .ge(TChargingGun::getCreateTime,start) |
| | | .le(TChargingGun::getCreateTime,end) .list(); |
| | | List<TChargingPile> list8 = chargingPileService.lambdaQuery() |
| | | .ge(TChargingPile::getCreateTime,start) |
| | | .le(TChargingPile::getCreateTime,end) .list(); |
| | | List<TChargingPileNotification> list9 = chargingPileNotificationService.lambdaQuery() |
| | | .ge(TChargingPileNotification::getCreateTime,start) |
| | | .le(TChargingPileNotification::getCreateTime,end) .list(); |
| | | List<TFaultMessage> list10 = faultMessageService.lambdaQuery() |
| | | .ge(TFaultMessage::getCreateTime,start) |
| | | .le(TFaultMessage::getCreateTime,end) .list(); |
| | | List<TMonitoringEquipment> list11 = monitoringEquipmentService.lambdaQuery() |
| | | .ge(TMonitoringEquipment::getCreateTime,start) |
| | | .le(TMonitoringEquipment::getCreateTime,end) .list(); |
| | | List<TParkingLot> list12 = parkingLotService.lambdaQuery() |
| | | .ge(TParkingLot::getCreateTime,start) |
| | | .le(TParkingLot::getCreateTime,end) .list(); |
| | | List<TParkingRecord> list13 = parkingRecordService.lambdaQuery() |
| | | .ge(TParkingRecord::getCreateTime,start) |
| | | .le(TParkingRecord::getCreateTime,end) .list(); |
| | | List<TPartnerSite> list14 = partnerSiteService.list(); |
| | | List<TRepair> list15 = repairService.lambdaQuery() |
| | | .ge(TRepair::getCreateTime,start) |
| | | .le(TRepair::getCreateTime,end) .list(); |
| | | List<TVehicleRamp> list16 = vehicleRampService.lambdaQuery() |
| | | .ge(TVehicleRamp::getCreateTime,start) |
| | | .le(TVehicleRamp::getCreateTime,end) .list(); |
| | | List<TSiteMenu> list17 = siteMenuService.lambdaQuery().between(TSiteMenu::getCreateTime, start, end).list(); |
| | | |
| | | governmentCloudAccountVO.setPartners(list1); |
| | | governmentCloudAccountVO.setSites(list2); |
| | |
| | | governmentCloudAccountVO.setMonitoringEquipments(list11); |
| | | governmentCloudAccountVO.setParkingLots(list12); |
| | | governmentCloudAccountVO.setParkingRecords(list13); |
| | | // governmentCloudAccountVO.setPartnerSites(list14); |
| | | governmentCloudAccountVO.setPartnerSites(list14); |
| | | governmentCloudAccountVO.setRepairs(list15); |
| | | governmentCloudAccountVO.setVehicleRamps(list16); |
| | | // governmentCloudAccountVO.setSiteMenus(list17); |
| | | governmentCloudAccountVO.setSiteMenus(list17); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | |
| | |
| | | * @param number |
| | | * @return |
| | | */ |
| | | @Log(title = "【扫一扫】通过桩编号获取电站信息", businessType = BusinessType.OTHER,operatorType = OperatorType.MOBILE) |
| | | @GetMapping("/getSiteInfoByNumber") |
| | | @ApiOperation(value = "扫一扫后通过桩编号获取电站信息", tags = {"小程序-扫一扫"}) |
| | | public R<SiteInfoVO> getSiteInfoByNumber(@RequestParam("number") String number){ |
| | |
| | | // 查询是否有下级审核中的策略 |
| | | TAccountingStrategy children = accountingStrategyService.getOne(Wrappers.lambdaQuery(TAccountingStrategy.class) |
| | | .eq(TAccountingStrategy::getParentId, dto.getId()) |
| | | .ne(TAccountingStrategy::getAuditStatus, Arrays.asList(3,4))); |
| | | .notIn(TAccountingStrategy::getAuditStatus, Arrays.asList(3,4))); |
| | | if(Objects.nonNull(children)){ |
| | | // 删除计费策略明细信息 |
| | | accountingStrategyDetailService.remove(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | |
| | | accountingStrategyVO.setUserName(userName); |
| | | } |
| | | accountingStrategyVO.setAccountingStrategyDetailList(accountingStrategyDetailService.list(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, children.getId()))); |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, children.getId()).eq(TAccountingStrategyDetail::getDelFlag, 0))); |
| | | }else { |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getById(id); |
| | | BeanUtils.copyProperties(accountingStrategy,accountingStrategyVO); |
| | |
| | | accountingStrategyVO.setUserName(userName); |
| | | } |
| | | accountingStrategyVO.setAccountingStrategyDetailList(accountingStrategyDetailService.list(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, id))); |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, id).eq(TAccountingStrategyDetail::getDelFlag, 0))); |
| | | } |
| | | return AjaxResult.ok(accountingStrategyVO); |
| | | } |
| | |
| | | } |
| | | //硬件 |
| | | |
| | | List<TAccountingStrategyDetail> accountingStrategyDetails = accountingStrategyDetailService.list(new LambdaQueryWrapper<TAccountingStrategyDetail>().eq(TAccountingStrategyDetail::getAccountingStrategyId, byId.getId())); |
| | | List<TAccountingStrategyDetail> accountingStrategyDetails = accountingStrategyDetailService.list(new LambdaQueryWrapper<TAccountingStrategyDetail>() |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, byId.getId()).eq(TAccountingStrategyDetail::getDelFlag, 0)); |
| | | List<TChargingPile> list = chargingPileService.lambdaQuery().eq(TChargingPile::getSiteId, byId.getSiteId()).list(); |
| | | for (TChargingPile tChargingPile : list) { |
| | | integrationClient.setupBillingModel1(tChargingPile.getCode(), JSON.toJSONString(accountingStrategyDetails)); |
| | |
| | | // 会员折扣 |
| | | BigDecimal discount = one1.getDiscount(); |
| | | List<TAccountingStrategyDetail> list = accountingStrategyDetailService.lambdaQuery().eq(TAccountingStrategyDetail::getAccountingStrategyId, one1.getId()) |
| | | .list(); |
| | | .eq(TAccountingStrategyDetail::getDelFlag, 0).list(); |
| | | // 当前时间属于哪个计费策略 |
| | | LocalTime now = LocalTime.now(); |
| | | // 电价 |
| | |
| | | } |
| | | Site site = siteService.getById(chargingPile.getSiteId()); |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getById(site.getAccountingStrategyId()); |
| | | if(null == accountingStrategy){ |
| | | List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getChargingPileId, chargingPile.getId())); |
| | | accountingStrategy = accountingStrategyService.getById(list.get(0).getAccountingStrategyId()); |
| | | } |
| | | |
| | | TAccountingStrategyDetail one = accountingStrategyDetailService.getOne(Wrappers.<TAccountingStrategyDetail>lambdaQuery() |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, accountingStrategy.getId()) |
| | | .last(" and DATE_FORMAT(now(), '%H:%i') between start_time and end_time")); |
| | | .last(" and DATE_FORMAT(now(), '%H:%i') between start_time and (if(end_time = '00:00', '23:59', end_time))")); |
| | | return R.ok(dto.getStrategyDetailId().equals(one.getId())); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.chargingPile.api.model.Partner; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.util.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import com.ruoyi.common.core.utils.WebUtils; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | |
| | | @Resource |
| | | private OtherClient otherClient; |
| | | @Resource |
| | | private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; |
| | | private UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService; |
| | | @ApiOperation(value = "下载", tags = {"管理后台-结算表记录"}) |
| | | @PutMapping("/downloadSettlement") |
| | | @Log(title = "【结算表记录】下载结算表", businessType = BusinessType.EXPORT) |
| | |
| | | settlementExportVO.setAverageServiceChargeReal(""); |
| | | settlementExportVO.setAverageServiceCharge(""); |
| | | // 获取充电时间 |
| | | UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); |
| | | UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataService.getLastDataById(chargingOrder.getCode()); |
| | | if (data5!=null){ |
| | | if (data5.getCumulative_charging_time()!=null){ |
| | | settlementExportVO.setChargingSecond(data5.getCumulative_charging_time()+""); |
| | |
| | | } |
| | | // 获取开始SOC 结束soc |
| | | if (chargingOrder.getCode()!=null){ |
| | | List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataClient.getDataByOrderCode(chargingOrder.getCode()).getData(); |
| | | List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataService.getDataByOrderCode(chargingOrder.getCode()); |
| | | if (data6!=null && !data6.isEmpty()){ |
| | | int min = 100; |
| | | int max = 0; |
| | |
| | | Integer status = vo.getStatus(); |
| | | Long time = (Long) redisTemplate.opsForHash().get("charging_gun_online", (pile_code + gun_code)); |
| | | //小于1分钟才处理数据,防止频繁查询数据 |
| | | if(null != time && (System.currentTimeMillis() - time) < 60000){ |
| | | if(null != time && (System.currentTimeMillis() - time) < 30000){ |
| | | return; |
| | | } |
| | | TChargingGun tChargingGun = chargingGunService.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getFullNumber, (pile_code + gun_code)).eq(TChargingGun::getDelFlag, 0)); |
| | |
| | | TChargingGun chargingGun = chargingGunService.getById(gunId); |
| | | TAccountingStrategy accountingStrategy = accountingStrategyMapper.selectById(chargingGun.getAccountingStrategyId()); |
| | | if(Objects.isNull(accountingStrategy)){ |
| | | Site site = siteService.getById(chargingGun.getSiteId()); |
| | | accountingStrategy = accountingStrategyMapper.selectById(site.getAccountingStrategyId()); |
| | | if(Objects.isNull(accountingStrategy)){ |
| | | throw new ServiceException("未查询到计费策略"); |
| | | } |
| | | } |
| | | List<TAccountingStrategyDetailVO> list = this.queryAccountingStrategyDetailByStrategyId(accountingStrategy.getId()); |
| | | list.stream().filter(item -> "00:00".equals(item.getEndTime())).forEach(item -> item.setEndTime("23:59:59")); |
| | | // 获取当前登录用户id |
| | |
| | | qrCodeDelivery.setPrefix_length(code_prefix.length()); |
| | | qrCodeDelivery.setCode_prefix(code_prefix); |
| | | qrCodeDelivery.setQr_code(code_prefix + chargingPile.getCode() + dto.getCode()); |
| | | qrCodeDelivery.setCreate_time(new Date()); |
| | | qrCodeDelivery.setLast_time(new Date()); |
| | | sendMessageClient.qrCodeDelivery(qrCodeDelivery); |
| | | Site site = siteMapper.selectById(chargingPile.getSiteId()); |
| | | // 推送充换电站信息 |
| | |
| | | qrCodeDelivery.setPrefix_length(code_prefix.length()); |
| | | qrCodeDelivery.setCode_prefix(code_prefix); |
| | | qrCodeDelivery.setQr_code(code_prefix + chargingPile.getCode() + dto.getCode()); |
| | | qrCodeDelivery.setCreate_time(new Date()); |
| | | qrCodeDelivery.setLast_time(new Date()); |
| | | sendMessageClient.qrCodeDelivery(qrCodeDelivery); |
| | | tcecClient.superviseNotificationStationInfo(one.getSiteId()); |
| | | |
| | |
| | | import com.ruoyi.chargingPile.dto.GetChargingGunMonitoring; |
| | | import com.ruoyi.chargingPile.mapper.TChargingPileMapper; |
| | | import com.ruoyi.chargingPile.service.*; |
| | | import com.ruoyi.chargingPile.util.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | 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.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserRoleClient; |
| | | import com.ruoyi.system.api.model.SysUserRoleVo; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | * @author xiaochen |
| | | * @since 2024-08-06 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class TChargingPileServiceImpl extends ServiceImpl<TChargingPileMapper, TChargingPile> implements TChargingPileService { |
| | | |
| | |
| | | private AppUserCarClient appUserCarClient; |
| | | |
| | | @Resource |
| | | private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; |
| | | private UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService; |
| | | |
| | | @Resource |
| | | private SysUserRoleClient sysUserRoleClient; |
| | |
| | | qrCodeDelivery.setPrefix_length(code_prefix.length()); |
| | | qrCodeDelivery.setCode_prefix(code_prefix); |
| | | qrCodeDelivery.setQr_code(code_prefix + chargingPile.getCode() + chargingGun.getCode()); |
| | | qrCodeDelivery.setCreate_time(new Date()); |
| | | qrCodeDelivery.setLast_time(new Date()); |
| | | sendMessageClient.qrCodeDelivery(qrCodeDelivery); |
| | | } |
| | | tcecClient.superviseNotificationStationInfo(chargingPile.getSiteId()); |
| | |
| | | // 查询正在充电的单子的实时记录 |
| | | TChargingOrder chargingOrder = chargingOrderClient.getOrderDetailByGunId(chargingGun.getId()).getData(); |
| | | if(Objects.nonNull(chargingOrder)){ |
| | | UploadRealTimeMonitoringData uploadRealTimeMonitoringData = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); |
| | | UploadRealTimeMonitoringData uploadRealTimeMonitoringData = uploadRealTimeMonitoringDataService.getLastDataById(chargingOrder.getCode()); |
| | | if(null != uploadRealTimeMonitoringData){ |
| | | chargingGun.setSoc(uploadRealTimeMonitoringData.getSoc()); |
| | | }else{ |
| | |
| | | gunMonitoring.setLicensePlate(chargingOrder.getPlateNum()); |
| | | } |
| | | |
| | | UploadRealTimeMonitoringData data = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); |
| | | UploadRealTimeMonitoringData data = uploadRealTimeMonitoringDataService.getLastDataById(chargingOrder.getCode()); |
| | | gunMonitoring.setChargingRatio(BigDecimal.valueOf(data.getSoc())); |
| | | gunMonitoring.setElectricQuantity(data.getCharging_degree().toString()); |
| | | gunMonitoring.setSoc(data.getSoc().toString()); |
| | |
| | | */ |
| | | @Override |
| | | public void updateStatus() { |
| | | List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getDelFlag, 0)); |
| | | //查询出redis集合汇总符合条件的数据 |
| | | Set keys = redisTemplate.opsForHash().keys("charging_gun_online"); |
| | | List<String> fullNumbers = new ArrayList<>(); |
| | | keys.forEach(key -> { |
| | | Long time = (Long) redisTemplate.opsForHash().get("charging_gun_online", key); |
| | | if(null != time && System.currentTimeMillis() - time > 300000){ |
| | | log.info("设备编号:{} 已离线", key); |
| | | log.info("间隔时间", System.currentTimeMillis() - time); |
| | | fullNumbers.add(key.toString()); |
| | | } |
| | | }); |
| | | if(fullNumbers.size() == 0){ |
| | | return; |
| | | } |
| | | |
| | | //处理符合条件的数据,修改设备状态 |
| | | List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().in(TChargingGun::getFullNumber, fullNumbers).eq(TChargingGun::getDelFlag, 0)); |
| | | for (TChargingGun chargingGun : list) { |
| | | 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(); |
| | | chargingGun1.setId(chargingGun.getId()); |
| | | chargingGun1.setStatus(1); |
| | |
| | | siteName = siteName.substring(0,10); |
| | | } |
| | | chargingPileNotificationService.saveData(4,faultMessage.getSiteId(),faultMessage.getChargingPileId(),site.getPhone(),"检测到"+siteName+"..."+chargingPile.getNumber()+"号桩设备离线,请及时查看处理!"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import org.springframework.boot.web.context.WebServerInitializedEvent; |
| | | import org.springframework.context.ApplicationListener; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | * 定时任务工具类 |
| | | */ |
| | | @Component |
| | | public class TaskUtil { |
| | | public class TaskUtil implements ApplicationListener<WebServerInitializedEvent> { |
| | | |
| | | @Resource |
| | | private TChargingPileService chargingPileService;; |
| | | private TChargingPileService chargingPileService; |
| | | |
| | | private Integer port = null; |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void onApplicationEvent(WebServerInitializedEvent event) { |
| | | port = event.getWebServer().getPort(); |
| | | System.out.println("端口号:" + port); |
| | | } |
| | | |
| | | /** |
| | | * 每隔2分钟去处理的定时任务 |
| | | * 每隔1分钟去处理的定时任务 |
| | | */ |
| | | @Scheduled(fixedRate = 120000) |
| | | @Scheduled(fixedRate = 60000) |
| | | public void taskMinute(){ |
| | | if(null != port && port == 5300){ |
| | | chargingPileService.updateStatus(); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.util.mongodb.base; |
| | | |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface BaseService<T> { |
| | | |
| | | /** |
| | | * 添加 |
| | | * @param t 实体类 |
| | | * @return 添加结果 1=成功 0=失败 |
| | | */ |
| | | int create(T t); |
| | | |
| | | /** |
| | | * 根据id查询 |
| | | * @param id 实体id |
| | | * @return 实体对象 |
| | | */ |
| | | T findById(String id); |
| | | |
| | | /** |
| | | * 查询列表 |
| | | * @return 实体列表 |
| | | */ |
| | | List<T> findAll(); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.util.mongodb.service; |
| | | |
| | | import com.ruoyi.chargingPile.util.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface BmsDemandAndChargerExportationService extends BaseService<BmsDemandAndChargerExportation> { |
| | | |
| | | |
| | | /** |
| | | * 获取bms数据 |
| | | * @param orderCode |
| | | * @return |
| | | */ |
| | | List<BmsDemandAndChargerExportation> getBmsDemandAndChargerExportation(String orderCode); |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.util.mongodb.service; |
| | | |
| | | import com.ruoyi.chargingPile.util.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.api.model.ChargingHandshake; |
| | | |
| | | public interface ChargingHandshakeService extends BaseService<ChargingHandshake> { |
| | | |
| | | |
| | | ChargingHandshake getDataByOrderCode(String code); |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.util.mongodb.service; |
| | | |
| | | import com.ruoyi.chargingPile.util.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.api.model.PlatformStartChargingReply; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface PlatformStartChargingReplyService extends BaseService<PlatformStartChargingReply> { |
| | | |
| | | /** |
| | | * 根据订单编号查询远程启机应答数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | List<PlatformStartChargingReply> getPlatformStartChargingReply(String code); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.util.mongodb.service; |
| | | |
| | | import com.ruoyi.chargingPile.util.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.api.model.PlatformStopChargingReply; |
| | | import com.ruoyi.integration.api.vo.GetPlatformStopChargingReply; |
| | | |
| | | public interface PlatformStopChargingReplyService extends BaseService<PlatformStopChargingReply> { |
| | | |
| | | /** |
| | | * 根据枪编号获取停机应答 |
| | | * @return |
| | | */ |
| | | PlatformStopChargingReply getPlatformStopChargingReply(GetPlatformStopChargingReply query); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.util.mongodb.service; |
| | | |
| | | import com.ruoyi.chargingPile.util.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.api.model.SecurityDetection; |
| | | |
| | | /** |
| | | */ |
| | | public interface SecurityDetectionService extends BaseService<SecurityDetection> { |
| | | |
| | | |
| | | /** |
| | | * 根据业务流水号查询数据 |
| | | * @param transactionSerialNumber |
| | | * @return |
| | | */ |
| | | SecurityDetection getSecurityDetection(String transactionSerialNumber); |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.util.mongodb.service; |
| | | |
| | | import com.ruoyi.chargingPile.util.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.api.model.TransactionRecord; |
| | | |
| | | public interface TransactionRecordService extends BaseService<TransactionRecord> { |
| | | |
| | | /** |
| | | * 根据订单流水号查询数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | TransactionRecord findOne(String code); |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.util.mongodb.service; |
| | | |
| | | import com.ruoyi.chargingPile.util.mongodb.base.BaseService; |
| | | import com.ruoyi.common.core.dto.MongoChargingOrderQuery; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringPageData; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.List; |
| | | |
| | | public interface UploadRealTimeMonitoringDataService extends BaseService<UploadRealTimeMonitoringData> { |
| | | |
| | | /** |
| | | * 根据订单号查询监控数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | List<UploadRealTimeMonitoringData> getDataByOrderCode(String code); |
| | | UploadRealTimeMonitoringPageData getDataAll(MongoChargingOrderQuery mongoChargingOrderQuery) throws ParseException; |
| | | |
| | | /** |
| | | * 查询订单最新一条数据 |
| | | * @param transaction_serial_number |
| | | * @return |
| | | */ |
| | | UploadRealTimeMonitoringData getLastDataById(String transaction_serial_number); |
| | | |
| | | void delete(String id); |
| | | |
| | | void updateById(String id); |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.util.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.chargingPile.util.mongodb.service.BmsDemandAndChargerExportationService; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | 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; |
| | | |
| | | @Service |
| | | public class BmsDemandAndChargerExportationServiceImpl implements BmsDemandAndChargerExportationService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(BmsDemandAndChargerExportation bmsDemandAndChargerExportation) { |
| | | mongoTemplate.save(bmsDemandAndChargerExportation); |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | | public BmsDemandAndChargerExportation findById(String id) { |
| | | return mongoTemplate.findById(id, BmsDemandAndChargerExportation.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<BmsDemandAndChargerExportation> findAll() { |
| | | return mongoTemplate.findAll(BmsDemandAndChargerExportation.class); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<BmsDemandAndChargerExportation> getBmsDemandAndChargerExportation(String orderCode) { |
| | | Query query = new Query(); |
| | | if(StringUtils.isNotEmpty(orderCode)){ |
| | | query.addCriteria(Criteria.where("transaction_serial_number").is(orderCode)); |
| | | } |
| | | List<BmsDemandAndChargerExportation> uploadRealTimeMonitoringData = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , BmsDemandAndChargerExportation.class); |
| | | return uploadRealTimeMonitoringData; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.util.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.chargingPile.util.mongodb.service.ChargingHandshakeService; |
| | | import com.ruoyi.integration.api.model.ChargingHandshake; |
| | | 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; |
| | | |
| | | @Service |
| | | public class ChargingHandshakeServiceImpl implements ChargingHandshakeService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(ChargingHandshake chargingHandshake) { |
| | | mongoTemplate.save(chargingHandshake); |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | | public ChargingHandshake findById(String id) { |
| | | return mongoTemplate.findById(id, ChargingHandshake.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ChargingHandshake> findAll() { |
| | | return mongoTemplate.findAll(ChargingHandshake.class); |
| | | } |
| | | |
| | | @Override |
| | | public ChargingHandshake getDataByOrderCode(String code) { |
| | | List<ChargingHandshake> charging_gun_code = mongoTemplate.find(new Query().addCriteria(Criteria.where("transaction_serial_number").is(code)), ChargingHandshake.class); |
| | | return charging_gun_code.size() > 0 ? charging_gun_code.get(0) : null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.util.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.chargingPile.util.mongodb.service.PlatformStartChargingReplyService; |
| | | import com.ruoyi.integration.api.model.PlatformStartChargingReply; |
| | | 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; |
| | | |
| | | @Service |
| | | public class PlatformStartChargingReplyServiceImpl implements PlatformStartChargingReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(PlatformStartChargingReply platformStartChargingReply) { |
| | | mongoTemplate.save(platformStartChargingReply); |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformStartChargingReply findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformStartChargingReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformStartChargingReply> findAll() { |
| | | return mongoTemplate.findAll(PlatformStartChargingReply.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据订单编号查询远程启机应答数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<PlatformStartChargingReply> getPlatformStartChargingReply(String code) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("transaction_serial_number").is(code)); |
| | | List<PlatformStartChargingReply> platformStartChargingReplies = mongoTemplate.find(query, PlatformStartChargingReply.class); |
| | | return platformStartChargingReplies; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.util.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.chargingPile.util.mongodb.service.PlatformStopChargingReplyService; |
| | | import com.ruoyi.integration.api.model.PlatformStopChargingReply; |
| | | import com.ruoyi.integration.api.vo.GetPlatformStopChargingReply; |
| | | 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.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class PlatformStopChargingReplyServiceImpl implements PlatformStopChargingReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(PlatformStopChargingReply platformStopChargingReply) { |
| | | mongoTemplate.save(platformStopChargingReply); |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformStopChargingReply findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformStopChargingReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformStopChargingReply> findAll() { |
| | | return mongoTemplate.findAll(PlatformStopChargingReply.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据枪编号获取 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public PlatformStopChargingReply getPlatformStopChargingReply(GetPlatformStopChargingReply query) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | List<PlatformStopChargingReply> platformStopChargingReplies = mongoTemplate.find(new Query().addCriteria(Criteria.where("charging_pile_code").is(query.getCharging_pile_code()) |
| | | .and("charging_gun_code").is(query.getCharging_gun_code()).and("create_time").lte(sdf.format(new Date())).gte(query.getEnd_time())), PlatformStopChargingReply.class); |
| | | return platformStopChargingReplies.size() > 0 ? platformStopChargingReplies.get(0) : null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.util.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.chargingPile.util.mongodb.service.SecurityDetectionService; |
| | | import com.ruoyi.integration.api.model.SecurityDetection; |
| | | 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; |
| | | |
| | | |
| | | /** |
| | | * 心跳包应答实现类 |
| | | **/ |
| | | @Service |
| | | public class SecurityDetectionServiceImpl implements SecurityDetectionService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(SecurityDetection securityDetection) { |
| | | mongoTemplate.save(securityDetection); |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | | public SecurityDetection findById(String id) { |
| | | return mongoTemplate.findById(id, SecurityDetection.class); |
| | | } |
| | | |
| | | @Override |
| | | 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; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.util.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.chargingPile.util.mongodb.service.TransactionRecordService; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.TransactionRecord; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | 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; |
| | | |
| | | @Service |
| | | public class TransactionRecordServiceImpl implements TransactionRecordService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(TransactionRecord transactionRecord) { |
| | | mongoTemplate.save(transactionRecord); |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | | public TransactionRecord findById(String id) { |
| | | return mongoTemplate.findById(id, TransactionRecord.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<TransactionRecord> findAll() { |
| | | return mongoTemplate.findAll(TransactionRecord.class); |
| | | } |
| | | |
| | | /** |
| | | * 根据订单流水号查询数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @Override |
| | | public TransactionRecord findOne(String code) { |
| | | Query query = new Query(); |
| | | if(StringUtils.isNotEmpty(code)){ |
| | | query.addCriteria(Criteria.where("transaction_serial_number").is(code)); |
| | | } |
| | | List<TransactionRecord> transactionRecords = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , TransactionRecord.class); |
| | | return transactionRecords.size() > 0 ? transactionRecords.get(0) : null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.util.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.chargingPile.util.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import com.ruoyi.common.core.dto.MongoChargingOrderQuery; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringPageData; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.data.domain.Sort; |
| | | 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.data.mongodb.core.query.Update; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class UploadRealTimeMonitoringDataServiceImpl implements UploadRealTimeMonitoringDataService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(UploadRealTimeMonitoringData uploadRealTimeMonitoringData) { |
| | | mongoTemplate.save(uploadRealTimeMonitoringData); |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | | public UploadRealTimeMonitoringData findById(String id) { |
| | | return mongoTemplate.findById(id, UploadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<UploadRealTimeMonitoringData> findAll() { |
| | | return mongoTemplate.findAll(UploadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据订单号查询监控数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<UploadRealTimeMonitoringData> getDataByOrderCode(String code) { |
| | | Query query = new Query(); |
| | | if(StringUtils.isNotEmpty(code)){ |
| | | query.addCriteria(Criteria.where("transaction_serial_number").is(code)); |
| | | } |
| | | List<UploadRealTimeMonitoringData> uploadRealTimeMonitoringData = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , UploadRealTimeMonitoringData.class); |
| | | return uploadRealTimeMonitoringData; |
| | | } |
| | | |
| | | @Override |
| | | public UploadRealTimeMonitoringPageData getDataAll(MongoChargingOrderQuery mongoChargingOrderQuery) throws ParseException { |
| | | Query query = new Query(); |
| | | // if (!values.isEmpty()){ |
| | | // query.addCriteria(Criteria.where("transaction_serial_number").in(values)); |
| | | // } |
| | | if (mongoChargingOrderQuery.getCode() != null && !mongoChargingOrderQuery.getCode().isEmpty()) { |
| | | query.addCriteria(Criteria.where("transaction_serial_number").regex(mongoChargingOrderQuery.getCode(),"i")); // "i" 表示不区分大小写 |
| | | } |
| | | if (mongoChargingOrderQuery.getOrderType() !=null){ |
| | | query.addCriteria(Criteria.where("orderType").is(mongoChargingOrderQuery.getOrderType())); |
| | | } |
| | | if (mongoChargingOrderQuery.getSiteId() != null){ |
| | | query.addCriteria(Criteria.where("siteId").is(mongoChargingOrderQuery.getSiteId())); |
| | | } |
| | | if (!mongoChargingOrderQuery.getSiteIds().isEmpty()){ |
| | | query.addCriteria(Criteria.where("siteId").in(mongoChargingOrderQuery.getSiteIds())); |
| | | } |
| | | if (mongoChargingOrderQuery.getChargingPileCode() != null && !mongoChargingOrderQuery.getChargingPileCode().isEmpty()) { |
| | | query.addCriteria(Criteria.where("charging_pile_code").is(mongoChargingOrderQuery.getChargingPileCode())); |
| | | } |
| | | if (mongoChargingOrderQuery.getChargingGunCode() != null && !mongoChargingOrderQuery.getChargingGunCode().isEmpty()){ |
| | | query.addCriteria(Criteria.where("charging_gun_code").is(mongoChargingOrderQuery.getChargingGunCode())); |
| | | } |
| | | if (mongoChargingOrderQuery.getStatus() != null){ |
| | | query.addCriteria(Criteria.where("status").is(mongoChargingOrderQuery.getStatus())); |
| | | } |
| | | |
| | | if (mongoChargingOrderQuery.getCreateTime() != null) { |
| | | String[] split = mongoChargingOrderQuery.getCreateTime().split(" - "); |
| | | |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date start = dateFormat.parse(split[0]); |
| | | Date end = dateFormat.parse(split[1]); |
| | | query.addCriteria(Criteria.where("create_time").gte(start).lt(end)); |
| | | } |
| | | |
| | | if (mongoChargingOrderQuery.getLastTime() != null && mongoChargingOrderQuery.getLastTime() != null) { |
| | | String[] split = mongoChargingOrderQuery.getLastTime().split(" - "); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date start = dateFormat.parse(split[0]); |
| | | Date end = dateFormat.parse(split[1]); |
| | | query.addCriteria(Criteria.where("last_time").gte(start).lt(end)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | long totalElements = mongoTemplate.count(query, UploadRealTimeMonitoringData.class); |
| | | |
| | | // 创建带有排序的 Pageable 对象 |
| | | Pageable pageable = PageRequest.of( |
| | | mongoChargingOrderQuery.getPageCurr()-1, |
| | | mongoChargingOrderQuery.getPageSize(), |
| | | Sort.by(Sort.Direction.DESC, "create_time") |
| | | ); |
| | | |
| | | // 设置分页和排序 |
| | | query.with(pageable); |
| | | |
| | | // 执行查询并获取 Page 对象 |
| | | List<UploadRealTimeMonitoringData> page = mongoTemplate.find(query, UploadRealTimeMonitoringData.class,"upload_real_time_monitoring_data"); |
| | | |
| | | // 设置分页 |
| | | // Pageable pageable = PageRequest.of(mongoChargingOrderQuery.getPageSize()*(mongoChargingOrderQuery.getPageCurr()-1), mongoChargingOrderQuery.getPageSize()); |
| | | // query.with(pageable); |
| | | // query.with(Sort.by(Sort.Direction.DESC,"create_time")); |
| | | List<UploadRealTimeMonitoringData> uploadRealTimeMonitoringData = mongoTemplate.find( |
| | | query |
| | | , UploadRealTimeMonitoringData.class); |
| | | |
| | | UploadRealTimeMonitoringPageData uploadRealTimeMonitoringPageData = new UploadRealTimeMonitoringPageData(); |
| | | uploadRealTimeMonitoringPageData.setCount(totalElements); |
| | | uploadRealTimeMonitoringPageData.setRecords(page); |
| | | return uploadRealTimeMonitoringPageData; |
| | | } |
| | | |
| | | @Override |
| | | public UploadRealTimeMonitoringData getLastDataById(String transaction_serial_number) { |
| | | Query query = new Query(); |
| | | if (StringUtils.isNotEmpty(transaction_serial_number)){ |
| | | query.addCriteria(Criteria.where("transaction_serial_number").is(transaction_serial_number)); |
| | | } |
| | | // 按照 createdAt 字段降序排序 |
| | | query.with(Sort.by(Sort.Direction.DESC, "create_time")); |
| | | // 限制结果只返回一条记录 |
| | | query.limit(1); |
| | | return mongoTemplate.findOne(query, UploadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(String id) { |
| | | UploadRealTimeMonitoringData byId = findById(id.toString()); |
| | | mongoTemplate.remove(byId); |
| | | } |
| | | |
| | | @Override |
| | | public void updateById(String id) { |
| | | // 创建查询条件 |
| | | Query query = new Query(Criteria.where("_id").is(id)); |
| | | // 创建更新对象 |
| | | Update update = new Update().set("last_time", new Date()); |
| | | // 执行更新操作 |
| | | mongoTemplate.updateFirst(query, update, UploadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | } |
| | |
| | | FROM t_accounting_strategy_detail tasd |
| | | LEFT JOIN t_accounting_strategy tas ON tas.id = tasd.accounting_strategy_id |
| | | <where> |
| | | tasd.del_flag = 0 |
| | | <if test="strategyId != null"> |
| | | AND tasd.accounting_strategy_id = #{strategyId} |
| | | </if> |
| | |
| | | <if test="chargingPileId != null and chargingPileId != 0">#{chargingPileId},</if> |
| | | <if test="phone != null and phone != ''">#{phone},</if> |
| | | <if test="content != null and content != ''">#{content},</if> |
| | | sysdate() |
| | | now() |
| | | ) |
| | | </insert> |
| | | |
| | |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <!--rocketmq--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>com.alibaba.cloud</groupId>--> |
| | | <!-- <artifactId>spring-cloud-starter-stream-rocketmq</artifactId>--> |
| | | <!-- <version>2.2.2.RELEASE</version>--> |
| | | <!-- <exclusions>--> |
| | | <!-- <exclusion>--> |
| | | <!-- <groupId>org.apache.rocketmq</groupId>--> |
| | | <!-- <artifactId>rocketmq-client</artifactId>--> |
| | | <!-- </exclusion>--> |
| | | <!-- <exclusion>--> |
| | | <!-- <groupId>org.apache.rocketmq</groupId>--> |
| | | <!-- <artifactId>rocketmq-acl</artifactId>--> |
| | | <!-- </exclusion>--> |
| | | <!-- </exclusions>--> |
| | | <!-- </dependency>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.apache.rocketmq</groupId>--> |
| | | <!-- <artifactId>rocketmq-client</artifactId>--> |
| | | <!-- <version>4.7.1</version>--> |
| | | <!-- </dependency>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.apache.rocketmq</groupId>--> |
| | | <!-- <artifactId>rocketmq-acl</artifactId>--> |
| | | <!-- <version>4.7.1</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.rocketmq</groupId> |
| | | <artifactId>rocketmq-spring-boot-starter</artifactId> |
| | | <version>2.3.0</version> |
| | | </dependency> |
| | | |
| | | <!--mongodb--> |
| | | <dependency> |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getOrderInfoByCode") |
| | | public R<UploadRealTimeMonitoringData> chargingOrderInfo(@RequestParam("orderId") String orderId){ |
| | | List<UploadRealTimeMonitoringData> dataByOrderCode = uploadRealTimeMonitoringDataService.getDataByOrderCode(orderId); |
| | | if(dataByOrderCode.size() > 0){ |
| | | UploadRealTimeMonitoringData uploadRealTimeMonitoringData = dataByOrderCode.get(0); |
| | | return R.ok(uploadRealTimeMonitoringData); |
| | | } |
| | | return R.ok(); |
| | | public R<UploadRealTimeMonitoringData> getOrderInfoByCode(@RequestParam("orderId") String orderId){ |
| | | UploadRealTimeMonitoringData dataByOrderCode = uploadRealTimeMonitoringDataService.getLastDataById(orderId); |
| | | return R.ok(dataByOrderCode); |
| | | } |
| | | |
| | | /** |
| | |
| | | stationInfo.setCountryCode(StringUtils.isNotEmpty(datum.getCountryCode()) ? datum.getCountryCode() : "CN"); |
| | | stationInfo.setAreaCode(datum.getDistrictsCode()); |
| | | stationInfo.setAddress(datum.getAddress()); |
| | | stationInfo.setStationTel(StringUtils.isNotEmpty(datum.getPhone()) ? datum.getPhone().split(",")[0] : ""); |
| | | stationInfo.setStationTel(StringUtils.isNotEmpty(serviceTel) ? serviceTel.split(",")[0] : ""); |
| | | stationInfo.setServiceTel(StringUtils.isNotEmpty(serviceTel) ? serviceTel.split(",")[0] : ""); |
| | | switch (datum.getSiteType()){ |
| | | case 0: |
| | |
| | | queryEquipChargeStatusResult.setEndTime((null == chargingOrder.getEndTime() ? LocalDateTime.now() : chargingOrder.getEndTime()).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | queryEquipChargeStatusResult.setTotalPower(chargingOrder.getElectricity()); |
| | | |
| | | |
| | | List<TChargingOrderAccountingStrategy> data = chargingOrderAccountingStrategyClient.getChargingOrderAccountingStrategyByOrderId(chargingOrder.getId()).getData(); |
| | | if(data.size() > 0){ |
| | | BigDecimal totalElectricity = data.stream().map(TChargingOrderAccountingStrategy::getPeriodElectricPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal serviceCharge = data.stream().map(TChargingOrderAccountingStrategy::getPeriodServicePrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal totalMoney = totalElectricity.add(serviceCharge).setScale(4, RoundingMode.HALF_EVEN); |
| | | queryEquipChargeStatusResult.setElecMoney(totalElectricity); |
| | | queryEquipChargeStatusResult.setSeviceMoney(serviceCharge); |
| | | queryEquipChargeStatusResult.setTotalMoney(chargingOrder.getPaymentAmount()); |
| | | }else{ |
| | | queryEquipChargeStatusResult.setTotalMoney(totalMoney); |
| | | }else if(null != chargingOrder.getRechargeAmount() && null != chargingOrder.getResidualAmount()){ |
| | | queryEquipChargeStatusResult.setElecMoney(chargingOrder.getRechargeAmount().subtract(chargingOrder.getResidualAmount())); |
| | | queryEquipChargeStatusResult.setSeviceMoney(BigDecimal.ZERO); |
| | | queryEquipChargeStatusResult.setTotalMoney(chargingOrder.getRechargeAmount().subtract(chargingOrder.getResidualAmount())); |
| | | }else{ |
| | | queryEquipChargeStatusResult.setElecMoney(BigDecimal.ZERO); |
| | | queryEquipChargeStatusResult.setSeviceMoney(BigDecimal.ZERO); |
| | | queryEquipChargeStatusResult.setTotalMoney(BigDecimal.ZERO); |
| | | } |
| | | |
| | | //构建充电明细 |
| | |
| | | |
| | | List<TChargingOrderAccountingStrategy> data = chargingOrderAccountingStrategyClient.getChargingOrderAccountingStrategyByOrderId(chargingOrder.getId()).getData(); |
| | | if(data.size() > 0){ |
| | | BigDecimal totalElectricity = data.stream().map(TChargingOrderAccountingStrategy::getPeriodElectricPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal serviceCharge = data.stream().map(TChargingOrderAccountingStrategy::getPeriodServicePrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | notificationChargeOrderInfo.setTotalElecMoney(totalElectricity.setScale(2, RoundingMode.HALF_EVEN)); |
| | | notificationChargeOrderInfo.setTotalSeviceMoney(serviceCharge.setScale(2, RoundingMode.HALF_EVEN)); |
| | | notificationChargeOrderInfo.setTotalMoney(chargingOrder.getPaymentAmount()); |
| | | BigDecimal totalElectricity = data.stream().map(TChargingOrderAccountingStrategy::getPeriodElectricPrice).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(4, RoundingMode.HALF_EVEN); |
| | | BigDecimal serviceCharge = data.stream().map(TChargingOrderAccountingStrategy::getPeriodServicePrice).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(4, RoundingMode.HALF_EVEN); |
| | | BigDecimal totalMoney = totalElectricity.add(serviceCharge).setScale(4, RoundingMode.HALF_EVEN); |
| | | notificationChargeOrderInfo.setTotalElecMoney(totalElectricity); |
| | | notificationChargeOrderInfo.setTotalSeviceMoney(serviceCharge); |
| | | notificationChargeOrderInfo.setTotalMoney(totalMoney); |
| | | }else{ |
| | | notificationChargeOrderInfo.setTotalElecMoney(chargingOrder.getRechargeAmount().subtract(chargingOrder.getResidualAmount())); |
| | | notificationChargeOrderInfo.setTotalSeviceMoney(BigDecimal.ZERO); |
| | |
| | | * @return |
| | | */ |
| | | public static NotificationChargeOrderInfoResult notificationChargeOrderInfo(Operator operator, NotificationChargeOrderInfo info){ |
| | | System.out.println("推送充电订单信息:--->" + JSON.toJSONString(info)); |
| | | HttpRequest post = HttpUtil.createPost(operator.getUrl() + InterfaceUrlEnum.NOTIFICATION_CHARGE_ORDER_INFO.getUrl()); |
| | | buildBody(post, info, operator); |
| | | HttpResponse execute = post.execute(); |
| | |
| | | stationInfo.setStationName(datum.getName()); |
| | | stationInfo.setCountryCode(StringUtils.isNotEmpty(datum.getCountryCode()) ? datum.getCountryCode() : "CN"); |
| | | stationInfo.setAddress(datum.getAddress()); |
| | | // stationInfo.setStationTel(datum.getPhone()); |
| | | stationInfo.setStationTel(StringUtils.isNotEmpty(datum.getPhone()) ? datum.getPhone().split(",")[0] : ""); |
| | | stationInfo.setServiceTel(StringUtils.isNotEmpty(serviceTel) ? serviceTel.split(",")[0] : ""); |
| | | // stationInfo.setServiceTel(serviceTel); |
| | | stationInfo.setStationTel(serviceTel); |
| | | stationInfo.setServiceTel(serviceTel); |
| | | switch (datum.getSiteType()){ |
| | | case 0: |
| | | stationInfo.setStationType(StationTypeEnum.OTHER.getType()); |
| | |
| | | if(data.size() > 0){ |
| | | BigDecimal totalElectricity = data.stream().map(TChargingOrderAccountingStrategy::getPeriodElectricPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal serviceCharge = data.stream().map(TChargingOrderAccountingStrategy::getPeriodServicePrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal totalMoney = totalElectricity.add(serviceCharge).setScale(4, RoundingMode.HALF_EVEN); |
| | | queryEquipChargeStatusResult.setElecMoney(totalElectricity); |
| | | queryEquipChargeStatusResult.setSeviceMoney(serviceCharge); |
| | | queryEquipChargeStatusResult.setTotalMoney(chargingOrder.getPaymentAmount()); |
| | | queryEquipChargeStatusResult.setTotalMoney(totalMoney); |
| | | }else{ |
| | | queryEquipChargeStatusResult.setElecMoney(chargingOrder.getRechargeAmount().subtract(chargingOrder.getResidualAmount())); |
| | | queryEquipChargeStatusResult.setSeviceMoney(BigDecimal.ZERO); |
| | |
| | | |
| | | List<TChargingOrderAccountingStrategy> data = chargingOrderAccountingStrategyClient.getChargingOrderAccountingStrategyByOrderId(chargingOrder.getId()).getData(); |
| | | if(data.size() > 0){ |
| | | BigDecimal totalElectricity = data.stream().map(TChargingOrderAccountingStrategy::getPeriodElectricPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal serviceCharge = data.stream().map(TChargingOrderAccountingStrategy::getPeriodServicePrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | notificationChargeOrderInfo.setTotalElecMoney(totalElectricity.setScale(2, RoundingMode.HALF_EVEN)); |
| | | notificationChargeOrderInfo.setTotalSeviceMoney(serviceCharge.setScale(2, RoundingMode.HALF_EVEN)); |
| | | notificationChargeOrderInfo.setTotalMoney(chargingOrder.getPaymentAmount()); |
| | | BigDecimal totalElectricity = data.stream().map(TChargingOrderAccountingStrategy::getPeriodElectricPrice).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(4, RoundingMode.HALF_EVEN); |
| | | BigDecimal serviceCharge = data.stream().map(TChargingOrderAccountingStrategy::getPeriodServicePrice).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(4, RoundingMode.HALF_EVEN); |
| | | BigDecimal totalMoney = totalElectricity.add(serviceCharge).setScale(4, RoundingMode.HALF_EVEN); |
| | | notificationChargeOrderInfo.setTotalElecMoney(totalElectricity); |
| | | notificationChargeOrderInfo.setTotalSeviceMoney(serviceCharge); |
| | | notificationChargeOrderInfo.setTotalMoney(totalMoney); |
| | | }else{ |
| | | notificationChargeOrderInfo.setTotalElecMoney(chargingOrder.getRechargeAmount().subtract(chargingOrder.getResidualAmount())); |
| | | notificationChargeOrderInfo.setTotalSeviceMoney(BigDecimal.ZERO); |
| | |
| | | import com.ruoyi.order.api.model.TChargingBill; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.web.context.WebServerInitializedEvent; |
| | | import org.springframework.context.ApplicationListener; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | * @date 2023/7/11 8:39 |
| | | */ |
| | | @Component |
| | | public class TaskUtil { |
| | | public class TaskUtil implements ApplicationListener<WebServerInitializedEvent> { |
| | | |
| | | |
| | | @Resource |
| | |
| | | @Resource |
| | | private ChargingPileClient chargingPileClient; |
| | | |
| | | private Integer port = null; |
| | | |
| | | |
| | | @Override |
| | | public void onApplicationEvent(WebServerInitializedEvent event) { |
| | | port = event.getWebServer().getPort(); |
| | | System.out.println("端口号:" + port); |
| | | } |
| | | |
| | | |
| | | // 每天凌晨12点30执行 推送充电用能统计 |
| | | @Scheduled(cron = "0 30 0 * * ?") |
| | | public void superviseNotificationOperationStatsInfo() { |
| | | if(null != port && port == 5701){ |
| | | StationStatsInfoResult res = new StationStatsInfoResult(); |
| | | int dayOfMonth1 = LocalDateTime.now().getYear(); |
| | | int dayOfMonth2 = LocalDateTime.now().getMonthValue(); |
| | |
| | | res.setStationStatsInfos(stationStatsInfos); |
| | | tcecSuperviseUtil.superviseNotificationOperationStatsInfo(res); |
| | | } |
| | | } |
| | | // 每15分钟执行一次的定时任务 |
| | | @Scheduled(cron = "0 0/15 * * * ?") |
| | | public void supervise_notification_realtime_power_info() { |
| | | if(null != port && port == 5701){ |
| | | List<Site> data = siteClient.getSiteAll().getData(); |
| | | List<Integer> siteIds = data.stream().map(Site::getId).collect(Collectors.toList()); |
| | | List<Integer> siteIds = data.stream().filter(s->s.getStatus() == 1).map(Site::getId).collect(Collectors.toList()); |
| | | List<TChargingPile> tChargingPiles = chargingPileClient.getChargingPileBySiteIds(siteIds).getData(); |
| | | List<Integer> collect1 = tChargingPiles.stream().map(TChargingPile::getId).collect(Collectors.toList()); |
| | | List<TChargingGun> chargingGunList = chargingGunClient.getChargingGunByChargingPileIds(collect1).getData(); |
| | |
| | | chargingStatisticeDTO.setEndTime(now); |
| | | List<TChargingOrder> data1 = chargingOrderClient.getChargingStatistics(chargingStatisticeDTO).getData(); |
| | | for (Site datum : data) { |
| | | List<TChargingOrder> collect = data1.stream().filter(e -> e.getSiteId().equals(datum.getId()) |
| | | &&e.getChargingPower()!=null).collect(Collectors.toList()); |
| | | List<TChargingOrder> collect = data1.stream().filter(e -> e.getSiteId().equals(datum.getId()) && e.getChargingPower()!=null).collect(Collectors.toList()); |
| | | SupStationPowerInfo supStationPowerInfo = new SupStationPowerInfo(); |
| | | supStationPowerInfo.setOperatorID("906171535"); |
| | | supStationPowerInfo.setEquipmentOwnerID("906171535"); |
| | | supStationPowerInfo.setStationID(datum.getId().toString()); |
| | | supStationPowerInfo.setStationClassification(1); |
| | | supStationPowerInfo.setDataTime(DateUtils.localDateTimeToString(LocalDateTime.now())); |
| | | BigDecimal divide = collect.stream().map(TChargingOrder::getChargingPower).reduce(BigDecimal::add).get().divide(new BigDecimal(collect.size()).setScale(4, BigDecimal.ROUND_DOWN)); |
| | | BigDecimal divide = collect.stream().map(TChargingOrder::getChargingPower).reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal(collect.size()).setScale(4, BigDecimal.ROUND_DOWN)); |
| | | supStationPowerInfo.setStationRealTimePower(divide); |
| | | supStationPowerInfo.setEquipmentPowerInfos(buildEquipmentPowerInfo(datum.getId(), tChargingPiles, chargingGunList)); |
| | | stationStatsInfos.add(supStationPowerInfo); |
| | | } |
| | | supStationPowerInfoResult.setSupStationPowerInfos(stationStatsInfos); |
| | | tcecSuperviseUtil.superviseNotificationRealtimePowerInfo(supStationPowerInfoResult); |
| | | |
| | | } |
| | | } |
| | | /** |
| | | * 构建桩数据 |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/AcquisitionBillingModeMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/base/BaseMessage.java |
| | |
| | | package com.ruoyi.integration.rocket.base; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import lombok.Data; |
| | | |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/BillingModeVerifyMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
New file |
| | |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 充电阶段BMS中止 |
| | | **/ |
| | | |
| | | @Data |
| | | public class BmsAbortMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private String bms_stop_charging_reason; // BMS 中止充电原因(1-2 位——所需求的 SOC 目标值,3-4 位——达到总电压的设定值,5-6 位——达到单体电压设定值,7-8 位——充电机主动中止) |
| | | private String bms_aborted_charging_fault_cause; // BMS 中止充电故障原因(1-2 位——绝缘故障,3-4 位——输出连接器过温故障,5-6 位——BMS 元件、输出连接器过温,7-8 位——充电连接器故障,9-10 位——电池组温度过高故障,11-12 位——高压继电器故障,13 位-14 位——检测点 2 电压检测故障,15-16 位——其他故障) |
| | | private String bms_aborted_charging_error_cause; // BMS 中止充电错误原因(1-2 位——电流过大,3-4 位——电压异常,5-8 位——预留位) |
| | | |
| | | } |
| | | |
| | | |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/BmsDemandAndChargerExportationMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/BmsInformationMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/ChargingHandshakeMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/ChargingMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | @Data |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/base/ChargingOrderMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.base; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import lombok.Data; |
| | | |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/ChargingPileReturnsGroundLockDataMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/ChargingPileStartsChargingMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/ClearOfflineCardReplyMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/EndChargeMessage.java |
| | |
| | | package com.ruoyi.integration.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/ErrorMessageMessage.java |
| | |
| | | package com.ruoyi.integration.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | @Data |
| | | @Document(collection = "error_message") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ErrorMessageMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/GroundLockRealTimeDataMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/base/GunStatusMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.base; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import lombok.Data; |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 充电阶段充电机中止 |
| | | **/ |
| | | |
| | | @Data |
| | | public class MotorAbortMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private String charger_stops_charging_reason; // 充电机中止充电原因(1-2 位——达到充电机设定的条件中止,3-4 位——人工中止,5-6 位——异常中止) |
| | | private String charging_failure_cause; // 充电机中止充电故障原因(1-2 位——充电机过温故障,3-4 位——充电连接器故障,5-6 位——充电机内部过温故障,7-8 位——所需电量不能传送,9-10 位——充电机急停故障,11-12 位——其他故障,13-16 位——预留位) |
| | | private String charging_machine_stopped_charging_error_cause; // 充电机中止充电错误原因(1-2 位——电流不匹配,3-4 位——电压异常,5-8 位——预留位) |
| | | |
| | | } |
| | | |
| | | |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/OnlineMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/ParameterSettingMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/PingMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/PlatformRemoteUpdateReplyMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/PlatformRestartReplyMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/PlatformStartChargingReplyMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/PlatformStopChargingReplyMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/QrCodeDeliveryMessage.java |
| | |
| | | package com.ruoyi.integration.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/QrCodeDeliveryReplyMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/QueryOfflineCardReplyMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/SecurityDetectionMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/SetupBillingModelReplyMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/SynchronizeOfflineCardReplyMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/TimingSettingMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/TimingSettingReplyMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/TransactionRecordMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/UpdateBalanceReplyMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/UploadRealTimeMonitoringDataMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/WorkingParameterSettingReplyMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.integration.iotda.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.integration.api.model.*; |
| | | import com.ruoyi.integration.iotda.constant.SendTagConstant; |
| | | import com.ruoyi.integration.iotda.enums.ServiceIdMenu; |
| | | import com.ruoyi.integration.iotda.model.*; |
| | | import com.ruoyi.integration.iotda.utils.produce.IotMessageProduce; |
| | | import com.ruoyi.integration.iotda.utils.tools.CP56Time2aConverter; |
| | | import com.ruoyi.integration.iotda.utils.tools.MessageUtil; |
| | | import com.ruoyi.integration.iotda.utils.tools.StrategyUtil; |
| | | import com.ruoyi.integration.rocket.model.*; |
| | | import com.ruoyi.integration.rocket.produce.EnhanceProduce; |
| | | import com.ruoyi.integration.iotda.utils.tools.ChargingMessageUtil; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.client.producer.SendResult; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.FileWriter; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | |
| | | public class IotMessageListener { |
| | | |
| | | @Autowired |
| | | private EnhanceProduce enhanceProduce; |
| | | @Autowired |
| | | private MessageUtil messageUtil; |
| | | @Autowired |
| | | private IotMessageProduce iotMessageProduce; |
| | |
| | | |
| | | @Resource |
| | | private ChargingPileClient chargingPileClient; |
| | | |
| | | @Resource |
| | | private ChargingMessageUtil chargingMessageUtil; |
| | | |
| | | |
| | | |
| | |
| | | @PostMapping(value = "/message") |
| | | public AjaxResult<String> message(@RequestBody JSONObject jsonObject) throws IOException { |
| | | log.info("接收到消息中转:{}",jsonObject); |
| | | JSONObject content = jsonObject.getJSONObject("notify_data").getJSONObject("body").getJSONObject("content"); |
| | | JSONObject body = jsonObject.getJSONObject("notify_data").getJSONObject("body"); |
| | | JSONObject content = null; |
| | | try { |
| | | content = body.getJSONObject("content"); |
| | | }catch (Exception e){ |
| | | String content1 = body.getString("content"); |
| | | String substring = content1.substring(content1.length() - 1); |
| | | if(!"}".equals(substring)){ |
| | | content1 = content1.substring(0, content1.length() - 1) + "}"; |
| | | } |
| | | log.info("content1:"+content1); |
| | | content = JSON.parseObject(content1); |
| | | } |
| | | JSONObject header = jsonObject.getJSONObject("notify_data").getJSONObject("header"); |
| | | String deviceId = header.getString("device_id"); // 设备id |
| | | String nodeId = header.getString("node_id"); // 设备编号 |
| | | String productId = header.getString("product_id"); // 产品id |
| | | String service_id = content.getString("service_id"); |
| | | log.info("服务id:{}",service_id); |
| | | // 写入文件 |
| | | // FileWriter writer = new FileWriter("D:/sample.txt",true); |
| | | // writer.write("接收到消息中转:"+jsonObject+"\n"); |
| | | // writer.write("服务id:"+service_id+"\n"); |
| | | // writer.close(); |
| | | SendResult sendResult; |
| | | ChargingMessage chargingMessage = new ChargingMessage(); |
| | | chargingMessage.setServiceId(service_id); |
| | | // 设备消息下发 |
| | | String result; |
| | | switch (service_id){ |
| | | case SendTagConstant.ONLINE: |
| | | long ONLINE = System.currentTimeMillis(); |
| | | |
| | | OnlineMessage onlineMessage = JSON.parseObject(content.toJSONString(),OnlineMessage.class); |
| | | sendResult = enhanceProduce.onlineMessage(onlineMessage); |
| | | // chargingMessage.setOnlineMessage(onlineMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | chargingMessage.setOnlineMessage(onlineMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | // 响应硬件 |
| | | // 业务处理 登录认证应答 |
| | | OnlineReply onlineReply = new OnlineReply(); |
| | |
| | | timingSettingReplyOnline.setCharging_pile_code(onlineMessage.getCharging_pile_code()); |
| | | timingSettingReplyOnline.setCurrent_time(CP56Time2aConverter.convertToCP56Time2a(new Date())); |
| | | iotMessageProduce.sendMessage(timingSettingReplyOnline.getCharging_pile_code(), ServiceIdMenu.TIMING_SETTING_REPLY.getKey(),messageUtil.timingSettingReply(timingSettingReplyOnline)); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | |
| | | log.warn("ONLINE消息处理:{} 毫秒", System.currentTimeMillis() - ONLINE); |
| | | break; |
| | | case SendTagConstant.PING: |
| | | long PING = System.currentTimeMillis(); |
| | | |
| | | PingMessage pingMessage = JSON.parseObject(content.toJSONString(),PingMessage.class); |
| | | //存储缓存中,5分钟有效 |
| | | redisTemplate.opsForValue().set("ping:" + pingMessage.getCharging_pile_code() + pingMessage.getCharging_gun_code(), pingMessage, 5, TimeUnit.MINUTES); |
| | | sendResult = null; |
| | | // sendResult = enhanceProduce.pingMessage(pingMessage); |
| | | // chargingMessage.setPingMessage(pingMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | // 响应硬件 |
| | | Pong pong = new Pong(); |
| | | pong.setCharging_pile_code(pingMessage.getCharging_pile_code()); |
| | |
| | | pong.setCharging_gun_status(0); |
| | | iotMessageProduce.sendMessage(pong.getCharging_pile_code(), ServiceIdMenu.PONG.getKey(), messageUtil.pong(pong)); |
| | | |
| | | |
| | | Long time = (Long) redisTemplate.opsForHash().get("charging_gun_online", (pingMessage.getCharging_pile_code() + pingMessage.getCharging_gun_code())); |
| | | //小于1分钟才处理数据,防止频繁查询数据 |
| | | if(null != time && (System.currentTimeMillis() - time) < 60000){ |
| | | log.warn("PING消息处理:{} 毫秒", System.currentTimeMillis() - PING); |
| | | break; |
| | | } |
| | | |
| | | //检查修改设备状态 |
| | | UpdateChargingPileStatusVo vo1 = new UpdateChargingPileStatusVo(); |
| | | vo1.setGun_code(pingMessage.getCharging_gun_code()); |
| | | vo1.setPile_code(pingMessage.getCharging_pile_code()); |
| | | vo1.setStatus(pingMessage.getCharging_gun_status()); |
| | | chargingPileClient.updateChargingPileStatus(vo1); |
| | | // 监管平台推送充电设备状态 |
| | | String gunCode = pingMessage.getCharging_pile_code() + pingMessage.getCharging_gun_code(); |
| | | ChargingMessage chargingMessage1 = new ChargingMessage(); |
| | | chargingMessage1.setServiceId(SendTagConstant.GUN_STATUS); |
| | | GunStatusMessage gunStatusMessage = new GunStatusMessage(); |
| | | gunStatusMessage.setFullNumber(gunCode); |
| | | chargingMessage1.setGunStatusMessage(gunStatusMessage); |
| | | sendResult = enhanceProduce.gunStatusMessage(chargingMessage1); |
| | | |
| | | |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | log.warn("PING消息处理:{} 毫秒", System.currentTimeMillis() - PING); |
| | | break; |
| | | case SendTagConstant.END_CHARGE: |
| | | long END_CHARGE = System.currentTimeMillis(); |
| | | |
| | | EndChargeMessage endChargeMessage = JSON.parseObject(content.toJSONString(),EndChargeMessage.class); |
| | | sendResult = enhanceProduce.endChargeMessage(endChargeMessage); |
| | | // chargingMessage.setEndChargeMessage(endChargeMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | // 响应硬件 |
| | | chargingMessage.setEndChargeMessage(endChargeMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | log.warn("END_CHARGE消息处理:{} 毫秒", System.currentTimeMillis() - END_CHARGE); |
| | | break; |
| | | case SendTagConstant.ERROR_MESSAGE: |
| | | long ERROR_MESSAGE = System.currentTimeMillis(); |
| | | |
| | | ErrorMessageMessage errorMessageMessage = JSON.parseObject(content.toJSONString(),ErrorMessageMessage.class); |
| | | sendResult = enhanceProduce.errorMessageMessage(errorMessageMessage); |
| | | // chargingMessage.setErrorMessageMessage(errorMessageMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | // 响应硬件 |
| | | chargingMessage.setErrorMessageMessage(errorMessageMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | log.warn("ERROR_MESSAGE消息处理:{} 毫秒", System.currentTimeMillis() - ERROR_MESSAGE); |
| | | break; |
| | | case SendTagConstant.BILLING_MODE_VERIFY: |
| | | long BILLING_MODE_VERIFY = System.currentTimeMillis(); |
| | | |
| | | BillingModeVerifyMessage billingModeVerifyMessage = JSON.parseObject(content.toJSONString(),BillingModeVerifyMessage.class); |
| | | sendResult = enhanceProduce.billingModeVerifyMessage(billingModeVerifyMessage); |
| | | // chargingMessage.setBillingModeVerifyMessage(billingModeVerifyMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | chargingMessage.setBillingModeVerifyMessage(billingModeVerifyMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | // 响应硬件 |
| | | BillingModeVerifyReply billingModeVerifyReply = new BillingModeVerifyReply(); |
| | | if(billingModeVerifyMessage.getBilling_model_code().equals("0")){ |
| | |
| | | } |
| | | } |
| | | iotMessageProduce.sendMessage(billingModeVerifyReply.getCharging_pile_code(), ServiceIdMenu.BILLING_MODE_VERIFY_REPLY.getKey(),messageUtil.billingModeVerifyReply(billingModeVerifyReply)); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | |
| | | log.warn("ERROR_MESSAGE消息处理:{} 毫秒", System.currentTimeMillis() - BILLING_MODE_VERIFY); |
| | | break; |
| | | case SendTagConstant.ACQUISITION_BILLING_MODE: |
| | | long ACQUISITION_BILLING_MODE = System.currentTimeMillis(); |
| | | |
| | | AcquisitionBillingModeMessage acquisitionBillingModeMessage = JSON.parseObject(content.toJSONString(),AcquisitionBillingModeMessage.class); |
| | | sendResult = enhanceProduce.acquisitionBillingModeMessage(acquisitionBillingModeMessage); |
| | | // chargingMessage.setAcquisitionBillingModeMessage(acquisitionBillingModeMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | chargingMessage.setAcquisitionBillingModeMessage(acquisitionBillingModeMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | // 响应硬件 计费模型请求应答 1=尖阶段,2=峰阶段,3=平阶段,4=谷阶段 |
| | | List<TAccountingStrategyDetail> accountingStrategyDetails = accountingStrategyDetailClient.getDetailListByCode(acquisitionBillingModeMessage.getCharging_pile_code()).getData(); |
| | | Map<Integer, TAccountingStrategyDetail> strategyPrice = StrategyUtil.getStrategyPrice(accountingStrategyDetails); |
| | |
| | | acquisitionBillingModeReply.setCharging_pile_code(acquisitionBillingModeMessage.getCharging_pile_code()); |
| | | acquisitionBillingModeReply.setLoss_ratio(BigDecimal.ZERO); |
| | | iotMessageProduce.sendMessage(acquisitionBillingModeReply.getCharging_pile_code(), ServiceIdMenu.ACQUISITION_BILLING_MODE_REPLY.getKey(),messageUtil.acquisitionBillingModeReply(acquisitionBillingModeReply)); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | |
| | | log.warn("ACQUISITION_BILLING_MODE消息处理:{} 毫秒", System.currentTimeMillis() - ACQUISITION_BILLING_MODE); |
| | | break; |
| | | case SendTagConstant.UPLOAD_REAL_TIME_MONITORING_DATA: |
| | | long UPLOAD_REAL_TIME_MONITORING_DATA = System.currentTimeMillis(); |
| | | |
| | | log.info("充电实时数据上传"); |
| | | UploadRealTimeMonitoringDataMessage uploadRealTimeMonitoringDataMessage = JSON.parseObject(content.toJSONString(),UploadRealTimeMonitoringDataMessage.class); |
| | | sendResult = enhanceProduce.uploadRealTimeMonitoringDataMessage(uploadRealTimeMonitoringDataMessage); |
| | | // chargingMessage.setUploadRealTimeMonitoringDataMessage(uploadRealTimeMonitoringDataMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | // 响应硬件 |
| | | chargingMessage.setUploadRealTimeMonitoringDataMessage(uploadRealTimeMonitoringDataMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | log.warn("UPLOAD_REAL_TIME_MONITORING_DATA消息处理:{} 毫秒", System.currentTimeMillis() - UPLOAD_REAL_TIME_MONITORING_DATA); |
| | | break; |
| | | case SendTagConstant.CHARGING_HANDSHAKE: |
| | | long CHARGING_HANDSHAKE = System.currentTimeMillis(); |
| | | |
| | | ChargingHandshakeMessage chargingHandshakeMessage = JSON.parseObject(content.toJSONString(),ChargingHandshakeMessage.class); |
| | | sendResult = enhanceProduce.chargingHandshakeMessage(chargingHandshakeMessage); |
| | | // chargingMessage.setChargingHandshakeMessage(chargingHandshakeMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | // 响应硬件 |
| | | chargingMessage.setChargingHandshakeMessage(chargingHandshakeMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | log.warn("CHARGING_HANDSHAKE消息处理:{} 毫秒", System.currentTimeMillis() - CHARGING_HANDSHAKE); |
| | | break; |
| | | case SendTagConstant.PARAMETER_SETTING: |
| | | long PARAMETER_SETTING = System.currentTimeMillis(); |
| | | |
| | | ParameterSettingMessage parameterSettingMessage = JSON.parseObject(content.toJSONString(),ParameterSettingMessage.class); |
| | | sendResult = enhanceProduce.parameterSettingMessage(parameterSettingMessage); |
| | | // chargingMessage.setParameterSettingMessage(parameterSettingMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | chargingMessage.setParameterSettingMessage(parameterSettingMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | log.warn("PARAMETER_SETTING消息处理:{} 毫秒", System.currentTimeMillis() - PARAMETER_SETTING); |
| | | break; |
| | | case SendTagConstant.BMS_ABORT: |
| | | long BMS_ABORT = System.currentTimeMillis(); |
| | | |
| | | BmsAbortMessage bmsAbortMessage = JSON.parseObject(content.toJSONString(),BmsAbortMessage.class); |
| | | sendResult = enhanceProduce.bmsAbortMessage(bmsAbortMessage); |
| | | // chargingMessage.setBmsAbortMessage(bmsAbortMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | // 响应硬件 |
| | | chargingMessage.setBmsAbortMessage(bmsAbortMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | log.warn("BMS_ABORT消息处理:{} 毫秒", System.currentTimeMillis() - BMS_ABORT); |
| | | break; |
| | | case SendTagConstant.MOTOR_ABORT: |
| | | long MOTOR_ABORT = System.currentTimeMillis(); |
| | | |
| | | MotorAbortMessage motorAbortMessage = JSON.parseObject(content.toJSONString(),MotorAbortMessage.class); |
| | | sendResult = enhanceProduce.motorAbortMessage(motorAbortMessage); |
| | | // chargingMessage.setMotorAbortMessage(motorAbortMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | chargingMessage.setMotorAbortMessage(motorAbortMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | log.warn("MOTOR_ABORT消息处理:{} 毫秒", System.currentTimeMillis() - MOTOR_ABORT); |
| | | break; |
| | | case SendTagConstant.BMS_DEMAND_AND_CHARGER_EXPORTATION: |
| | | long BMS_DEMAND_AND_CHARGER_EXPORTATION = System.currentTimeMillis(); |
| | | |
| | | BmsDemandAndChargerExportationMessage bmsDemandAndChargerExportationMessage = JSON.parseObject(content.toJSONString(),BmsDemandAndChargerExportationMessage.class); |
| | | sendResult = enhanceProduce.bmsDemandAndChargerExportationMessage(bmsDemandAndChargerExportationMessage); |
| | | // chargingMessage.setBmsDemandAndChargerExportationMessage(bmsDemandAndChargerExportationMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | // 响应硬件 |
| | | chargingMessage.setBmsDemandAndChargerExportationMessage(bmsDemandAndChargerExportationMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | log.warn("BMS_DEMAND_AND_CHARGER_EXPORTATION消息处理:{} 毫秒", System.currentTimeMillis() - BMS_DEMAND_AND_CHARGER_EXPORTATION); |
| | | break; |
| | | case SendTagConstant.BMS_INFORMATION: |
| | | long BMS_INFORMATION = System.currentTimeMillis(); |
| | | |
| | | BmsInformationMessage bmsInformationMessage = JSON.parseObject(content.toJSONString(),BmsInformationMessage.class); |
| | | sendResult = enhanceProduce.bmsInformationMessage(bmsInformationMessage); |
| | | // chargingMessage.setBmsInformationMessage(bmsInformationMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | // 响应硬件 |
| | | chargingMessage.setBmsInformationMessage(bmsInformationMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | log.warn("BMS_INFORMATION消息处理:{} 毫秒", System.currentTimeMillis() - BMS_INFORMATION); |
| | | break; |
| | | case SendTagConstant.CHARGING_PILE_STARTS_CHARGING: |
| | | long CHARGING_PILE_STARTS_CHARGING = System.currentTimeMillis(); |
| | | |
| | | ChargingPileStartsChargingMessage chargingPileStartsChargingMessage = JSON.parseObject(content.toJSONString(),ChargingPileStartsChargingMessage.class); |
| | | sendResult = enhanceProduce.chargingPileStartsChargingMessage(chargingPileStartsChargingMessage); |
| | | // chargingMessage.setChargingPileStartsChargingMessage(chargingPileStartsChargingMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | chargingMessage.setChargingPileStartsChargingMessage(chargingPileStartsChargingMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | // 响应硬件 |
| | | PlatformConfirmationCharging platformConfirmationCharging = new PlatformConfirmationCharging(); |
| | | platformConfirmationCharging.setCharging_pile_code(chargingPileStartsChargingMessage.getCharging_pile_code()); |
| | |
| | | platformConfirmationCharging.setAuthentication(1); |
| | | // TODO 若是失败,给出失败原因 |
| | | iotMessageProduce.sendMessage(platformConfirmationCharging.getCharging_pile_code(), ServiceIdMenu.PLATFORM_CONFIRMATION_CHARGING.getKey(),messageUtil.platformConfirmationCharging(platformConfirmationCharging)); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | |
| | | log.warn("CHARGING_PILE_STARTS_CHARGING消息处理:{} 毫秒", System.currentTimeMillis() - CHARGING_PILE_STARTS_CHARGING); |
| | | break; |
| | | case SendTagConstant.PLATFORM_START_CHARGING_REPLY: |
| | | long PLATFORM_START_CHARGING_REPLY = System.currentTimeMillis(); |
| | | |
| | | PlatformStartChargingReplyMessage platformStartChargingReplyMessage = JSON.parseObject(content.toJSONString(),PlatformStartChargingReplyMessage.class); |
| | | sendResult = enhanceProduce.platformStartChargingReplyMessage(platformStartChargingReplyMessage); |
| | | // chargingMessage.setPlatformStartChargingReplyMessage(platformStartChargingReplyMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | // 响应硬件 |
| | | chargingMessage.setPlatformStartChargingReplyMessage(platformStartChargingReplyMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | log.warn("PLATFORM_START_CHARGING_REPLY消息处理:{} 毫秒", System.currentTimeMillis() - PLATFORM_START_CHARGING_REPLY); |
| | | break; |
| | | case SendTagConstant.PLATFORM_STOP_CHARGING_REPLY: |
| | | long PLATFORM_STOP_CHARGING_REPLY = System.currentTimeMillis(); |
| | | |
| | | PlatformStopChargingReplyMessage platformStopChargingReplyMessage = JSON.parseObject(content.toJSONString(),PlatformStopChargingReplyMessage.class); |
| | | sendResult = enhanceProduce.platformStopChargingReplyMessage(platformStopChargingReplyMessage); |
| | | // chargingMessage.setPlatformStopChargingReplyMessage(platformStopChargingReplyMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | // 响应硬件 |
| | | chargingMessage.setPlatformStopChargingReplyMessage(platformStopChargingReplyMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | log.warn("PLATFORM_STOP_CHARGING_REPLY消息处理:{} 毫秒", System.currentTimeMillis() - PLATFORM_STOP_CHARGING_REPLY); |
| | | break; |
| | | case SendTagConstant.TRANSACTION_RECORD: |
| | | long TRANSACTION_RECORD = System.currentTimeMillis(); |
| | | |
| | | TransactionRecordMessage transactionRecordMessage = JSON.parseObject(content.toJSONString(),TransactionRecordMessage.class); |
| | | transactionRecordMessage.setResult(content.toJSONString()); |
| | | sendResult = enhanceProduce.transactionRecordMessage(transactionRecordMessage); |
| | | // chargingMessage.setTransactionRecordMessage(transactionRecordMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | chargingMessage.setTransactionRecordMessage(transactionRecordMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | // 响应硬件 |
| | | ConfirmTransactionRecord confirmTransactionRecord = new ConfirmTransactionRecord(); |
| | | confirmTransactionRecord.setTransaction_serial_number(transactionRecordMessage.getTransaction_serial_number()); |
| | | confirmTransactionRecord.setConfirm_result(0); |
| | | iotMessageProduce.sendMessage(transactionRecordMessage.getCharging_pile_code(), ServiceIdMenu.CONFIRM_TRANSACTION_RECORD.getKey(),messageUtil.confirmTransactionRecord(confirmTransactionRecord)); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | |
| | | log.warn("TRANSACTION_RECORD消息处理:{} 毫秒", System.currentTimeMillis() - TRANSACTION_RECORD); |
| | | break; |
| | | case SendTagConstant.UPDATE_BALANCE_REPLY: |
| | | long UPDATE_BALANCE_REPLY = System.currentTimeMillis(); |
| | | |
| | | UpdateBalanceReplyMessage updateBalanceReplyMessage = JSON.parseObject(content.toJSONString(),UpdateBalanceReplyMessage.class); |
| | | sendResult = enhanceProduce.updateBalanceReplyMessage(updateBalanceReplyMessage); |
| | | // chargingMessage.setUpdateBalanceReplyMessage(updateBalanceReplyMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | // 响应硬件 |
| | | chargingMessage.setUpdateBalanceReplyMessage(updateBalanceReplyMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | log.warn("UPDATE_BALANCE_REPLY消息处理:{} 毫秒", System.currentTimeMillis() - UPDATE_BALANCE_REPLY); |
| | | break; |
| | | case SendTagConstant.SYNCHRONIZE_OFFLINE_CARD_REPLY: |
| | | long SYNCHRONIZE_OFFLINE_CARD_REPLY = System.currentTimeMillis(); |
| | | |
| | | SynchronizeOfflineCardReplyMessage synchronizeOfflineCardReplyMessage = JSON.parseObject(content.toJSONString(),SynchronizeOfflineCardReplyMessage.class); |
| | | sendResult = enhanceProduce.synchronizeOfflineCardReplyMessage(synchronizeOfflineCardReplyMessage); |
| | | // chargingMessage.setSynchronizeOfflineCardReplyMessage(synchronizeOfflineCardReplyMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | // 响应硬件 |
| | | chargingMessage.setSynchronizeOfflineCardReplyMessage(synchronizeOfflineCardReplyMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | log.warn("SYNCHRONIZE_OFFLINE_CARD_REPLY消息处理:{} 毫秒", System.currentTimeMillis() - SYNCHRONIZE_OFFLINE_CARD_REPLY); |
| | | break; |
| | | case SendTagConstant.CLEAR_OFFLINE_CARD_REPLY: |
| | | long CLEAR_OFFLINE_CARD_REPLY = System.currentTimeMillis(); |
| | | |
| | | ClearOfflineCardReplyMessage clearOfflineCardReplyMessage = JSON.parseObject(content.toJSONString(),ClearOfflineCardReplyMessage.class); |
| | | sendResult = enhanceProduce.clearOfflineCardReplyMessage(clearOfflineCardReplyMessage); |
| | | // chargingMessage.setClearOfflineCardReplyMessage(clearOfflineCardReplyMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | // 响应硬件 |
| | | chargingMessage.setClearOfflineCardReplyMessage(clearOfflineCardReplyMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | log.warn("CLEAR_OFFLINE_CARD_REPLY消息处理:{} 毫秒", System.currentTimeMillis() - CLEAR_OFFLINE_CARD_REPLY); |
| | | break; |
| | | case SendTagConstant.WORKING_PARAMETER_SETTING_REPLY: |
| | | long WORKING_PARAMETER_SETTING_REPLY = System.currentTimeMillis(); |
| | | |
| | | WorkingParameterSettingReplyMessage workingParameterSettingReplyMessage = JSON.parseObject(content.toJSONString(),WorkingParameterSettingReplyMessage.class); |
| | | sendResult = enhanceProduce.workingParameterSettingReplyMessage(workingParameterSettingReplyMessage); |
| | | // chargingMessage.setWorkingParameterSettingReplyMessage(workingParameterSettingReplyMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | // 响应硬件 |
| | | chargingMessage.setWorkingParameterSettingReplyMessage(workingParameterSettingReplyMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | log.warn("WORKING_PARAMETER_SETTING_REPLY消息处理:{} 毫秒", System.currentTimeMillis() - WORKING_PARAMETER_SETTING_REPLY); |
| | | break; |
| | | case SendTagConstant.TIMING_SETTING: |
| | | long TIMING_SETTING = System.currentTimeMillis(); |
| | | |
| | | TimingSettingMessage timingSettingMessage = JSON.parseObject(content.toJSONString(),TimingSettingMessage.class); |
| | | sendResult = enhanceProduce.timingSettingMessage(timingSettingMessage); |
| | | // chargingMessage.setTimingSettingMessage(timingSettingMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | chargingMessage.setTimingSettingMessage(timingSettingMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | // 响应硬件 对时设置应答 |
| | | TimingSettingReply timingSettingReply = new TimingSettingReply(); |
| | | timingSettingReply.setCharging_pile_code(timingSettingMessage.getCharging_pile_code()); |
| | | timingSettingReply.setCurrent_time(CP56Time2aConverter.convertToCP56Time2a(new Date())); |
| | | iotMessageProduce.sendMessage(timingSettingReply.getCharging_pile_code(), ServiceIdMenu.TIMING_SETTING_REPLY.getKey(),messageUtil.timingSettingReply(timingSettingReply)); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | |
| | | log.warn("TIMING_SETTING消息处理:{} 毫秒", System.currentTimeMillis() - TIMING_SETTING); |
| | | break; |
| | | case SendTagConstant.SETUP_BILLING_MODEL_REPLY: |
| | | long SETUP_BILLING_MODEL_REPLY = System.currentTimeMillis(); |
| | | |
| | | SetupBillingModelReplyMessage setupBillingModelReplyMessage = JSON.parseObject(content.toJSONString(),SetupBillingModelReplyMessage.class); |
| | | sendResult = enhanceProduce.setupBillingModelReplyMessage(setupBillingModelReplyMessage); |
| | | // chargingMessage.setSetupBillingModelReplyMessage(setupBillingModelReplyMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | // 响应硬件 |
| | | chargingMessage.setSetupBillingModelReplyMessage(setupBillingModelReplyMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | log.warn("SETUP_BILLING_MODEL_REPLY消息处理:{} 毫秒", System.currentTimeMillis() - SETUP_BILLING_MODEL_REPLY); |
| | | break; |
| | | case SendTagConstant.GROUND_LOCK_REAL_TIME_DATA: |
| | | long GROUND_LOCK_REAL_TIME_DATA = System.currentTimeMillis(); |
| | | |
| | | GroundLockRealTimeDataMessage groundLockRealTimeDataMessage = JSON.parseObject(content.toJSONString(),GroundLockRealTimeDataMessage.class); |
| | | sendResult = enhanceProduce.groundLockRealTimeDataMessage(groundLockRealTimeDataMessage); |
| | | // chargingMessage.setGroundLockRealTimeDataMessage(groundLockRealTimeDataMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | // 响应硬件 |
| | | chargingMessage.setGroundLockRealTimeDataMessage(groundLockRealTimeDataMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | log.warn("GROUND_LOCK_REAL_TIME_DATA消息处理:{} 毫秒", System.currentTimeMillis() - GROUND_LOCK_REAL_TIME_DATA); |
| | | break; |
| | | case SendTagConstant.CHARGING_PILE_RETURNS_GROUND_LOCK_DATA: |
| | | long CHARGING_PILE_RETURNS_GROUND_LOCK_DATA = System.currentTimeMillis(); |
| | | |
| | | ChargingPileReturnsGroundLockDataMessage chargingPileReturnsGroundLockDataMessage = JSON.parseObject(content.toJSONString(),ChargingPileReturnsGroundLockDataMessage.class); |
| | | sendResult = enhanceProduce.chargingPileReturnsGroundLockDataMessage(chargingPileReturnsGroundLockDataMessage); |
| | | // chargingMessage.setChargingPileReturnsGroundLockDataMessage(chargingPileReturnsGroundLockDataMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | // 响应硬件 |
| | | chargingMessage.setChargingPileReturnsGroundLockDataMessage(chargingPileReturnsGroundLockDataMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | log.warn("CHARGING_PILE_RETURNS_GROUND_LOCK_DATA消息处理:{} 毫秒", System.currentTimeMillis() - CHARGING_PILE_RETURNS_GROUND_LOCK_DATA); |
| | | break; |
| | | case SendTagConstant.PLATFORM_RESTART_REPLY: |
| | | long PLATFORM_RESTART_REPLY = System.currentTimeMillis(); |
| | | |
| | | PlatformRestartReplyMessage platformRestartReplyMessage = JSON.parseObject(content.toJSONString(),PlatformRestartReplyMessage.class); |
| | | sendResult = enhanceProduce.platformRestartReplyMessage(platformRestartReplyMessage); |
| | | // chargingMessage.setPlatformRestartReplyMessage(platformRestartReplyMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | // 响应硬件 |
| | | chargingMessage.setPlatformRestartReplyMessage(platformRestartReplyMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | log.warn("PLATFORM_RESTART_REPLY消息处理:{} 毫秒", System.currentTimeMillis() - PLATFORM_RESTART_REPLY); |
| | | break; |
| | | case SendTagConstant.QR_CODE_DELIVERY_REPLY: |
| | | long QR_CODE_DELIVERY_REPLY = System.currentTimeMillis(); |
| | | |
| | | QrCodeDeliveryReplyMessage qrCodeDeliveryReplyMessage = JSON.parseObject(content.toJSONString(),QrCodeDeliveryReplyMessage.class); |
| | | sendResult = enhanceProduce.qrCodeDeliveryReplyMessage(qrCodeDeliveryReplyMessage); |
| | | // chargingMessage.setQrCodeDeliveryReplyMessage(qrCodeDeliveryReplyMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | // 响应硬件 |
| | | chargingMessage.setQrCodeDeliveryReplyMessage(qrCodeDeliveryReplyMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | log.warn("QR_CODE_DELIVERY_REPLY消息处理:{} 毫秒", System.currentTimeMillis() - QR_CODE_DELIVERY_REPLY); |
| | | break; |
| | | case SendTagConstant.SECURITY_DETECTION: |
| | | long SECURITY_DETECTION = System.currentTimeMillis(); |
| | | |
| | | SecurityDetectionMessage securityDetectionMessage = JSON.parseObject(content.toJSONString(),SecurityDetectionMessage.class); |
| | | sendResult = enhanceProduce.securityDetectionMessage(securityDetectionMessage); |
| | | // chargingMessage.setSecurityDetectionMessage(securityDetectionMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | // 响应硬件 |
| | | chargingMessage.setSecurityDetectionMessage(securityDetectionMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | log.warn("SECURITY_DETECTION消息处理:{} 毫秒", System.currentTimeMillis() - SECURITY_DETECTION); |
| | | break; |
| | | default: |
| | | long other = System.currentTimeMillis(); |
| | | |
| | | PlatformRemoteUpdateReplyMessage platformRemoteUpdateReplyMessage = JSON.parseObject(content.toJSONString(),PlatformRemoteUpdateReplyMessage.class); |
| | | sendResult = enhanceProduce.platformRemoteUpdateReplyMessage(platformRemoteUpdateReplyMessage); |
| | | // chargingMessage.setPlatformRemoteUpdateReplyMessage(platformRemoteUpdateReplyMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | // 响应硬件 |
| | | chargingMessage.setPlatformRemoteUpdateReplyMessage(platformRemoteUpdateReplyMessage); |
| | | chargingMessageUtil.handleMessage(chargingMessage); |
| | | |
| | | log.warn("other消息处理:{} 毫秒", System.currentTimeMillis() - other); |
| | | break; |
| | | } |
| | | log.info("rocketmq消息下发结果:{}",sendResult); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | return JSON.toJSONString(response); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.info("消息下发至设备异常:code---{},msg---{}", code, e.getMessage()); |
| | | log.error("消息下发至设备异常:code---{},msg---{}", code, e.getMessage()); |
| | | return e.getMessage(); |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.iotda.utils.tools; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.chargingPile.api.feignClient.AccountingStrategyDetailClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | import com.ruoyi.chargingPile.api.vo.UpdateChargingPileStatusVo; |
| | | import com.ruoyi.integration.api.model.*; |
| | | import com.ruoyi.integration.iotda.constant.SendTagConstant; |
| | | import com.ruoyi.integration.iotda.model.*; |
| | | import com.ruoyi.integration.mongodb.service.*; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.query.UploadRealTimeMonitoringDataQuery; |
| | | import com.ruoyi.order.api.vo.PlatformStartChargingReplyMessageVO; |
| | | import com.ruoyi.order.api.vo.PlatformStopChargingReplyVO; |
| | | import com.ruoyi.order.api.vo.SecurityDetectionVO; |
| | | import com.ruoyi.order.api.vo.TransactionRecordMessageVO; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.RoundingMode; |
| | | import java.util.Objects; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | |
| | | @Slf4j |
| | | @Component |
| | | public class ChargingMessageUtil { |
| | | |
| | | @Autowired |
| | | private AcquisitionBillingModeService acquisitionBillingModeService; |
| | | @Autowired |
| | | private BillingModeVerifyService billingModeVerifyService; |
| | | @Autowired |
| | | private BmsAbortService bmsAbortService; |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | @Autowired |
| | | private BmsDemandAndChargerExportationService bmsDemandAndChargerExportationService; |
| | | @Autowired |
| | | private OnlineService onlineService; |
| | | @Autowired |
| | | private PingService pingService; |
| | | @Autowired |
| | | private EndChargeService endChargeService; |
| | | @Autowired |
| | | private ErrorMessageMessageService errorMessageMessageService; |
| | | @Autowired |
| | | private UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService; |
| | | @Resource |
| | | private AccountingStrategyDetailClient accountingStrategyDetailClient; |
| | | @Autowired |
| | | private ChargingHandshakeService chargingHandshakeService; |
| | | @Autowired |
| | | private ParameterSettingService parameterSettingService; |
| | | @Autowired |
| | | private MotorAbortService motorAbortService; |
| | | @Autowired |
| | | private BmsInformationService bmsInformationService; |
| | | @Autowired |
| | | private ChargingPileStartsChargingService chargingPileStartsChargingService; |
| | | @Autowired |
| | | private PlatformStartChargingReplyService platformStartChargingReplyService; |
| | | @Autowired |
| | | private PlatformStopChargingReplyService platformStopChargingReplyService; |
| | | @Autowired |
| | | private TransactionRecordService transactionRecordService; |
| | | @Autowired |
| | | private UpdateBalanceReplyService updateBalanceReplyService; |
| | | @Autowired |
| | | private SynchronizeOfflineCardReplyService synchronizeOfflineCardReplyService; |
| | | @Autowired |
| | | private ClearOfflineCardReplyService clearOfflineCardReplyService; |
| | | @Autowired |
| | | private WorkingParameterSettingReplyService workingParameterSettingReplyService; |
| | | @Autowired |
| | | private TimingSettingService timingSettingService; |
| | | @Autowired |
| | | private SetupBillingModelReplyService setupBillingModelReplyService; |
| | | @Autowired |
| | | private GroundLockRealTimeDataService groundLockRealTimeDataService; |
| | | @Autowired |
| | | private ChargingPileReturnsGroundLockDataService chargingPileReturnsGroundLockDataService; |
| | | @Autowired |
| | | private PlatformRestartReplyService platformRestartReplyService; |
| | | @Autowired |
| | | private PlatformRemoteUpdateReplyService platformRemoteUpdateReplyService; |
| | | @Autowired |
| | | private QrCodeDeliveryReplyService qrCodeDeliveryReplyService; |
| | | @Autowired |
| | | private SecurityDetectionService securityDetectionService; |
| | | |
| | | @Resource |
| | | private ChargingPileClient chargingPileClient; |
| | | |
| | | @Resource |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public void handleMessage(ChargingMessage message){ |
| | | log.info("收到的消息内容:{}",message); |
| | | String serviceId = message.getServiceId(); |
| | | if(!StringUtils.hasLength(serviceId)){ |
| | | return; |
| | | } |
| | | switch (serviceId){ |
| | | case SendTagConstant.ONLINE: |
| | | OnlineMessage onlineMessage = message.getOnlineMessage(); |
| | | log.info("充电桩登录认证业务消息处理:{}",onlineMessage); |
| | | // 持久化消息 |
| | | Online online = new Online(); |
| | | BeanUtils.copyProperties(onlineMessage,online); |
| | | onlineService.create(online); |
| | | break; |
| | | case SendTagConstant.PING: |
| | | PingMessage pingMessage = message.getPingMessage(); |
| | | log.info("充电桩心跳包-业务消息处理:{}",pingMessage); |
| | | // 持久化消息 |
| | | Ping ping = new Ping(); |
| | | BeanUtils.copyProperties(pingMessage,ping); |
| | | pingService.save(ping); |
| | | //存储缓存中,5分钟有效 |
| | | redisTemplate.opsForValue().set("ping:" + ping.getCharging_pile_code() + ping.getCharging_gun_code(), ping, 5, TimeUnit.MINUTES); |
| | | |
| | | UpdateChargingPileStatusVo vo1 = new UpdateChargingPileStatusVo(); |
| | | vo1.setGun_code(pingMessage.getCharging_gun_code()); |
| | | vo1.setPile_code(pingMessage.getCharging_pile_code()); |
| | | vo1.setStatus(pingMessage.getCharging_gun_status()); |
| | | chargingPileClient.updateChargingPileStatus(vo1); |
| | | break; |
| | | case SendTagConstant.END_CHARGE: |
| | | EndChargeMessage endChargeMessage = message.getEndChargeMessage(); |
| | | log.info("充电结束-业务消息处理:{}",endChargeMessage); |
| | | // 持久化消息 |
| | | EndCharge endCharge = new EndCharge(); |
| | | BeanUtils.copyProperties(endChargeMessage,endCharge); |
| | | endChargeService.create(endCharge); |
| | | // 业务处理 |
| | | chargingOrderClient.endCharge(endCharge.getTransaction_serial_number()); |
| | | break; |
| | | case SendTagConstant.ERROR_MESSAGE: |
| | | ErrorMessageMessage errorMessageMessage1 = message.getErrorMessageMessage(); |
| | | log.info("错误报文-业务消息处理:{}",errorMessageMessage1); |
| | | // 持久化消息 |
| | | // ErrorMessageMessage errorMessageMessage = new ErrorMessageMessage(); |
| | | // BeanUtils.copyProperties(errorMessageMessage1,errorMessageMessage); |
| | | // errorMessageMessageService.create(errorMessageMessage); |
| | | break; |
| | | case SendTagConstant.BILLING_MODE_VERIFY: |
| | | BillingModeVerifyMessage billingModeVerifyMessage = message.getBillingModeVerifyMessage(); |
| | | log.info("计费模型验证请求-业务消息处理:{}",billingModeVerifyMessage); |
| | | // 持久化消息 |
| | | // BillingModeVerify billingModeVerify = new BillingModeVerify(); |
| | | // BeanUtils.copyProperties(billingModeVerifyMessage,billingModeVerify); |
| | | // billingModeVerifyService.create(billingModeVerify); |
| | | break; |
| | | case SendTagConstant.ACQUISITION_BILLING_MODE: |
| | | AcquisitionBillingModeMessage acquisitionBillingModeMessage = message.getAcquisitionBillingModeMessage(); |
| | | log.info("充电桩计费模型请求-业务消息处理:{}",acquisitionBillingModeMessage); |
| | | // 持久化消息 |
| | | AcquisitionBillingMode acquisitionBillingMode = new AcquisitionBillingMode(); |
| | | BeanUtils.copyProperties(acquisitionBillingModeMessage,acquisitionBillingMode); |
| | | acquisitionBillingModeService.create(acquisitionBillingMode); |
| | | break; |
| | | case SendTagConstant.UPLOAD_REAL_TIME_MONITORING_DATA: |
| | | //限制数据处理频率,60秒一次 |
| | | UploadRealTimeMonitoringDataMessage uploadRealTimeMonitoringDataMessage = message.getUploadRealTimeMonitoringDataMessage(); |
| | | String transaction_serial_number = uploadRealTimeMonitoringDataMessage.getTransaction_serial_number(); |
| | | Object o = redisTemplate.opsForValue().get("upload_real_time_monitoring_data:" + transaction_serial_number); |
| | | if(null != o){ |
| | | Long m = System.currentTimeMillis() - (Long) o; |
| | | if(m < 60000){ |
| | | break; |
| | | } |
| | | } |
| | | redisTemplate.opsForValue().set("upload_real_time_monitoring_data:" + transaction_serial_number, System.currentTimeMillis(), 1, TimeUnit.MINUTES); |
| | | try { |
| | | log.info("上传实时监测数据-业务消息处理:{}",uploadRealTimeMonitoringDataMessage); |
| | | // 持久化消息 |
| | | UploadRealTimeMonitoringData uploadRealTimeMonitoringData = new UploadRealTimeMonitoringData(); |
| | | BeanUtils.copyProperties(uploadRealTimeMonitoringDataMessage,uploadRealTimeMonitoringData); |
| | | // 查询mogondb上一条数据 |
| | | UploadRealTimeMonitoringData data = uploadRealTimeMonitoringDataService.getLastDataById(uploadRealTimeMonitoringDataMessage.getTransaction_serial_number()); |
| | | // 查询订单 |
| | | TChargingOrder chargingOrder = chargingOrderClient.getOrderByCode(uploadRealTimeMonitoringDataMessage.getTransaction_serial_number()).getData(); |
| | | // 查询当前时间段的计费策略 |
| | | TAccountingStrategyDetail accountingStrategyDetail = accountingStrategyDetailClient.getDetailBySiteId(chargingOrder.getSiteId()).getData(); |
| | | uploadRealTimeMonitoringData.setElectrovalence_all(accountingStrategyDetail.getElectrovalence()); |
| | | uploadRealTimeMonitoringData.setService_charge(accountingStrategyDetail.getServiceCharge()); |
| | | if (Objects.nonNull(data)) { |
| | | uploadRealTimeMonitoringDataService.updateById(data.getId()); |
| | | uploadRealTimeMonitoringData.setPeriod_electric_price(uploadRealTimeMonitoringDataMessage.getPaid_amount().subtract(data.getPaid_amount())); |
| | | uploadRealTimeMonitoringData.setPeriod_charging_degree(uploadRealTimeMonitoringDataMessage.getCharging_degree().subtract(data.getCharging_degree())); |
| | | uploadRealTimeMonitoringData.setPeriod_service_price(uploadRealTimeMonitoringDataMessage.getCharging_degree().multiply(accountingStrategyDetail.getServiceCharge()).setScale(4, RoundingMode.HALF_UP)); |
| | | }else { |
| | | log.info("首次上传实时监测数据"); |
| | | uploadRealTimeMonitoringData.setPeriod_electric_price(uploadRealTimeMonitoringDataMessage.getPaid_amount()); |
| | | uploadRealTimeMonitoringData.setPeriod_charging_degree(uploadRealTimeMonitoringDataMessage.getCharging_degree()); |
| | | uploadRealTimeMonitoringData.setPeriod_service_price(uploadRealTimeMonitoringDataMessage.getCharging_degree().multiply(accountingStrategyDetail.getServiceCharge()).setScale(4, RoundingMode.HALF_UP)); |
| | | } |
| | | uploadRealTimeMonitoringData.setOrderType(chargingOrder.getOrderType()); |
| | | uploadRealTimeMonitoringData.setSiteId(chargingOrder.getSiteId()); |
| | | uploadRealTimeMonitoringData.setStatus(chargingOrder.getStatus()); |
| | | int i = uploadRealTimeMonitoringDataService.create(uploadRealTimeMonitoringData); |
| | | if(i == 0){ |
| | | log.error("数据存储mongo失败"); |
| | | } |
| | | |
| | | // 业务处理 |
| | | UploadRealTimeMonitoringDataQuery query = new UploadRealTimeMonitoringDataQuery(); |
| | | BeanUtils.copyProperties(uploadRealTimeMonitoringData, query); |
| | | chargingOrderClient.chargeMonitoring(query); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | break; |
| | | case SendTagConstant.CHARGING_HANDSHAKE: |
| | | ChargingHandshakeMessage chargingHandshakeMessage = message.getChargingHandshakeMessage(); |
| | | log.info("充电握手-业务消息处理:{}",chargingHandshakeMessage); |
| | | // 持久化消息 |
| | | ChargingHandshake chargingHandshake = new ChargingHandshake(); |
| | | BeanUtils.copyProperties(chargingHandshakeMessage,chargingHandshake); |
| | | chargingHandshakeService.create(chargingHandshake); |
| | | break; |
| | | case SendTagConstant.PARAMETER_SETTING: |
| | | ParameterSettingMessage parameterSettingMessage = message.getParameterSettingMessage(); |
| | | log.info("参数配置-业务消息处理:{}",parameterSettingMessage); |
| | | // 持久化消息 |
| | | // ParameterSetting parameterSetting = new ParameterSetting(); |
| | | // BeanUtils.copyProperties(parameterSettingMessage,parameterSetting); |
| | | // parameterSettingService.create(parameterSetting); |
| | | break; |
| | | case SendTagConstant.BMS_ABORT: |
| | | BmsAbortMessage bmsAbortMessage = message.getBmsAbortMessage(); |
| | | log.info("充电阶段BMS中止-业务消息处理:{}",bmsAbortMessage); |
| | | // 持久化消息 |
| | | BmsAbort bmsAbort = new BmsAbort(); |
| | | BeanUtils.copyProperties(bmsAbortMessage,bmsAbort); |
| | | bmsAbortService.create(bmsAbort); |
| | | // 业务处理 |
| | | chargingOrderClient.excelEndCharge(bmsAbort.getTransaction_serial_number()); |
| | | break; |
| | | case SendTagConstant.MOTOR_ABORT: |
| | | MotorAbortMessage motorAbortMessage = message.getMotorAbortMessage(); |
| | | log.info("充电阶段充电机中止-业务消息处理:{}",motorAbortMessage); |
| | | // 持久化消息 |
| | | MotorAbort motorAbort = new MotorAbort(); |
| | | BeanUtils.copyProperties(motorAbortMessage,motorAbort); |
| | | motorAbortService.create(motorAbort); |
| | | // 业务处理 |
| | | chargingOrderClient.excelEndCharge(motorAbort.getTransaction_serial_number()); |
| | | break; |
| | | case SendTagConstant.BMS_DEMAND_AND_CHARGER_EXPORTATION: |
| | | BmsDemandAndChargerExportationMessage bmsDemandAndChargerExportationMessage = message.getBmsDemandAndChargerExportationMessage(); |
| | | log.info("充电过程BMS需求、充电机输出-业务消息处理:{}",bmsDemandAndChargerExportationMessage); |
| | | String transaction_serial_number1 = bmsDemandAndChargerExportationMessage.getTransaction_serial_number(); |
| | | Object o1 = redisTemplate.opsForValue().get("bms_demand_and_charger_exportation:" + transaction_serial_number1); |
| | | if(null != o1){ |
| | | Long m = System.currentTimeMillis() - (Long) o1; |
| | | if(m < 60000){ |
| | | break; |
| | | } |
| | | } |
| | | redisTemplate.opsForValue().set("bms_demand_and_charger_exportation:" + transaction_serial_number1, System.currentTimeMillis(), 1, TimeUnit.MINUTES); |
| | | |
| | | // 持久化消息 |
| | | BmsDemandAndChargerExportation bmsDemandAndChargerExportation = new BmsDemandAndChargerExportation(); |
| | | BeanUtils.copyProperties(bmsDemandAndChargerExportationMessage,bmsDemandAndChargerExportation); |
| | | bmsDemandAndChargerExportationService.create(bmsDemandAndChargerExportation); |
| | | |
| | | // 业务处理 |
| | | TChargingOrder chargingOrderBms = chargingOrderClient.getOrderByCode(bmsDemandAndChargerExportationMessage.getTransaction_serial_number()).getData(); |
| | | if(Objects.nonNull(chargingOrderBms)){ |
| | | chargingOrderBms.setNeedElec(bmsDemandAndChargerExportationMessage.getBms_current_requirements()); |
| | | chargingOrderClient.updateChargingOrder(chargingOrderBms); |
| | | } |
| | | break; |
| | | case SendTagConstant.BMS_INFORMATION: |
| | | BmsInformationMessage bmsInformationMessage = message.getBmsInformationMessage(); |
| | | log.info("充电过程BMS信息-业务消息处理:{}",bmsInformationMessage); |
| | | String transaction_serial_number2 = bmsInformationMessage.getTransaction_serial_number(); |
| | | Object o2 = redisTemplate.opsForValue().get("bms_information:" + transaction_serial_number2); |
| | | if(null != o2){ |
| | | Long m = System.currentTimeMillis() - (Long) o2; |
| | | if(m < 60000){ |
| | | break; |
| | | } |
| | | } |
| | | redisTemplate.opsForValue().set("bms_information:" + transaction_serial_number2, System.currentTimeMillis(), 1, TimeUnit.MINUTES); |
| | | |
| | | // 持久化消息 |
| | | BmsInformation bmsInformation = new BmsInformation(); |
| | | BeanUtils.copyProperties(bmsInformationMessage,bmsInformation); |
| | | bmsInformationService.create(bmsInformation); |
| | | break; |
| | | case SendTagConstant.CHARGING_PILE_STARTS_CHARGING: |
| | | ChargingPileStartsChargingMessage chargingPileStartsChargingMessage = message.getChargingPileStartsChargingMessage(); |
| | | log.info("充电桩主动申请启动充电-业务消息处理:{}",chargingPileStartsChargingMessage); |
| | | // 持久化消息 |
| | | ChargingPileStartsCharging chargingPileStartsCharging = new ChargingPileStartsCharging(); |
| | | BeanUtils.copyProperties(chargingPileStartsChargingMessage,chargingPileStartsCharging); |
| | | chargingPileStartsChargingService.create(chargingPileStartsCharging); |
| | | break; |
| | | case SendTagConstant.PLATFORM_START_CHARGING_REPLY: |
| | | PlatformStartChargingReplyMessage platformStartChargingReplyMessage = message.getPlatformStartChargingReplyMessage(); |
| | | log.info("远程启机命令回复-业务消息处理:{}",platformStartChargingReplyMessage); |
| | | // 持久化消息 |
| | | PlatformStartChargingReply platformStartChargingReply = new PlatformStartChargingReply(); |
| | | BeanUtils.copyProperties(platformStartChargingReplyMessage,platformStartChargingReply); |
| | | platformStartChargingReplyService.create(platformStartChargingReply); |
| | | |
| | | // 业务处理 |
| | | PlatformStartChargingReplyMessageVO message1 = new PlatformStartChargingReplyMessageVO(); |
| | | BeanUtils.copyProperties(platformStartChargingReplyMessage, message1); |
| | | chargingOrderClient.startChargeSuccessfully(message1); |
| | | break; |
| | | case SendTagConstant.PLATFORM_STOP_CHARGING_REPLY: |
| | | PlatformStopChargingReplyMessage platformStopChargingReplyMessage = message.getPlatformStopChargingReplyMessage(); |
| | | log.info("远程停机命令回复-业务消息处理:{}",platformStopChargingReplyMessage); |
| | | // 持久化消息 |
| | | PlatformStopChargingReply platformStopChargingReply = new PlatformStopChargingReply(); |
| | | BeanUtils.copyProperties(platformStopChargingReplyMessage,platformStopChargingReply); |
| | | platformStopChargingReplyService.create(platformStopChargingReply); |
| | | |
| | | PlatformStopChargingReplyVO platformStopChargingReply1 = new PlatformStopChargingReplyVO(); |
| | | BeanUtils.copyProperties(platformStopChargingReply, platformStopChargingReply1); |
| | | chargingOrderClient.terminateSuccessfulResponse(platformStopChargingReply1); |
| | | break; |
| | | case SendTagConstant.TRANSACTION_RECORD: |
| | | TransactionRecordMessage transactionRecordMessage = message.getTransactionRecordMessage(); |
| | | log.info("交易记录-业务消息处理:{}",transactionRecordMessage); |
| | | transactionRecordMessage.setResult(JSONObject.toJSONString(transactionRecordMessage)); |
| | | // 持久化消息 |
| | | TransactionRecord transactionRecord = new TransactionRecord(); |
| | | BeanUtils.copyProperties(transactionRecordMessage,transactionRecord); |
| | | transactionRecord.setResult(transactionRecordMessage.getResult()); |
| | | transactionRecordService.create(transactionRecord); |
| | | |
| | | // 业务处理 |
| | | TChargingOrder chargingOrderRecord = chargingOrderClient.getOrderByCode(transactionRecordMessage.getTransaction_serial_number()).getData(); |
| | | if(Objects.nonNull(chargingOrderRecord)){ |
| | | chargingOrderRecord.setTotalElectricity(transactionRecordMessage.getTotal_electricity()); |
| | | chargingOrderClient.updateChargingOrder(chargingOrderRecord); |
| | | } |
| | | //计算费用 |
| | | TransactionRecordMessageVO vo = new TransactionRecordMessageVO(); |
| | | BeanUtils.copyProperties(transactionRecordMessage,vo); |
| | | chargingOrderClient.endChargeBillingCharge(vo); |
| | | |
| | | // 添加实时上传结束记录 |
| | | // 查询mogondb上一条数据 |
| | | UploadRealTimeMonitoringData data = uploadRealTimeMonitoringDataService.getLastDataById(transactionRecordMessage.getTransaction_serial_number()); |
| | | if(Objects.nonNull(data) && data.getStatus() != 5){ |
| | | UploadRealTimeMonitoringData uploadRealTimeMonitoringData = new UploadRealTimeMonitoringData(); |
| | | BeanUtils.copyProperties(data,uploadRealTimeMonitoringData); |
| | | uploadRealTimeMonitoringData.setStatus(5); |
| | | uploadRealTimeMonitoringDataService.create(uploadRealTimeMonitoringData); |
| | | } |
| | | break; |
| | | case SendTagConstant.UPDATE_BALANCE_REPLY: |
| | | UpdateBalanceReplyMessage updateBalanceReplyMessage = message.getUpdateBalanceReplyMessage(); |
| | | log.info("余额更新应答-业务消息处理:{}",updateBalanceReplyMessage); |
| | | // 持久化消息 |
| | | UpdateBalanceReply updateBalanceReply = new UpdateBalanceReply(); |
| | | BeanUtils.copyProperties(updateBalanceReplyMessage,updateBalanceReply); |
| | | updateBalanceReplyService.create(updateBalanceReply); |
| | | break; |
| | | case SendTagConstant.SYNCHRONIZE_OFFLINE_CARD_REPLY: |
| | | SynchronizeOfflineCardReplyMessage synchronizeOfflineCardReplyMessage = message.getSynchronizeOfflineCardReplyMessage(); |
| | | log.info("卡数据同步应答-业务消息处理:{}",synchronizeOfflineCardReplyMessage); |
| | | // 持久化消息 |
| | | SynchronizeOfflineCardReply synchronizeOfflineCardReply = new SynchronizeOfflineCardReply(); |
| | | BeanUtils.copyProperties(synchronizeOfflineCardReplyMessage,synchronizeOfflineCardReply); |
| | | synchronizeOfflineCardReplyService.create(synchronizeOfflineCardReply); |
| | | break; |
| | | case SendTagConstant.CLEAR_OFFLINE_CARD_REPLY: |
| | | ClearOfflineCardReplyMessage clearOfflineCardReplyMessage = message.getClearOfflineCardReplyMessage(); |
| | | log.info("离线卡数据清除应答-业务消息处理:{}",clearOfflineCardReplyMessage); |
| | | // 持久化消息 |
| | | ClearOfflineCardReply clearOfflineCardReply = new ClearOfflineCardReply(); |
| | | BeanUtils.copyProperties(clearOfflineCardReplyMessage,clearOfflineCardReply); |
| | | clearOfflineCardReplyService.create(clearOfflineCardReply); |
| | | break; |
| | | case SendTagConstant.WORKING_PARAMETER_SETTING_REPLY: |
| | | WorkingParameterSettingReplyMessage workingParameterSettingReplyMessage = message.getWorkingParameterSettingReplyMessage(); |
| | | log.info("充电桩工作参数设置应答-业务消息处理:{}",workingParameterSettingReplyMessage); |
| | | // 持久化消息 |
| | | WorkingParameterSettingReply workingParameterSettingReply = new WorkingParameterSettingReply(); |
| | | BeanUtils.copyProperties(workingParameterSettingReplyMessage,workingParameterSettingReply); |
| | | workingParameterSettingReplyService.create(workingParameterSettingReply); |
| | | break; |
| | | case SendTagConstant.TIMING_SETTING: |
| | | TimingSettingMessage timingSettingMessage = message.getTimingSettingMessage(); |
| | | log.info("对时设置-业务消息处理:{}",timingSettingMessage); |
| | | // 持久化消息 |
| | | // TimingSetting timingSetting = new TimingSetting(); |
| | | // BeanUtils.copyProperties(timingSettingMessage,timingSetting); |
| | | // timingSettingService.create(timingSetting); |
| | | break; |
| | | case SendTagConstant.SETUP_BILLING_MODEL_REPLY: |
| | | SetupBillingModelReplyMessage setupBillingModelReplyMessage = message.getSetupBillingModelReplyMessage(); |
| | | log.info("计费模型应答-业务消息处理:{}",setupBillingModelReplyMessage); |
| | | // 持久化消息 |
| | | SetupBillingModelReply setupBillingModelReply = new SetupBillingModelReply(); |
| | | BeanUtils.copyProperties(setupBillingModelReplyMessage,setupBillingModelReply); |
| | | setupBillingModelReplyService.create(setupBillingModelReply); |
| | | break; |
| | | case SendTagConstant.GROUND_LOCK_REAL_TIME_DATA: |
| | | GroundLockRealTimeDataMessage groundLockRealTimeDataMessage = message.getGroundLockRealTimeDataMessage(); |
| | | log.info("地锁数据上送(充电桩上送)-业务消息处理:{}",groundLockRealTimeDataMessage); |
| | | // 持久化消息 |
| | | GroundLockRealTimeData groundLockRealTimeData = new GroundLockRealTimeData(); |
| | | BeanUtils.copyProperties(groundLockRealTimeDataMessage,groundLockRealTimeData); |
| | | groundLockRealTimeDataService.create(groundLockRealTimeData); |
| | | break; |
| | | case SendTagConstant.CHARGING_PILE_RETURNS_GROUND_LOCK_DATA: |
| | | ChargingPileReturnsGroundLockDataMessage chargingPileReturnsGroundLockDataMessage = message.getChargingPileReturnsGroundLockDataMessage(); |
| | | log.info("充电桩返回数据(上行)-业务消息处理:{}",chargingPileReturnsGroundLockDataMessage); |
| | | // 持久化消息 |
| | | ChargingPileReturnsGroundLockData chargingPileReturnsGroundLockData = new ChargingPileReturnsGroundLockData(); |
| | | BeanUtils.copyProperties(chargingPileReturnsGroundLockDataMessage,chargingPileReturnsGroundLockData); |
| | | chargingPileReturnsGroundLockDataService.create(chargingPileReturnsGroundLockData); |
| | | break; |
| | | case SendTagConstant.PLATFORM_RESTART_REPLY: |
| | | PlatformRestartReplyMessage platformRestartReplyMessage = message.getPlatformRestartReplyMessage(); |
| | | log.info("远程重启应答-业务消息处理:{}",platformRestartReplyMessage); |
| | | // 持久化消息 |
| | | PlatformRestartReply platformRestartReply = new PlatformRestartReply(); |
| | | BeanUtils.copyProperties(platformRestartReplyMessage,platformRestartReply); |
| | | platformRestartReplyService.create(platformRestartReply); |
| | | break; |
| | | case SendTagConstant.QR_CODE_DELIVERY_REPLY: |
| | | QrCodeDeliveryReplyMessage qrCodeDeliveryReplyMessage = message.getQrCodeDeliveryReplyMessage(); |
| | | log.info("二维码下发应答-业务消息处理:{}",qrCodeDeliveryReplyMessage); |
| | | QrCodeDeliveryReply qrCodeDeliveryReply = new QrCodeDeliveryReply(); |
| | | BeanUtils.copyProperties(qrCodeDeliveryReplyMessage,qrCodeDeliveryReply); |
| | | qrCodeDeliveryReplyService.create(qrCodeDeliveryReply); |
| | | break; |
| | | case SendTagConstant.SECURITY_DETECTION: |
| | | SecurityDetectionMessage securityDetectionMessage = message.getSecurityDetectionMessage(); |
| | | log.info("安全监测-业务消息处理:{}",securityDetectionMessage); |
| | | SecurityDetection securityDetection = new SecurityDetection(); |
| | | BeanUtils.copyProperties(securityDetectionMessage,securityDetection); |
| | | securityDetectionService.create(securityDetection); |
| | | |
| | | SecurityDetectionVO securityDetection1 = new SecurityDetectionVO(); |
| | | BeanUtils.copyProperties(securityDetection, securityDetection1); |
| | | chargingOrderClient.securityDetection(securityDetection1); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | public JSONObject billingModeVerifyReply(BillingModeVerifyReply billingModeVerifyReply){ |
| | | log.info("计费模型验证请求应答:{}", billingModeVerifyReply); |
| | | billingModeVerifyReplyService.create(billingModeVerifyReply); |
| | | // billingModeVerifyReplyService.create(billingModeVerifyReply); |
| | | return getMessageJsonString(billingModeVerifyReply, ServiceIdMenu.BILLING_MODE_VERIFY_REPLY.getValue()); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | public JSONObject timingSettingReply(TimingSettingReply timingSettingReply){ |
| | | timingSettingReplyService.create(timingSettingReply); |
| | | log.info("对时设置应答:{}", timingSettingReply); |
| | | // timingSettingReplyService.create(timingSettingReply); |
| | | return getMessageJsonString(timingSettingReply, ServiceIdMenu.TIMING_SETTING_REPLY.getValue()); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface AcquisitionBillingModeReplyService extends BaseService<AcquisitionBillingModeReply> { |
| | | |
| | | |
| | | /** |
| | | * 定时任务删除超过2个月的数据 |
| | | */ |
| | | void taskDelete(); |
| | | } |
| | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface AcquisitionBillingModeService extends BaseService<AcquisitionBillingMode> { |
| | | |
| | | |
| | | /** |
| | | * 定时任务删除超过2个月数据 |
| | | */ |
| | | void taskDelete(); |
| | | } |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | public interface BillingModeVerifyReplyService extends BaseService<BillingModeVerifyReply> { |
| | | |
| | | |
| | | /** |
| | | * 定时任务删除超过2个月数据 |
| | | */ |
| | | void taskDelete(); |
| | | } |
| | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface BillingModeVerifyService extends BaseService<BillingModeVerify> { |
| | | |
| | | |
| | | /** |
| | | * 定时任务删除2个月前的数据 |
| | | */ |
| | | void taskDelete(); |
| | | } |
| | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface BmsAbortService extends BaseService<BmsAbort> { |
| | | |
| | | /** |
| | | * 定时任务删除2个月前的数据 |
| | | */ |
| | | void taskDelete(); |
| | | } |
| | |
| | | */ |
| | | List<BmsDemandAndChargerExportation> getBmsDemandAndChargerExportation(String orderCode); |
| | | |
| | | |
| | | /** |
| | | * 定时任务删除2个月前的数据 |
| | | */ |
| | | void taskDelete(); |
| | | |
| | | } |
| | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface BmsInformationService extends BaseService<BmsInformation> { |
| | | |
| | | |
| | | /** |
| | | * 定时任务删除2个月前的数据 |
| | | */ |
| | | void taskDelete(); |
| | | } |
| | |
| | | |
| | | ChargingHandshake getDataByOrderCode(String code); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 定时任务删除2个月前的数据 |
| | | */ |
| | | void taskDelete(); |
| | | } |
| | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface ConfirmTransactionRecordService extends BaseService<ConfirmTransactionRecord> { |
| | | |
| | | /** |
| | | * 定时任务删除超过4个月的数据 |
| | | */ |
| | | void taskDelete(); |
| | | } |
| | |
| | | |
| | | public interface EndChargeService extends BaseService<EndCharge> { |
| | | |
| | | |
| | | /** |
| | | * 定时任务删除2个月前的数据 |
| | | */ |
| | | void taskDelete(); |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.rocket.model.ErrorMessageMessage; |
| | | import com.ruoyi.integration.iotda.model.ErrorMessageMessage; |
| | | |
| | | public interface ErrorMessageMessageService extends BaseService<ErrorMessageMessage> { |
| | | |
| | | |
| | | /** |
| | | * 定时任务删除2个月前的数据 |
| | | */ |
| | | void taskDelete(); |
| | | |
| | | |
| | | } |
| | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface MotorAbortService extends BaseService<MotorAbort> { |
| | | |
| | | |
| | | /** |
| | | * 定时任务删除2个月前的数据 |
| | | */ |
| | | void taskDelete(); |
| | | |
| | | } |
| | |
| | | */ |
| | | public interface OnlineReplyService extends BaseService<OnlineReply> { |
| | | |
| | | /** |
| | | * 定时任务删除2个月前的数据 |
| | | */ |
| | | void taskDelete(); |
| | | |
| | | } |
| | |
| | | */ |
| | | public interface OnlineService extends BaseService<Online> { |
| | | |
| | | /** |
| | | * 定时任务删除2个月前的数据 |
| | | */ |
| | | void taskDelete(); |
| | | |
| | | } |
| | |
| | | */ |
| | | List<PlatformStartChargingReply> getPlatformStartChargingReply(String code); |
| | | |
| | | |
| | | /** |
| | | * 定时任务删除超过2个月的数据 |
| | | */ |
| | | void taskDelete(); |
| | | |
| | | } |
| | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface PlatformStartChargingService extends BaseService<PlatformStartCharging> { |
| | | |
| | | /** |
| | | * 定时任务删除超过2个月的数据 |
| | | */ |
| | | void taskDelete(); |
| | | } |
| | |
| | | */ |
| | | PlatformStopChargingReply getPlatformStopChargingReply(GetPlatformStopChargingReply query); |
| | | |
| | | |
| | | /** |
| | | * 定时任务删除2个月前的数据 |
| | | */ |
| | | void taskDelete(); |
| | | |
| | | } |
| | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface PlatformStopChargingService extends BaseService<PlatformStopCharging> { |
| | | |
| | | /** |
| | | * 定时任务删除2个月前的数据 |
| | | */ |
| | | void taskDelete(); |
| | | } |
| | |
| | | */ |
| | | public interface QrCodeDeliveryService extends BaseService<QrCodeDelivery> { |
| | | |
| | | |
| | | |
| | | /** |
| | | * 定时任务删除2个月前的数据 |
| | | */ |
| | | void taskDelete(); |
| | | |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | SecurityDetection getSecurityDetection(String transactionSerialNumber); |
| | | |
| | | |
| | | /** |
| | | * 定时任务删除超过1个月的数据 |
| | | */ |
| | | void taskDelete(); |
| | | } |
| | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface SetupBillingModelReplyService extends BaseService<SetupBillingModelReply> { |
| | | |
| | | |
| | | /** |
| | | * 定时任务删除2个月前的数据 |
| | | */ |
| | | void taskDelete(); |
| | | |
| | | } |
| | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface SetupBillingModelService extends BaseService<SetupBillingModel> { |
| | | |
| | | /** |
| | | * 定时任务删除2个月前的数据 |
| | | */ |
| | | void taskDelete(); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | TransactionRecord findOne(String code); |
| | | |
| | | |
| | | /** |
| | | * 定时任务删除超过4个月的数据 |
| | | */ |
| | | void taskDelete(); |
| | | } |
| | |
| | | void delete(String id); |
| | | |
| | | void updateById(String id); |
| | | |
| | | /** |
| | | * 定时任务删除2个月前的数据 |
| | | */ |
| | | void taskDelete(); |
| | | } |
| | |
| | | import com.ruoyi.integration.mongodb.service.AcquisitionBillingModeReplyService; |
| | | 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.time.LocalDateTime; |
| | | import java.util.List; |
| | | @Service |
| | | public class AcquisitionBillingModeReplyServiceImpl implements AcquisitionBillingModeReplyService { |
| | |
| | | public List<AcquisitionBillingModeReply> findAll() { |
| | | return mongoTemplate.findAll(AcquisitionBillingModeReply.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 定时任务删除超过2个月的数据 |
| | | */ |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(2))); |
| | | mongoTemplate.remove(query, AcquisitionBillingModeReply.class); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.integration.mongodb.service.AcquisitionBillingModeService; |
| | | 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.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | public List<AcquisitionBillingMode> findAll() { |
| | | return mongoTemplate.findAll(AcquisitionBillingMode.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 定时任务删除超过2个月数据 |
| | | */ |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(2))); |
| | | mongoTemplate.remove(query, AcquisitionBillingMode.class); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.integration.mongodb.service.BillingModeVerifyReplyService; |
| | | 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.time.LocalDateTime; |
| | | import java.util.List; |
| | | @Service |
| | | public class BillingModeVerifyReplyServiceImpl implements BillingModeVerifyReplyService { |
| | |
| | | public List<BillingModeVerifyReply> findAll() { |
| | | return mongoTemplate.findAll(BillingModeVerifyReply.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 定时任务删除2个月前的数据 |
| | | */ |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(2))); |
| | | mongoTemplate.remove(query, BillingModeVerifyReply.class); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.integration.mongodb.service.BillingModeVerifyService; |
| | | 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.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | public List<BillingModeVerify> findAll() { |
| | | return mongoTemplate.findAll(BillingModeVerify.class); |
| | | } |
| | | |
| | | /** |
| | | * 定时任务删除2个月前的数据 |
| | | */ |
| | | @Override |
| | | public void taskDelete() { |
| | | |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(2))); |
| | | mongoTemplate.remove(query, BillingModeVerify.class); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.integration.mongodb.service.BmsAbortService; |
| | | 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.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | public List<BmsAbort> findAll() { |
| | | return mongoTemplate.findAll(BmsAbort.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 定时任务删除2个月前的数据 |
| | | */ |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(2))); |
| | | mongoTemplate.remove(query, BmsAbort.class); |
| | | } |
| | | } |
| | |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | , BmsDemandAndChargerExportation.class); |
| | | return uploadRealTimeMonitoringData; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 定时任务删除3个月前的数据 |
| | | */ |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(2))); |
| | | mongoTemplate.remove(query, BmsDemandAndChargerExportation.class); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.integration.mongodb.service.BmsInformationService; |
| | | 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.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | public List<BmsInformation> findAll() { |
| | | return mongoTemplate.findAll(BmsInformation.class); |
| | | } |
| | | |
| | | /** |
| | | * 定时任务删除2个月前的数据 |
| | | */ |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(2))); |
| | | mongoTemplate.remove(query, BmsInformation.class); |
| | | } |
| | | } |
| | |
| | | List<ChargingHandshake> charging_gun_code = mongoTemplate.find(new Query().addCriteria(Criteria.where("transaction_serial_number").is(code)), ChargingHandshake.class); |
| | | return charging_gun_code.size() > 0 ? charging_gun_code.get(0) : null; |
| | | } |
| | | |
| | | /** |
| | | * 定时任务删除2个月前的数据 |
| | | */ |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(2))); |
| | | mongoTemplate.remove(query, ChargingHandshake.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.api.model.TransactionRecord; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.ConfirmTransactionRecord; |
| | | import com.ruoyi.integration.mongodb.service.ConfirmTransactionRecordService; |
| | | 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.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | public List<ConfirmTransactionRecord> findAll() { |
| | | return mongoTemplate.findAll(ConfirmTransactionRecord.class); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(4))); |
| | | mongoTemplate.remove(query, ConfirmTransactionRecord.class); |
| | | } |
| | | } |
| | |
| | | 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.api.model.EndCharge; |
| | | import com.ruoyi.integration.api.model.Pong; |
| | | import com.ruoyi.integration.mongodb.service.EndChargeService; |
| | | 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.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | |
| | |
| | | public List<EndCharge> findAll() { |
| | | return mongoTemplate.findAll(EndCharge.class); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(2))); |
| | | mongoTemplate.remove(query, EndCharge.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.api.model.EndCharge; |
| | | import com.ruoyi.integration.api.model.MotorAbort; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.service.EndChargeService; |
| | | import com.ruoyi.integration.mongodb.service.ErrorMessageMessageService; |
| | | import com.ruoyi.integration.rocket.model.ErrorMessageMessage; |
| | | import com.ruoyi.integration.iotda.model.ErrorMessageMessage; |
| | | 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.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | |
| | |
| | | public List<ErrorMessageMessage> findAll() { |
| | | return mongoTemplate.findAll(ErrorMessageMessage.class); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(2))); |
| | | mongoTemplate.remove(query, ErrorMessageMessage.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.api.model.BmsAbort; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.MotorAbort; |
| | | import com.ruoyi.integration.mongodb.service.MotorAbortService; |
| | | 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.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | public List<MotorAbort> findAll() { |
| | | return mongoTemplate.findAll(MotorAbort.class); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(2))); |
| | | mongoTemplate.remove(query, MotorAbort.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.OnlineReply; |
| | | import com.ruoyi.integration.mongodb.service.OnlineReplyService; |
| | | 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.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | |
| | |
| | | public List<OnlineReply> findAll() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(2))); |
| | | mongoTemplate.remove(query, OnlineReply.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.mongodb.service.OnlineService; |
| | | 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.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | |
| | |
| | | public List<Online> findAll() { |
| | | return mongoTemplate.findAll(Online.class); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(2))); |
| | | mongoTemplate.remove(query, Online.class); |
| | | } |
| | | } |
| | |
| | | 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.api.model.PlatformStartChargingReply; |
| | | import com.ruoyi.integration.mongodb.service.PlatformStartChargingReplyService; |
| | |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | List<PlatformStartChargingReply> platformStartChargingReplies = mongoTemplate.find(query, PlatformStartChargingReply.class); |
| | | return platformStartChargingReplies; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(2))); |
| | | mongoTemplate.remove(query, PlatformStartChargingReply.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.api.model.ConfirmTransactionRecord; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.PlatformStartCharging; |
| | | import com.ruoyi.integration.mongodb.service.PlatformStartChargingService; |
| | | 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.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | public List<PlatformStartCharging> findAll() { |
| | | return mongoTemplate.findAll(PlatformStartCharging.class); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(2))); |
| | | mongoTemplate.remove(query, PlatformStartCharging.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformStopCharging; |
| | | import com.ruoyi.integration.api.vo.GetPlatformStopChargingReply; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.PlatformStopChargingReply; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | .and("charging_gun_code").is(query.getCharging_gun_code()).and("create_time").lte(sdf.format(new Date())).gte(query.getEnd_time())), PlatformStopChargingReply.class); |
| | | return platformStopChargingReplies.size() > 0 ? platformStopChargingReplies.get(0) : null; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(2))); |
| | | mongoTemplate.remove(query, PlatformStopCharging.class); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.PlatformStopCharging; |
| | | import com.ruoyi.integration.iotda.model.ErrorMessageMessage; |
| | | import com.ruoyi.integration.mongodb.service.PlatformStopChargingService; |
| | | 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.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | public List<PlatformStopCharging> findAll() { |
| | | return mongoTemplate.findAll(PlatformStopCharging.class); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(2))); |
| | | mongoTemplate.remove(query, PlatformStopCharging.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.api.model.QrCodeDelivery; |
| | | import com.ruoyi.integration.api.model.SetupBillingModelReply; |
| | | 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.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | |
| | |
| | | public List<QrCodeDelivery> findAll() { |
| | | return mongoTemplate.findAll(QrCodeDelivery.class); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(2))); |
| | | mongoTemplate.remove(query, QrCodeDelivery.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformStartCharging; |
| | | import com.ruoyi.integration.api.model.SecurityDetection; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.service.SecurityDetectionService; |
| | |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | |
| | |
| | | .is(transactionSerialNumber)), SecurityDetection.class); |
| | | return securityDetectionList.size() > 0 ? securityDetectionList.get(0) : null; |
| | | } |
| | | |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(1))); |
| | | mongoTemplate.remove(query, SecurityDetection.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.api.model.SetupBillingModel; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.SetupBillingModelReply; |
| | | import com.ruoyi.integration.mongodb.service.SetupBillingModelReplyService; |
| | | 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.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | public List<SetupBillingModelReply> findAll() { |
| | | return mongoTemplate.findAll(SetupBillingModelReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(2))); |
| | | mongoTemplate.remove(query, SetupBillingModelReply.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformStopCharging; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.SetupBillingModel; |
| | | import com.ruoyi.integration.mongodb.service.SetupBillingModelService; |
| | | 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.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | public List<SetupBillingModel> findAll() { |
| | | return mongoTemplate.findAll(SetupBillingModel.class); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(2))); |
| | | mongoTemplate.remove(query, SetupBillingModel.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.AcquisitionBillingModeReply; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.TimingSetting; |
| | |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | , TransactionRecord.class); |
| | | return transactionRecords.size() > 0 ? transactionRecords.get(0) : null; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(4))); |
| | | mongoTemplate.remove(query, TransactionRecord.class); |
| | | } |
| | | } |
| | |
| | | |
| | | import cn.hutool.db.sql.Direction; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringPageData; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | mongoTemplate.updateFirst(query, update, UploadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void taskDelete() { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("create_time").lt(LocalDateTime.now().minusMonths(2))); |
| | | mongoTemplate.remove(query, UploadRealTimeMonitoringData.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.util; |
| | | |
| | | import com.ruoyi.integration.mongodb.service.*; |
| | | import org.springframework.boot.web.context.WebServerInitializedEvent; |
| | | import org.springframework.context.ApplicationListener; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * 定时任务工具类 |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/21 11:43 |
| | | */ |
| | | @Component |
| | | public class TaskUtils implements ApplicationListener<WebServerInitializedEvent> { |
| | | |
| | | @Resource |
| | | private AcquisitionBillingModeReplyService acquisitionBillingModeReplyService; |
| | | |
| | | @Resource |
| | | private AcquisitionBillingModeService acquisitionBillingModeService; |
| | | |
| | | @Resource |
| | | private BillingModeVerifyReplyService billingModeVerifyReplyService; |
| | | |
| | | @Resource |
| | | private BillingModeVerifyService billingModeVerifyService; |
| | | |
| | | @Resource |
| | | private BmsAbortService bmsAbortService; |
| | | |
| | | @Resource |
| | | private BmsDemandAndChargerExportationService bmsDemandAndChargerExportationService; |
| | | |
| | | @Resource |
| | | private BmsInformationService bmsInformationService; |
| | | |
| | | @Resource |
| | | private ChargingHandshakeService chargingHandshakeService; |
| | | |
| | | @Resource |
| | | private UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService; |
| | | |
| | | @Resource |
| | | private OnlineService onlineService; |
| | | |
| | | @Resource |
| | | private OnlineReplyService onlineReplyService; |
| | | |
| | | @Resource |
| | | private TransactionRecordService transactionRecordService; |
| | | |
| | | @Resource |
| | | private ConfirmTransactionRecordService confirmTransactionRecordService; |
| | | |
| | | @Resource |
| | | private PlatformStartChargingService platformStartChargingService; |
| | | |
| | | @Resource |
| | | private SecurityDetectionService securityDetectionService; |
| | | |
| | | @Resource |
| | | private PlatformStartChargingReplyService platformStartChargingReplyService; |
| | | |
| | | @Resource |
| | | private MotorAbortService motorAbortService; |
| | | |
| | | @Resource |
| | | private ErrorMessageMessageService errorMessageMessageService; |
| | | |
| | | @Resource |
| | | private PlatformStopChargingService platformStopChargingService; |
| | | |
| | | @Resource |
| | | private PlatformStopChargingReplyService platformStopChargingReplyService; |
| | | |
| | | @Resource |
| | | private SetupBillingModelService setupBillingModelService; |
| | | |
| | | @Resource |
| | | private SetupBillingModelReplyService setupBillingModelReplyService; |
| | | |
| | | @Resource |
| | | private QrCodeDeliveryService qrCodeDeliveryService; |
| | | |
| | | @Resource |
| | | private EndChargeService endChargeService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | private Integer port = null; |
| | | |
| | | @Override |
| | | public void onApplicationEvent(WebServerInitializedEvent event) { |
| | | port = event.getWebServer().getPort(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 定时任务 |
| | | */ |
| | | @Scheduled(cron = "0 0 10 * * ?") |
| | | public void run(){ |
| | | if(null != port && port == 5700){ |
| | | bmsInformationService.taskDelete(); |
| | | bmsDemandAndChargerExportationService.taskDelete(); |
| | | uploadRealTimeMonitoringDataService.taskDelete(); |
| | | onlineService.taskDelete(); |
| | | onlineReplyService.taskDelete(); |
| | | billingModeVerifyService.taskDelete(); |
| | | billingModeVerifyReplyService.taskDelete(); |
| | | acquisitionBillingModeService.taskDelete(); |
| | | acquisitionBillingModeReplyService.taskDelete(); |
| | | transactionRecordService.taskDelete(); |
| | | confirmTransactionRecordService.taskDelete(); |
| | | platformStartChargingService.taskDelete(); |
| | | securityDetectionService.taskDelete(); |
| | | platformStartChargingReplyService.taskDelete(); |
| | | chargingHandshakeService.taskDelete(); |
| | | bmsAbortService.taskDelete(); |
| | | motorAbortService.taskDelete(); |
| | | errorMessageMessageService.taskDelete(); |
| | | platformStopChargingService.taskDelete(); |
| | | platformStopChargingReplyService.taskDelete(); |
| | | setupBillingModelService.taskDelete(); |
| | | setupBillingModelReplyService.taskDelete(); |
| | | qrCodeDeliveryService.taskDelete(); |
| | | endChargeService.taskDelete(); |
| | | } |
| | | } |
| | | } |
| | |
| | | # username: nacos |
| | | # password: nacos |
| | | # 生产环境 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | server-addr: 192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | |
| | | # username: nacos |
| | | # password: nacos |
| | | # 生产环境 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | server-addr: 192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | |
| | | # username: nacos |
| | | # password: nacos |
| | | # 生产环境 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | server-addr: 192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | |
| | | nacos: |
| | | discovery: |
| | | # 服务注册地址 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | server-addr: 192.168.0.123:8848 |
| | | service: ${spring.application.name} |
| | | group: DEFAULT_GROUP |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | |
| | | password: nacos |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | server-addr: 192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | username: nacos |
| | | password: nacos |
| | |
| | | package com.ruoyi.integration; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.nacos.common.utils.JacksonUtils; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.barrierGate.model.CloudParkingOrder; |
| | | import com.ruoyi.integration.barrierGate.server.ParkingOrderService; |
| | | import com.ruoyi.integration.drainage.AESUtil; |
| | | import com.ruoyi.integration.drainage.TCECSuperviseUtil; |
| | | import com.ruoyi.integration.drainage.model.*; |
| | | import com.ruoyi.integration.drainage.util.AesEncryption; |
| | | import com.ruoyi.integration.drainage.util.HMacMD5Util; |
| | | import com.ruoyi.integration.drainage.util.SequenceGenerator; |
| | | import com.ruoyi.integration.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import com.ruoyi.order.api.dto.ChargingStatisticeDTO; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.other.api.domain.Operator; |
| | | import com.ruoyi.other.api.feignClient.OperatorClient; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.core.RocketMQTemplate; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.springframework.cglib.core.Local; |
| | | import org.springframework.messaging.support.MessageBuilder; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | @Slf4j |
| | | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = RuoYiIntegrationApplication.class) |
| | | public class RuoYiIntegrationApplicationTests { |
| | |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <!--rocketmq--> |
| | | <dependency> |
| | | <groupId>org.apache.rocketmq</groupId> |
| | | <artifactId>rocketmq-spring-boot-starter</artifactId> |
| | | <version>2.3.0</version> |
| | | </dependency> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>com.alibaba.cloud</groupId>--> |
| | | <!-- <artifactId>spring-cloud-starter-stream-rocketmq</artifactId>--> |
| | | <!-- <version>2.2.2.RELEASE</version>--> |
| | | <!-- <exclusions>--> |
| | | <!-- <exclusion>--> |
| | | <!-- <groupId>org.apache.rocketmq</groupId>--> |
| | | <!-- <artifactId>rocketmq-client</artifactId>--> |
| | | <!-- </exclusion>--> |
| | | <!-- <exclusion>--> |
| | | <!-- <groupId>org.apache.rocketmq</groupId>--> |
| | | <!-- <artifactId>rocketmq-acl</artifactId>--> |
| | | <!-- </exclusion>--> |
| | | <!-- </exclusions>--> |
| | | <!-- </dependency>--> |
| | | <!-- --> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.apache.rocketmq</groupId>--> |
| | | <!-- <artifactId>rocketmq-client</artifactId>--> |
| | | <!-- <version>4.7.1</version>--> |
| | | <!-- </dependency>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.apache.rocketmq</groupId>--> |
| | | <!-- <artifactId>rocketmq-acl</artifactId>--> |
| | | <!-- <version>4.7.1</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <!--mongodb--> |
| | | <dependency> |
| | |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-integration</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-jianguan</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
New file |
| | |
| | | package com.ruoyi.jianguan.controller; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.integration.api.vo.ChargingOrderVo; |
| | | import com.ruoyi.jianguan.model.SupChargeOrderInfo; |
| | | import com.ruoyi.jianguan.model.SupEquipChargeStatus; |
| | | import com.ruoyi.jianguan.util.ChuanYiChongSuperviseUtil; |
| | | import com.ruoyi.jianguan.util.TCECSuperviseUtil; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.other.api.domain.Operator; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/12 10:07 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/chargingMessage") |
| | | public class ChargingMessageController { |
| | | |
| | | @Resource |
| | | private TCECSuperviseUtil tcecSuperviseUtil; |
| | | |
| | | private final static String operatorId = "906171535"; |
| | | @Resource |
| | | private ChargingGunClient chargingGunClient; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | @Resource |
| | | private ChuanYiChongSuperviseUtil chuanYiChongSuperviseUtil; |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | |
| | | |
| | | /** |
| | | * 推送充电订单信息 |
| | | * @param chargingOrder |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/pushOrderInfo") |
| | | public R pushOrderInfo(@RequestBody ChargingOrderVo chargingOrder){ |
| | | SupChargeOrderInfo supChargeOrderInfo = new SupChargeOrderInfo(); |
| | | supChargeOrderInfo.setOperatorID(operatorId); |
| | | supChargeOrderInfo.setEquipmentOwnerID(operatorId); |
| | | supChargeOrderInfo.setStationID(String.valueOf(chargingOrder.getSiteId())); |
| | | supChargeOrderInfo.setEquipmentID(String.valueOf(chargingOrder.getChargingPileId())); |
| | | supChargeOrderInfo.setOrderNo(operatorId+chargingOrder.getCode()); |
| | | TChargingGun chargingGun1 = chargingGunClient.getChargingGunById(chargingOrder.getChargingGunId()).getData(); |
| | | supChargeOrderInfo.setConnectorID(chargingGun1.getFullNumber()); |
| | | supChargeOrderInfo.setEquipmentClassification(1); |
| | | supChargeOrderInfo.setPushTimeStamp(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); |
| | | supChargeOrderInfo.setStartTime(chargingOrder.getStartTime() != null ? chargingOrder.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) : ""); |
| | | supChargeOrderInfo.setEndTime(chargingOrder.getEndTime() != null ? chargingOrder.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) : ""); |
| | | supChargeOrderInfo.setTotalPower(chargingOrder.getElectrovalence()); |
| | | supChargeOrderInfo.setTotalElecMoney(chargingOrder.getElectrovalence()); |
| | | supChargeOrderInfo.setTotalServiceMoney(chargingOrder.getServiceCharge()); |
| | | supChargeOrderInfo.setTotalMoney(chargingOrder.getOrderAmount()); |
| | | switch (chargingOrder.getEndMode()){ |
| | | case 0: |
| | | supChargeOrderInfo.setStopReason(5); |
| | | supChargeOrderInfo.setStopDesc("异常终止"); |
| | | break; |
| | | case 1: |
| | | supChargeOrderInfo.setStopReason(0); |
| | | supChargeOrderInfo.setStopDesc("用户手动停止充电"); |
| | | break; |
| | | case 2: |
| | | supChargeOrderInfo.setStopReason(1); |
| | | supChargeOrderInfo.setStopDesc("客户归属地运营商平台停止充电"); |
| | | break; |
| | | case 3: |
| | | supChargeOrderInfo.setStopReason(1); |
| | | supChargeOrderInfo.setStopDesc("费用不足中止"); |
| | | break; |
| | | } |
| | | tcecSuperviseUtil.notificationChargeOrderInfo(new Operator(), supChargeOrderInfo); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 推送充电订单状态 |
| | | * @param chargingOrder |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/pushOrderStatus") |
| | | public R pushOrderStatus(@RequestBody ChargingOrderVo chargingOrder){ |
| | | log.info("推送充电订单状态:{}", chargingOrder); |
| | | SupEquipChargeStatus supEquipChargeStatus = new SupEquipChargeStatus(); |
| | | supEquipChargeStatus.setOperatorID(operatorId); |
| | | supEquipChargeStatus.setEquipmentOwnerID(operatorId); |
| | | supEquipChargeStatus.setStationID(String.valueOf(chargingOrder.getSiteId())); |
| | | supEquipChargeStatus.setEquipmentID(String.valueOf(chargingOrder.getChargingPileId())); |
| | | supEquipChargeStatus.setOrderNo(operatorId+chargingOrder.getCode()); |
| | | switch (chargingOrder.getStatus()){ |
| | | case 2: |
| | | supEquipChargeStatus.setConnectorStatus(1); |
| | | break; |
| | | case 3: |
| | | supEquipChargeStatus.setConnectorStatus(2); |
| | | break; |
| | | case 4: |
| | | supEquipChargeStatus.setConnectorStatus(3); |
| | | break; |
| | | case 5: |
| | | supEquipChargeStatus.setConnectorStatus(4); |
| | | break; |
| | | } |
| | | TChargingGun chargingGun2 = chargingGunClient.getChargingGunById(chargingOrder.getChargingGunId()).getData(); |
| | | supEquipChargeStatus.setConnectorID(chargingGun2.getFullNumber()); |
| | | supEquipChargeStatus.setEquipmentClassification(1); |
| | | supEquipChargeStatus.setPushTimeStamp(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); |
| | | switch (chargingGun2.getStatus()){ |
| | | case 1: |
| | | supEquipChargeStatus.setConnectorStatus(0); |
| | | break; |
| | | case 2: |
| | | supEquipChargeStatus.setConnectorStatus(1); |
| | | break; |
| | | case 3: |
| | | supEquipChargeStatus.setConnectorStatus(2); |
| | | break; |
| | | case 4: |
| | | supEquipChargeStatus.setConnectorStatus(3); |
| | | break; |
| | | case 5: |
| | | supEquipChargeStatus.setConnectorStatus(3); |
| | | break; |
| | | case 6: |
| | | supEquipChargeStatus.setConnectorStatus(4); |
| | | break; |
| | | case 7: |
| | | supEquipChargeStatus.setConnectorStatus(255); |
| | | break; |
| | | } |
| | | supEquipChargeStatus.setCurrentA(chargingOrder.getCurrent()); |
| | | |
| | | supEquipChargeStatus.setSOC(null != chargingOrder.getTotalElectricity()?chargingOrder.getTotalElectricity():new BigDecimal("1")); |
| | | supEquipChargeStatus.setStartTime(chargingOrder.getStartTime() != null ? chargingOrder.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) : ""); |
| | | supEquipChargeStatus.setEndTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); |
| | | supEquipChargeStatus.setTotalPower(chargingOrder.getElectrovalence()); |
| | | tcecSuperviseUtil.notificationSupEquipChargeStatus(new Operator(), supEquipChargeStatus); |
| | | TAppUser data = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); |
| | | // 川逸充 |
| | | if (chargingOrder.getRechargePaymentType()==3){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("StartChargeSeq",chargingOrder.getCode()); |
| | | jsonObject.put("ConnectorID",chargingGun2.getFullNumber()); |
| | | LocalDateTime startTime = chargingOrder.getStartTime(); |
| | | log.info("川逸充用户信息"+data); |
| | | if (StringUtils.hasLength(data.getPhone())){ |
| | | jsonObject.put("Mobile",data.getPhone()); |
| | | } |
| | | //状态(0=未知,1=等待中/已插枪,2=启动中,3=充电中,4=停止中,5=已结束) |
| | | int tempStatus = 0; |
| | | switch (chargingOrder.getStatus()){ |
| | | case 1: |
| | | tempStatus=1; |
| | | |
| | | case 2: |
| | | tempStatus=1; |
| | | jsonObject.put("StartChargeSeqStat",tempStatus); |
| | | if (startTime!=null){ |
| | | jsonObject.put("StartTime",startTime.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | }else{ |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // 转化为yyyy-MM-dd HH:mm:ss格式字符串 |
| | | jsonObject.put("StartTime",now.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | } |
| | | chuanYiChongSuperviseUtil.notificationStationStatus(new Operator(), jsonObject); |
| | | break; |
| | | case 3: |
| | | tempStatus=2; |
| | | jsonObject.put("StartChargeSeqStat",tempStatus); |
| | | if (startTime!=null){ |
| | | jsonObject.put("StartTime",startTime.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | }else{ |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // 转化为yyyy-MM-dd HH:mm:ss格式字符串 |
| | | jsonObject.put("StartTime",now.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | } |
| | | chuanYiChongSuperviseUtil.notificationStationStatus(new Operator(), jsonObject); |
| | | break; |
| | | case 4: |
| | | break; |
| | | case 5: |
| | | jsonObject.put("StartChargeSeqStat",4); |
| | | int temp = 0; |
| | | //充电枪状态(1=离线,2=空闲,3=占用(未充电),4=占用(充电中),5=占用(已充满),6=占用(预约锁定),7=故障) |
| | | switch (chargingGun2.getStatus()){ |
| | | case 1: |
| | | temp = 0; |
| | | break; |
| | | case 2: |
| | | temp=1; |
| | | break; |
| | | case 3: |
| | | temp=2; |
| | | break; |
| | | case 4: |
| | | temp=3; |
| | | break; |
| | | case 5: |
| | | temp=4; |
| | | break; |
| | | case 6: |
| | | temp=4; |
| | | break; |
| | | case 7: |
| | | temp = 255; |
| | | break; |
| | | } |
| | | jsonObject.put("ConnectorStatus",temp); |
| | | |
| | | jsonObject.put("CurrentA",chargingOrder.getCurrent()); |
| | | jsonObject.put("VoltageA",chargingOrder.getVoltage()); |
| | | LocalDateTime startTime2 = chargingOrder.getStartTime(); |
| | | |
| | | if (startTime2!=null){ |
| | | jsonObject.put("StartTime",startTime2.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | }else{ |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // 转化为yyyy-MM-dd HH:mm:ss格式字符串 |
| | | jsonObject.put("StartTime",now.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | } |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // 转化为yyyy-MM-dd HH:mm:ss格式字符串 |
| | | jsonObject.put("EndTime",now.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | jsonObject.put("TotalPower",chargingOrder.getElectricity()); |
| | | jsonObject.put("TotalMoney",chargingOrder.getOrderAmount()); |
| | | chuanYiChongSuperviseUtil.notificationSupEquipChargeStatus(new Operator(), jsonObject); |
| | | break; |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 查询订单状态 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/getOrderById") |
| | | public R pushOrderStatus(@RequestParam Long orderId){ |
| | | log.info("川易充通过id查询订单:{}", orderId); |
| | | R<TChargingOrder> tChargingOrderR = chargingOrderClient.orderDetail(orderId); |
| | | return R.ok(tChargingOrderR.getData()); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.integration.api.model.*; |
| | | import com.ruoyi.jianguan.mongodb.service.*; |
| | | import com.ruoyi.jianguan.mqtt.config.TopicConstants; |
| | | import com.ruoyi.jianguan.mqtt.util.MqttPushUtil; |
| | | import com.ruoyi.jianguan.rocket.model.ErrorMessageMessage; |
| | | import io.netty.util.concurrent.DefaultThreadFactory; |
| | | import lombok.SneakyThrows; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.concurrent.*; |
| | | |
| | | /** |
| | |
| | | private UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService; |
| | | @Autowired |
| | | private MqttPushUtil mqttPushUtil; |
| | | @Autowired |
| | | private RedisService redisService; |
| | | |
| | | /** |
| | | * 每天的9点执行的任务 |
| | | */ |
| | | @Scheduled(cron = "0 0 10 * * *") |
| | | // @Scheduled(fixedRate = 60000) |
| | | @Scheduled(fixedRate = 86400000) |
| | | public void taskDay(){ |
| | | try { |
| | | // 判断是否存在标识 |
| | | Thread.sleep(1000); |
| | | String flag = redisService.getCacheObject("cloud_integration"); |
| | | System.out.println("市政云硬件数据传输标识:" + flag); |
| | | if (Objects.isNull(flag)) { |
| | | log.info("市政云硬件数据传输无标识,开始传输硬件数据"); |
| | | redisService.setCacheObject("cloud_integration", "1",24L,TimeUnit.HOURS); |
| | | // 传输mongodb的硬件数据 |
| | | createCustomThreadPool(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | }); |
| | | |
| | | TimeUnit.MILLISECONDS.sleep(1); |
| | | |
| | | // Future<String> future = customthreadPoolExecutor.submit(() -> { |
| | | // log.info("线程:{},办理业务", Thread.currentThread().getName()); |
| | | // return "业务办理完成"; |
| | | // }); |
| | | // log.info(future.get()); |
| | | } finally { |
| | | gracefulShutdown(customthreadPoolExecutor); |
| | | } |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/base/BaseMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.base; |
| | | package com.ruoyi.jianguan.model; |
| | | |
| | | import lombok.Data; |
| | | |
File was renamed from ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/rocket/model/ErrorMessageMessage.java |
| | |
| | | package com.ruoyi.jianguan.rocket.model; |
| | | package com.ruoyi.jianguan.model; |
| | | |
| | | import com.ruoyi.jianguan.rocket.base.BaseMessage; |
| | | import com.ruoyi.jianguan.model.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | package com.ruoyi.jianguan.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.EndCharge; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | import com.ruoyi.jianguan.rocket.model.ErrorMessageMessage; |
| | | import com.ruoyi.jianguan.model.ErrorMessageMessage; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | |
| | | |
| | | import com.ruoyi.integration.api.model.GroundLockRealTimeData; |
| | | import com.ruoyi.jianguan.mongodb.base.BaseService; |
| | | import com.ruoyi.jianguan.rocket.model.ErrorMessageMessage; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.EndCharge; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.ErrorMessageMessageService; |
| | | import com.ruoyi.jianguan.rocket.model.ErrorMessageMessage; |
| | | import com.ruoyi.jianguan.model.ErrorMessageMessage; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | |
| | | package com.ruoyi.jianguan.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.GroundLockRealTimeData; |
| | | import com.ruoyi.jianguan.constant.IotConstant; |
| | | import com.ruoyi.jianguan.mongodb.service.GroundLockRealTimeDataService; |
| | | import com.ruoyi.jianguan.rocket.model.ErrorMessageMessage; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | |
| | | public void connectionLost(Throwable throwable) { |
| | | if (client == null || !client.isConnected()) { |
| | | System.out.println("连接断开,正在重连...."); |
| | | int[] Qos = {0}; |
| | | String[] topic1 = {TopicConstants.CHARGE_PILE_CODE}; |
| | | try { |
| | | client.connect(options); |
| | | client.subscribe(topic1, Qos); |
| | | log.info("连接失败重连成功"); |
| | | } catch (MqttException e) { |
| | | log.info("连接失败重连失败"); |
| | |
| | | // 设置超时时间 单位为秒 |
| | | options.setConnectionTimeout(TIME_OUT);///默认:30 |
| | | // 设置是否清空session,这里如果设置为false表示服务器会保留客户端的连接记录,设置为true表示每次连接到服务器都以新的身份连接 |
| | | options.setCleanSession(false);//默认:true |
| | | options.setCleanSession(true);//默认:true |
| | | // 设置断开后重新连接(设置为true时将启用自动重新连接) |
| | | options.setAutomaticReconnect(true);//默认:false |
| | | // 设置会话心跳时间 单位为秒 服务器会每隔1.5*20秒的时间向客户端发送个消息判断客户端是否在线,但这个方法并没有重连的机制 |
| | | options.setKeepAliveInterval(KEEP_ALIVE);//默认:60 |
| | | // 设置回调 |
| | | mqttClient.setCallback(new PushCallback()); |
| | | mqttClient.setCallback(new MqttCallback() { |
| | | @Override |
| | | public void connectionLost(Throwable cause) { |
| | | System.out.println("Connection lost, reconnecting..."); |
| | | reconnect(); |
| | | } |
| | | |
| | | @Override |
| | | public void messageArrived(String topic, MqttMessage message) throws Exception { |
| | | System.out.println("Message arrived: " + new String(message.getPayload())); |
| | | } |
| | | |
| | | @Override |
| | | public void deliveryComplete(IMqttDeliveryToken token) { |
| | | System.out.println("Delivery complete"); |
| | | } |
| | | }); |
| | | mqttClient.connect(options); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | mqttClient.connect(options); |
| | | } |
| | | |
| | | public void reconnect() { |
| | | while (!mqttClient.isConnected()) { |
| | | try { |
| | | // MQTT的连接设置 |
| | | MqttConnectOptions options = new MqttConnectOptions(); |
| | | options.setUserName(USER_NAME); |
| | | options.setPassword(PASS_WORD.toCharArray()); |
| | | // 设置超时时间 单位为秒 |
| | | options.setConnectionTimeout(TIME_OUT);///默认:30 |
| | | // 设置是否清空session,这里如果设置为false表示服务器会保留客户端的连接记录,设置为true表示每次连接到服务器都以新的身份连接 |
| | | options.setCleanSession(true);//默认:true |
| | | // 设置断开后重新连接(设置为true时将启用自动重新连接) |
| | | options.setAutomaticReconnect(true);//默认:false |
| | | // 设置会话心跳时间 单位为秒 服务器会每隔1.5*20秒的时间向客户端发送个消息判断客户端是否在线,但这个方法并没有重连的机制 |
| | | options.setKeepAliveInterval(KEEP_ALIVE);//默认:60 |
| | | mqttClient.connect(options); |
| | | System.out.println("重连成功"); |
| | | } catch (MqttException e) { |
| | | System.out.println("重连失败"); |
| | | log.info("connectionLost e:{}", e.getMessage()); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 发布,默认qos为0,非持久化 |
| | | */ |
| | |
| | | buildBody(post, info, operator); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | | log.error("推送三方平台充电开始状态失败:" + execute.body()); |
| | | log.error("川易充推送三方平台充电开始状态失败:" + execute.body()); |
| | | return null; |
| | | } |
| | | log.info("推送三方平台设备状态响应:" + execute.body()); |
| | | log.info("川易充推送三方平台设备状态响应:" + execute.body()); |
| | | BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | Integer Ret = baseResult.getRet(); |
| | | if(0 != Ret){ |
| | | log.error("推送三方平台充电开始状态失败:" + baseResult.getMsg()); |
| | | log.error("川易充推送三方平台充电开始状态失败:" + baseResult.getMsg()); |
| | | return null; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), DataSecret, DataSecretIV); |
| | | log.info("推送三方平台设备状态Data:" + decrypt); |
| | | log.info("川易充推送三方平台设备状态Data:" + decrypt); |
| | | NotificationStationStatusResult notificationStationStatusResult = JSON.parseObject(decrypt, NotificationStationStatusResult.class); |
| | | return notificationStationStatusResult; |
| | | } |
| | |
| | | buildBody(post, info, operator); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | | log.error("推送川逸充平台充电结束状态失败:" + execute.body()); |
| | | log.error("川易充推送川逸充平台充电结束状态失败:" + execute.body()); |
| | | return null; |
| | | } |
| | | log.info("推送川逸充平台充电结束状态响应:" + execute.body()); |
| | | log.info("川易充推送川逸充平台充电结束状态响应:" + execute.body()); |
| | | BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | Integer Ret = baseResult.getRet(); |
| | | if(0 != Ret){ |
| | | log.error("推送川逸充平台充电结束状态失败:" + baseResult.getMsg()); |
| | | log.error("川易充推送川逸充平台充电结束状态失败:" + baseResult.getMsg()); |
| | | return null; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), DataSecret, DataSecretIV); |
| | | log.info("推送川逸充充电结束.状态Data:" + decrypt); |
| | | log.info("川易充推送川逸充充电结束.状态Data:" + decrypt); |
| | | NotificationEquipChargeStatusResult notificationEquipChargeStatusResult = JSON.parseObject(decrypt, NotificationEquipChargeStatusResult.class); |
| | | return notificationEquipChargeStatusResult; |
| | | } |
| | |
| | | baseRequest.setSig(hmacMD5); |
| | | String request_json = JacksonUtils.toJson(baseRequest); |
| | | post.body(request_json); |
| | | log.info("推送三方平台请求地址:" + post.getUrl()); |
| | | log.info("推送三方平台请求参数:" + request_json); |
| | | log.info("推送三方平台请求Data:" + o.toJSONString()); |
| | | log.info("川易充推送三方平台请求地址:" + post.getUrl()); |
| | | log.info("川易充推送三方平台请求参数:" + request_json); |
| | | log.info("川易充推送三方平台请求Data:" + o.toJSONString()); |
| | | } |
| | | /** |
| | | * 构建请求参数和消息头 |
| | |
| | | package com.ruoyi.jianguan.util; |
| | | import com.ruoyi.account.api.factory.JianGuanAccountFallbackFactory; |
| | | import com.ruoyi.account.api.feignClient.JianGuanAccountClient; |
| | | import com.ruoyi.other.api.domain.*; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysLoginLog; |
| | | import com.ruoyi.system.api.domain.SysOperLog; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | |
| | | import com.ruoyi.other.api.domain.TEnterpriseUserApplication; |
| | | import com.ruoyi.other.api.domain.THtml; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TSystemConfiguration; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.domain.Operator; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | | import com.ruoyi.other.api.domain.TInvoiceType; |
| | | import com.ruoyi.other.api.domain.TIntegralRule; |
| | | import com.ruoyi.other.api.domain.TActivity; |
| | | import com.ruoyi.other.api.domain.TAdvertising; |
| | | import com.ruoyi.other.api.domain.TCompany; |
| | | import com.ruoyi.other.api.domain.TEvaluationTag; |
| | | import com.ruoyi.other.api.domain.TNotice; |
| | | import com.ruoyi.other.api.domain.TUserTag; |
| | | |
| | | import com.ruoyi.order.api.model.AccountingStrategyDetailOrder; |
| | | import com.ruoyi.order.api.model.TOrderInvoice; |
| | |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.account.api.model.TAppUserSign; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.ruoyi.account.api.model.TAppUserVipDetail; |
| | |
| | | import com.ruoyi.account.api.model.TAppUserIntegralChange; |
| | | import com.ruoyi.account.api.model.TAppUserTag; |
| | | |
| | | import com.ruoyi.account.api.feignClient.JianGuanAccountClient; |
| | | import com.ruoyi.account.api.vo.GovernmentCloudAccountVO; |
| | | import com.ruoyi.chargingPile.api.feignClient.JianGuanChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | /** |
| | |
| | | @Resource |
| | | private JianGuanSystemClient jianGuanSystemClient; |
| | | |
| | | // 每两小时执行一次的定时任务 |
| | | // @Scheduled(cron = "0 0 0/2 * * ?") |
| | | public static void main(String[] args) { |
| | | LocalDate yesterday = LocalDate.now().minusDays(1); |
| | | |
| | | LocalDateTime startOfDay = yesterday.atTime(0, 0, 0); |
| | | LocalDateTime endOfDay = yesterday.atTime(23, 59, 59); |
| | | // 转化为Date类型 |
| | | Date startDate = Date.from(startOfDay.atZone(ZoneId.systemDefault()).toInstant()); |
| | | Date endDate = Date.from(endOfDay.atZone(ZoneId.systemDefault()).toInstant()); |
| | | |
| | | System.err.println(startOfDay); |
| | | System.err.println(endOfDay); |
| | | } |
| | | // 每天下午3点执行的定时任务 |
| | | @Scheduled(fixedRate = 86400000) |
| | | public void taskMonth() { |
| | | log.info("市政云传数据"); |
| | | LocalDate yesterday = LocalDate.now().minusDays(1); |
| | | |
| | | LocalDateTime startOfDay = yesterday.atTime(0, 0, 0); |
| | | LocalDateTime endOfDay = yesterday.atTime(23, 59, 59); |
| | | // 转化为Date类型 |
| | | Date startDate = Date.from(startOfDay.atZone(ZoneId.systemDefault()).toInstant()); |
| | | Date endDate = Date.from(endOfDay.atZone(ZoneId.systemDefault()).toInstant()); |
| | | // account服务 |
| | | GovernmentCloudAccountVO data = jianGuanAccountClient.listAll().getData(); |
| | | if (data != null) { |
| | | log.info("Account"); |
| | | |
| | | List<TAppCoupon> appCoupons = data.getAppCoupons(); |
| | | if (!appCoupons.isEmpty()) { |
| | | log.info("用户优惠券"+appCoupons); |
| | | appCouponService.saveBatch(appCoupons); |
| | | log.info("用户优惠券"+appCoupons.size()); |
| | | // 将id 设置为null |
| | | log.info("策略"+appCoupons.size()); |
| | | appCoupons = appCoupons.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < appCoupons.size(); i += 700) { |
| | | appCouponService.saveOrUpdateBatch(appCoupons.subList(i, Math.min(i + 700, appCoupons.size()))); |
| | | } |
| | | } |
| | | List<TAppUser> appUsers = data.getAppUsers(); |
| | | if (!appUsers.isEmpty()) { |
| | | log.info("用户"+appUsers); |
| | | log.info("用户"+appUsers.size()); |
| | | appUsers = appUsers.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < appUsers.size(); i += 700) { |
| | | appUserService.saveOrUpdateBatch(appUsers.subList(i, Math.min(i + 700, appUsers.size()))); |
| | | } |
| | | |
| | | appUserService.saveBatch(appUsers); |
| | | } |
| | | List<TAppUserAddress> appUserAddresses = data.getAppUserAddresses(); |
| | | if (!appUserAddresses.isEmpty()) { |
| | | log.info("用户地址"+appUserAddresses); |
| | | |
| | | appUserAddressService.saveBatch(appUserAddresses); |
| | | log.info("用户地址"+appUserAddresses.size()); |
| | | appUserAddresses = appUserAddresses.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < appUserAddresses.size(); i += 700) { |
| | | appUserAddressService.saveOrUpdateBatch(appUserAddresses.subList(i, Math.min(i + 700, appUserAddresses.size()))); |
| | | } |
| | | } |
| | | List<TAppUserCar> appUserCars = data.getAppUserCars(); |
| | | if (!appUserCars.isEmpty()) { |
| | | log.info("用户车辆"+appUserCars); |
| | | |
| | | appUserCarService.saveBatch(appUserCars); |
| | | log.info("用户车辆"+appUserCars.size()); |
| | | appUserCars = appUserCars.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < appUserCars.size(); i += 700) { |
| | | appUserCarService.saveOrUpdateBatch(appUserCars.subList(i, Math.min(i + 700, appUserCars.size()))); |
| | | } |
| | | } |
| | | List<TAppUserIntegralChange> appUserIntegralChanges = data.getAppUserIntegralChanges(); |
| | | if (!appUserIntegralChanges.isEmpty()) { |
| | | log.info("用户积分变动"+appUserIntegralChanges); |
| | | |
| | | appUserIntegralChangeService.saveBatch(appUserIntegralChanges); |
| | | log.info("用户积分变动"+appUserIntegralChanges.size()); |
| | | appUserIntegralChanges = appUserIntegralChanges.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < appUserIntegralChanges.size(); i += 700) { |
| | | appUserIntegralChangeService.saveOrUpdateBatch(appUserIntegralChanges.subList(i, Math.min(i + 700, appUserIntegralChanges.size()))); |
| | | } |
| | | } |
| | | List<TAppUserSign> appUserSigns = data.getAppUserSigns(); |
| | | if (!appUserSigns.isEmpty()) { |
| | | log.info("用户签到"+appUserSigns); |
| | | |
| | | appUserSignService.saveBatch(appUserSigns); |
| | | log.info("用户签到"+appUserSigns.size()); |
| | | appUserSigns = appUserSigns.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < appUserSigns.size(); i += 700) { |
| | | appUserSignService.saveOrUpdateBatch(appUserSigns.subList(i, Math.min(i + 700, appUserSigns.size()))); |
| | | } |
| | | } |
| | | List<TAppUserTag> appUserTags = data.getAppUserTags(); |
| | | if (!appUserTags.isEmpty()) { |
| | | log.info("用户标签"+appUserTags); |
| | | log.info("用户标签"+appUserTags.size()); |
| | | |
| | | appUserTagService.saveBatch(appUserTags); |
| | | appUserTags = appUserTags.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < appUserTags.size(); i += 700) { |
| | | appUserTagService.saveOrUpdateBatch(appUserTags.subList(i, Math.min(i + 700, appUserTags.size()))); |
| | | } |
| | | } |
| | | List<TAppUserVipDetail> appUserVipDetails = data.getAppUserVipDetails(); |
| | | if (!appUserVipDetails.isEmpty()) { |
| | | log.info("用户会员明细"+appUserVipDetails); |
| | | log.info("用户会员明细"+appUserVipDetails.size()); |
| | | |
| | | appUserVipDetailService.saveBatch(appUserVipDetails); |
| | | appUserVipDetails = appUserVipDetails.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < appUserVipDetails.size(); i += 700) { |
| | | appUserVipDetailService.saveOrUpdateBatch(appUserVipDetails.subList(i, Math.min(i + 700, appUserVipDetails.size()))); |
| | | } |
| | | } |
| | | List<TInviteUser> inviteUsers = data.getInviteUsers(); |
| | | if (!inviteUsers.isEmpty()) { |
| | | log.info("邀请用户"+inviteUsers); |
| | | inviteUserService.saveBatch(inviteUsers); |
| | | log.info("邀请用户"+inviteUsers.size()); |
| | | inviteUsers = inviteUsers.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < inviteUsers.size(); i += 700) { |
| | | inviteUserService.saveOrUpdateBatch(inviteUsers.subList(i, Math.min(i + 700, inviteUsers.size()))); |
| | | } |
| | | } |
| | | List<TInvoiceInformation> invoiceInformations = data.getInvoiceInformations(); |
| | | if (!invoiceInformations.isEmpty()) { |
| | | log.info("开票"+invoiceInformations); |
| | | tInvoiceInformationService.saveBatch(invoiceInformations); |
| | | log.info("开票"+invoiceInformations.size()); |
| | | invoiceInformations = invoiceInformations.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < invoiceInformations.size(); i += 700) { |
| | | tInvoiceInformationService.saveOrUpdateBatch(invoiceInformations.subList(i, Math.min(i + 700, invoiceInformations.size()))); |
| | | } |
| | | } |
| | | } |
| | | // chargingPile服务 |
| | | GovernmentCloudChargingPileVO data1 = jianGuanChargingPileClient.listAll().getData(); |
| | | if (data1 != null) { |
| | | log.info("chargingPile服务"); |
| | | |
| | | List<Partner> partners = data1.getPartners(); |
| | | if (!partners.isEmpty()) { |
| | | log.info("合作商"+partners); |
| | | log.info("合作商"+partners.size()); |
| | | |
| | | partnerService.saveBatch(partners); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < partners.size(); i += 700) { |
| | | partnerService.saveOrUpdateBatch(partners.subList(i, Math.min(i + 700, partners.size()))); |
| | | } |
| | | } |
| | | List<Site> sites = data1.getSites(); |
| | | if (!sites.isEmpty()) { |
| | | log.info("站点"+sites); |
| | | log.info("站点"+sites.size()); |
| | | |
| | | siteService.saveBatch(sites); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < sites.size(); i += 700) { |
| | | siteService.saveOrUpdateBatch(sites.subList(i, Math.min(i + 700, sites.size()))); |
| | | } |
| | | } |
| | | List<TAccountingStrategy> accountingStrategies = data1.getAccountingStrategies(); |
| | | if (!accountingStrategies.isEmpty()) { |
| | | log.info("策略"+accountingStrategies); |
| | | |
| | | accountingStrategyService.saveBatch(accountingStrategies); |
| | | log.info("策略"+accountingStrategies.size()); |
| | | // 筛选出昨天凌晨00:00:00到昨天晚上23:59:59的数据 |
| | | accountingStrategies = accountingStrategies.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < accountingStrategies.size(); i += 700) { |
| | | accountingStrategyService.saveOrUpdateBatch(accountingStrategies.subList(i, Math.min(i + 700, accountingStrategies.size()))); |
| | | } |
| | | } |
| | | List<TAccountingStrategyDetail> accountingStrategyDetails = data1.getAccountingStrategyDetails(); |
| | | if (!accountingStrategyDetails.isEmpty()) { |
| | | log.info("策略明细"+accountingStrategyDetails); |
| | | |
| | | accountingStrategyDetailService.saveBatch(accountingStrategyDetails); |
| | | log.info("策略明细"+accountingStrategyDetails.size()); |
| | | accountingStrategyDetails = accountingStrategyDetails.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | for (int i = 0; i < accountingStrategies.size(); i += 700) { |
| | | accountingStrategyDetailService.saveOrUpdateBatch(accountingStrategyDetails.subList(i, Math.min(i + 700, accountingStrategyDetails.size()))); |
| | | } |
| | | } |
| | | List<TApplyChargingPile> applyChargingPiles = data1.getApplyChargingPiles(); |
| | | if (!applyChargingPiles.isEmpty()) { |
| | | log.info("申请充电桩"+applyChargingPiles); |
| | | log.info("申请充电桩"+applyChargingPiles.size()); |
| | | applyChargingPiles = applyChargingPiles.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | // 分批插入数据 每次最多700条 |
| | | |
| | | applyChargingPileService.saveBatch(applyChargingPiles); |
| | | for (int i = 0; i < applyChargingPiles.size(); i += 700) { |
| | | applyChargingPileService.saveOrUpdateBatch(applyChargingPiles.subList(i, Math.min(i + 700, applyChargingPiles.size()))); |
| | | } |
| | | } |
| | | List<TCarport> carports = data1.getCarports(); |
| | | if (!carports.isEmpty()) { |
| | | log.info("停车场"+carports); |
| | | |
| | | carportService.saveBatch(carports); |
| | | log.info("车库"+carports.size()); |
| | | // 分批插入数据 每次最多700条 |
| | | carports = carports.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | for (int i = 0; i < carports.size(); i += 700) { |
| | | carportService.saveOrUpdateBatch(carports.subList(i, Math.min(i + 700, carports.size()))); |
| | | } |
| | | } |
| | | List<TChargingGun> chargingGuns = data1.getChargingGuns(); |
| | | if (!chargingGuns.isEmpty()) { |
| | | log.info("充电枪"+chargingGuns); |
| | | log.info("充电枪"+chargingGuns.size()); |
| | | // 分批插入数据 每次最多700条 |
| | | chargingGuns = chargingGuns.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | for (int i = 0; i < chargingGuns.size(); i += 700) { |
| | | chargingGunService.saveOrUpdateBatch(chargingGuns.subList(i, Math.min(i + 700, chargingGuns.size()))); |
| | | } |
| | | |
| | | chargingGunService.saveBatch(chargingGuns); |
| | | chargingGunService.saveOrUpdateBatch(chargingGuns); |
| | | } |
| | | List<TChargingPile> chargingPiles = data1.getChargingPiles(); |
| | | if (!chargingPiles.isEmpty()) { |
| | | log.info("充电桩"+chargingPiles); |
| | | log.info("充电桩"+chargingPiles.size()); |
| | | // 分批插入数据 每次最多700条 |
| | | chargingPiles = chargingPiles.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | for (int i = 0; i < chargingPiles.size(); i += 700) { |
| | | chargingPileService.saveOrUpdateBatch(chargingPiles.subList(i, Math.min(i + 700, chargingPiles.size()))); |
| | | } |
| | | |
| | | chargingPileService.saveBatch(chargingPiles); |
| | | } |
| | | List<TChargingPileNotification> chargingPileNotifications = data1.getChargingPileNotifications(); |
| | | if (!chargingPileNotifications.isEmpty()) { |
| | | log.info("通知"+chargingPileNotifications); |
| | | |
| | | chargingPileNotificationService.saveBatch(chargingPileNotifications); |
| | | log.info("充电桩通知"+chargingPileNotifications.size()); |
| | | // 分批插入数据 每次最多700条 |
| | | chargingPileNotifications = chargingPileNotifications.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | for (int i = 0; i < chargingPileNotifications.size(); i += 700) { |
| | | chargingPileNotificationService.saveOrUpdateBatch(chargingPileNotifications.subList(i, Math.min(i + 700, chargingPileNotifications.size()))); |
| | | } |
| | | } |
| | | List<TFaultMessage> faultMessages = data1.getFaultMessages(); |
| | | if (!faultMessages.isEmpty()) { |
| | | log.info("故障"+faultMessages); |
| | | |
| | | faultMessageService.saveBatch(faultMessages); |
| | | log.info("故障"+faultMessages.size()); |
| | | // 分批插入数据 每次最多700条 |
| | | faultMessages = faultMessages.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | for (int i = 0; i < faultMessages.size(); i += 700) { |
| | | faultMessageService.saveOrUpdateBatch(faultMessages.subList(i, Math.min(i + 700, faultMessages.size()))); |
| | | } |
| | | } |
| | | List<TMonitoringEquipment> monitoringEquipments = data1.getMonitoringEquipments(); |
| | | if (!monitoringEquipments.isEmpty()) { |
| | | log.info("监控设备"+monitoringEquipments); |
| | | log.info("监控设备"+monitoringEquipments.size()); |
| | | // 分批插入数据 每次最多700条 |
| | | monitoringEquipments = monitoringEquipments.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | for (int i = 0; i < monitoringEquipments.size(); i += 700) { |
| | | monitoringEquipmentService.saveOrUpdateBatch(monitoringEquipments.subList(i, Math.min(i + 700, monitoringEquipments.size()))); |
| | | |
| | | monitoringEquipmentService.saveBatch(monitoringEquipments); |
| | | } |
| | | } |
| | | List<TParkingLot> parkingLots = data1.getParkingLots(); |
| | | if (!parkingLots.isEmpty()) { |
| | | log.info("停车场"+parkingLots); |
| | | |
| | | parkingLotService.saveBatch(parkingLots); |
| | | log.info("停车场"+parkingLots.size()); |
| | | // 分批插入数据 每次最多700条 |
| | | parkingLots = parkingLots.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | for (int i = 0; i < parkingLots.size(); i += 700) { |
| | | parkingLotService.saveOrUpdateBatch(parkingLots.subList(i, Math.min(i + 700, parkingLots.size()))); |
| | | } |
| | | } |
| | | List<TParkingRecord> parkingRecords = data1.getParkingRecords(); |
| | | if (!parkingRecords.isEmpty()) { |
| | | log.info("停车记录"+parkingRecords); |
| | | |
| | | parkingRecordService.saveBatch(parkingRecords); |
| | | log.info("停车记录"+parkingRecords.size()); |
| | | // 分批插入数据 每次最多700条 |
| | | parkingRecords = parkingRecords.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | for (int i = 0; i < parkingRecords.size(); i += 700) { |
| | | parkingRecordService.saveOrUpdateBatch(parkingRecords.subList(i, Math.min(i + 700, parkingRecords.size()))); |
| | | } |
| | | // List<TPartnerSite> partnerSites = data1.getPartnerSites(); |
| | | // if (!partnerSites.isEmpty()) { |
| | | // partnerSiteService.saveBatch(partnerSites); |
| | | // } |
| | | } |
| | | List<TPartnerSite> partnerSites = data1.getPartnerSites(); |
| | | if (partnerSites!=null&&!partnerSites.isEmpty()) { |
| | | log.info("合作商站点"+parkingRecords.size()); |
| | | // 分批插入数据 每次最多700条 |
| | | |
| | | for (int i = 0; i < partnerSites.size(); i += 700) { |
| | | partnerSiteService.saveOrUpdateBatch(partnerSites.subList(i, Math.min(i + 700, partnerSites.size()))); |
| | | } |
| | | } |
| | | List<TRepair> repairs = data1.getRepairs(); |
| | | if (!repairs.isEmpty()) { |
| | | log.info("报修"+repairs); |
| | | |
| | | repairService.saveBatch(repairs); |
| | | log.info("报修"+repairs.size()); |
| | | // 分批插入数据 每次最多700条 |
| | | repairs = repairs.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | for (int i = 0; i < repairs.size(); i += 700) { |
| | | repairService.saveOrUpdateBatch(repairs.subList(i, Math.min(i + 700, repairs.size()))); |
| | | } |
| | | // List<TSiteMenu> siteMenus = data1.getSiteMenus(); |
| | | // if (!siteMenus.isEmpty()) { |
| | | // siteMenuService.saveBatch(siteMenus); |
| | | // } |
| | | } |
| | | List<TSiteMenu> siteMenus = data1.getSiteMenus(); |
| | | if (siteMenus!=null&&!siteMenus.isEmpty()) { |
| | | log.info("站点菜单"+repairs.size()); |
| | | // 分批插入数据 每次最多700条 |
| | | siteMenus = siteMenus.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | for (int i = 0; i < siteMenus.size(); i += 700) { |
| | | siteMenuService.saveOrUpdateBatch(siteMenus.subList(i, Math.min(i + 700, siteMenus.size()))); |
| | | } |
| | | } |
| | | List<TVehicleRamp> vehicleRamps = data1.getVehicleRamps(); |
| | | if (!vehicleRamps.isEmpty()) { |
| | | log.info("车道"+vehicleRamps); |
| | | |
| | | vehicleRampService.saveBatch(vehicleRamps); |
| | | log.info("车道"+vehicleRamps.size()); |
| | | // 分批插入数据 每次最多700条 |
| | | vehicleRamps = vehicleRamps.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | for (int i = 0; i < vehicleRamps.size(); i += 700) { |
| | | vehicleRampService.saveOrUpdateBatch(vehicleRamps.subList(i, Math.min(i + 700, vehicleRamps.size()))); |
| | | } |
| | | } |
| | | } |
| | | //order服务 |
| | | GovernmentCloudOrderVO data2 = jianGuanOrderClient.listAll().getData(); |
| | | |
| | | |
| | | if (data2 != null) { |
| | | List<AccountingStrategyDetailOrder> accountingStrategyDetailOrders = data2.getAccountingStrategyDetailOrders(); |
| | | // GovernmentCloudOrderVO data2 = jianGuanOrderClient.listAll().getData(); |
| | | GovernmentCloudOrderVO dataOrder1 = jianGuanOrderClient.listAll1().getData(); |
| | | GovernmentCloudOrderVO dataOrder2 = jianGuanOrderClient.listAll2().getData(); |
| | | GovernmentCloudOrderVO dataOrder3 = jianGuanOrderClient.listAll3().getData(); |
| | | GovernmentCloudOrderVO dataOrder4 = jianGuanOrderClient.listAll4().getData(); |
| | | GovernmentCloudOrderVO dataOrder5 = jianGuanOrderClient.listAll5().getData(); |
| | | GovernmentCloudOrderVO dataOrder6 = jianGuanOrderClient.listAll6().getData(); |
| | | GovernmentCloudOrderVO dataOrder7 = jianGuanOrderClient.listAll7().getData(); |
| | | GovernmentCloudOrderVO dataOrder8 = jianGuanOrderClient.listAll8().getData(); |
| | | GovernmentCloudOrderVO dataOrder9 = jianGuanOrderClient.listAll9().getData(); |
| | | GovernmentCloudOrderVO dataOrder10 = jianGuanOrderClient.listAll10().getData(); |
| | | GovernmentCloudOrderVO dataOrder11 = jianGuanOrderClient.listAll11().getData(); |
| | | GovernmentCloudOrderVO dataOrder12 = jianGuanOrderClient.listAll12().getData(); |
| | | GovernmentCloudOrderVO dataOrder13 = jianGuanOrderClient.listAll13().getData(); |
| | | GovernmentCloudOrderVO dataOrder14 = jianGuanOrderClient.listAll14().getData(); |
| | | GovernmentCloudOrderVO dataOrder15 = jianGuanOrderClient.listAll15().getData(); |
| | | GovernmentCloudOrderVO dataOrder16 = jianGuanOrderClient.listAll16().getData(); |
| | | GovernmentCloudOrderVO dataOrder17 = jianGuanOrderClient.listAll17().getData(); |
| | | GovernmentCloudOrderVO dataOrder18 = jianGuanOrderClient.listAll18().getData(); |
| | | log.info("Order服务"); |
| | | if (dataOrder1 != null) { |
| | | List<AccountingStrategyDetailOrder> accountingStrategyDetailOrders = dataOrder1.getAccountingStrategyDetailOrders(); |
| | | if (!accountingStrategyDetailOrders.isEmpty()) { |
| | | log.info("订单明细策略"+accountingStrategyDetailOrders); |
| | | |
| | | accountingStrategyDetailOrderService.saveBatch(accountingStrategyDetailOrders); |
| | | log.info("订单明细策略" + accountingStrategyDetailOrders.size()); |
| | | // 分批插入数据 每次最多700条 |
| | | accountingStrategyDetailOrders = accountingStrategyDetailOrders.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | for (int i = 0; i < accountingStrategyDetailOrders.size(); i += 700) { |
| | | accountingStrategyDetailOrderService.saveOrUpdateBatch(accountingStrategyDetailOrders.subList(i, Math.min(i + 700, accountingStrategyDetailOrders.size()))); |
| | | } |
| | | List<AccountingStrategyOrder> accountingStrategyOrders = data2.getAccountingStrategyOrders(); |
| | | } |
| | | } |
| | | if (dataOrder2 != null) { |
| | | List<AccountingStrategyOrder> accountingStrategyOrders = dataOrder2.getAccountingStrategyOrders(); |
| | | if (!accountingStrategyOrders.isEmpty()) { |
| | | log.info("订单策略"+accountingStrategyOrders); |
| | | |
| | | accountingStrategyOrderService.saveBatch(accountingStrategyOrders); |
| | | log.info("订单策略" + accountingStrategyOrders.size()); |
| | | // 分批插入数据 每次最多700条 |
| | | int size = 700; |
| | | accountingStrategyOrders = accountingStrategyOrders.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | for (int i = 0; i < accountingStrategyOrders.size(); i += size) { |
| | | List<AccountingStrategyOrder> subList = accountingStrategyOrders.subList(i, Math.min(i + size, accountingStrategyOrders.size())); |
| | | accountingStrategyOrderService.saveOrUpdateBatch(subList); |
| | | } |
| | | List<TChargingBill> chargingBills = data2.getChargingBills(); |
| | | } |
| | | } |
| | | if (dataOrder3 != null) { |
| | | List<TChargingBill> chargingBills = dataOrder3.getChargingBills(); |
| | | if (!chargingBills.isEmpty()) { |
| | | log.info("账单"+chargingBills); |
| | | |
| | | chargingBillService.saveBatch(chargingBills); |
| | | log.info("账单" + chargingBills.size()); |
| | | // 分批插入数据 每次最多700条 |
| | | // 分批插入数据 每次最多700条 |
| | | chargingBills = chargingBills.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | for (int i = 0; i < chargingBills.size(); i += 700) { |
| | | chargingBillService.saveOrUpdateBatch(chargingBills.subList(i, Math.min(i + 700, chargingBills.size()))); |
| | | } |
| | | List<TChargingOrder> chargingOrders = data2.getChargingOrders(); |
| | | if (!chargingOrders.isEmpty()) { |
| | | log.info("充电订单"+chargingOrders); |
| | | |
| | | chargingOrderService.saveBatch(chargingOrders); |
| | | } |
| | | List<TChargingOrderAccountingStrategy> chargingOrderAccountingStrategies = data2.getChargingOrderAccountingStrategies(); |
| | | } |
| | | if (dataOrder4 != null) { |
| | | List<TChargingOrderAccountingStrategy> chargingOrderAccountingStrategies = dataOrder4.getChargingOrderAccountingStrategies(); |
| | | if (!chargingOrderAccountingStrategies.isEmpty()) { |
| | | log.info("充电订单策略"+chargingOrderAccountingStrategies); |
| | | |
| | | chargingOrderAccountingStrategyService.saveBatch(chargingOrderAccountingStrategies); |
| | | log.info("充电订单策略" + chargingOrderAccountingStrategies.size()); |
| | | // 分批插入数据 每次最多700条 |
| | | chargingOrderAccountingStrategies = chargingOrderAccountingStrategies.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | for (int i = 0; i < chargingOrderAccountingStrategies.size(); i += 700) { |
| | | chargingOrderAccountingStrategyService.saveOrUpdateBatch(chargingOrderAccountingStrategies.subList(i, Math.min(i + 700, chargingOrderAccountingStrategies.size()))); |
| | | } |
| | | List<TChargingOrderRefund> chargingOrderRefunds = data2.getChargingOrderRefunds(); |
| | | } |
| | | } |
| | | if (dataOrder5 != null) { |
| | | List<TChargingOrderRefund> chargingOrderRefunds = dataOrder5.getChargingOrderRefunds(); |
| | | if (!chargingOrderRefunds.isEmpty()) { |
| | | log.info("充电订单退款"+chargingOrderRefunds); |
| | | log.info("充电订单退款" + chargingOrderRefunds.size()); |
| | | |
| | | chargingOrderRefundService.saveBatch(chargingOrderRefunds); |
| | | // 分批插入数据 每次最多700条 |
| | | chargingOrderRefunds = chargingOrderRefunds.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | for (int i = 0; i < chargingOrderRefunds.size(); i += 700) { |
| | | chargingOrderRefundService.saveOrUpdateBatch(chargingOrderRefunds.subList(i, Math.min(i + 700, chargingOrderRefunds.size()))); |
| | | } |
| | | List<TExchangeOrder> exchangeOrders = data2.getExchangeOrders(); |
| | | } |
| | | } |
| | | if (dataOrder6 != null) { |
| | | List<TChargingOrder> chargingOrders = dataOrder6.getChargingOrders(); |
| | | if (!chargingOrders.isEmpty()) { |
| | | log.info("充电订单" + chargingOrders.size()); |
| | | // 分批插入数据 每次最多700条 |
| | | chargingOrders = chargingOrders.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | for (int i = 0; i < chargingOrders.size(); i += 700) { |
| | | chargingOrderService.saveOrUpdateBatch(chargingOrders.subList(i, Math.min(i + 700, chargingOrders.size()))); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | if (dataOrder7 != null) { |
| | | List<TExchangeOrder> exchangeOrders = dataOrder7.getExchangeOrders(); |
| | | if (!exchangeOrders.isEmpty()) { |
| | | log.info("兑换订单"+exchangeOrders); |
| | | |
| | | exchangeOrderService.saveBatch(exchangeOrders); |
| | | log.info("兑换订单" + exchangeOrders.size()); |
| | | exchangeOrders = exchangeOrders.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < exchangeOrders.size(); i += 700) { |
| | | exchangeOrderService.saveOrUpdateBatch(exchangeOrders.subList(i, Math.min(i + 700, exchangeOrders.size()))); |
| | | } |
| | | List<TGrantVip> grantVips = data2.getGrantVips(); |
| | | } |
| | | } |
| | | if (dataOrder8 != null) { |
| | | List<TGrantVip> grantVips = dataOrder8.getGrantVips(); |
| | | if (!grantVips.isEmpty()) { |
| | | log.info("赠送vip"+grantVips); |
| | | log.info("赠送vip" + grantVips.size()); |
| | | |
| | | grantVipService.saveBatch(grantVips); |
| | | // 分批插入数据 每次最多700条 |
| | | grantVips = grantVips.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | for (int i = 0; i < grantVips.size(); i += 700) { |
| | | grantVipService.saveOrUpdateBatch(grantVips.subList(i, Math.min(i + 700, grantVips.size()))); |
| | | } |
| | | List<TOrderAppeal> orderAppeals = data2.getOrderAppeals(); |
| | | } |
| | | } |
| | | if (dataOrder9 != null) { |
| | | List<TOrderAppeal> orderAppeals = dataOrder9.getOrderAppeals(); |
| | | if (!orderAppeals.isEmpty()) { |
| | | log.info("订单申诉"+orderAppeals); |
| | | |
| | | orderAppealService.saveBatch(orderAppeals); |
| | | log.info("订单申诉" + orderAppeals.size()); |
| | | orderAppeals = orderAppeals.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < orderAppeals.size(); i += 700) { |
| | | orderAppealService.saveOrUpdateBatch(orderAppeals.subList(i, Math.min(i + 700, orderAppeals.size()))); |
| | | } |
| | | List<TOrderEvaluate> orderEvaluates = data2.getOrderEvaluates(); |
| | | } |
| | | } |
| | | if (dataOrder10 != null) { |
| | | List<TOrderEvaluate> orderEvaluates = dataOrder10.getOrderEvaluates(); |
| | | if (!orderEvaluates.isEmpty()) { |
| | | log.info("订单评价"+orderEvaluates); |
| | | |
| | | orderEvaluateService.saveBatch(orderEvaluates); |
| | | log.info("订单评价"+orderEvaluates.size()); |
| | | orderEvaluates = orderEvaluates.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < orderEvaluates.size(); i += 700) { |
| | | orderEvaluateService.saveOrUpdateBatch(orderEvaluates.subList(i, Math.min(i + 700, orderEvaluates.size()))); |
| | | } |
| | | List<TOrderEvaluateTag> orderEvaluateTags = data2.getOrderEvaluateTags(); |
| | | } |
| | | } |
| | | if (dataOrder11 != null) { |
| | | List<TOrderEvaluateTag> orderEvaluateTags = dataOrder11.getOrderEvaluateTags(); |
| | | if (!orderEvaluateTags.isEmpty()) { |
| | | log.info("订单评价标签"+orderEvaluateTags); |
| | | |
| | | orderEvaluateTagService.saveBatch(orderEvaluateTags); |
| | | log.info("订单评价标签" + orderEvaluateTags.size()); |
| | | // 分批插入数据 每次最多700条 |
| | | orderEvaluateTags = orderEvaluateTags.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | for (int i = 0; i < orderEvaluateTags.size(); i += 700) { |
| | | orderEvaluateTagService.saveOrUpdateBatch(orderEvaluateTags.subList(i, Math.min(i + 700, orderEvaluateTags.size()))); |
| | | } |
| | | List<TOrderInvoice> orderInvoices = data2.getOrderInvoices(); |
| | | if (!orderInvoices.isEmpty()) { |
| | | log.info("订单开票"+orderInvoices); |
| | | |
| | | orderInvoiceService.saveBatch(orderInvoices); |
| | | } |
| | | List<TOrderInvoiceDetail> orderInvoiceDetails = data2.getOrderInvoiceDetails(); |
| | | } |
| | | if (dataOrder12 != null) { |
| | | List<TOrderInvoiceDetail> orderInvoiceDetails = dataOrder12.getOrderInvoiceDetails(); |
| | | if (!orderInvoiceDetails.isEmpty()) { |
| | | log.info("订单开票明细"+orderInvoiceDetails); |
| | | |
| | | orderInvoiceDetailService.saveBatch(orderInvoiceDetails); |
| | | log.info("订单开票明细" + orderInvoiceDetails.size()); |
| | | // 分批插入数据 每次最多700条 |
| | | orderInvoiceDetails = orderInvoiceDetails.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | for (int i = 0; i < orderInvoiceDetails.size(); i += 700) { |
| | | orderInvoiceDetailService.saveOrUpdateBatch(orderInvoiceDetails.subList(i, Math.min(i + 700, orderInvoiceDetails.size()))); |
| | | } |
| | | List<TSettlementConfirm> settlementConfirms = data2.getSettlementConfirms(); |
| | | } |
| | | } |
| | | if (dataOrder13 != null) { |
| | | List<TOrderInvoice> orderInvoices = dataOrder13.getOrderInvoices(); |
| | | if (!orderInvoices.isEmpty()) { |
| | | log.info("订单开票" + orderInvoices.size()); |
| | | orderInvoices = orderInvoices.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < orderInvoices.size(); i += 700) { |
| | | orderInvoiceService.saveOrUpdateBatch(orderInvoices.subList(i, Math.min(i + 700, orderInvoices.size()))); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (dataOrder14 != null) { |
| | | List<TSettlementConfirm> settlementConfirms = dataOrder14.getSettlementConfirms(); |
| | | if (!settlementConfirms.isEmpty()) { |
| | | log.info("账单结算"+settlementConfirms); |
| | | |
| | | settlementConfirmService.saveBatch(settlementConfirms); |
| | | log.info("账单结算" + settlementConfirms.size()); |
| | | settlementConfirms = settlementConfirms.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < settlementConfirms.size(); i += 700) { |
| | | settlementConfirmService.saveOrUpdateBatch(settlementConfirms.subList(i, Math.min(i + 700, settlementConfirms.size()))); |
| | | } |
| | | List<TShoppingOrder> shoppingOrders = data2.getShoppingOrders(); |
| | | if (!shoppingOrders.isEmpty()) { |
| | | log.info("购物订单"+shoppingOrders); |
| | | |
| | | shoppingOrderService.saveBatch(shoppingOrders); |
| | | } |
| | | List<TShoppingOrderRefund> shoppingOrderRefunds = data2.getShoppingOrderRefunds(); |
| | | } |
| | | if (dataOrder15 != null) { |
| | | List<TShoppingOrderRefund> shoppingOrderRefunds = dataOrder15.getShoppingOrderRefunds(); |
| | | if (!shoppingOrderRefunds.isEmpty()) { |
| | | log.info("购物订单退款"+shoppingOrderRefunds); |
| | | |
| | | shoppingOrderRefundService.saveBatch(shoppingOrderRefunds); |
| | | log.info("购物订单退款" + shoppingOrderRefunds.size()); |
| | | // 分批插入数据 每次最多700条 |
| | | shoppingOrderRefunds = shoppingOrderRefunds.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | for (int i = 0; i < shoppingOrderRefunds.size(); i += 700) { |
| | | shoppingOrderRefundService.saveOrUpdateBatch(shoppingOrderRefunds.subList(i, Math.min(i + 700, shoppingOrderRefunds.size()))); |
| | | } |
| | | List<TVipOrder> vipOrders = data2.getVipOrders(); |
| | | if (!vipOrders.isEmpty()) { |
| | | log.info("会员订单"+vipOrders); |
| | | |
| | | vipOrderService.saveBatch(vipOrders); |
| | | } |
| | | List<TVipOrderRefund> vipOrderRefunds = data2.getVipOrderRefunds(); |
| | | } |
| | | if (dataOrder16 != null) { |
| | | List<TVipOrderRefund> vipOrderRefunds = dataOrder16.getVipOrderRefunds(); |
| | | if (!vipOrderRefunds.isEmpty()) { |
| | | log.info("会员订单退款"+vipOrderRefunds); |
| | | vipOrderRefunds = vipOrderRefunds.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < vipOrderRefunds.size(); i += 700) { |
| | | vipOrderRefundService.saveOrUpdateBatch(vipOrderRefunds.subList(i, Math.min(i + 700, vipOrderRefunds.size()))); |
| | | } |
| | | } |
| | | } |
| | | if (dataOrder17 != null) { |
| | | List<TVipOrder> vipOrders = dataOrder17.getVipOrders(); |
| | | if (!vipOrders.isEmpty()) { |
| | | log.info("会员订单" + vipOrders.size()); |
| | | vipOrders = vipOrders.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < vipOrders.size(); i += 700) { |
| | | vipOrderService.saveOrUpdateBatch(vipOrders.subList(i, Math.min(i + 700, vipOrders.size()))); |
| | | } |
| | | } |
| | | } |
| | | if (dataOrder18 != null) { |
| | | List<TShoppingOrder> shoppingOrders = dataOrder18.getShoppingOrders(); |
| | | if (!shoppingOrders.isEmpty()) { |
| | | log.info("购物订单" + shoppingOrders.size()); |
| | | shoppingOrders = shoppingOrders.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < shoppingOrders.size(); i += 700) { |
| | | shoppingOrderService.saveOrUpdateBatch(shoppingOrders.subList(i, Math.min(i + 700, shoppingOrders.size()))); |
| | | } |
| | | } |
| | | } |
| | | |
| | | vipOrderRefundService.saveBatch(vipOrderRefunds); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // other服务 |
| | | GovernmentCloudOtherVO data3 = jianGuanOtherClient.listAll().getData(); |
| | | if (data3 != null) { |
| | | log.info("other服务"); |
| | | |
| | | List<Operator> operators = data3.getOperators(); |
| | | if (!operators.isEmpty()) { |
| | | log.info("运营商"+operators); |
| | | log.info("运营商"+operators.size()); |
| | | |
| | | operatorService.saveOrUpdateBatch(operators); |
| | | } |
| | | List<TActivity> activities = data3.getActivities(); |
| | | if (!activities.isEmpty()) { |
| | | log.info("活动"+activities); |
| | | log.info("活动"+activities.size()); |
| | | |
| | | activityService.saveBatch(activities); |
| | | activityService.saveOrUpdateBatch(activities); |
| | | } |
| | | List<TAdvertising> advertisings = data3.getAdvertisings(); |
| | | if (!advertisings.isEmpty()) { |
| | | log.info("广告"+advertisings); |
| | | log.info("广告"+advertisings.size()); |
| | | |
| | | advertisingService.saveBatch(advertisings); |
| | | advertisingService.saveOrUpdateBatch(advertisings); |
| | | } |
| | | List<TCompany> companies = data3.getCompanies(); |
| | | if (!companies.isEmpty()) { |
| | | log.info("公司"+companies); |
| | | log.info("公司"+companies.size()); |
| | | |
| | | companyService.saveBatch(companies); |
| | | companyService.saveOrUpdateBatch(companies); |
| | | } |
| | | List<TCoupon> coupons = data3.getCoupons(); |
| | | if (!coupons.isEmpty()) { |
| | | log.info("优惠券"+coupons); |
| | | log.info("优惠券"+coupons.size()); |
| | | |
| | | couponService.saveBatch(coupons); |
| | | couponService.saveOrUpdateBatch(coupons); |
| | | } |
| | | List<TEnterpriseUserApplication> enterpriseUserApplications = data3.getEnterpriseUserApplications(); |
| | | if (!enterpriseUserApplications.isEmpty()) { |
| | | log.info("公司申请"+enterpriseUserApplications); |
| | | log.info("公司申请"+enterpriseUserApplications.size()); |
| | | |
| | | enterpriseUserApplicationService.saveBatch(enterpriseUserApplications); |
| | | enterpriseUserApplicationService.saveOrUpdateBatch(enterpriseUserApplications); |
| | | } |
| | | List<TEvaluationTag> evaluationTags = data3.getEvaluationTags(); |
| | | if (!evaluationTags.isEmpty()) { |
| | | log.info("评价标签"+evaluationTags); |
| | | log.info("评价标签"+evaluationTags.size()); |
| | | |
| | | evaluationTagService.saveBatch(evaluationTags); |
| | | evaluationTagService.saveOrUpdateBatch(evaluationTags); |
| | | } |
| | | List<TGoods> goods = data3.getGoods(); |
| | | if (!goods.isEmpty()) { |
| | | log.info("商品"+goods); |
| | | log.info("商品"+goods.size()); |
| | | |
| | | goodsService.saveBatch(goods); |
| | | goodsService.saveOrUpdateBatch(goods); |
| | | } |
| | | List<THtml> htmls = data3.getHtmls(); |
| | | if (!htmls.isEmpty()) { |
| | | log.info("html"+htmls); |
| | | log.info("html"+htmls.size()); |
| | | |
| | | htmlService.saveOrUpdateBatch(htmls); |
| | | } |
| | | List<TIntegralRule> integralRules = data3.getIntegralRules(); |
| | | if (!integralRules.isEmpty()) { |
| | | log.info("积分规则"+integralRules); |
| | | log.info("积分规则"+integralRules.size()); |
| | | |
| | | integralRuleService.saveBatch(integralRules); |
| | | integralRuleService.saveOrUpdateBatch(integralRules); |
| | | } |
| | | List<TInvoiceType> invoiceTypes = data3.getInvoiceTypes(); |
| | | if (!invoiceTypes.isEmpty()) { |
| | | log.info("开票类型"+invoiceTypes); |
| | | log.info("开票类型"+invoiceTypes.size()); |
| | | |
| | | invoiceTypeService.saveBatch(invoiceTypes); |
| | | invoiceTypeService.saveOrUpdateBatch(invoiceTypes); |
| | | } |
| | | List<TNotice> notices = data3.getNotices(); |
| | | if (!notices.isEmpty()) { |
| | | log.info("通知"+notices); |
| | | |
| | | noticeService.saveBatch(notices); |
| | | log.info("通知"+notices.size()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < notices.size(); i += 700) { |
| | | noticeService.saveOrUpdateBatch(notices.subList(i, Math.min(i + 700, notices.size()))); |
| | | } |
| | | } |
| | | List<TSystemConfiguration> systemConfigurations = data3.getSystemConfigurations(); |
| | | if (!systemConfigurations.isEmpty()) { |
| | | log.info("系统设置"+systemConfigurations); |
| | | log.info("系统设置"+systemConfigurations.size()); |
| | | |
| | | systemConfigurationService.saveOrUpdateBatch(systemConfigurations); |
| | | } |
| | | List<TUserTag> userTags = data3.getUserTags(); |
| | | if (!userTags.isEmpty()) { |
| | | log.info("用户标签"+userTags); |
| | | userTagService.saveBatch(userTags); |
| | | log.info("用户标签"+userTags.size()); |
| | | |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < userTags.size(); i += 700) { |
| | | userTagService.saveOrUpdateBatch(userTags.subList(i, Math.min(i + 700, userTags.size()))); |
| | | } |
| | | } |
| | | List<TVip> vips = data3.getVips(); |
| | | if (!vips.isEmpty()) { |
| | | log.info("会员"+vips); |
| | | vipService.saveBatch(vips); |
| | | log.info("会员"+vips.size()); |
| | | |
| | | vipService.saveOrUpdateBatch(vips); |
| | | } |
| | | List<TUserSite> userSites = data3.getUserSites(); |
| | | if (userSites!=null&&!userSites.isEmpty()) { |
| | | log.info("用户站点"+userSites.size()); |
| | | |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < userTags.size(); i += 700) { |
| | | userSiteService.saveOrUpdateBatch(userSites.subList(i, Math.min(i + 700, userSites.size()))); |
| | | } |
| | | } |
| | | List<TRoleSite> roleSites = data3.getRoleSites(); |
| | | if (roleSites!=null&&!userSites.isEmpty()) { |
| | | log.info("角色站点"+userSites.size()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < roleSites.size(); i += 700) { |
| | | roleSiteService.saveOrUpdateBatch(roleSites.subList(i, Math.min(i + 700, roleSites.size()))); |
| | | } |
| | | } |
| | | } |
| | | GovernmentCloudSystemVO data4 = jianGuanSystemClient.listAll().getData(); |
| | | if (data4 != null) { |
| | | log.info("System服务"); |
| | | |
| | | List<SysLoginLog> loginLogs = data4.getLoginLogs(); |
| | | if (!loginLogs.isEmpty()) { |
| | | log.info("登录日志"+loginLogs); |
| | | sysLoginLogService.saveBatch(loginLogs); |
| | | log.info("登录日志"+loginLogs.size()); |
| | | loginLogs = loginLogs.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime()!=null&&accountingStrategy.getCreateTime().isAfter(startOfDay)) |
| | | .filter(accountingStrategy -> accountingStrategy.getCreateTime().isBefore(endOfDay)) |
| | | .collect(Collectors.toList()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < loginLogs.size(); i += 700) { |
| | | sysLoginLogService.saveOrUpdateBatch(loginLogs.subList(i, Math.min(i + 700, loginLogs.size()))); |
| | | } |
| | | } |
| | | List<SysOperLog> sysOperLogs = data4.getSysOperLogs(); |
| | | if (!sysOperLogs.isEmpty()) { |
| | | log.info("操作日志"+sysOperLogs); |
| | | sysOperLogService.saveBatch(sysOperLogs); |
| | | log.info("操作日志"+sysOperLogs.size()); |
| | | sysOperLogs = sysOperLogs.stream() |
| | | .filter(accountingStrategy -> accountingStrategy.getOperTime().after(startDate)) |
| | | .filter(accountingStrategy -> accountingStrategy.getOperTime().before(endDate)) |
| | | .collect(Collectors.toList()); |
| | | // 分批插入数据 每次最多700条 |
| | | for (int i = 0; i < sysOperLogs.size(); i += 700) { |
| | | sysOperLogService.saveOrUpdateBatch(sysOperLogs.subList(i, Math.min(i + 700, sysOperLogs.size()))); |
| | | } |
| | | } |
| | | List<SysRole> sysRoles = data4.getSysRoles(); |
| | | if (!sysRoles.isEmpty()) { |
| | | log.info("角色"+sysRoles); |
| | | sysRoleService.saveBatch(sysRoles); |
| | | log.info("角色"+sysRoles.size()); |
| | | |
| | | sysRoleService.saveOrUpdateBatch(sysRoles); |
| | | } |
| | | List<SysUser> sysUsers = data4.getSysUsers(); |
| | | if (!sysUsers.isEmpty()) { |
| | | log.info("系统用户"+sysUsers); |
| | | sysUserService.saveBatch(sysUsers); |
| | | log.info("系统用户"+sysUsers.size()); |
| | | |
| | | sysUserService.saveOrUpdateBatch(sysUsers); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.util; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.jianguan.model.ConnectorStatusInfo; |
| | | import com.ruoyi.jianguan.model.SupEquipChargeStatus; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.vo.TChargingOrderVo; |
| | | import com.ruoyi.other.api.domain.Operator; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/12 9:10 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class TaskUtil { |
| | | |
| | | @Resource |
| | | private ChargingGunClient chargingGunClient; |
| | | |
| | | private final static String operatorId = "906171535"; |
| | | @Resource |
| | | private TCECSuperviseUtil tcecSuperviseUtil; |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Resource |
| | | private RedisTemplate redisTemplate; |
| | | @Resource |
| | | private ChuanYiChongSuperviseUtil chuanYiChongSuperviseUtil; |
| | | |
| | | |
| | | /** |
| | | * 10秒定时推送枪状态 |
| | | */ |
| | | @Scheduled(fixedRate = 10000) |
| | | public void taskPushStatus(){ |
| | | pushStatus(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 1分钟定时推送订单状态 |
| | | */ |
| | | @Scheduled(fixedRate = 60000) |
| | | public void taskPushOrderStatus(){ |
| | | pushOrderStatus(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 定时推送订单状态 |
| | | */ |
| | | public void pushOrderStatus(){ |
| | | TChargingOrderVo order = new TChargingOrderVo(); |
| | | order.setStatusList(new ArrayList<Integer>(){{ |
| | | add(3); |
| | | }}); |
| | | List<TChargingOrder> orders = chargingOrderClient.getChargingOrder(order).getData(); |
| | | for (TChargingOrder chargingOrder : orders) { |
| | | log.info("推送充电订单状态:{}", chargingOrder); |
| | | SupEquipChargeStatus supEquipChargeStatus = new SupEquipChargeStatus(); |
| | | supEquipChargeStatus.setOperatorID(operatorId); |
| | | supEquipChargeStatus.setEquipmentOwnerID(operatorId); |
| | | supEquipChargeStatus.setStationID(String.valueOf(chargingOrder.getSiteId())); |
| | | supEquipChargeStatus.setEquipmentID(String.valueOf(chargingOrder.getChargingPileId())); |
| | | supEquipChargeStatus.setOrderNo(operatorId+chargingOrder.getCode()); |
| | | switch (chargingOrder.getStatus()){ |
| | | case 2: |
| | | supEquipChargeStatus.setConnectorStatus(1); |
| | | break; |
| | | case 3: |
| | | supEquipChargeStatus.setConnectorStatus(2); |
| | | break; |
| | | case 4: |
| | | supEquipChargeStatus.setConnectorStatus(3); |
| | | break; |
| | | case 5: |
| | | supEquipChargeStatus.setConnectorStatus(4); |
| | | break; |
| | | } |
| | | TChargingGun chargingGun2 = chargingGunClient.getChargingGunById(chargingOrder.getChargingGunId()).getData(); |
| | | supEquipChargeStatus.setConnectorID(chargingGun2.getFullNumber()); |
| | | supEquipChargeStatus.setEquipmentClassification(1); |
| | | supEquipChargeStatus.setPushTimeStamp(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); |
| | | switch (chargingGun2.getStatus()){ |
| | | case 1: |
| | | supEquipChargeStatus.setConnectorStatus(0); |
| | | break; |
| | | case 2: |
| | | supEquipChargeStatus.setConnectorStatus(1); |
| | | break; |
| | | case 3: |
| | | supEquipChargeStatus.setConnectorStatus(2); |
| | | break; |
| | | case 4: |
| | | supEquipChargeStatus.setConnectorStatus(3); |
| | | break; |
| | | case 5: |
| | | supEquipChargeStatus.setConnectorStatus(3); |
| | | break; |
| | | case 6: |
| | | supEquipChargeStatus.setConnectorStatus(4); |
| | | break; |
| | | case 7: |
| | | supEquipChargeStatus.setConnectorStatus(255); |
| | | break; |
| | | } |
| | | supEquipChargeStatus.setCurrentA(chargingOrder.getCurrent()); |
| | | |
| | | supEquipChargeStatus.setSOC(null != chargingOrder.getTotalElectricity()?chargingOrder.getTotalElectricity():new BigDecimal("1")); |
| | | supEquipChargeStatus.setStartTime(chargingOrder.getStartTime() != null ? chargingOrder.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) : ""); |
| | | supEquipChargeStatus.setEndTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); |
| | | supEquipChargeStatus.setTotalPower(chargingOrder.getElectrovalence()); |
| | | tcecSuperviseUtil.notificationSupEquipChargeStatus(new Operator(), supEquipChargeStatus); |
| | | TAppUser data = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); |
| | | |
| | | // 川逸充 |
| | | if (chargingOrder.getRechargePaymentType()==3){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("StartChargeSeq",chargingOrder.getCode()); |
| | | jsonObject.put("ConnectorID",chargingGun2.getFullNumber()); |
| | | log.info("川逸充用户信息"+data); |
| | | if (StringUtils.hasLength(data.getPhone())){ |
| | | jsonObject.put("Mobile",data.getPhone()); |
| | | } |
| | | LocalDateTime startTime = chargingOrder.getStartTime(); |
| | | |
| | | //状态(0=未知,1=等待中/已插枪,2=启动中,3=充电中,4=停止中,5=已结束) |
| | | int tempStatus = 0; |
| | | switch (chargingOrder.getStatus()){ |
| | | case 1: |
| | | tempStatus=1; |
| | | |
| | | case 2: |
| | | tempStatus=1; |
| | | jsonObject.put("StartChargeSeqStat",tempStatus); |
| | | if (startTime!=null){ |
| | | jsonObject.put("StartTime",startTime.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | }else{ |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // 转化为yyyy-MM-dd HH:mm:ss格式字符串 |
| | | jsonObject.put("StartTime",now.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | } |
| | | chuanYiChongSuperviseUtil.notificationStationStatus(new Operator(), jsonObject); |
| | | break; |
| | | case 3: |
| | | tempStatus=2; |
| | | jsonObject.put("StartChargeSeqStat",tempStatus); |
| | | if (startTime!=null){ |
| | | jsonObject.put("StartTime",startTime.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | }else{ |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // 转化为yyyy-MM-dd HH:mm:ss格式字符串 |
| | | jsonObject.put("StartTime",now.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | } |
| | | chuanYiChongSuperviseUtil.notificationStationStatus(new Operator(), jsonObject); |
| | | break; |
| | | case 4: |
| | | break; |
| | | case 5: |
| | | jsonObject.put("StartChargeSeqStat",4); |
| | | int temp = 0; |
| | | //充电枪状态(1=离线,2=空闲,3=占用(未充电),4=占用(充电中),5=占用(已充满),6=占用(预约锁定),7=故障) |
| | | switch (chargingGun2.getStatus()){ |
| | | case 1: |
| | | temp = 0; |
| | | break; |
| | | case 2: |
| | | temp=1; |
| | | break; |
| | | case 3: |
| | | temp=2; |
| | | break; |
| | | case 4: |
| | | temp=3; |
| | | break; |
| | | case 5: |
| | | temp=4; |
| | | break; |
| | | case 6: |
| | | temp=4; |
| | | break; |
| | | case 7: |
| | | temp = 255; |
| | | break; |
| | | } |
| | | jsonObject.put("ConnectorStatus",temp); |
| | | |
| | | jsonObject.put("CurrentA",chargingOrder.getCurrent()); |
| | | jsonObject.put("VoltageA",chargingOrder.getVoltage()); |
| | | LocalDateTime startTime2 = chargingOrder.getStartTime(); |
| | | |
| | | if (startTime2!=null){ |
| | | jsonObject.put("StartTime",startTime2.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | }else{ |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // 转化为yyyy-MM-dd HH:mm:ss格式字符串 |
| | | jsonObject.put("StartTime",now.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | } |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // 转化为yyyy-MM-dd HH:mm:ss格式字符串 |
| | | jsonObject.put("EndTime",now.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | jsonObject.put("TotalPower",chargingOrder.getElectricity()); |
| | | jsonObject.put("TotalMoney",chargingOrder.getOrderAmount()); |
| | | chuanYiChongSuperviseUtil.notificationSupEquipChargeStatus(new Operator(), jsonObject); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 推送枪状态到平台 |
| | | */ |
| | | public void pushStatus(){ |
| | | redisTemplate.keys("ping:*").forEach(key->{ |
| | | String fullNumber = key.toString().split(":")[1]; |
| | | log.info("推送枪状态到监管平台:{}",fullNumber); |
| | | TChargingGun chargingGun = chargingGunClient.getChargingGunByFullNumber(fullNumber).getData(); |
| | | if (chargingGun!=null){ |
| | | ConnectorStatusInfo connectorStatusInfo = new ConnectorStatusInfo(); |
| | | connectorStatusInfo.setOperatorID(operatorId); |
| | | connectorStatusInfo.setEquipmentOwnerID(operatorId); |
| | | connectorStatusInfo.setStationID(String.valueOf(chargingGun.getSiteId())); |
| | | connectorStatusInfo.setEquipmentID(String.valueOf(chargingGun.getChargingPileId())); |
| | | connectorStatusInfo.setConnectorID(chargingGun.getFullNumber()); |
| | | if (chargingGun.getEquipmentClassification()!=null){ |
| | | connectorStatusInfo.setEquipmentClassification(chargingGun.getEquipmentClassification()); |
| | | }else { |
| | | connectorStatusInfo.setEquipmentClassification(1); |
| | | } |
| | | switch (chargingGun.getStatus()){ |
| | | case 1: |
| | | connectorStatusInfo.setStatus(0); |
| | | break; |
| | | case 2: |
| | | connectorStatusInfo.setStatus(1); |
| | | break; |
| | | case 3: |
| | | connectorStatusInfo.setStatus(2); |
| | | break; |
| | | case 4: |
| | | connectorStatusInfo.setStatus(3); |
| | | break; |
| | | case 5: |
| | | connectorStatusInfo.setStatus(3); |
| | | break; |
| | | case 6: |
| | | connectorStatusInfo.setStatus(4); |
| | | break; |
| | | case 7: |
| | | connectorStatusInfo.setStatus(255); |
| | | break; |
| | | } |
| | | connectorStatusInfo.setUpdateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); |
| | | tcecSuperviseUtil.notificationStationStatus(new Operator(), connectorStatusInfo); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | allow-circular-references: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: prod |
| | | # active: dev |
| | | active: prod |
| | | |
| | | --- |
| | | spring: |
New file |
| | |
| | | package com.ruoyi.jianguan; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.nacos.common.utils.JacksonUtils; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.ruoyi.jianguan.model.BaseRequestJianGuan; |
| | | import com.ruoyi.jianguan.model.BaseResult; |
| | | import com.ruoyi.jianguan.model.NotificationStationStatusResult; |
| | | import com.ruoyi.jianguan.model.QueryTokenResult; |
| | | import com.ruoyi.jianguan.util.AESUtil; |
| | | import com.ruoyi.jianguan.util.AesEncryption; |
| | | import com.ruoyi.jianguan.util.HMacMD5Util; |
| | | import com.ruoyi.jianguan.util.SequenceGenerator; |
| | | import com.ruoyi.other.api.domain.Operator; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | |
| | | @Slf4j |
| | | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = RuoYiJianGuanApplication.class) |
| | | public class RuoYiJianGuanApplicationTests { |
| | | private static final String OperatorID = "906171535"; |
| | | private static final String OperatorSecret = "9jG8qysc5RxdbjvnvdmuRYQg6J82Fwj1"; |
| | | private static final String SigSecret = "RruzbZxnr74tqxe1"; |
| | | private static final String DataSecret = "3QJXn4MSj78zcpW1"; |
| | | private static final String DataSecretIV = "jhqj64V9gX8NHbu1"; |
| | | private final static String query_token = "/query_token"; |
| | | |
| | | private final static String url = "https://dataexchange.cdczpt.com/shevcs/v1"; |
| | | private final static String supervise_notification_equip_charge_status = "/notification_start_charge_result"; |
| | | |
| | | @Test |
| | | public void contextLoads() { |
| | | com.alibaba.fastjson2.JSONObject jsonObject = new com.alibaba.fastjson2.JSONObject(); |
| | | jsonObject.put("StartChargeSeq","CD34920250109232935330"); |
| | | jsonObject.put("ConnectorID","202412310000100101"); |
| | | jsonObject.put("StartChargeSeqStat",1); |
| | | |
| | | // 转化为yyyy-MM-dd HH:mm:ss格式字符串 |
| | | jsonObject.put("StartTime","2025-01-09 23:29:40"); |
| | | |
| | | HttpRequest post = HttpUtil.createPost(url+supervise_notification_equip_charge_status); |
| | | buildBody(post, jsonObject, new Operator()); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | | log.error("推送三方平台充电开始状态失败:" + execute.body()); |
| | | } |
| | | log.info("推送三方平台设备状态响应:" + execute.body()); |
| | | BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | Integer Ret = baseResult.getRet(); |
| | | if(0 != Ret){ |
| | | log.error("推送三方平台充电开始状态失败:" + baseResult.getMsg()); |
| | | |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), DataSecret, DataSecretIV); |
| | | log.info("推送三方平台设备状态Data:" + decrypt); |
| | | NotificationStationStatusResult notificationStationStatusResult = JSON.parseObject(decrypt, NotificationStationStatusResult.class); |
| | | System.err.println(notificationStationStatusResult); |
| | | } |
| | | @Test |
| | | public void contextLoads1() { |
| | | com.alibaba.fastjson2.JSONObject jsonObject = new com.alibaba.fastjson2.JSONObject(); |
| | | jsonObject.put("StartChargeSeq","CD34920250109232935330"); |
| | | jsonObject.put("StartChargeSeqStat",4); |
| | | jsonObject.put("ConnectorID","202412310000100101"); |
| | | jsonObject.put("ConnectorStatus",2); |
| | | |
| | | jsonObject.put("CurrentA",83); |
| | | jsonObject.put("VoltageA",344); |
| | | jsonObject.put("StartTime","2025-01-09 23:29:40"); |
| | | |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // 转化为yyyy-MM-dd HH:mm:ss格式字符串 |
| | | jsonObject.put("EndTime",now.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | jsonObject.put("TotalPower",34.29); |
| | | jsonObject.put("TotalMoney",25.93); |
| | | |
| | | HttpRequest post = HttpUtil.createPost(url+supervise_notification_equip_charge_status); |
| | | buildBody(post, jsonObject, new Operator()); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | | log.error("推送三方平台充电开始状态失败:" + execute.body()); |
| | | } |
| | | log.info("推送三方平台设备状态响应:" + execute.body()); |
| | | BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | Integer Ret = baseResult.getRet(); |
| | | if(0 != Ret){ |
| | | log.error("推送三方平台充电开始状态失败:" + baseResult.getMsg()); |
| | | |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), DataSecret, DataSecretIV); |
| | | log.info("推送三方平台设备状态Data:" + decrypt); |
| | | NotificationStationStatusResult notificationStationStatusResult = JSON.parseObject(decrypt, NotificationStationStatusResult.class); |
| | | System.err.println(notificationStationStatusResult); |
| | | } |
| | | /** |
| | | * 构建请求参数和消息头 |
| | | * @param post |
| | | * @param |
| | | */ |
| | | public void buildBody(HttpRequest post, com.alibaba.fastjson2.JSONObject o, Operator operator){ |
| | | Long timeStamp = Long.valueOf(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
| | | post.contentType("application/json;charset=utf-8"); |
| | | post.header("Authorization", "Bearer " + queryToken()); |
| | | BaseRequestJianGuan baseRequest = new BaseRequestJianGuan(); |
| | | baseRequest.setOperatorID("906171535"); |
| | | baseRequest.setTimeStamp(timeStamp+""); |
| | | baseRequest.setSeq("0001"); |
| | | |
| | | |
| | | String encrypt = AesEncryption.encrypt(DataSecret, DataSecretIV,o.toJSONString()); |
| | | // String encrypt = AesEncryption.encrypt(DataSecret, DataSecretIV,jsonString); |
| | | |
| | | baseRequest.setData(encrypt); |
| | | baseRequest.setOperator(operator); |
| | | SequenceGenerator generator = new SequenceGenerator(); |
| | | String nextSequence = generator.getNextSequence(); |
| | | |
| | | String hmacMD5 = HMacMD5Util.getHMacMD5("906171535",timeStamp+"", encrypt,nextSequence,SigSecret); |
| | | // String hmacMD5 = HMacMD5Util.getHMacMD5(OperatorID,timeStamp, data,nextSequence,OurSigSecret); |
| | | |
| | | baseRequest.setSig(hmacMD5); |
| | | String request_json = JacksonUtils.toJson(baseRequest); |
| | | post.body(request_json); |
| | | log.info("推送三方平台请求地址:" + post.getUrl()); |
| | | log.info("推送三方平台请求参数:" + request_json); |
| | | log.info("推送三方平台请求Data:" + o.toJSONString()); |
| | | } |
| | | public String queryToken(){ |
| | | HttpRequest post = HttpUtil.createPost(url + query_token); |
| | | JSONObject info = new JSONObject(); |
| | | info.put("OperatorID", "906171535"); |
| | | info.put("OperatorSecret", OperatorSecret); |
| | | Long timeStamp = Long.valueOf(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
| | | post.contentType("application/json;charset=utf-8"); |
| | | BaseRequestJianGuan baseRequest = new BaseRequestJianGuan(); |
| | | baseRequest.setOperatorID("906171535"); |
| | | baseRequest.setTimeStamp(timeStamp+""); |
| | | baseRequest.setSeq("0001"); |
| | | String jsonString = JacksonUtils.toJson(info); |
| | | SequenceGenerator generator = new SequenceGenerator(); |
| | | String nextSequence = generator.getNextSequence(); |
| | | String data = AesEncryption.encrypt(DataSecret, DataSecretIV,jsonString); |
| | | String hmacMD5 = HMacMD5Util.getHMacMD5("906171535",timeStamp+"", data,nextSequence,SigSecret); |
| | | baseRequest.setData(data); |
| | | baseRequest.setSig(hmacMD5); |
| | | String request_json = JacksonUtils.toJson(baseRequest); |
| | | log.info("获取三方平台授权token请求地址:" + post.getUrl()); |
| | | log.info("获取三方平台授权token请求参数:" + request_json); |
| | | log.info("获取三方平台授权token请求Data:" + jsonString); |
| | | post.body(request_json); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | | log.error("获取三方平台授权token失败:" + execute.body()); |
| | | return null; |
| | | } |
| | | log.info("获取三方平台授权token响应参数:" + execute.body()); |
| | | BaseResult baseResult = JSON.parseObject(execute.body(), BaseResult.class); |
| | | Integer Ret = baseResult.getRet(); |
| | | if(0 != Ret){ |
| | | log.error("获取三方平台授权token失败:" + baseResult.getMsg()); |
| | | return null; |
| | | } |
| | | //解密参数 |
| | | String decrypt = AESUtil.decrypt(baseResult.getData(), DataSecret, DataSecretIV); |
| | | log.info("获取三方平台授权token响应Data:" + decrypt); |
| | | QueryTokenResult queryTokenResult = JSON.parseObject(decrypt, QueryTokenResult.class); |
| | | String token = queryTokenResult.getAccessToken(); |
| | | // Long tokenAvailableTime = LocalDateTime.now().toEpochSecond(ZoneOffset.UTC) + queryTokenResult.getTokenAvailab |
| | | return token; |
| | | } |
| | | } |
| | |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | |
| | | <!--mongodb--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-mongodb</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.afterturn</groupId> |
| | | <artifactId>easypoi-spring-boot-starter</artifactId> |
| | |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-redis</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.redisson</groupId> |
| | | <artifactId>redisson-spring-boot-starter</artifactId> |
| | | <version>3.16.8</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-jianguan</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | @PostMapping("/listAll") |
| | | R<GovernmentCloudOrderVO> listAll() { |
| | | LocalDateTime end = LocalDateTime.now(); |
| | | LocalDateTime start = LocalDateTime.now().minusDays(1); |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudOrderVO governmentCloudAccountVO = new GovernmentCloudOrderVO(); |
| | | List<AccountingStrategyDetailOrder> list1 = accountingStrategyDetailOrderService.lambdaQuery().between(AccountingStrategyDetailOrder::getCreateTime, start, end).list(); |
| | | List<AccountingStrategyOrder> list2 = accountingStrategyOrderService.lambdaQuery().between(AccountingStrategyOrder::getCreateTime, start, end).list(); |
| | | List<TChargingBill> list3 = chargingBillService.lambdaQuery().between(TChargingBill::getCreateTime, start, end).list(); |
| | | List<TChargingOrderAccountingStrategy> list4 = chargingOrderAccountingStrategyService.lambdaQuery().between(TChargingOrderAccountingStrategy::getCreateTime, start, end).list(); |
| | | List<TChargingOrderRefund> list5 = chargingOrderRefundService.lambdaQuery().between(TChargingOrderRefund::getCreateTime, start, end).list(); |
| | | List<TChargingOrder> list6 = chargingOrderService.lambdaQuery().between(TChargingOrder::getCreateTime, start, end).list(); |
| | | List<TExchangeOrder> list7 = exchangeOrderService.lambdaQuery().between(TExchangeOrder::getCreateTime, start, end).list(); |
| | | List<TGrantVip> list8 = grantVipService.lambdaQuery().between(TGrantVip::getCreateTime, start, end).list(); |
| | | List<TOrderAppeal> list9 = orderAppealService.lambdaQuery().between(TOrderAppeal::getCreateTime, start, end).list(); |
| | | List<TOrderEvaluate> list10 = orderEvaluateService.lambdaQuery().between(TOrderEvaluate::getCreateTime, start, end).list(); |
| | | List<TOrderEvaluateTag> list11 = orderEvaluateTagService.lambdaQuery().between(TOrderEvaluateTag::getCreateTime, start, end).list(); |
| | | List<TOrderInvoiceDetail> list12 = orderInvoiceDetailService.lambdaQuery().between(TOrderInvoiceDetail::getCreateTime, start, end).list(); |
| | | List<TOrderInvoice> list13 = orderInvoiceService.lambdaQuery().between(TOrderInvoice::getCreateTime, start, end).list(); |
| | | List<TSettlementConfirm> list14 = settlementConfirmService.lambdaQuery().between(TSettlementConfirm::getCreateTime, start, end).list(); |
| | | List<TShoppingOrderRefund> list15 = shoppingOrderRefundService.lambdaQuery().between(TShoppingOrderRefund::getCreateTime, start, end).list(); |
| | | List<TVipOrderRefund> list16 = vipOrderRefundService.lambdaQuery().between(TVipOrderRefund::getCreateTime, start, end).list(); |
| | | List<TVipOrder> list17 = vipOrderService.lambdaQuery().between(TVipOrder::getCreateTime, start, end).list(); |
| | | List<TShoppingOrder> list18 = shoppingOrderService.lambdaQuery().between(TShoppingOrder::getCreateTime, start, end).list(); |
| | | List<AccountingStrategyDetailOrder> list1 = accountingStrategyDetailOrderService.lambdaQuery() |
| | | .ge(AccountingStrategyDetailOrder::getCreateTime,start) |
| | | .le(AccountingStrategyDetailOrder::getCreateTime,end) .list(); |
| | | List<AccountingStrategyOrder> list2 = accountingStrategyOrderService.lambdaQuery() |
| | | .ge(AccountingStrategyOrder::getCreateTime,start) |
| | | .le(AccountingStrategyOrder::getCreateTime,end) .list(); |
| | | List<TChargingBill> list3 = chargingBillService.lambdaQuery() |
| | | .ge(TChargingBill::getCreateTime,start) |
| | | .le(TChargingBill::getCreateTime,end) .list(); |
| | | List<TChargingOrderAccountingStrategy> list4 = chargingOrderAccountingStrategyService.lambdaQuery() |
| | | .ge(TChargingOrderAccountingStrategy::getCreateTime,start) |
| | | .le(TChargingOrderAccountingStrategy::getCreateTime,end) .list(); |
| | | List<TChargingOrderRefund> list5 = chargingOrderRefundService.lambdaQuery() |
| | | .ge(TChargingOrderRefund::getCreateTime,start) |
| | | .le(TChargingOrderRefund::getCreateTime,end) .list(); |
| | | List<TChargingOrder> list6 = chargingOrderService.lambdaQuery() |
| | | .ge(TChargingOrder::getCreateTime,start) |
| | | .le(TChargingOrder::getCreateTime,end) .list(); |
| | | List<TExchangeOrder> list7 = exchangeOrderService.lambdaQuery() |
| | | .ge(TExchangeOrder::getCreateTime,start) |
| | | .le(TExchangeOrder::getCreateTime,end) .list(); |
| | | List<TGrantVip> list8 = grantVipService.lambdaQuery() |
| | | .ge(TGrantVip::getCreateTime,start) |
| | | .le(TGrantVip::getCreateTime,end) .list(); |
| | | List<TOrderAppeal> list9 = orderAppealService.lambdaQuery() |
| | | .ge(TOrderAppeal::getCreateTime,start) |
| | | .le(TOrderAppeal::getCreateTime,end) .list(); |
| | | List<TOrderEvaluate> list10 = orderEvaluateService.lambdaQuery() |
| | | .ge(TOrderEvaluate::getCreateTime,start) |
| | | .le(TOrderEvaluate::getCreateTime,end) .list(); |
| | | List<TOrderEvaluateTag> list11 = orderEvaluateTagService.lambdaQuery() |
| | | .ge(TOrderEvaluateTag::getCreateTime,start) |
| | | .le(TOrderEvaluateTag::getCreateTime,end) .list(); |
| | | List<TOrderInvoiceDetail> list12 = orderInvoiceDetailService.lambdaQuery() |
| | | .ge(TOrderInvoiceDetail::getCreateTime,start) |
| | | .le(TOrderInvoiceDetail::getCreateTime,end) .list(); |
| | | List<TOrderInvoice> list13 = orderInvoiceService.lambdaQuery() |
| | | .ge(TOrderInvoice::getCreateTime,start) |
| | | .le(TOrderInvoice::getCreateTime,end) .list(); |
| | | List<TSettlementConfirm> list14 = settlementConfirmService.lambdaQuery() |
| | | .ge(TSettlementConfirm::getCreateTime,start) |
| | | .le(TSettlementConfirm::getCreateTime,end) .list(); |
| | | List<TShoppingOrderRefund> list15 = shoppingOrderRefundService.lambdaQuery() |
| | | .ge(TShoppingOrderRefund::getCreateTime,start) |
| | | .le(TShoppingOrderRefund::getCreateTime,end) .list(); |
| | | List<TVipOrderRefund> list16 = vipOrderRefundService.lambdaQuery() |
| | | .ge(TVipOrderRefund::getCreateTime,start) |
| | | .le(TVipOrderRefund::getCreateTime,end) .list(); |
| | | List<TVipOrder> list17 = vipOrderService.lambdaQuery() |
| | | .ge(TVipOrder::getCreateTime,start) |
| | | .le(TVipOrder::getCreateTime,end) .list(); |
| | | List<TShoppingOrder> list18 = shoppingOrderService.lambdaQuery() |
| | | .ge(TShoppingOrder::getCreateTime,start) |
| | | .le(TShoppingOrder::getCreateTime,end) .list(); |
| | | |
| | | governmentCloudAccountVO.setAccountingStrategyDetailOrders(list1); |
| | | governmentCloudAccountVO.setAccountingStrategyOrders(list2); |
| | |
| | | governmentCloudAccountVO.setVipOrderRefunds(list16); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | @PostMapping("/listAll1") |
| | | R<GovernmentCloudOrderVO> listAll1() { |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudOrderVO governmentCloudAccountVO = new GovernmentCloudOrderVO(); |
| | | List<AccountingStrategyDetailOrder> list1 = accountingStrategyDetailOrderService.lambdaQuery() |
| | | .ge(AccountingStrategyDetailOrder::getCreateTime,start) |
| | | .le(AccountingStrategyDetailOrder::getCreateTime,end) |
| | | .list(); |
| | | governmentCloudAccountVO.setAccountingStrategyDetailOrders(list1); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | @PostMapping("/listAll2") |
| | | R<GovernmentCloudOrderVO> listAll2() { |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudOrderVO governmentCloudAccountVO = new GovernmentCloudOrderVO(); |
| | | List<AccountingStrategyOrder> list2 = accountingStrategyOrderService.lambdaQuery() |
| | | .ge(AccountingStrategyOrder::getCreateTime,start) |
| | | .le(AccountingStrategyOrder::getCreateTime,end) .list(); |
| | | governmentCloudAccountVO.setAccountingStrategyOrders(list2); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | @PostMapping("/listAll3") |
| | | R<GovernmentCloudOrderVO> listAll3() { |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudOrderVO governmentCloudAccountVO = new GovernmentCloudOrderVO(); |
| | | List<TChargingBill> list3 = chargingBillService.lambdaQuery() |
| | | .ge(TChargingBill::getCreateTime,start) |
| | | .le(TChargingBill::getCreateTime,end) .list(); |
| | | governmentCloudAccountVO.setChargingBills(list3); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | @PostMapping("/listAll4") |
| | | R<GovernmentCloudOrderVO> listAll4() { |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudOrderVO governmentCloudAccountVO = new GovernmentCloudOrderVO(); |
| | | List<TChargingOrderAccountingStrategy> list4 = chargingOrderAccountingStrategyService.lambdaQuery() |
| | | .ge(TChargingOrderAccountingStrategy::getCreateTime,start) |
| | | .le(TChargingOrderAccountingStrategy::getCreateTime,end) .list(); |
| | | governmentCloudAccountVO.setChargingOrderAccountingStrategies(list4); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | @PostMapping("/listAll5") |
| | | R<GovernmentCloudOrderVO> listAll5() { |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudOrderVO governmentCloudAccountVO = new GovernmentCloudOrderVO(); |
| | | List<TChargingOrderRefund> list5 = chargingOrderRefundService.lambdaQuery() |
| | | .ge(TChargingOrderRefund::getCreateTime,start) |
| | | .le(TChargingOrderRefund::getCreateTime,end) .list(); |
| | | governmentCloudAccountVO.setChargingOrderRefunds(list5); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | @PostMapping("/listAll6") |
| | | R<GovernmentCloudOrderVO> listAll6() { |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudOrderVO governmentCloudAccountVO = new GovernmentCloudOrderVO(); |
| | | List<TChargingOrder> list6 = chargingOrderService.lambdaQuery() |
| | | .ge(TChargingOrder::getCreateTime,start) |
| | | .le(TChargingOrder::getCreateTime,end) .list(); |
| | | governmentCloudAccountVO.setChargingOrders(list6); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | @PostMapping("/listAll7") |
| | | R<GovernmentCloudOrderVO> listAll7() { |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudOrderVO governmentCloudAccountVO = new GovernmentCloudOrderVO(); |
| | | List<TExchangeOrder> list7 = exchangeOrderService.lambdaQuery() |
| | | .ge(TExchangeOrder::getCreateTime,start) |
| | | .le(TExchangeOrder::getCreateTime,end) .list(); |
| | | governmentCloudAccountVO.setExchangeOrders(list7); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | @PostMapping("/listAll8") |
| | | R<GovernmentCloudOrderVO> listAll8() { |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudOrderVO governmentCloudAccountVO = new GovernmentCloudOrderVO(); |
| | | List<TGrantVip> list8 = grantVipService.lambdaQuery() |
| | | .ge(TGrantVip::getCreateTime,start) |
| | | .le(TGrantVip::getCreateTime,end) .list(); |
| | | governmentCloudAccountVO.setGrantVips(list8); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | @PostMapping("/listAll9") |
| | | R<GovernmentCloudOrderVO> listAll9() { |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudOrderVO governmentCloudAccountVO = new GovernmentCloudOrderVO(); |
| | | List<TOrderAppeal> list9 = orderAppealService.lambdaQuery() |
| | | .ge(TOrderAppeal::getCreateTime,start) |
| | | .le(TOrderAppeal::getCreateTime,end) .list(); |
| | | governmentCloudAccountVO.setOrderAppeals(list9); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | @PostMapping("/listAll10") |
| | | R<GovernmentCloudOrderVO> listAll10() { |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudOrderVO governmentCloudAccountVO = new GovernmentCloudOrderVO(); |
| | | List<TOrderEvaluate> list10 = orderEvaluateService.lambdaQuery() |
| | | .ge(TOrderEvaluate::getCreateTime,start) |
| | | .le(TOrderEvaluate::getCreateTime,end) .list(); |
| | | governmentCloudAccountVO.setOrderEvaluates(list10); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | @PostMapping("/listAll11") |
| | | R<GovernmentCloudOrderVO> listAll11() { |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudOrderVO governmentCloudAccountVO = new GovernmentCloudOrderVO(); |
| | | List<TOrderEvaluateTag> list11 = orderEvaluateTagService.lambdaQuery() |
| | | .ge(TOrderEvaluateTag::getCreateTime,start) |
| | | .le(TOrderEvaluateTag::getCreateTime,end) .list(); |
| | | governmentCloudAccountVO.setOrderEvaluateTags(list11); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | @PostMapping("/listAll12") |
| | | R<GovernmentCloudOrderVO> listAll12() { |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudOrderVO governmentCloudAccountVO = new GovernmentCloudOrderVO(); |
| | | List<TOrderInvoiceDetail> list12 = orderInvoiceDetailService.lambdaQuery() |
| | | .ge(TOrderInvoiceDetail::getCreateTime,start) |
| | | .le(TOrderInvoiceDetail::getCreateTime,end) .list(); |
| | | governmentCloudAccountVO.setOrderInvoiceDetails(list12); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | @PostMapping("/listAll13") |
| | | R<GovernmentCloudOrderVO> listAll13() { |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudOrderVO governmentCloudAccountVO = new GovernmentCloudOrderVO(); |
| | | List<TOrderInvoice> list13 = orderInvoiceService.lambdaQuery() |
| | | .ge(TOrderInvoice::getCreateTime,start) |
| | | .le(TOrderInvoice::getCreateTime,end) .list(); |
| | | governmentCloudAccountVO.setOrderInvoices(list13); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | @PostMapping("/listAll14") |
| | | R<GovernmentCloudOrderVO> listAll14() { |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudOrderVO governmentCloudAccountVO = new GovernmentCloudOrderVO(); |
| | | List<TSettlementConfirm> list14 = settlementConfirmService.lambdaQuery() |
| | | .ge(TSettlementConfirm::getCreateTime,start) |
| | | .le(TSettlementConfirm::getCreateTime,end) .list(); |
| | | governmentCloudAccountVO.setSettlementConfirms(list14); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | @PostMapping("/listAll15") |
| | | R<GovernmentCloudOrderVO> listAll15() { |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudOrderVO governmentCloudAccountVO = new GovernmentCloudOrderVO(); |
| | | List<TShoppingOrderRefund> list15 = shoppingOrderRefundService.lambdaQuery() |
| | | .ge(TShoppingOrderRefund::getCreateTime,start) |
| | | .le(TShoppingOrderRefund::getCreateTime,end) .list(); |
| | | governmentCloudAccountVO.setShoppingOrderRefunds(list15); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | @PostMapping("/listAll16") |
| | | R<GovernmentCloudOrderVO> listAll16() { |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudOrderVO governmentCloudAccountVO = new GovernmentCloudOrderVO(); |
| | | List<TVipOrderRefund> list16 = vipOrderRefundService.lambdaQuery() |
| | | .ge(TVipOrderRefund::getCreateTime,start) |
| | | .le(TVipOrderRefund::getCreateTime,end) .list(); |
| | | governmentCloudAccountVO.setVipOrderRefunds(list16); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | @PostMapping("/listAll17") |
| | | R<GovernmentCloudOrderVO> listAll17() { |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudOrderVO governmentCloudAccountVO = new GovernmentCloudOrderVO(); |
| | | List<TVipOrder> list17 = vipOrderService.lambdaQuery() |
| | | .ge(TVipOrder::getCreateTime,start) |
| | | .le(TVipOrder::getCreateTime,end) .list(); |
| | | governmentCloudAccountVO.setVipOrders(list17); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | @PostMapping("/listAll18") |
| | | R<GovernmentCloudOrderVO> listAll18() { |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudOrderVO governmentCloudAccountVO = new GovernmentCloudOrderVO(); |
| | | List<TShoppingOrder> list18 = shoppingOrderService.lambdaQuery() |
| | | .ge(TShoppingOrder::getCreateTime,start) |
| | | .le(TShoppingOrder::getCreateTime,end) .list(); |
| | | governmentCloudAccountVO.setShoppingOrders(list18); |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.ruoyi.order.dto.*; |
| | | import com.ruoyi.order.service.*; |
| | | import com.ruoyi.order.util.PreviousSixMonths; |
| | | import com.ruoyi.order.util.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import com.ruoyi.order.vo.EndOfChargePageInfo; |
| | | import com.ruoyi.order.vo.StatisticsOfBatteryVO; |
| | | import com.ruoyi.order.vo.WatchChargingOrderVo; |
| | |
| | | @Resource |
| | | private TOrderInvoiceService invoiceService; |
| | | @Resource |
| | | private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; |
| | | private UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService; |
| | | @Resource |
| | | private PartnerClient partnerClient; |
| | | @Resource |
| | |
| | | public R<Map<String,Object>> total() { |
| | | //count近6个月的数据 |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserClient.getSysUser(userId).getData(); |
| | | //获取当前登录的siteIds |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | List<GetSiteListDTO> data9 = siteClient.getSiteListByUserId(userId).getData(); |
| | |
| | | siteIds.add(-1); |
| | | } |
| | | Map<String,Object> map = chargingOrderService.countAll(siteIds); |
| | | if(1 == sysUser.getObjectId()){ |
| | | BigDecimal data = parkingLotClient.getRecordAmount().getData(); |
| | | if (map ==null){ |
| | | map = new HashMap<String,Object>(); |
| | |
| | | map.put("shopAmount",data1); |
| | | BigDecimal data2 = vipOrderService.getSumAmout(); |
| | | map.put("vipAmount",data2); |
| | | }else{ |
| | | map.put("parkingAmount",0); |
| | | map.put("shopAmount",0); |
| | | map.put("vipAmount",0); |
| | | } |
| | | List<TChargingOrder> list = chargingOrderService.lambdaQuery().eq(TChargingOrder::getStatus, 5).eq(TChargingOrder::getDelFlag, 0) |
| | | .eq(TChargingOrder::getRechargePaymentStatus, 2).list(); |
| | | .eq(TChargingOrder::getRechargePaymentStatus, 2).in(TChargingOrder::getSiteId, siteIds).list(); |
| | | BigDecimal sharingAmount = BigDecimal.ZERO; |
| | | BigDecimal commissionAmount = BigDecimal.ZERO; |
| | | //计算list中electrovalence的总和 |
| | |
| | | @GetMapping(value = "/watch/deletes") |
| | | @ApiOperation(value = "监控订单-删除", tags = {"管理后台-订单管理"}) |
| | | public R watchChargingOrder(@RequestParam String id) { |
| | | uploadRealTimeMonitoringDataClient.delete(id); |
| | | uploadRealTimeMonitoringDataService.delete(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping(value = "/getOrderByCode/{code}") |
| | | public R<TChargingOrder> getOrderByCode(@PathVariable("code") String code){ |
| | | return R.ok(chargingOrderService.getOne(Wrappers.lambdaQuery(TChargingOrder.class) |
| | | .eq(TChargingOrder::getCode,code))); |
| | | TChargingOrder one = chargingOrderService.getOne(Wrappers.lambdaQuery(TChargingOrder.class) |
| | | .eq(TChargingOrder::getCode, code)); |
| | | one.setIdStr(one.getId().toString()); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | |
| | |
| | | return R.ok(String.valueOf(chargingOrder.getId())); |
| | | } |
| | | |
| | | // @GetMapping(value = "/getOrderByCode") |
| | | // @ApiOperation(value = "H5通过编号查询订单", tags = {"H5-首页-用户充电订单信息"}) |
| | | // public R<String> getOrderByCode(@RequestParam("code") String code) { |
| | | // Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | // TChargingOrder chargingOrder = chargingOrderService.getOne(Wrappers.lambdaQuery(TChargingOrder.class) |
| | | // .eq(TChargingOrder::getAppUserId, userId) |
| | | // .in(TChargingOrder::getStatus, Arrays.asList(1,2,3,4)) |
| | | // .orderByDesc(TChargingOrder::getCreateTime) |
| | | // .last("LIMIT 1")); |
| | | // if(Objects.isNull(chargingOrder)){ |
| | | // return R.ok(); |
| | | // } |
| | | // return R.ok(String.valueOf(chargingOrder.getId())); |
| | | // } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | // 发送邮箱 |
| | | // 收件人电子邮箱,TODO 换成自己的收件箱 |
| | | String to = "443237572@qq.com"; |
| | | // 发件人电子邮箱,TODO 换成自己的发件箱 |
| | | String from = "13281306557@163.com"; |
| | | // 指定发送邮件的主机为 |
| | | String host = "smtp.163.com"; |
| | | Properties properties = new Properties(); |
| | | properties.put("mail.smtp.host", "smtp.163.com"); |
| | | properties.put("mail.smtp.socketFactory.port", "465"); |
| | | properties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); |
| | | properties.put("mail.smtp.auth", "true"); |
| | | properties.put("mail.smtp.port", "465"); |
| | | properties.put("mail.smtp.ssl.enable", "true"); // 明确开启SSL |
| | | // 获取默认session对象 |
| | | Session session = Session.getDefaultInstance(properties,new Authenticator(){ |
| | | @Override |
| | | public PasswordAuthentication getPasswordAuthentication() |
| | | { |
| | | //发件人邮件用户名、授权码,换成自己的发件箱及授权码 |
| | | return new PasswordAuthentication("13281306557@163.com", "NUSdxDQqadYvVek2"); |
| | | } |
| | | }); |
| | | |
| | | try{ |
| | | // 创建默认的 MimeMessage 对象 |
| | | MimeMessage message = new MimeMessage(session); |
| | | // Set From,设置发件人 |
| | | InternetAddress fromMail = new InternetAddress(from); |
| | | //设置发件人名称,TODO 换成自己的发件箱 |
| | | fromMail.setPersonal(MimeUtility.encodeText("明星电力<13281306557@163.com>")); |
| | | message.setFrom(fromMail); |
| | | // Set To: 设置收件人 |
| | | InternetAddress toMail = new InternetAddress(to); |
| | | // TODO 换成自己的收件箱 |
| | | InternetAddress toMail2 = new InternetAddress(to); |
| | | //发多个邮箱 |
| | | Address[] allRecipients = {toMail, toMail2}; |
| | | message.setRecipients(Message.RecipientType.TO, allRecipients); |
| | | // Set Subject: 邮件主体 |
| | | message.setSubject("明星电力"); |
| | | // 设置消息体 |
| | | message.setSentDate(new Date()); |
| | | // 指定为混合关系 |
| | | MimeMultipart msgMultipart = new MimeMultipart("mixed"); |
| | | message.setContent(msgMultipart); |
| | | // 邮件信息组装 |
| | | //组装的顺序非常重要,一定要先组装文本域,再组装文件 |
| | | MimeBodyPart htmlPart = new MimeBodyPart(); |
| | | // 组装内容 |
| | | htmlPart.setContent("开票", "text/html;charset=UTF-8"); |
| | | msgMultipart.addBodyPart(htmlPart); |
| | | |
| | | // 组装附件 |
| | | MimeBodyPart filePart = new MimeBodyPart(); |
| | | String imageUrl = "https://mxcd.zhinenganguan.com/file/2025-02-14/_1@2x.png"; |
| | | try { |
| | | // 下载数据 |
| | | URL url = new URL(imageUrl); |
| | | InputStream inputStream = url.openStream(); |
| | | byte[] imageBytes = IOUtils.toByteArray(inputStream); |
| | | |
| | | // 创建临时文件 |
| | | // 截取imageUrl后缀名 |
| | | String fileExtension = imageUrl.substring(imageUrl.lastIndexOf(".")); |
| | | File tempFile = File.createTempFile("tempImage", fileExtension); |
| | | try (FileOutputStream fos = new FileOutputStream(tempFile)) { |
| | | fos.write(imageBytes); |
| | | } |
| | | |
| | | // 创建 FileDataSource |
| | | FileDataSource fileDataSource = new FileDataSource(tempFile); |
| | | System.out.println("FileDataSource created: " + fileDataSource.getName()); |
| | | // 如果需要,可以使用 DataHandler 进行进一步处理 |
| | | DataHandler dh = new DataHandler(fileDataSource); |
| | | // 清理:删除临时文件(如果不再需要) |
| | | tempFile.deleteOnExit(); // 可根据需要保留或删除 |
| | | filePart.setDataHandler(dh); |
| | | // 附件区别内嵌内容的一个特点是有文件名,为防止中文乱码要编码 |
| | | filePart.setFileName(MimeUtility.encodeText(dh.getName())); |
| | | msgMultipart.addBodyPart(filePart); |
| | | message.saveChanges(); |
| | | //发送 |
| | | //Transport.send(message, message.getAllRecipients()); |
| | | Transport.send(message); |
| | | System.out.println("发送成功"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | }catch (MessagingException | UnsupportedEncodingException mex) { |
| | | mex.printStackTrace(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/invoiceManagement/accept_hear_case"}, logical = Logical.OR) |
| | | @PostMapping("/uploadPdf") |
| | |
| | | import com.ruoyi.order.api.query.ChargingOrderQuery; |
| | | import com.ruoyi.order.api.vo.ChargingOrderListVO; |
| | | import com.ruoyi.order.api.vo.ChargingOrderVO; |
| | | import com.ruoyi.order.api.vo.TChargingOrderVo; |
| | | import com.ruoyi.order.dto.*; |
| | | import com.ruoyi.order.vo.OrderCountByDate; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | |
| | | List<OrderCountByDate> countOrdersByDate(@Param("startTime")LocalDateTime startTime, @Param("endTime")LocalDateTime endTime,@Param("gunIds")List<Integer> gunIds); |
| | | |
| | | BigDecimal getSumDegreeBySiteIds(@Param("siteIds") List<Integer> siteIds); |
| | | |
| | | |
| | | /** |
| | | * 获取启动失败且时间超过1小时的订单 |
| | | * @return |
| | | */ |
| | | List<TChargingOrder> findFailedStartupOrder(); |
| | | |
| | | |
| | | /** |
| | | * 获取停止中的数据 |
| | | * @return |
| | | */ |
| | | List<TChargingOrder> findStoppedOrder(); |
| | | |
| | | |
| | | /** |
| | | * 获取充电中的订单 |
| | | * @return |
| | | */ |
| | | List<TChargingOrder> findChargingOrder(); |
| | | } |
| | |
| | | R<StatisticsOfBatteryVO> getStatisticsOfBattery(); |
| | | |
| | | BigDecimal getSumDegreeBySiteIds(List<Integer> siteIds); |
| | | |
| | | /** |
| | | * 获取启动失败且时间超过1小时的订单 |
| | | * @return |
| | | */ |
| | | List<TChargingOrder> findFailedStartupOrder(); |
| | | |
| | | |
| | | /** |
| | | * 获取停止中的数据 |
| | | * @return |
| | | */ |
| | | List<TChargingOrder> findStoppedOrder(); |
| | | |
| | | /** |
| | | * 获取充电中的数据 |
| | | * @return |
| | | */ |
| | | List<TChargingOrder> findChargingOrder(); |
| | | } |
| | |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.ChargingHandshakeClient; |
| | | import com.ruoyi.integration.api.feignClient.PlatformStartChargingReplyClient; |
| | | import com.ruoyi.integration.api.feignClient.SendMessageClient; |
| | | import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.feignClient.*; |
| | | import com.ruoyi.integration.api.model.*; |
| | | import com.ruoyi.integration.api.vo.ChargingOrderVo; |
| | | import com.ruoyi.integration.api.vo.GetPlatformStopChargingReply; |
| | | import com.ruoyi.integration.api.vo.StartChargeResult; |
| | | import com.ruoyi.order.api.dto.SettlementConfirmAdd; |
| | |
| | | import com.ruoyi.order.service.TChargingOrderService; |
| | | import com.ruoyi.order.service.TOrderEvaluateService; |
| | | import com.ruoyi.order.service.*; |
| | | import com.ruoyi.order.util.RedisLock; |
| | | import com.ruoyi.order.util.mongodb.service.PlatformStartChargingReplyService; |
| | | import com.ruoyi.order.util.mongodb.service.TransactionRecordService; |
| | | import com.ruoyi.order.util.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import com.ruoyi.order.vo.EndOfChargePageInfo; |
| | | import com.ruoyi.order.vo.OrderCountByDate; |
| | | import com.ruoyi.order.vo.StatisticsOfBatteryVO; |
| | |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import org.redisson.Redisson; |
| | | import org.redisson.api.RLock; |
| | | import org.redisson.api.RedissonClient; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | |
| | | private RedisService redisService; |
| | | |
| | | @Resource |
| | | private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; |
| | | private UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService; |
| | | |
| | | @Resource |
| | | private TCECClient tcecClient; |
| | |
| | | private AccountingStrategyClient accountingStrategyClient; |
| | | |
| | | @Resource |
| | | private PlatformStartChargingReplyClient platformStartChargingReplyClient; |
| | | private PlatformStartChargingReplyService platformStartChargingReplyService; |
| | | |
| | | @Resource |
| | | private TChargingOrderRefundService chargingOrderRefundService; |
| | |
| | | @Resource |
| | | private SecurityDetectionClient securityDetectionClient; |
| | | |
| | | @Resource |
| | | private BmsDemandAndChargerExportationClient bmsDemandAndChargerExportationClient; |
| | | |
| | | //计数器 |
| | | private Map<String, Integer> counter_map = new HashMap<>(); |
| | | |
| | |
| | | private OperatorClient operatorClient; |
| | | |
| | | @Resource |
| | | private TransactionRecordClient transactionRecordClient; |
| | | private TransactionRecordService transactionRecordService; |
| | | |
| | | @Resource |
| | | private ITChargingOrderSummaryDataService chargingOrderSummaryDataService; |
| | | @Resource |
| | | private TOrderAppealService orderAppealService; |
| | | |
| | | @Autowired |
| | | private RedissonClient redissonClient; |
| | | |
| | | @Resource |
| | | private ChargingMessageClient chargingMessageClient; |
| | | |
| | | |
| | | /** |
| | | * 获取小程序充电记录列表数据 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 获取充电订单明细 |
| | | * |
| | | * @param id 订单id |
| | | * @return |
| | | */ |
| | |
| | | }else{ |
| | | myChargingOrderInfo.setLicensePlate(chargingOrder.getPlateNum()); |
| | | } |
| | | if (null != chargingOrder.getStartTime()) { |
| | | myChargingOrderInfo.setStartTime(chargingOrder.getStartTime().atZone(ZoneId.systemDefault()).toInstant().getEpochSecond() * 1000); |
| | | } |
| | | if (null != chargingOrder.getEndTime()) { |
| | | myChargingOrderInfo.setEndTime(chargingOrder.getEndTime().atZone(ZoneId.systemDefault()).toInstant().getEpochSecond() * 1000); |
| | | } |
| | | myChargingOrderInfo.setOrderAmount(chargingOrder.getOrderAmount()); |
| | | myChargingOrderInfo.setPaymentAmount(chargingOrder.getPaymentAmount()); |
| | | myChargingOrderInfo.setRechargeAmount(chargingOrder.getRechargeAmount()); |
| | |
| | | .orderByAsc(TChargingOrderAccountingStrategy::getStartTime) |
| | | ); |
| | | myChargingOrderInfo.setStageCost(stageCost); |
| | | List<UploadRealTimeMonitoringData> dataList = uploadRealTimeMonitoringDataClient.getDataByOrderCode(chargingOrder.getCode()).getData(); |
| | | List<UploadRealTimeMonitoringData> dataList = uploadRealTimeMonitoringDataService.getDataByOrderCode(chargingOrder.getCode()); |
| | | if(null != dataList){ |
| | | //在MongoDB中获取数据 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); |
| | |
| | | |
| | | /** |
| | | * 获取待开票订单列表 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 充电支付 |
| | | * |
| | | * @param addChargingOrder |
| | | * @return |
| | | */ |
| | | @Override |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | public AjaxResult paymentChargingOrder(AddChargingOrder addChargingOrder) { |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | TAppUser appUser = appUserClient.getUserById(userId).getData(); |
| | |
| | | |
| | | //检查当前枪是否是正在使用中 |
| | | TChargingOrder one = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getChargingGunId, addChargingOrder.getId()) |
| | | .in(TChargingOrder::getStatus, Arrays.asList(1, 2, 3)).eq(TChargingOrder::getDelFlag, 0)); |
| | | .in(TChargingOrder::getStatus, Arrays.asList(3)).eq(TChargingOrder::getDelFlag, 0)); |
| | | if(null != one){ |
| | | return AjaxResult.error("充电枪正在充电中,启动失败"); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 支付成功后的回调处理逻辑 |
| | | * |
| | | * @param paymentType 支付方式:1=微信,2=支付宝 |
| | | * @param out_trade_no 业务流水号 |
| | | * @param transaction_id 三方支付流水号 |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | public AjaxResult chargingOrderCallback(Integer paymentType, String out_trade_no, String transaction_id, String attach) { |
| | | TChargingOrder chargingOrder = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getCode, out_trade_no)); |
| | | if(chargingOrder.getRechargePaymentStatus() == 2){ |
| | |
| | | |
| | | /** |
| | | * 定时检测mongodb数据库数据 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | |
| | | } |
| | | String code = chargingOrder.getCode(); |
| | | String key = "AQJC_" + chargingOrder.getChargingGunId(); |
| | | List<PlatformStartChargingReply> data = platformStartChargingReplyClient.getPlatformStartChargingReply(code).getData(); |
| | | List<PlatformStartChargingReply> data = platformStartChargingReplyService.getPlatformStartChargingReply(code); |
| | | log.info(code + ":-------------------开始检查调起充电结果-------------------" + data.toString()); |
| | | if(data.size() != 0){ |
| | | PlatformStartChargingReply platformStartChargingReply = data.get(1); |
| | |
| | | |
| | | //清除计时器中的无效数据 |
| | | counter_map.remove(code); |
| | | TChargingOrder order = new TChargingOrder(); |
| | | order.setId(id); |
| | | order.setAppUserId(chargingOrder.getAppUserId()); |
| | | if(0 == startup_result){ |
| | | //启动失败 |
| | | preChargeCheck1.setStartupSuccess(3); |
| | | preChargeCheck1.setFailureCause(failure_cause); |
| | | //启动失败后取消订单,退款操作 |
| | | refund(code); |
| | | order.setStatus(-1); |
| | | order.setEndMode(0); |
| | | chargingOrder.setStatus(-1); |
| | | chargingOrder.setEndMode(0); |
| | | }else{ |
| | | //启动成功 |
| | | preChargeCheck1.setStartupSuccess(2); |
| | | order.setStatus(3); |
| | | order.setStartTime(LocalDateTime.now()); |
| | | chargingOrder.setStatus(3); |
| | | chargingOrder.setStartTime(LocalDateTime.now()); |
| | | } |
| | | this.updateById(order); |
| | | this.updateById(chargingOrder); |
| | | if (chargingOrder.getStatus() == 3) { |
| | | //推送监管平台订单状态 |
| | | new Thread(() -> { |
| | | ChargingOrderVo chargingOrderVo = new ChargingOrderVo(); |
| | | BeanUtils.copyProperties(chargingOrder, chargingOrderVo); |
| | | chargingMessageClient.pushOrderStatus(chargingOrderVo); |
| | | }).start(); |
| | | } |
| | | |
| | | redisService.setCacheObject(key, preChargeCheck1, 24L, TimeUnit.HOURS); |
| | | //推送三方平台订单状态 |
| | | if(2 == chargingOrder.getOrderSource()){ |
| | |
| | | |
| | | /** |
| | | * 修改安全检测数据 |
| | | * |
| | | * @param securityDetection |
| | | */ |
| | | @Override |
| | |
| | | |
| | | /** |
| | | * 启动充电应答 |
| | | * |
| | | * @param message |
| | | */ |
| | | @Override |
| | |
| | | } |
| | | redisService.setCacheObject("AQJC_" + order.getChargingGunId(), preChargeCheck1, 24L, TimeUnit.HOURS); |
| | | this.updateById(order); |
| | | |
| | | if (3 == order.getStatus()) { |
| | | //推送监管平台订单状态 |
| | | new Thread(() -> { |
| | | ChargingOrderVo chargingOrderVo = new ChargingOrderVo(); |
| | | BeanUtils.copyProperties(order, chargingOrderVo); |
| | | chargingMessageClient.pushOrderStatus(chargingOrderVo); |
| | | }).start(); |
| | | } |
| | | //推送三方平台启动充电结果 |
| | | if(2 == order.getOrderSource()){ |
| | | StartChargeResult result = new StartChargeResult(); |
| | |
| | | |
| | | /** |
| | | * 启动失败后的退款,取消订单 |
| | | * |
| | | * @param code |
| | | */ |
| | | public void refund(String code){ |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | public void refund1(String code, BigDecimal money){ |
| | | log.info(code + ":-------------------充电成功,执行手动退款-------------------"); |
| | | TChargingOrder chargingOrder = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getCode, code)); |
| | |
| | | |
| | | /** |
| | | * 启动失败后微信退款的回调处理 |
| | | * |
| | | * @param out_refund_no |
| | | * @param refund_id |
| | | * @param tradeState |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取充电中的详情 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | |
| | | chargingDetails.setCode(one.getCode()); |
| | | chargingDetails.setStatus(one.getStatus()); |
| | | chargingDetails.setChargingCost(one.getResidualAmount()); |
| | | UploadRealTimeMonitoringData data = uploadRealTimeMonitoringDataClient.chargingOrderInfo(one.getCode()).getData(); |
| | | UploadRealTimeMonitoringData data = uploadRealTimeMonitoringDataService.getLastDataById(one.getCode()); |
| | | if(null != data){ |
| | | chargingDetails.setChargeCurrent(data.getOutput_current()); |
| | | chargingDetails.setChargeVoltage(data.getOutput_voltage()); |
| | |
| | | |
| | | /** |
| | | * 停止充电操作 |
| | | * |
| | | * @param id 订单id |
| | | * @return |
| | | */ |
| | | @Override |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | public AjaxResult stopCharging(String id) { |
| | | TChargingOrder order = this.getById(id); |
| | | Integer status = order.getStatus(); |
| | |
| | | if(!order.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | TChargingOrder chargingOrder = new TChargingOrder(); |
| | | chargingOrder.setId(Long.valueOf(id)); |
| | | chargingOrder.setAppUserId(order.getAppUserId()); |
| | | chargingOrder.setEndTime(LocalDateTime.now()); |
| | | chargingOrder.setStatus(4); |
| | | chargingOrder.setEndMode(1); |
| | | this.updateById(chargingOrder); |
| | | order.setEndTime(LocalDateTime.now()); |
| | | order.setStatus(4); |
| | | order.setEndMode(1); |
| | | this.updateById(order); |
| | | |
| | | String code1 = order.getCode(); |
| | | TChargingGun chargingGun = chargingGunClient.getChargingGunById(order.getChargingGunId()).getData(); |
| | | //异步线程处理停机 |
| | |
| | | |
| | | /** |
| | | * 结束充电后处理用户标签数据 |
| | | * |
| | | * @param chargingOrder |
| | | */ |
| | | public void editUserTag(TChargingOrder chargingOrder){ |
| | |
| | | |
| | | /** |
| | | * 推荐奖励(被推荐首单奖励) |
| | | * |
| | | * @param chargingOrder |
| | | */ |
| | | public void referralReward(TChargingOrder chargingOrder){ |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 停止充电应答结果处理 |
| | | * |
| | | * @param platformStopChargingReply |
| | | */ |
| | | @Override |
| | |
| | | this.updateById(chargingOrder); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | |
| | | } |
| | | // 获取开始SOC 结束soc |
| | | if (chargingOrderListVO.getCode()!=null){ |
| | | List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataClient.getDataByOrderCode(chargingOrderListVO.getCode()).getData(); |
| | | List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataService.getDataByOrderCode(chargingOrderListVO.getCode()); |
| | | |
| | | if (data6!=null && !data6.isEmpty()){ |
| | | int min = 100; |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public ChargingOrderListInfoVO chargingInfo(String uid) { |
| | | TChargingOrder chargingOrder= this.getById(uid); |
| | |
| | | |
| | | // 获取开始SOC 结束soc |
| | | if (chargingOrder.getCode()!=null){ |
| | | List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataClient.getDataByOrderCode(chargingOrder.getCode()).getData(); |
| | | List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataService.getDataByOrderCode(chargingOrder.getCode()); |
| | | if (data6!=null){ |
| | | for (UploadRealTimeMonitoringData uploadRealTimeMonitoringData : data6) { |
| | | if (uploadRealTimeMonitoringData.getOutput_current()!=null&& |
| | |
| | | |
| | | /** |
| | | * 处理充电订单实时监控数据相关的业务逻辑 |
| | | * |
| | | * @param query |
| | | */ |
| | | @Override |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | public void chargeMonitoring(UploadRealTimeMonitoringDataQuery query) { |
| | | if(com.ruoyi.common.core.utils.StringUtils.isNotEmpty(query.getTransaction_serial_number())){ |
| | | //获取当前的计费策略 |
| | |
| | | } |
| | | chargingOrder.setChargingCapacity(query.getCharging_degree()); |
| | | chargingOrder.setElectricity(query.getCharging_degree()); |
| | | chargingOrder.setTotalElectricity(new BigDecimal(100 - query.getSoc())); |
| | | BmsDemandAndChargerExportation data = bmsDemandAndChargerExportationClient.getBmsDemandAndChargerExportation(chargingOrder1.getCode()).getData(); |
| | | if(null != data){ |
| | | chargingOrder.setNeedElec(data.getBms_current_requirements()); |
| | | } |
| | | chargingOrder.setTotalElectricity(new BigDecimal(query.getSoc())); |
| | | this.updateById(chargingOrder); |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 自动结束充电后的处理逻辑 |
| | | * |
| | | * @param orderCode |
| | | */ |
| | | @Override |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | public void endCharge(String orderCode, Integer endMode) { |
| | | TChargingOrder order = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getCode, orderCode)); |
| | | TChargingOrder chargingOrder = new TChargingOrder(); |
| | |
| | | |
| | | /** |
| | | * 异常结束充电处理逻辑 |
| | | * |
| | | * @param orderCode |
| | | */ |
| | | @Override |
| | |
| | | |
| | | /** |
| | | * 停止充电返回账单后计算费用 |
| | | * |
| | | * @param vo |
| | | */ |
| | | @Override |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | public R endChargeBillingCharge(TransactionRecordMessageVO vo) { |
| | | RLock lock = redissonClient.getLock("endOrder:" + vo.getTransaction_serial_number()); |
| | | boolean tryLock = false; |
| | | try { |
| | | tryLock = lock.tryLock(100, TimeUnit.SECONDS); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | lock.unlock(); |
| | | return R.ok(); |
| | | } |
| | | if (!tryLock) { |
| | | return R.ok(); |
| | | } |
| | | try { |
| | | TChargingOrder chargingOrder = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getCode, vo.getTransaction_serial_number())); |
| | | if(null == chargingOrder){ |
| | | return R.ok(); |
| | |
| | | |
| | | //获取订单的计费策略 |
| | | List<AccountingStrategyDetailOrder> accountingStrategyDetailOrderList = accountingStrategyDetailOrderClient.getAllAccountingStrategyDetailOrder(chargingOrder.getId()).getData(); |
| | | if (accountingStrategyDetailOrderList.isEmpty()) { |
| | | return R.fail("计费策略为空,无法计算费用"); |
| | | } |
| | | accountingStrategyDetailOrderList.get(accountingStrategyDetailOrderList.size() - 1).setEndTime("23:59"); |
| | | //开始处理计费明细数据和优惠数据 |
| | | chargingOrderAccountingStrategyService.remove(new LambdaQueryWrapper<TChargingOrderAccountingStrategy>().eq(TChargingOrderAccountingStrategy::getChargingOrderId, chargingOrder.getId())); |
| | | SimpleDateFormat sdfs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | List<AccountingStrategyDetailOrderVo> lists = new ArrayList<>(); |
| | | try { |
| | | //跨天 |
| | | if(!vo.getStart_time().split(" ")[0].equals(vo.getEnd_time().split(" ")[0])){ |
| | | //当天的 |
| | |
| | | lists.add(vo1); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | R.fail("处理失败"); |
| | | } |
| | | |
| | | //开始处理明细 |
| | | for (int i = 0; i < lists.size(); i++) { |
| | |
| | | TChargingOrder order = new TChargingOrder(); |
| | | order.setId(chargingOrder.getId()); |
| | | order.setAppUserId(chargingOrder.getAppUserId()); |
| | | UploadRealTimeMonitoringData uploadRealTimeMonitoringData = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); |
| | | UploadRealTimeMonitoringData uploadRealTimeMonitoringData = uploadRealTimeMonitoringDataService.getLastDataById(chargingOrder.getCode()); |
| | | if(null != uploadRealTimeMonitoringData && null == chargingOrder.getEndMode()){ |
| | | Integer soc = uploadRealTimeMonitoringData.getSoc(); |
| | | if(soc >= 98){ |
| | |
| | | this.chargingOrderStartupFailureWxRefund(chargingOrderRefund.getRefundCode(), resp.getTradeNo(), "SUCCESS", null); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | summaryData.setElectricPrice(electronic_reduce.setScale(2, BigDecimal.ROUND_HALF_EVEN)); |
| | | summaryData.setServicePrice(serviceMoney.setScale(2, BigDecimal.ROUND_HALF_EVEN)); |
| | | chargingOrderSummaryDataService.save(summaryData); |
| | | |
| | | //推送监管平台订单状态和订单详情 |
| | | ChargingOrderVo chargingOrderVo = new ChargingOrderVo(); |
| | | BeanUtils.copyProperties(chargingOrder, chargingOrderVo); |
| | | chargingMessageClient.pushOrderInfo(chargingOrderVo); |
| | | chargingMessageClient.pushOrderStatus(chargingOrderVo); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | lock.unlock(); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> usersDay(ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | return this.baseMapper.usersDay(statisticsQueryDto); |
| | |
| | | public List<Map<String, Object>> usersByQuery(ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | return this.baseMapper.usersByQuery(statisticsQueryDto); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> usersByQuery1(ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | return this.baseMapper.usersByQuery1(statisticsQueryDto); |
| | |
| | | private TVipOrderService vipOrderService; |
| | | @Resource |
| | | private TVipOrderRefundService vipOrderRefundService; |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | |
| | | |
| | | /** |
| | | * 根据车牌号和开始时间查询充电数据 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | |
| | | |
| | | @Autowired |
| | | private TChargingOrderService chargingOrderService; |
| | | |
| | | @Override |
| | | public SettlementTotalVO settlementTotal(String time) { |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | |
| | | .divide(subtract2, 2, RoundingMode.HALF_DOWN) |
| | | .multiply(new BigDecimal("100")) |
| | | .setScale(2, RoundingMode.HALF_DOWN); |
| | | tSettlementConfirm.setTotalPercentage(bigDecimal1+"%"); } |
| | | tSettlementConfirm.setTotalPercentage(bigDecimal1 + "%"); |
| | | } |
| | | beforeCost = beforeCost.add(settlementConfirm.getCost()); |
| | | beforeIncome = beforeIncome.add(settlementConfirm.getIncome()); |
| | | } |
| | |
| | | res.setList2(total); |
| | | return res; |
| | | } |
| | | |
| | | @Override |
| | | public SettlementTotalVO settlementTotalR(String time,Long userId) { |
| | | //如果没传siteId,获取当前登陆人所有的siteIds |
| | |
| | | .divide(subtract2, 2, RoundingMode.HALF_DOWN) |
| | | .multiply(new BigDecimal("100")) |
| | | .setScale(2, RoundingMode.HALF_DOWN); |
| | | tSettlementConfirm.setTotalPercentage(bigDecimal1+"%"); } |
| | | tSettlementConfirm.setTotalPercentage(bigDecimal1 + "%"); |
| | | } |
| | | beforeCost = beforeCost.add(settlementConfirm.getCost()); |
| | | beforeIncome = beforeIncome.add(settlementConfirm.getIncome()); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 获取充电结束页面详情 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 添加三方平台充电订单数据 |
| | | * |
| | | * @param query |
| | | */ |
| | | @Override |
| | |
| | | |
| | | /** |
| | | * 三方平台停止充电操作 |
| | | * |
| | | * @param startChargeSeq |
| | | * @return |
| | | */ |
| | |
| | | chargingOrder.setStatus(4); |
| | | chargingOrder.setEndMode(1); |
| | | this.updateById(chargingOrder); |
| | | |
| | | tcecClient.notificationEquipChargeStatus(order.getStartChargeSeq(), order.getOperatorId()); |
| | | |
| | | String code1 = order.getCode(); |
| | |
| | | |
| | | /** |
| | | * 获取充电后没有扣除费用的数据 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | |
| | | .ne(TChargingOrder::getElectricity, 0).in(TChargingOrder::getStatus, Arrays.asList(4, 5))); |
| | | List<Map<String, Object>> mapList = new ArrayList<>(); |
| | | for (TChargingOrder order : list) { |
| | | TransactionRecord transactionRecord = transactionRecordClient.findTransactionRecord(order.getCode()).getData(); |
| | | TransactionRecord transactionRecord = transactionRecordService.findOne(order.getCode()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("order", order); |
| | | map.put("transactionRecord", transactionRecord); |
| | |
| | | |
| | | |
| | | /** |
| | | * |
| | | * 手动推送订单给第三方平台 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | |
| | | tcecClient.notificationChargeOrderInfo(chargingOrder.getStartChargeSeq(), chargingOrder.getOperatorId()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public R addChargingOrderSummaryData(){ |
| | |
| | | vo.setCounts(counts); |
| | | return R.ok(vo); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getSumDegreeBySiteIds(List<Integer> siteIds) { |
| | | |
| | | return this.baseMapper.getSumDegreeBySiteIds(siteIds); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取启动失败且时间超过1小时的订单 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<TChargingOrder> findFailedStartupOrder() { |
| | | return this.baseMapper.findFailedStartupOrder(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取停止中的数据 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<TChargingOrder> findStoppedOrder() { |
| | | return this.baseMapper.findStoppedOrder(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取充电中的数据 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<TChargingOrder> findChargingOrder() { |
| | | return this.baseMapper.findChargingOrder(); |
| | | } |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | @GlobalTransactional(rollbackFor = Exception.class)//分布式事务 |
| | | public AjaxResult addOrderEvaluate(OrderEvaluateVo query) { |
| | | TOrderEvaluate orderEvaluate = this.getOne(new LambdaQueryWrapper<TOrderEvaluate>().eq(TOrderEvaluate::getOrderId, query.getOrderId()) |
| | | .eq(TOrderEvaluate::getOrderType, query.getOrderType()).eq(TOrderEvaluate::getDelFlag, 0)); |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | public AjaxResult addOrderInvoice(AddOrderInvoice addOrderInvoice) { |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | String orders = addOrderInvoice.getOrders(); |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | @GlobalTransactional(rollbackFor = Exception.class)//分布式事务 |
| | | public AjaxResult cancelShoppingOrderWxRefund(String out_refund_no, String refund_id, String refund_status, String success_time) { |
| | | TShoppingOrderRefund one = shoppingOrderRefundService.getOne(new LambdaQueryWrapper<TShoppingOrderRefund>().eq(TShoppingOrderRefund::getRefundCode, out_refund_no)); |
| | | one.setRefundStatus(2); |
New file |
| | |
| | | package com.ruoyi.order.util.mongodb.base; |
| | | |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface BaseService<T> { |
| | | |
| | | /** |
| | | * 添加 |
| | | * @param t 实体类 |
| | | * @return 添加结果 1=成功 0=失败 |
| | | */ |
| | | int create(T t); |
| | | |
| | | /** |
| | | * 根据id查询 |
| | | * @param id 实体id |
| | | * @return 实体对象 |
| | | */ |
| | | T findById(String id); |
| | | |
| | | /** |
| | | * 查询列表 |
| | | * @return 实体列表 |
| | | */ |
| | | List<T> findAll(); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; |
| | | import com.ruoyi.order.util.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface BmsDemandAndChargerExportationService extends BaseService<BmsDemandAndChargerExportation> { |
| | | |
| | | |
| | | /** |
| | | * 获取bms数据 |
| | | * @param orderCode |
| | | * @return |
| | | */ |
| | | List<BmsDemandAndChargerExportation> getBmsDemandAndChargerExportation(String orderCode); |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.ChargingHandshake; |
| | | import com.ruoyi.order.util.mongodb.base.BaseService; |
| | | |
| | | public interface ChargingHandshakeService extends BaseService<ChargingHandshake> { |
| | | |
| | | |
| | | ChargingHandshake getDataByOrderCode(String code); |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformStartChargingReply; |
| | | import com.ruoyi.order.util.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface PlatformStartChargingReplyService extends BaseService<PlatformStartChargingReply> { |
| | | |
| | | /** |
| | | * 根据订单编号查询远程启机应答数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | List<PlatformStartChargingReply> getPlatformStartChargingReply(String code); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformStopChargingReply; |
| | | import com.ruoyi.integration.api.vo.GetPlatformStopChargingReply; |
| | | import com.ruoyi.order.util.mongodb.base.BaseService; |
| | | |
| | | public interface PlatformStopChargingReplyService extends BaseService<PlatformStopChargingReply> { |
| | | |
| | | /** |
| | | * 根据枪编号获取停机应答 |
| | | * @return |
| | | */ |
| | | PlatformStopChargingReply getPlatformStopChargingReply(GetPlatformStopChargingReply query); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.SecurityDetection; |
| | | import com.ruoyi.order.util.mongodb.base.BaseService; |
| | | |
| | | /** |
| | | */ |
| | | public interface SecurityDetectionService extends BaseService<SecurityDetection> { |
| | | |
| | | |
| | | /** |
| | | * 根据业务流水号查询数据 |
| | | * @param transactionSerialNumber |
| | | * @return |
| | | */ |
| | | SecurityDetection getSecurityDetection(String transactionSerialNumber); |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.TransactionRecord; |
| | | import com.ruoyi.order.util.mongodb.base.BaseService; |
| | | |
| | | public interface TransactionRecordService extends BaseService<TransactionRecord> { |
| | | |
| | | /** |
| | | * 根据订单流水号查询数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | TransactionRecord findOne(String code); |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.mongodb.service; |
| | | |
| | | import com.ruoyi.common.core.dto.MongoChargingOrderQuery; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringPageData; |
| | | import com.ruoyi.order.util.mongodb.base.BaseService; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.List; |
| | | |
| | | public interface UploadRealTimeMonitoringDataService extends BaseService<UploadRealTimeMonitoringData> { |
| | | |
| | | /** |
| | | * 根据订单号查询监控数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | List<UploadRealTimeMonitoringData> getDataByOrderCode(String code); |
| | | UploadRealTimeMonitoringPageData getDataAll(MongoChargingOrderQuery mongoChargingOrderQuery) throws ParseException; |
| | | |
| | | /** |
| | | * 查询订单最新一条数据 |
| | | * @param transaction_serial_number |
| | | * @return |
| | | */ |
| | | UploadRealTimeMonitoringData getLastDataById(String transaction_serial_number); |
| | | |
| | | void delete(String id); |
| | | |
| | | void updateById(String id); |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; |
| | | import com.ruoyi.order.util.mongodb.service.BmsDemandAndChargerExportationService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | 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.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class BmsDemandAndChargerExportationServiceImpl implements BmsDemandAndChargerExportationService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(BmsDemandAndChargerExportation bmsDemandAndChargerExportation) { |
| | | mongoTemplate.save(bmsDemandAndChargerExportation); |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | | public BmsDemandAndChargerExportation findById(String id) { |
| | | return mongoTemplate.findById(id, BmsDemandAndChargerExportation.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<BmsDemandAndChargerExportation> findAll() { |
| | | return mongoTemplate.findAll(BmsDemandAndChargerExportation.class); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<BmsDemandAndChargerExportation> getBmsDemandAndChargerExportation(String orderCode) { |
| | | Query query = new Query(); |
| | | if(StringUtils.isNotEmpty(orderCode)){ |
| | | query.addCriteria(Criteria.where("transaction_serial_number").is(orderCode)); |
| | | } |
| | | List<BmsDemandAndChargerExportation> uploadRealTimeMonitoringData = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , BmsDemandAndChargerExportation.class); |
| | | return uploadRealTimeMonitoringData; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.api.model.ChargingHandshake; |
| | | import com.ruoyi.order.util.mongodb.service.ChargingHandshakeService; |
| | | 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; |
| | | |
| | | @Service |
| | | public class ChargingHandshakeServiceImpl implements ChargingHandshakeService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(ChargingHandshake chargingHandshake) { |
| | | mongoTemplate.save(chargingHandshake); |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | | public ChargingHandshake findById(String id) { |
| | | return mongoTemplate.findById(id, ChargingHandshake.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ChargingHandshake> findAll() { |
| | | return mongoTemplate.findAll(ChargingHandshake.class); |
| | | } |
| | | |
| | | @Override |
| | | public ChargingHandshake getDataByOrderCode(String code) { |
| | | List<ChargingHandshake> charging_gun_code = mongoTemplate.find(new Query().addCriteria(Criteria.where("transaction_serial_number").is(code)), ChargingHandshake.class); |
| | | return charging_gun_code.size() > 0 ? charging_gun_code.get(0) : null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformStartChargingReply; |
| | | import com.ruoyi.order.util.mongodb.service.PlatformStartChargingReplyService; |
| | | 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; |
| | | |
| | | @Service |
| | | public class PlatformStartChargingReplyServiceImpl implements PlatformStartChargingReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(PlatformStartChargingReply platformStartChargingReply) { |
| | | mongoTemplate.save(platformStartChargingReply); |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformStartChargingReply findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformStartChargingReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformStartChargingReply> findAll() { |
| | | return mongoTemplate.findAll(PlatformStartChargingReply.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据订单编号查询远程启机应答数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<PlatformStartChargingReply> getPlatformStartChargingReply(String code) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("transaction_serial_number").is(code)); |
| | | List<PlatformStartChargingReply> platformStartChargingReplies = mongoTemplate.find(query, PlatformStartChargingReply.class); |
| | | return platformStartChargingReplies; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformStopChargingReply; |
| | | import com.ruoyi.integration.api.vo.GetPlatformStopChargingReply; |
| | | import com.ruoyi.order.util.mongodb.service.PlatformStopChargingReplyService; |
| | | 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.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class PlatformStopChargingReplyServiceImpl implements PlatformStopChargingReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(PlatformStopChargingReply platformStopChargingReply) { |
| | | mongoTemplate.save(platformStopChargingReply); |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformStopChargingReply findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformStopChargingReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformStopChargingReply> findAll() { |
| | | return mongoTemplate.findAll(PlatformStopChargingReply.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据枪编号获取 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public PlatformStopChargingReply getPlatformStopChargingReply(GetPlatformStopChargingReply query) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | List<PlatformStopChargingReply> platformStopChargingReplies = mongoTemplate.find(new Query().addCriteria(Criteria.where("charging_pile_code").is(query.getCharging_pile_code()) |
| | | .and("charging_gun_code").is(query.getCharging_gun_code()).and("create_time").lte(sdf.format(new Date())).gte(query.getEnd_time())), PlatformStopChargingReply.class); |
| | | return platformStopChargingReplies.size() > 0 ? platformStopChargingReplies.get(0) : null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.api.model.SecurityDetection; |
| | | import com.ruoyi.order.util.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; |
| | | |
| | | |
| | | /** |
| | | * 心跳包应答实现类 |
| | | **/ |
| | | @Service |
| | | public class SecurityDetectionServiceImpl implements SecurityDetectionService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(SecurityDetection securityDetection) { |
| | | mongoTemplate.save(securityDetection); |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | | public SecurityDetection findById(String id) { |
| | | return mongoTemplate.findById(id, SecurityDetection.class); |
| | | } |
| | | |
| | | @Override |
| | | 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; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.TransactionRecord; |
| | | import com.ruoyi.order.util.mongodb.service.TransactionRecordService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | 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; |
| | | |
| | | @Service |
| | | public class TransactionRecordServiceImpl implements TransactionRecordService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(TransactionRecord transactionRecord) { |
| | | mongoTemplate.save(transactionRecord); |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | | public TransactionRecord findById(String id) { |
| | | return mongoTemplate.findById(id, TransactionRecord.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<TransactionRecord> findAll() { |
| | | return mongoTemplate.findAll(TransactionRecord.class); |
| | | } |
| | | |
| | | /** |
| | | * 根据订单流水号查询数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @Override |
| | | public TransactionRecord findOne(String code) { |
| | | Query query = new Query(); |
| | | if(StringUtils.isNotEmpty(code)){ |
| | | query.addCriteria(Criteria.where("transaction_serial_number").is(code)); |
| | | } |
| | | List<TransactionRecord> transactionRecords = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , TransactionRecord.class); |
| | | return transactionRecords.size() > 0 ? transactionRecords.get(0) : null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.dto.MongoChargingOrderQuery; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringPageData; |
| | | import com.ruoyi.order.util.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.data.domain.Sort; |
| | | 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.data.mongodb.core.query.Update; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class UploadRealTimeMonitoringDataServiceImpl implements UploadRealTimeMonitoringDataService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(UploadRealTimeMonitoringData uploadRealTimeMonitoringData) { |
| | | mongoTemplate.save(uploadRealTimeMonitoringData); |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | | public UploadRealTimeMonitoringData findById(String id) { |
| | | return mongoTemplate.findById(id, UploadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<UploadRealTimeMonitoringData> findAll() { |
| | | return mongoTemplate.findAll(UploadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据订单号查询监控数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<UploadRealTimeMonitoringData> getDataByOrderCode(String code) { |
| | | Query query = new Query(); |
| | | if(StringUtils.isNotEmpty(code)){ |
| | | query.addCriteria(Criteria.where("transaction_serial_number").is(code)); |
| | | } |
| | | List<UploadRealTimeMonitoringData> uploadRealTimeMonitoringData = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , UploadRealTimeMonitoringData.class); |
| | | return uploadRealTimeMonitoringData; |
| | | } |
| | | |
| | | @Override |
| | | public UploadRealTimeMonitoringPageData getDataAll(MongoChargingOrderQuery mongoChargingOrderQuery) throws ParseException { |
| | | Query query = new Query(); |
| | | // if (!values.isEmpty()){ |
| | | // query.addCriteria(Criteria.where("transaction_serial_number").in(values)); |
| | | // } |
| | | if (mongoChargingOrderQuery.getCode() != null && !mongoChargingOrderQuery.getCode().isEmpty()) { |
| | | query.addCriteria(Criteria.where("transaction_serial_number").regex(mongoChargingOrderQuery.getCode(),"i")); // "i" 表示不区分大小写 |
| | | } |
| | | if (mongoChargingOrderQuery.getOrderType() !=null){ |
| | | query.addCriteria(Criteria.where("orderType").is(mongoChargingOrderQuery.getOrderType())); |
| | | } |
| | | if (mongoChargingOrderQuery.getSiteId() != null){ |
| | | query.addCriteria(Criteria.where("siteId").is(mongoChargingOrderQuery.getSiteId())); |
| | | } |
| | | if (!mongoChargingOrderQuery.getSiteIds().isEmpty()){ |
| | | query.addCriteria(Criteria.where("siteId").in(mongoChargingOrderQuery.getSiteIds())); |
| | | } |
| | | if (mongoChargingOrderQuery.getChargingPileCode() != null && !mongoChargingOrderQuery.getChargingPileCode().isEmpty()) { |
| | | query.addCriteria(Criteria.where("charging_pile_code").is(mongoChargingOrderQuery.getChargingPileCode())); |
| | | } |
| | | if (mongoChargingOrderQuery.getChargingGunCode() != null && !mongoChargingOrderQuery.getChargingGunCode().isEmpty()){ |
| | | query.addCriteria(Criteria.where("charging_gun_code").is(mongoChargingOrderQuery.getChargingGunCode())); |
| | | } |
| | | if (mongoChargingOrderQuery.getStatus() != null){ |
| | | query.addCriteria(Criteria.where("status").is(mongoChargingOrderQuery.getStatus())); |
| | | } |
| | | |
| | | if (mongoChargingOrderQuery.getCreateTime() != null) { |
| | | String[] split = mongoChargingOrderQuery.getCreateTime().split(" - "); |
| | | |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date start = dateFormat.parse(split[0]); |
| | | Date end = dateFormat.parse(split[1]); |
| | | query.addCriteria(Criteria.where("create_time").gte(start).lt(end)); |
| | | } |
| | | |
| | | if (mongoChargingOrderQuery.getLastTime() != null && mongoChargingOrderQuery.getLastTime() != null) { |
| | | String[] split = mongoChargingOrderQuery.getLastTime().split(" - "); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date start = dateFormat.parse(split[0]); |
| | | Date end = dateFormat.parse(split[1]); |
| | | query.addCriteria(Criteria.where("last_time").gte(start).lt(end)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | long totalElements = mongoTemplate.count(query, UploadRealTimeMonitoringData.class); |
| | | |
| | | // 创建带有排序的 Pageable 对象 |
| | | Pageable pageable = PageRequest.of( |
| | | mongoChargingOrderQuery.getPageCurr()-1, |
| | | mongoChargingOrderQuery.getPageSize(), |
| | | Sort.by(Sort.Direction.DESC, "create_time") |
| | | ); |
| | | |
| | | // 设置分页和排序 |
| | | query.with(pageable); |
| | | |
| | | // 执行查询并获取 Page 对象 |
| | | List<UploadRealTimeMonitoringData> page = mongoTemplate.find(query, UploadRealTimeMonitoringData.class,"upload_real_time_monitoring_data"); |
| | | |
| | | // 设置分页 |
| | | // Pageable pageable = PageRequest.of(mongoChargingOrderQuery.getPageSize()*(mongoChargingOrderQuery.getPageCurr()-1), mongoChargingOrderQuery.getPageSize()); |
| | | // query.with(pageable); |
| | | // query.with(Sort.by(Sort.Direction.DESC,"create_time")); |
| | | List<UploadRealTimeMonitoringData> uploadRealTimeMonitoringData = mongoTemplate.find( |
| | | query |
| | | , UploadRealTimeMonitoringData.class); |
| | | |
| | | UploadRealTimeMonitoringPageData uploadRealTimeMonitoringPageData = new UploadRealTimeMonitoringPageData(); |
| | | uploadRealTimeMonitoringPageData.setCount(totalElements); |
| | | uploadRealTimeMonitoringPageData.setRecords(page); |
| | | return uploadRealTimeMonitoringPageData; |
| | | } |
| | | |
| | | @Override |
| | | public UploadRealTimeMonitoringData getLastDataById(String transaction_serial_number) { |
| | | Query query = new Query(); |
| | | if (StringUtils.isNotEmpty(transaction_serial_number)){ |
| | | query.addCriteria(Criteria.where("transaction_serial_number").is(transaction_serial_number)); |
| | | } |
| | | // 按照 createdAt 字段降序排序 |
| | | query.with(Sort.by(Sort.Direction.DESC, "create_time")); |
| | | // 限制结果只返回一条记录 |
| | | query.limit(1); |
| | | return mongoTemplate.findOne(query, UploadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(String id) { |
| | | UploadRealTimeMonitoringData byId = findById(id.toString()); |
| | | mongoTemplate.remove(byId); |
| | | } |
| | | |
| | | @Override |
| | | public void updateById(String id) { |
| | | // 创建查询条件 |
| | | Query query = new Query(Criteria.where("_id").is(id)); |
| | | // 创建更新对象 |
| | | Update update = new Update().set("last_time", new Date()); |
| | | // 执行更新操作 |
| | | mongoTemplate.updateFirst(query, update, UploadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.order.util.task; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson2.util.UUIDUtils; |
| | | import com.alibaba.nacos.common.utils.UuidUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.feignClient.ChargingMessageClient; |
| | | import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.TransactionRecord; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.vo.ChargingOrderVo; |
| | | import com.ruoyi.order.api.model.TChargingBill; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TChargingOrderRefund; |
| | | import com.ruoyi.order.api.vo.TransactionRecordMessageVO; |
| | | import com.ruoyi.order.service.TChargingBillService; |
| | | import com.ruoyi.order.service.TChargingOrderRefundService; |
| | | import com.ruoyi.order.service.TChargingOrderService; |
| | | import com.ruoyi.order.util.mongodb.service.TransactionRecordService; |
| | | import com.ruoyi.order.util.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.logging.log4j.core.util.UuidUtil; |
| | | import org.apache.poi.util.StringUtil; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.web.context.WebServerInitializedEvent; |
| | | import org.springframework.context.ApplicationListener; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | * @author zhibing.pu |
| | | * @date 2023/7/11 8:39 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class TaskUtil { |
| | | public class TaskUtil implements ApplicationListener<WebServerInitializedEvent> { |
| | | |
| | | @Resource |
| | | private TChargingBillService chargingBillService; |
| | |
| | | @Resource |
| | | private TChargingOrderService chargingOrderService; |
| | | |
| | | @Resource |
| | | private TChargingOrderRefundService chargingOrderRefundService; |
| | | |
| | | @Resource |
| | | private UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService; |
| | | |
| | | @Resource |
| | | private TransactionRecordService transactionRecordService; |
| | | |
| | | @Resource |
| | | private ChargingMessageClient chargingMessageClient; |
| | | |
| | | private Integer port = null; |
| | | |
| | | |
| | | //十分钟循环执行的定时任务 |
| | | @Scheduled(fixedRate = 1000 * 60 * 10) |
| | | public void taskTenMinutes() { |
| | | if(null != port && port == 5400){ |
| | | List<TChargingOrder> failedStartupOrder = chargingOrderService.findFailedStartupOrder(); |
| | | log.info("定时任务执行,查询到启动失败的订单数量:{}", failedStartupOrder.size()); |
| | | for (TChargingOrder order : failedStartupOrder) { |
| | | //查询是否有充电信息 |
| | | List<UploadRealTimeMonitoringData> dataByOrderCode = uploadRealTimeMonitoringDataService.getDataByOrderCode(order.getCode()); |
| | | log.info("充电实时数据:{}", JSON.toJSONString(dataByOrderCode)); |
| | | //没有充电数据,则执行退款 |
| | | if(null == dataByOrderCode || dataByOrderCode.isEmpty()){ |
| | | log.info("定时任务执行,查询到启动失败的订单,执行退款:{}", order.getCode()); |
| | | chargingOrderService.refund(order.getCode()); |
| | | int num = 0; |
| | | while (true){ |
| | | TChargingOrderRefund one = chargingOrderRefundService.getOne(new LambdaQueryWrapper<TChargingOrderRefund>().eq(TChargingOrderRefund::getChargingOrderId, order.getId())); |
| | | if(null != one && 2 == one.getRefundStatus()){ |
| | | order.setStatus(-1); |
| | | chargingOrderService.updateById(order); |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(5000); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | num++; |
| | | if(num > 10){ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //处理退款中的数据 |
| | | List<TChargingOrder> stoppedOrder = chargingOrderService.findStoppedOrder(); |
| | | log.info("定时任务执行,查询到停止中的订单数量:{}", stoppedOrder.size()); |
| | | for (TChargingOrder order : stoppedOrder) { |
| | | TransactionRecord one = transactionRecordService.findOne(order.getCode()); |
| | | if(null != one){ |
| | | log.info("定时任务执行,查询到停止中的订单账单数据:{}", JSON.toJSONString(one)); |
| | | TransactionRecordMessageVO vo = new TransactionRecordMessageVO(); |
| | | BeanUtils.copyProperties(one, vo); |
| | | R r = chargingOrderService.endChargeBillingCharge(vo); |
| | | log.info("定时任务执行,停止中的订单处理结果:{}", JSON.toJSONString(r)); |
| | | } |
| | | } |
| | | //处理状态为充电中,但硬件已完成的订单 |
| | | List<TChargingOrder> chargingOrder = chargingOrderService.findChargingOrder(); |
| | | log.info("定时任务执行,查询到充电中的订单数量:{}", chargingOrder.size()); |
| | | for (TChargingOrder order : chargingOrder) { |
| | | TransactionRecord one = transactionRecordService.findOne(order.getCode()); |
| | | if(null != one && StringUtils.isNotEmpty(one.getResult())){ |
| | | log.info("定时任务执行,查询到充电中的订单账单数据:{}", JSON.toJSONString(one)); |
| | | TransactionRecordMessageVO vo = new TransactionRecordMessageVO(); |
| | | BeanUtils.copyProperties(one, vo); |
| | | R r = chargingOrderService.endChargeBillingCharge(vo); |
| | | log.info("定时任务执行,充电中的订单处理结果:{}", JSON.toJSONString(r)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | @Scheduled(cron = "0 0 0 2 * ?") |
| | | public void taskMonth() { |
| | | if(null != port && port == 5400){ |
| | | try { |
| | | // 获取上个月的开始和结束日期 |
| | | LocalDate firstDayOfLastMonth = LocalDate.now().minusMonths(1). |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 每个月最后一天23点执行的定时任务 |
| | | @Scheduled(cron = "0 0 23 * * ?") |
| | | public void taskLastDay() { |
| | | if(null != port && port == 5400){ |
| | | try { |
| | | // 获取上个月的开始和结束日期 |
| | | LocalDate firstDayOfLastMonth = LocalDate.now().minusMonths(1). |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onApplicationEvent(WebServerInitializedEvent event) { |
| | | port = event.getWebServer().getPort(); |
| | | System.out.println("端口号:" + port); |
| | | } |
| | | } |
| | |
| | | </foreach> |
| | | |
| | | </select> |
| | | |
| | | <select id="findFailedStartupOrder" resultType="com.ruoyi.order.api.model.TChargingOrder"> |
| | | SELECT |
| | | * |
| | | FROM |
| | | t_charging_order |
| | | WHERE |
| | | `status` = 2 |
| | | AND recharge_payment_status = 2 |
| | | AND recharge_serial_number IS NOT NULL |
| | | AND NOW() >= ADDDATE(pay_time, INTERVAL 15 MINUTE ) |
| | | AND del_flag = 0 |
| | | AND order_source = 1 |
| | | AND id NOT IN ( |
| | | SELECT |
| | | charging_order_id |
| | | FROM |
| | | t_charging_order_refund) |
| | | </select> |
| | | |
| | | |
| | | <select id="findStoppedOrder" resultType="com.ruoyi.order.api.model.TChargingOrder"> |
| | | SELECT |
| | | * |
| | | FROM |
| | | t_charging_order |
| | | WHERE |
| | | `status` = 4 |
| | | AND NOW() >= ADDDATE(end_time, INTERVAL 10 MINUTE ) |
| | | AND del_flag = 0 |
| | | AND id NOT IN ( |
| | | SELECT |
| | | charging_order_id |
| | | FROM |
| | | t_charging_order_refund) |
| | | </select> |
| | | |
| | | |
| | | <select id="findChargingOrder" resultType="com.ruoyi.order.api.model.TChargingOrder"> |
| | | SELECT |
| | | * |
| | | FROM |
| | | t_charging_order |
| | | WHERE |
| | | `status` = 3 |
| | | AND del_flag = 0 |
| | | AND id NOT IN ( |
| | | SELECT |
| | | charging_order_id |
| | | FROM |
| | | t_charging_order_refund) |
| | | </select> |
| | | </mapper> |
| | |
| | | //import com.ruoyi.chargingPile.api.model.Site; |
| | | //import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | //import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | //import com.ruoyi.common.core.domain.R; |
| | | //import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | //import com.ruoyi.common.core.web.page.PageInfo; |
| | | //import com.ruoyi.common.redis.service.RedisService; |
| | |
| | | //import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | | //import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | | //import org.junit.jupiter.api.Test; |
| | | //import org.redisson.api.RLock; |
| | | //import org.redisson.api.RedissonClient; |
| | | //import org.springframework.beans.factory.annotation.Autowired; |
| | | //import org.springframework.boot.test.context.SpringBootTest; |
| | | // |
| | | //import javax.annotation.Resource; |
| | | //import java.io.PrintWriter; |
| | | //import java.math.BigDecimal; |
| | | //import java.util.*; |
| | | //import java.util.concurrent.TimeUnit; |
| | | // |
| | | //@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = RuoYiOrderApplication.class) |
| | | //public class RuoYiOrderApplicationTests { |
| | | // |
| | | // @Resource |
| | | // private TChargingOrderService chargingOrderService; |
| | | // |
| | | // @Resource |
| | | // private ChargingGunClient chargingGunClient; |
| | | // @Resource |
| | | // private TSettlementConfirmMapper tSettlementConfirmMapper; |
| | | // |
| | | // @Resource |
| | | // private SiteClient siteClient; |
| | | // |
| | | // @Resource |
| | | // private AppUserCarClient appUserCarClient; |
| | | // @Resource |
| | | // private AppUserClient appUserClient; |
| | | // |
| | | // @Resource |
| | | // private ChargingPileClient chargingPileClient; |
| | | // |
| | | // @Resource |
| | | // private TChargingOrderAccountingStrategyService chargingOrderAccountingStrategyService; |
| | | // |
| | | // @Resource |
| | | // private TokenService tokenService; |
| | | // |
| | | // @Resource |
| | | // private WxPaymentClient wxPaymentClient; |
| | | // |
| | | // @Resource |
| | | // private AliPaymentClient aliPaymentClient; |
| | | // |
| | | // @Resource |
| | | // private AppCouponClient appCouponClient; |
| | | // |
| | | // @Resource |
| | | // private AppUserVipDetailClient appUserVipDetailClient; |
| | | // |
| | | // @Resource |
| | | // private RedisService redisService; |
| | | // |
| | | // @Resource |
| | | // private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; |
| | | // |
| | | // @Resource |
| | | // private ChargingHandshakeClient chargingHandshakeClient; |
| | | // |
| | | // @Resource |
| | | // private SendMessageClient sendMessageClient; |
| | | // |
| | | // @Resource |
| | | // private TOrderEvaluateService orderEvaluateService; |
| | | // |
| | | // @Resource |
| | | // private AccountingStrategyDetailClient accountingStrategyDetailClient; |
| | | // |
| | | // @Resource |
| | | // private AccountingStrategyDetailOrderClient accountingStrategyDetailOrderClient; |
| | | // |
| | | // @Resource |
| | | // private AccountingStrategyClient accountingStrategyClient; |
| | | // |
| | | // @Resource |
| | | // private PlatformStartChargingReplyClient platformStartChargingReplyClient; |
| | | // |
| | | // @Resource |
| | | // private TChargingOrderRefundService chargingOrderRefundService; |
| | | // |
| | | // @Resource |
| | | // private PlatformStopChargingReplyClient platformStopChargingReplyClient; |
| | | // |
| | | // @Resource |
| | | // private AccountingStrategyOrderService accountingStrategyOrderService; |
| | | // |
| | | // @Resource |
| | | // private AccountingStrategyDetailOrderService accountingStrategyDetailOrderService; |
| | | // |
| | | // @Resource |
| | | // private InviteUserClient inviteUserClient; |
| | | // |
| | | // @Resource |
| | | // private AppUserIntegralChangeClient appUserIntegralChangeClient; |
| | | // |
| | | // @Resource |
| | | // private IntegralRuleClient integralRuleClient; |
| | | // |
| | | // @Resource |
| | | // private VipClient vipClient; |
| | | // |
| | | // @Resource |
| | | // private UserTagClient userTagClient; |
| | | // |
| | | // @Resource |
| | | // private AppUserTagClient appUserTagClient; |
| | | // |
| | | // @Resource |
| | | // private SecurityDetectionClient securityDetectionClient; |
| | | // @Autowired |
| | | // private RedissonClient redissonClient; |
| | | // |
| | | // |
| | | // @Test |
| | | // public void test(){ |
| | | // PayOrderQueryDto payOrderQueryDto = new PayOrderQueryDto(); |
| | | // payOrderQueryDto.setPageCurr(1); |
| | | // payOrderQueryDto.setPageSize(10000999); |
| | | // PageInfo<PayOrderDto> data = chargingOrderService.payOrderQuery(payOrderQueryDto).getData(); |
| | | // RLock lock = redissonClient.getLock("endOrder:1234565"); |
| | | // boolean tryLock = false; |
| | | // try { |
| | | // tryLock = lock.tryLock(100, TimeUnit.SECONDS); |
| | | // } catch (InterruptedException e) { |
| | | // e.printStackTrace(); |
| | | // lock.unlock(); |
| | | // } |
| | | // if(!tryLock){ |
| | | // System.out.println("获取锁失败"); |
| | | // } |
| | | // System.out.println("获取锁成功"); |
| | | // } |
| | | //} |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.ruoyi.chargingPile.api.model.Partner; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.model.*; |
| | | import com.ruoyi.order.api.vo.GovernmentCloudOrderVO; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | @PostMapping("/listAll") |
| | | R<GovernmentCloudOtherVO> listAll() { |
| | | LocalDateTime end = LocalDateTime.now(); |
| | | LocalDateTime start = LocalDateTime.now().minusDays(1); |
| | | String start = LocalDate.now().minusDays(1)+" 00:00:00"; |
| | | String end = LocalDate.now().minusDays(1)+" 23:59:59"; |
| | | GovernmentCloudOtherVO governmentCloudAccountVO = new GovernmentCloudOtherVO(); |
| | | |
| | | |
| | | List<Operator> list1 = operatorService.lambdaQuery().list(); |
| | | List<TActivity> list2 = activityService.lambdaQuery().between(TActivity::getCreateTime, start, end).list(); |
| | | List<TAdvertising> list3 = advertisingService.lambdaQuery().between(TAdvertising::getCreateTime, start, end).list(); |
| | | List<TCompany> list4 = companyService.lambdaQuery().between(TCompany::getCreateTime, start, end).list(); |
| | | List<TCoupon> list5 = couponService.lambdaQuery().between(TCoupon::getCreateTime, start, end).list(); |
| | | List<TEnterpriseUserApplication> list6 = enterpriseUserApplicationService.lambdaQuery().between(TEnterpriseUserApplication::getCreateTime, start, end).list(); |
| | | List<TEvaluationTag> list7 = evaluationTagService.lambdaQuery().between(TEvaluationTag::getCreateTime, start, end).list(); |
| | | List<TGoods> list8 = goodsService.lambdaQuery().between(TGoods::getCreateTime, start, end).list(); |
| | | List<THtml> list9 = htmlService.lambdaQuery().list(); |
| | | List<TIntegralRule> list10 = integralRuleService.lambdaQuery().list(); |
| | | List<TInvoiceType> list11 = invoiceTypeService.lambdaQuery().between(TInvoiceType::getCreateTime, start, end).list(); |
| | | List<TNotice> list12 = noticeService.lambdaQuery().between(TNotice::getCreateTime, start, end).list(); |
| | | // List<TRoleSite> list13 = roleSiteService.lambdaQuery().between(TRoleSite::getCreateTime, start, end).list(); |
| | | List<Operator> list1 = operatorService.lambdaQuery() |
| | | .list(); |
| | | List<TActivity> list2 = activityService.lambdaQuery() |
| | | .ge(TActivity::getCreateTime,start) |
| | | .le(TActivity::getCreateTime,end) |
| | | .list(); |
| | | List<TAdvertising> list3 = advertisingService.lambdaQuery() |
| | | .ge(TAdvertising::getCreateTime,start) |
| | | .le(TAdvertising::getCreateTime,end) |
| | | .list(); |
| | | List<TCompany> list4 = companyService.lambdaQuery() |
| | | .ge(TCompany::getCreateTime,start) |
| | | .le(TCompany::getCreateTime,end) |
| | | .list(); |
| | | List<TCoupon> list5 = couponService.lambdaQuery() |
| | | .ge(TCoupon::getCreateTime,start) |
| | | .le(TCoupon::getCreateTime,end) |
| | | .list(); |
| | | List<TEnterpriseUserApplication> list6 = enterpriseUserApplicationService.lambdaQuery() |
| | | .ge(TEnterpriseUserApplication::getCreateTime,start) |
| | | .le(TEnterpriseUserApplication::getCreateTime,end) |
| | | .list(); |
| | | List<TEvaluationTag> list7 = evaluationTagService.lambdaQuery() |
| | | .ge(TEvaluationTag::getCreateTime,start) |
| | | .le(TEvaluationTag::getCreateTime,end) |
| | | .list(); |
| | | List<TGoods> list8 = goodsService.lambdaQuery() |
| | | .ge(TGoods::getCreateTime,start) |
| | | .le(TGoods::getCreateTime,end) |
| | | .list(); |
| | | List<THtml> list9 = htmlService.lambdaQuery() |
| | | .list(); |
| | | List<TIntegralRule> list10 = integralRuleService.lambdaQuery() |
| | | .list(); |
| | | List<TInvoiceType> list11 = invoiceTypeService.lambdaQuery() |
| | | .ge(TInvoiceType::getCreateTime,start) |
| | | .le(TInvoiceType::getCreateTime,end) |
| | | .list(); |
| | | List<TNotice> list12 = noticeService.lambdaQuery() |
| | | .ge(TNotice::getCreateTime,start) |
| | | .le(TNotice::getCreateTime,end) |
| | | .list(); |
| | | List<TRoleSite> list13 = roleSiteService.lambdaQuery().list(); |
| | | List<TSystemConfiguration> list14 = systemConfigurationService.lambdaQuery().list(); |
| | | // List<TUserSite> list15 = userSiteService.lambdaQuery().between(TUserSite::getCreateTime, start, end).list(); |
| | | List<TUserTag> list16 = userTagService.lambdaQuery().between(TUserTag::getCreateTime, start, end).list(); |
| | | List<TVip> list17 = vipService.lambdaQuery().between(TVip::getCreateTime, start, end).list(); |
| | | List<TUserSite> list15 = userSiteService.lambdaQuery().list(); |
| | | List<TUserTag> list16 = userTagService.lambdaQuery() |
| | | .ge(TUserTag::getCreateTime,start) |
| | | .le(TUserTag::getCreateTime,end) |
| | | .list(); |
| | | List<TVip> list17 = vipService.lambdaQuery() |
| | | .ge(TVip::getCreateTime,start) |
| | | .le(TVip::getCreateTime,end) |
| | | .list(); |
| | | governmentCloudAccountVO.setOperators(list1); |
| | | governmentCloudAccountVO.setActivities(list2); |
| | | governmentCloudAccountVO.setAdvertisings(list3); |
| | |
| | | governmentCloudAccountVO.setIntegralRules(list10); |
| | | governmentCloudAccountVO.setInvoiceTypes(list11); |
| | | governmentCloudAccountVO.setNotices(list12); |
| | | governmentCloudAccountVO.setRoleSites(list13); |
| | | governmentCloudAccountVO.setSystemConfigurations(list14); |
| | | governmentCloudAccountVO.setUserSites(list15); |
| | | governmentCloudAccountVO.setUserTags(list16); |
| | | governmentCloudAccountVO.setVips(list17); |
| | | |
| | | return R.ok(governmentCloudAccountVO); |
| | | } |
| | | |