Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
Conflicts:
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/model/WeixinProperties.java
25 文件已复制
48 文件已重命名
106个文件已修改
2个文件已删除
86个文件已添加
| | |
| | | target |
| | | |
| | | *.yaml |
| | | *.yml |
| | | *.yml |
| | | *.log |
New file |
| | |
| | | package com.ruoyi.account.api.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class InviteInfoDto { |
| | | @ApiModelProperty("已获得积分") |
| | | private Integer point; |
| | | @ApiModelProperty("已邀请人数") |
| | | private Integer inviteNum; |
| | | } |
| | |
| | | package com.ruoyi.account.api.factory; |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppCoupon; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.PointChangeDto; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<TAppCoupon> couponGetById(Long id) { |
| | | return R.fail("查询优惠券失败:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R updateAppUser(TAppUser appUser) { |
| | | return R.fail("修改用户失败:"+throwable.getMessage()); |
| | | } |
| | |
| | | package com.ruoyi.account.api.feignClient; |
| | | |
| | | import com.ruoyi.account.api.model.TAppCoupon; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.account.api.factory.AppUserFallbackFactory; |
| | |
| | | */ |
| | | @PostMapping(value = "/t-app-user/user/getUserById/{id}") |
| | | R<TAppUser> getUserById(@PathVariable("id") Long id); |
| | | |
| | | |
| | | @PostMapping(value = "/t-app-user/user/coupon/getById") |
| | | R<TAppCoupon> couponGetById(@RequestParam("id")Long id); |
| | | |
| | | |
| | | |
| | |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | |
| | | @ApiModelProperty(value = "最后一次登录时间") |
| | | @TableField("last_login_time") |
| | | private LocalDateTime lastLoginTime; |
| | | @ApiModelProperty(value = "邀请人id") |
| | | @TableField("invite_user_id") |
| | | private Long inviteUserId; |
| | | |
| | | |
| | | |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | |
| | | @ApiModelProperty(value = "签到天") |
| | | @TableField("sign_day") |
| | | @JsonFormat(pattern = "dd", timezone = "GMT+8") |
| | | private LocalDate signDay; |
| | | |
| | | @ApiModelProperty(value = "奖励积分") |
| | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableId(value = "id", type = IdType.NONE) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | |
| | | </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> |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/AcquisitionBillingMode.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/AcquisitionBillingModeReply.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/BillingModeVerify.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/BillingModeVerifyReply.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/BmsAbort.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/BmsDemandAndChargerExportation.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/BmsInformation.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/ChargingHandshake.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/ChargingPileReturnsGroundLockData.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/ChargingPileStartsCharging.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/ClearOfflineCard.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/ClearOfflineCardReply.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/ConfirmTransactionRecord.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/EndCharge.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/ErrorMessage.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/GroundLockRealTimeData.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/MotorAbort.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/Online.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/OnlineReply.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/OpenOrCloseGroundLock.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/ParameterSetting.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/Ping.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/PlatformConfirmationCharging.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/PlatformRemoteUpdate.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/PlatformRemoteUpdateReply.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/PlatformRestart.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/PlatformRestartReply.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/PlatformStartCharging.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/PlatformStartChargingReply.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/PlatformStopCharging.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/PlatformStopChargingReply.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/Pong.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/QueryOfflineCard.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/QueryOfflineCardReply.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/ReadRealTimeMonitoringData.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/SetupBillingModel.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/SetupBillingModelReply.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/SynchronizeOfflineCard.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/SynchronizeOfflineCardReply.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/TimingSetting.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/TimingSettingReply.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/TransactionRecord.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/UpdateBalance.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/UpdateBalanceReply.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/UploadRealTimeMonitoringData.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/WorkingParameterSetting.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/WorkingParameterSettingReply.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.ExchangeDto; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityVO; |
| | | import org.slf4j.Logger; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<Long> shopCreate(ExchangeDto exchangeDto) { |
| | | public R<TShoppingOrder> shopCreate(ExchangeDto exchangeDto) { |
| | | return R.fail("订单创建" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R callBack(String code, String outTradeNo) { |
| | | return R.fail("支付回调" + cause.getMessage()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R<TActivityVO> activityStatistics(TActivityStatisticsQuery dto) { |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.ExchangeDto; |
| | | import com.ruoyi.order.api.factory.OrderFallbackFactory; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityVO; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | |
| | | @PostMapping("/t-exchange-order/create") |
| | | public R<Long> exchangeCreate(@RequestBody ExchangeDto exchangeDto); |
| | | @PostMapping("/t-shopping-order/create") |
| | | public R<Long> shopCreate(@RequestBody ExchangeDto exchangeDto); |
| | | public R<TShoppingOrder> shopCreate(@RequestBody ExchangeDto exchangeDto); |
| | | @PostMapping("/t-shopping-order/callBack") |
| | | public R callBack(@RequestParam("code")String code,@RequestParam("outTradeNo")String outTradeNo); |
| | | |
| | | /** |
| | | * 管理后台 活动费用统计 |
| | |
| | | @ApiModelProperty(value = "充电终端名称 桩+枪") |
| | | private String terminalName; |
| | | @ApiModelProperty(value = "充电时间 秒") |
| | | private Integer chargingSecond; |
| | | private Long chargingSecond; |
| | | @ApiModelProperty(value = "平台手续费") |
| | | private BigDecimal platFormMoney; |
| | | @ApiModelProperty(value = "三方平台分佣") |
| | |
| | | private String licensePlate; |
| | | @ApiModelProperty(value = "手机号") |
| | | private String phone; |
| | | @ApiModelProperty(value = "累计充电量") |
| | | private BigDecimal chargingCapacity; |
| | | |
| | | @ApiModelProperty(value = "累计电费") |
| | | private BigDecimal electrovalence; |
| | | @ApiModelProperty(value = "累计服务费") |
| | |
| | | @ApiModelProperty(value = "总充电量") |
| | | private BigDecimal total; |
| | | @ApiModelProperty(value = "充电时长") |
| | | private BigDecimal time; |
| | | private Long time; |
| | | @ApiModelProperty(value = "收入") |
| | | private BigDecimal income; |
| | | @ApiModelProperty(value = "电费") |
| | |
| | | @ApiModelProperty(value = "上架状态(0=否,1=是)") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | |
| | | @ApiModelProperty(value = "小程序id") |
| | | @TableField("applet_id") |
| | | private String appletId; |
| | | @ApiModelProperty(value = "小程序名称") |
| | | @TableField("applet_name") |
| | | private String appletName; |
| | | |
| | | @ApiModelProperty(value = "广告状态 1未开始 2已开始 3已结束") |
| | | @TableField(exist = false) |
| | |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | @TableField("start_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime startTime; |
| | | @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") |
| | | private LocalDate startTime; |
| | | |
| | | @ApiModelProperty(value = "结束时间") |
| | | @TableField("end_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime endTime; |
| | | @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") |
| | | private LocalDate endTime; |
| | | |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.other.api.dto; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel("广告列表查询DTO") |
| | | public class SaveHtml extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "数据类型(1=积分规则说明,2=会员折扣说明,3=优惠券说明,4=双倍积分说明,5=商城专享价说明,6=会员协议,7=用户协议,8=隐私协议,9=邀请好友说明,10=资质证明,11=开票说明)") |
| | | private Integer type; |
| | | @ApiModelProperty(value = "标题") |
| | | private String info; |
| | | |
| | | |
| | | } |
| | |
| | | /** |
| | | * 回调地址 |
| | | */ |
| | | private String notifyUrl; |
| | | private String notifyUrl ="/"; |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class ExchangeDto { |
| | | @ApiModelProperty("商品id") |
| | |
| | | @ApiModelProperty("1微信2支付宝") |
| | | Integer payMethod; |
| | | |
| | | @ApiModelProperty(hidden =true) |
| | | BigDecimal orderPrice; |
| | | @ApiModelProperty(hidden =true) |
| | | BigDecimal payPrice; |
| | | @ApiModelProperty(hidden =true) |
| | | BigDecimal discountPrice; |
| | | @ApiModelProperty(hidden =true) |
| | | BigDecimal vipDiscount; |
| | | |
| | | |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | public <T> void setCacheMap(final String key, final Map<String, T> dataMap, long timeout) |
| | | { |
| | | if (dataMap != null) { |
| | | redisTemplate.opsForHash().putAll(key, dataMap); |
| | | redisTemplate.expire(key, timeout, TimeUnit.SECONDS); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获得缓存的Map |
| | | * |
| | |
| | | // 排除过滤的 uri 地址,nacos自行添加 |
| | | @Autowired |
| | | private IgnoreWhiteProperties ignoreWhite; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisService redisService; |
| | | |
| | |
| | | } |
| | | |
| | | private Mono<Void> unauthorizedResponse(ServerWebExchange exchange, String msg) { |
| | | log.error("[鉴权异常处理]请求路径:{}", exchange.getRequest().getPath()); |
| | | log.error("[鉴权异常处理]请求路径:{}", exchange.getRequest().getPath() + "\n" + msg); |
| | | return ServletUtils.webFluxResponseWriter(exchange.getResponse(), msg, HttpStatus.UNAUTHORIZED); |
| | | } |
| | | |
| | |
| | | if(null == cacheMap){ |
| | | cacheMap = new HashMap<>(); |
| | | cacheMap.put(url, timestamp); |
| | | redisService.setCacheMap(client, cacheMap); |
| | | redisService.setCacheMap(client, cacheMap, 5L); |
| | | }else{ |
| | | Object o = cacheMap.get(url); |
| | | if(null == o){ |
| | |
| | | Long old_timestamp = Long.valueOf(o.toString()); |
| | | Long new_timestamp = Long.valueOf(timestamp); |
| | | //两个请求时间差小于1秒,判定为重复提交 |
| | | if((new_timestamp - old_timestamp) <= 1000){ |
| | | if((new_timestamp - old_timestamp) <= 500){ |
| | | throw new RuntimeException("重复提交"); |
| | | }else{ |
| | | cacheMap.put(url, timestamp); |
| | | } |
| | | } |
| | | redisService.setCacheMap(client, cacheMap); |
| | | redisService.setCacheMap(client, cacheMap, 5L); |
| | | } |
| | | } |
| | | |
| | |
| | | if (claims == null) { |
| | | throw new RuntimeException("令牌已过期或验证不正确!"); |
| | | } |
| | | // String userkey = JwtUtils.getUserKey(claims); |
| | | // boolean islogin = redisService.hasKey(getTokenKey(userkey)); |
| | | // if (!islogin) { |
| | | // throw new RuntimeException("登录状态已过期"); |
| | | // } |
| | | String userid = JwtUtils.getUserId(claims); |
| | | String username = JwtUtils.getUserName(claims); |
| | | if (StringUtils.isEmpty(userid) || StringUtils.isEmpty(username)) { |
| | | if (StringUtils.isEmpty(userid)) { |
| | | throw new RuntimeException("令牌验证失败"); |
| | | } |
| | | } |
| | |
| | | public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) { |
| | | ServerHttpRequest request = exchange.getRequest(); |
| | | ServerHttpRequest.Builder mutate = request.mutate(); |
| | | HttpMethod method = request.getMethod(); |
| | | if(method != HttpMethod.POST){ |
| | | return chain.filter(exchange.mutate().request(mutate.build()).build()); |
| | | } |
| | | // 跳过不需要验证的路径 |
| | | String url = request.getURI().getPath(); |
| | | if (StringUtils.matches(url, ignoreWhite.getWhites())) { |
| | | return chain.filter(exchange); |
| | | } |
| | | HttpMethod method = request.getMethod(); |
| | | if(method != HttpMethod.POST){ |
| | | return chain.filter(exchange); |
| | | } |
| | | ServerHttpRequestDecorator httpRequestDecorator = requestDecorator(exchange); |
| | |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return HIGHEST_PRECEDENCE; |
| | | return -500; |
| | | } |
| | | } |
| | |
| | | @NotBlank(message = "获取用户信息加密串不能为空") |
| | | private String token; |
| | | |
| | | @ApiModelProperty(value = "邀请用户id") |
| | | private Long inviteUserId; |
| | | |
| | | } |
| | |
| | | String phoneNumber = new AliAppletTools(aliProperties).getPhoneNumber(appletUserLogin.getToken()); |
| | | log.info("获取支付宝用户信息:{}", phoneNumber); |
| | | // 用户信息封装 |
| | | return AjaxResult.success(appUserService.aliLogin(response,phoneNumber)); |
| | | return AjaxResult.success(appUserService.aliLogin(response,phoneNumber,appletUserLogin.getInviteUserId())); |
| | | } else { |
| | | String diagnosisUrl = DiagnosisUtils.getDiagnosisUrl(response); |
| | | log.warn("诊断结果:{}",diagnosisUrl); |
| | |
| | | @PostMapping("/grantCoupon") |
| | | public R grantCoupon(@RequestBody GrantCouponDto dto){ |
| | | List<TAppCoupon> res = new ArrayList<>(); |
| | | TCoupon coupon = otherClient.getCouponById(dto.getCouponId()).getData(); |
| | | |
| | | switch (dto.getType()){ |
| | | case 1: |
| | | // 根据标签ids 查询用户ids |
| | |
| | | tAppCoupon.setEndTime(dto.getEndTime()); |
| | | tAppCoupon.setWaysToObtain(dto.getWaysToObtain()); |
| | | tAppCoupon.setStatus(1); |
| | | tAppCoupon.setCouponJson(JSON.toJSONString(coupon)); |
| | | res.add(tAppCoupon); |
| | | } |
| | | tAppCouponService.saveBatch(res); |
| | |
| | | tAppCoupon.setEndTime(dto.getEndTime()); |
| | | tAppCoupon.setWaysToObtain(dto.getWaysToObtain()); |
| | | tAppCoupon.setStatus(1); |
| | | tAppCoupon.setCouponJson(JSON.toJSONString(coupon)); |
| | | res.add(tAppCoupon); |
| | | } |
| | | tAppCouponService.saveBatch(res); |
| | |
| | | tAppCoupon.setEndTime(dto.getEndTime()); |
| | | tAppCoupon.setWaysToObtain(dto.getWaysToObtain()); |
| | | tAppCoupon.setStatus(1); |
| | | tAppCoupon.setCouponJson(JSON.toJSONString(coupon)); |
| | | res.add(tAppCoupon); |
| | | } |
| | | tAppCouponService.saveBatch(res); |
| | |
| | | import com.ruoyi.account.service.*; |
| | | import com.ruoyi.account.util.PointDetailUtil; |
| | | import com.ruoyi.account.util.SignDayUtil; |
| | | import com.ruoyi.account.util.carBrand.CarBrandUtil; |
| | | import com.ruoyi.account.wx.model.WeixinProperties; |
| | | import com.ruoyi.account.util.GiveVipUtil; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.auth.AuthUtil; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | |
| | | |
| | | @Resource |
| | | private VipClient vipClient; |
| | | @Resource |
| | | private TInviteUserService inviteUserService; |
| | | |
| | | |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "优惠卷列表不分页(1可使用2不可用)", tags = {"小程序-个人中心"}) |
| | | @PostMapping(value = "/user/coupon/getById") |
| | | public R<TAppCoupon> couponGetById(@RequestParam("id")Long id) { |
| | | TAppCoupon appCoupon = appCouponService.getById(id); |
| | | return R.ok(appCoupon); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "赠送会员", tags = {"用户管理-用户列表"}) |
| | |
| | | } |
| | | //增加vipDetail |
| | | giveVipUtil.sendVip(nowUser, giveVipDto.getVipId(),plusDay); |
| | | |
| | | |
| | | appUserService.updateById(nowUser); |
| | | //执行一次赠送优惠卷的定时任务 |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "已赠送列表", tags = {"小程序-个人中心-邀请好友"}) |
| | | @PostMapping(value = "/user/invite/page") |
| | | public R<Page<TInviteUser>> invitePage(@RequestBody BasePage basePage) { |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | |
| | | Page<TInviteUser> page = inviteUserService.lambdaQuery().eq(TInviteUser::getAppUserId, userId).isNotNull(TInviteUser::getAward).orderByDesc(TInviteUser::getCreateTime).page(Page.of(basePage.getPageCurr(), basePage.getPageSize())); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | @ApiOperation(value = "已赠送列表", tags = {"小程序-个人中心-邀请好友"}) |
| | | @PostMapping(value = "/user/invite/info") |
| | | public R<InviteInfoDto> inviteInfo() { |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | Integer point = 0; |
| | | List<TInviteUser> list = inviteUserService.lambdaQuery().eq(TInviteUser::getAppUserId, userId).isNotNull(TInviteUser::getAward).orderByDesc(TInviteUser::getCreateTime).list(); |
| | | for (TInviteUser tInviteUser : list) { |
| | | point = point +tInviteUser.getAward(); |
| | | } |
| | | InviteInfoDto inviteInfoDto = new InviteInfoDto(); |
| | | inviteInfoDto.setPoint(point); |
| | | inviteInfoDto.setInviteNum(list.size()); |
| | | |
| | | |
| | | return R.ok(inviteInfoDto); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "更换手机号", tags = {"小程序-用户管理-更换手机号"}) |
| | | @PostMapping(value = "/user/updatePhone") |
| | |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取车辆品牌", tags = {"小程序-个人中心-车辆"}) |
| | | @GetMapping(value = "/user/car/getBrands") |
| | | public R getBrands(String name) throws Exception { |
| | | String brand = CarBrandUtil.getBrand(); |
| | | JSONObject jsonObject = JSON.parseObject(brand); |
| | | JSONArray data = jsonObject.getJSONArray("data"); |
| | | return R.ok(data); |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "根据品牌获取车型", tags = {"小程序-个人中心-车辆"}) |
| | | @GetMapping(value = "/user/car/getModel") |
| | | public R getModel(String id) throws Exception { |
| | | String modelById = CarBrandUtil.getModelById(id); |
| | | return R.ok(modelById); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | AppletUserDecodeData appletUserDecodeData = WxUtils.encryptedData(data.getEncryptedData(), sessionKey, data.getIv()); |
| | | appletUserDecodeData.setOpenId(openid); |
| | | return AjaxResult.success(appUserService.wxLogin(appletUserDecodeData)); |
| | | return AjaxResult.success(appUserService.wxLogin(appletUserDecodeData,data.getInviteUserId())); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.account.filter; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.service.TAppUserService; |
| | | import com.ruoyi.common.core.constant.TokenConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.JwtUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.jsonwebtoken.Claims; |
| | | import org.apache.logging.log4j.core.config.Order; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | @Component |
| | | public class AuthFilter implements Filter { |
| | | private static final Logger log = LoggerFactory.getLogger(AuthFilter.class); |
| | | |
| | | |
| | | @Lazy |
| | | @Resource |
| | | private TAppUserService appUserService; |
| | | |
| | | |
| | | @Lazy |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { |
| | | HttpServletRequest request = (HttpServletRequest) servletRequest; |
| | |
| | | * @param appletUserDecodeData |
| | | * @return |
| | | */ |
| | | Map<String, Object> wxLogin(AppletUserDecodeData appletUserDecodeData); |
| | | Map<String, Object> wxLogin(AppletUserDecodeData appletUserDecodeData,Long inviteUserId); |
| | | |
| | | /** |
| | | * 支付宝小程序登录用户封装 |
| | |
| | | * @return |
| | | */ |
| | | // Map<String, Object> aliLogin(AlipaySystemOauthTokenResponse response, AlipayUserInfoShareResponse userInfo); |
| | | Map<String, Object> aliLogin(AlipaySystemOauthTokenResponse response,String phone); |
| | | Map<String, Object> aliLogin(AlipaySystemOauthTokenResponse response,String phone,Long inviteUserId); |
| | | |
| | | /** |
| | | * 封装用户信息和token |
| | |
| | | */ |
| | | public interface TInviteUserService extends IService<TInviteUser> { |
| | | |
| | | /** |
| | | * 添加邀请用户 |
| | | * @param appUserId |
| | | * @param beInvitedAppUserId |
| | | */ |
| | | void saveInviteUser(Long appUserId, Long beInvitedAppUserId); |
| | | |
| | | } |
| | |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.mapper.TAppUserMapper; |
| | | import com.ruoyi.account.service.TAppUserService; |
| | | import com.ruoyi.account.service.TInviteUserService; |
| | | import com.ruoyi.account.wx.model.WeixinProperties; |
| | | import com.ruoyi.account.wx.pojo.AppletUserDecodeData; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | |
| | | public class TAppUserServiceImpl extends ServiceImpl<TAppUserMapper, TAppUser> implements TAppUserService { |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private TInviteUserService inviteUserService; |
| | | @Override |
| | | public Map<String, Object> wxLogin(AppletUserDecodeData appletUserDecodeData) { |
| | | public Map<String, Object> wxLogin(AppletUserDecodeData appletUserDecodeData,Long inviteUserId) { |
| | | // 通过手机号查询用户,是否已存在手动导入用户,包含支付宝用户 |
| | | TAppUser appUser = this.getOne(Wrappers.lambdaQuery(TAppUser.class) |
| | | .eq(TAppUser::getPhone, appletUserDecodeData.getPhoneNumber()) |
| | |
| | | if(Objects.nonNull(appUser.getStatus())){ |
| | | throwInfo(appUser.getStatus()); |
| | | } |
| | | appUser.setInviteUserId(inviteUserId); |
| | | appUser.setAvatar(appletUserDecodeData.getAvatarUrl()); |
| | | appUser.setCity(appletUserDecodeData.getCity()); |
| | | appUser.setName(appletUserDecodeData.getNickName()); |
| | | appUser.setProvince(appletUserDecodeData.getProvince()); |
| | | appUser.setWxOpenid(appletUserDecodeData.getOpenId()); |
| | | this.saveOrUpdate(appUser); |
| | | inviteUserService.saveInviteUser(appUser.getId(), inviteUserId); |
| | | return this.getUserInfo(appUser); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> aliLogin(AlipaySystemOauthTokenResponse response,String phone) { |
| | | public Map<String, Object> aliLogin(AlipaySystemOauthTokenResponse response,String phone,Long inviteUserId) { |
| | | // 通过手机号查询用户,是否已存在手动导入用户,包含微信用户 |
| | | TAppUser appUser = this.getOne(Wrappers.lambdaQuery(TAppUser.class) |
| | | .eq(TAppUser::getPhone, phone) |
| | |
| | | if(Objects.nonNull(appUser.getStatus())){ |
| | | throwInfo(appUser.getStatus()); |
| | | } |
| | | appUser.setInviteUserId(inviteUserId); |
| | | appUser.setAliOpenid(response.getOpenId()); |
| | | this.saveOrUpdate(appUser); |
| | | inviteUserService.saveInviteUser(appUser.getId(), inviteUserId); |
| | | return this.getUserInfo(appUser); |
| | | } |
| | | // @Override |
| | |
| | | import com.ruoyi.account.service.TInviteUserService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | |
| | | @Service |
| | | public class TInviteUserServiceImpl extends ServiceImpl<TInviteUserMapper, TInviteUser> implements TInviteUserService { |
| | | |
| | | @Override |
| | | public void saveInviteUser(Long appUserId, Long beInvitedAppUserId) { |
| | | TInviteUser inviteUser = new TInviteUser(); |
| | | inviteUser.setAppUserId(appUserId); |
| | | inviteUser.setBeInvitedAppUserId(beInvitedAppUserId); |
| | | inviteUser.setCreateTime(LocalDateTime.now()); |
| | | this.save(inviteUser); |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | }else { |
| | | nowUser.setVipEndTime(nowUser.getVipEndTime().plusDays(plusDay)); |
| | | nowUser.setVipEndTime(nowUser.getVipEndTime().plusDays(plusDay).minusDays(1)); |
| | | //获取detail里结束时间大于当前时间的数据,并将enttime延长 |
| | | TAppUserVipDetail tAppUserVipDetail = tAppUserVipDetailService.lambdaQuery().eq(TAppUserVipDetail::getAppUserId, nowUser.getId()).orderByDesc(TAppUserVipDetail::getEndTime).last("limit 1").one(); |
| | | |
New file |
| | |
| | | package com.ruoyi.account.util.carBrand; |
| | | |
| | | import com.cloud.apigateway.sdk.utils.Client; |
| | | import com.cloud.apigateway.sdk.utils.Request; |
| | | import org.apache.http.HttpEntity; |
| | | import org.apache.http.HttpResponse; |
| | | import org.apache.http.client.methods.HttpRequestBase; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.util.EntityUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | public class CarBrandUtil { |
| | | private static final Logger LOGGER = LoggerFactory.getLogger(CarBrandUtil.class); |
| | | public static String getBrand() throws Exception { |
| | | // Create a new request. |
| | | Request httpClientRequest = new Request(); |
| | | try { |
| | | // Set the request parameters. |
| | | // AppKey, AppSecrect, Method and Url are required parameters. |
| | | // Directly writing AK/SK in code is risky. For security, encrypt your AK/SK and store them in the configuration file or environment variables. |
| | | // In this example, the AK/SK are stored in environment variables for identity authentication. |
| | | // Before running this example, set environment variables HUAWEICLOUD_SDK_AK and HUAWEICLOUD_SDK_SK. |
| | | httpClientRequest.setKey("9a4a2b69afe141718f6843c5d39961ec"); |
| | | httpClientRequest.setSecret("541845f206324bbc933065b44fc98c47"); |
| | | httpClientRequest.setMethod("POST"); |
| | | // Set a request URL in the format of https://{Endpoint}/{URI}. |
| | | httpClientRequest.setUrl("https://vehiclequery.apistore.huaweicloud.com/vehicle/query/brand"); |
| | | httpClientRequest.addHeader("Content-Type", "text/plain"); |
| | | // Set a body for http request. |
| | | // httpClientRequest.setBody("put your request body here"); |
| | | } catch (Exception e) { |
| | | // LOGGER.error(e.getMessage()); |
| | | return ""; |
| | | } |
| | | CloseableHttpClient client = null; |
| | | try { |
| | | // Sign the request. |
| | | HttpRequestBase signedRequest = Client.sign(httpClientRequest, Constant.SIGNATURE_ALGORITHM_SDK_HMAC_SHA256); |
| | | if (Constant.DO_VERIFY) { |
| | | // creat httpClient and verify ssl certificate |
| | | HostName.setUrlHostName(httpClientRequest.getHost()); |
| | | client = (CloseableHttpClient) SSLCipherSuiteUtil.createHttpClientWithVerify(Constant.INTERNATIONAL_PROTOCOL); |
| | | } else { |
| | | // creat httpClient and do not verify ssl certificate |
| | | client = (CloseableHttpClient) SSLCipherSuiteUtil.createHttpClient(Constant.INTERNATIONAL_PROTOCOL); |
| | | } |
| | | HttpResponse response = client.execute(signedRequest); |
| | | // Print the body of the response. |
| | | HttpEntity resEntity = response.getEntity(); |
| | | if (resEntity != null) { |
| | | // LOGGER.info("Processing Body with name: {} and value: {}", System.getProperty("line.separator"), |
| | | // EntityUtils.toString(resEntity, "UTF-8")); |
| | | String string = EntityUtils.toString(resEntity, "UTF-8"); |
| | | return string; |
| | | } |
| | | } catch (Exception e) { |
| | | LOGGER.error(e.getMessage()); |
| | | } finally { |
| | | if (client != null) { |
| | | client.close(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | |
| | | public static String getModelById(String brandId) throws Exception { |
| | | // Create a new request. |
| | | Request httpClientRequest = new Request(); |
| | | try { |
| | | // Set the request parameters. |
| | | // AppKey, AppSecrect, Method and Url are required parameters. |
| | | // Directly writing AK/SK in code is risky. For security, encrypt your AK/SK and store them in the configuration file or environment variables. |
| | | // In this example, the AK/SK are stored in environment variables for identity authentication. |
| | | // Before running this example, set environment variables HUAWEICLOUD_SDK_AK and HUAWEICLOUD_SDK_SK. |
| | | httpClientRequest.setKey("9a4a2b69afe141718f6843c5d39961ec"); |
| | | httpClientRequest.setSecret("541845f206324bbc933065b44fc98c47"); |
| | | httpClientRequest.setMethod("POST"); |
| | | // Set a request URL in the format of https://{Endpoint}/{URI}. |
| | | httpClientRequest.setUrl("https://vehiclequery.apistore.huaweicloud.com/vehicle/query/series"); |
| | | httpClientRequest.addHeader("Content-Type", "text/plain"); |
| | | httpClientRequest.addQueryStringParam("brandId",brandId); |
| | | // Set a body for http request. |
| | | // httpClientRequest.setBody("put your request body here"); |
| | | } catch (Exception e) { |
| | | // LOGGER.error(e.getMessage()); |
| | | return ""; |
| | | } |
| | | CloseableHttpClient client = null; |
| | | try { |
| | | // Sign the request. |
| | | HttpRequestBase signedRequest = Client.sign(httpClientRequest, Constant.SIGNATURE_ALGORITHM_SDK_HMAC_SHA256); |
| | | if (Constant.DO_VERIFY) { |
| | | // creat httpClient and verify ssl certificate |
| | | HostName.setUrlHostName(httpClientRequest.getHost()); |
| | | client = (CloseableHttpClient) SSLCipherSuiteUtil.createHttpClientWithVerify(Constant.INTERNATIONAL_PROTOCOL); |
| | | } else { |
| | | // creat httpClient and do not verify ssl certificate |
| | | client = (CloseableHttpClient) SSLCipherSuiteUtil.createHttpClient(Constant.INTERNATIONAL_PROTOCOL); |
| | | } |
| | | HttpResponse response = client.execute(signedRequest); |
| | | // Print the body of the response. |
| | | HttpEntity resEntity = response.getEntity(); |
| | | if (resEntity != null) { |
| | | // LOGGER.info("Processing Body with name: {} and value: {}", System.getProperty("line.separator"), |
| | | // EntityUtils.toString(resEntity, "UTF-8")); |
| | | String string = EntityUtils.toString(resEntity, "UTF-8"); |
| | | return string; |
| | | } |
| | | } catch (Exception e) { |
| | | LOGGER.error(e.getMessage()); |
| | | } finally { |
| | | if (client != null) { |
| | | client.close(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | } |
New file |
| | |
| | | /* |
| | | * Copyright (c) Huawei Technologies Co., Ltd. 2022-2023. All rights reserved. |
| | | */ |
| | | |
| | | package com.ruoyi.account.util.carBrand; |
| | | |
| | | public final class Constant { |
| | | // verify ssl certificate (true) or do not verify (false) |
| | | public static final boolean DO_VERIFY = false; |
| | | |
| | | public static final String HTTPS = "HTTPS"; |
| | | public static final String TRUST_MANAGER_FACTORY = "SunX509"; |
| | | public static final String GM_PROTOCOL = "GMTLS"; |
| | | public static final String INTERNATIONAL_PROTOCOL = "TLSv1.2"; |
| | | public static final String SIGNATURE_ALGORITHM_SDK_HMAC_SHA256 = "SDK-HMAC-SHA256"; |
| | | public static final String SIGNATURE_ALGORITHM_SDK_HMAC_SM3 = "SDK-HMAC-SM3"; |
| | | public static final String[] SUPPORTED_CIPHER_SUITES = {"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", |
| | | "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", |
| | | "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"}; |
| | | public static final String SECURE_RANDOM_ALGORITHM_NATIVE_PRNG_NON_BLOCKING = "NativePRNGNonBlocking"; |
| | | |
| | | private Constant() { |
| | | } |
| | | } |
New file |
| | |
| | | /* |
| | | * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. |
| | | */ |
| | | |
| | | package com.ruoyi.account.util.carBrand; |
| | | |
| | | public class HostName { |
| | | private static String urlHostName; |
| | | |
| | | public static void setUrlHostName(String hostName) { |
| | | urlHostName = hostName; |
| | | } |
| | | |
| | | public static boolean checkHostName(String SSLHostName) { |
| | | return urlHostName.equals(SSLHostName); |
| | | } |
| | | } |
New file |
| | |
| | | /* |
| | | * Copyright (c) Huawei Technologies Co., Ltd. 2022-2023. All rights reserved. |
| | | */ |
| | | |
| | | package com.ruoyi.account.util.carBrand; |
| | | |
| | | import org.apache.http.client.HttpClient; |
| | | import org.apache.http.conn.ssl.SSLConnectionSocketFactory; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.impl.client.HttpClients; |
| | | import org.bouncycastle.crypto.BlockCipher; |
| | | import org.bouncycastle.crypto.engines.AESEngine; |
| | | import org.bouncycastle.crypto.prng.SP800SecureRandomBuilder; |
| | | import org.openeuler.BGMProvider; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import okhttp3.OkHttpClient; |
| | | |
| | | import javax.net.ssl.*; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.security.*; |
| | | import java.security.cert.X509Certificate; |
| | | import java.util.Locale; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | public class SSLCipherSuiteUtil { |
| | | private static final Logger LOGGER = LoggerFactory.getLogger(SSLCipherSuiteUtil.class); |
| | | private static CloseableHttpClient httpClient; |
| | | private static OkHttpClient okHttpClient; |
| | | |
| | | private static final int CIPHER_LEN = 256; |
| | | |
| | | private static final int ENTROPY_BITS_REQUIRED = 384; |
| | | |
| | | public static HttpClient createHttpClient(String protocol) throws Exception { |
| | | SSLContext sslContext = getSslContext(protocol); |
| | | // create factory |
| | | SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(sslContext, |
| | | new String[]{protocol}, Constant.SUPPORTED_CIPHER_SUITES, new TrustAllHostnameVerifier()); |
| | | |
| | | httpClient = HttpClients.custom().setSSLSocketFactory(sslConnectionSocketFactory).build(); |
| | | return httpClient; |
| | | } |
| | | |
| | | public static HttpClient createHttpClientWithVerify(String protocol) throws Exception { |
| | | SSLContext sslContext = getSslContextWithVerify(protocol); |
| | | // create factory |
| | | SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(sslContext, |
| | | new String[] {protocol}, Constant.SUPPORTED_CIPHER_SUITES, new TheRealHostnameVerifier()); |
| | | |
| | | httpClient = HttpClients.custom().setSSLSocketFactory(sslConnectionSocketFactory).build(); |
| | | return httpClient; |
| | | } |
| | | |
| | | public static OkHttpClient createOkHttpClient(String protocol) throws Exception { |
| | | SSLContext sslContext = getSslContext(protocol); |
| | | // Create an ssl socket factory with our all-trusting manager |
| | | SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory(); |
| | | OkHttpClient.Builder builder = new OkHttpClient.Builder() |
| | | .sslSocketFactory(sslSocketFactory, new TrustAllManager()) |
| | | .hostnameVerifier(new TrustAllHostnameVerifier()); |
| | | okHttpClient = builder.connectTimeout(10, TimeUnit.SECONDS).readTimeout(60, TimeUnit.SECONDS).build(); |
| | | return okHttpClient; |
| | | } |
| | | |
| | | public static OkHttpClient createOkHttpClientWithVerify(String protocol) throws Exception { |
| | | SSLContext sslContext = getSslContextWithVerify(protocol); |
| | | SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory(); |
| | | |
| | | TrustManagerFactory tmf = TrustManagerFactory.getInstance(Constant.TRUST_MANAGER_FACTORY); |
| | | tmf.init((KeyStore) null); |
| | | TrustManager[] verify = tmf.getTrustManagers(); |
| | | OkHttpClient.Builder builder = new OkHttpClient.Builder().sslSocketFactory(sslSocketFactory, |
| | | (X509TrustManager) verify[0]).hostnameVerifier(new TheRealHostnameVerifier()); |
| | | |
| | | okHttpClient = builder.connectTimeout(10, TimeUnit.SECONDS).readTimeout(60, TimeUnit.SECONDS).build(); |
| | | return okHttpClient; |
| | | } |
| | | |
| | | public static HttpURLConnection createHttpsOrHttpURLConnection(URL uUrl, String protocol) throws Exception { |
| | | // initial connection |
| | | if (uUrl.getProtocol().toUpperCase(Locale.getDefault()).equals(Constant.HTTPS)) { |
| | | SSLContext sslContext = getSslContext(protocol); |
| | | HttpsURLConnection.setDefaultHostnameVerifier(new TrustAllHostnameVerifier()); |
| | | HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory()); |
| | | return (HttpsURLConnection) uUrl.openConnection(); |
| | | } |
| | | return (HttpURLConnection) uUrl.openConnection(); |
| | | } |
| | | |
| | | public static HttpURLConnection createHttpsOrHttpURLConnectionWithVerify(URL uUrl, String protocol) throws Exception { |
| | | // initial connection |
| | | if (uUrl.getProtocol().toUpperCase(Locale.getDefault()).equals(Constant.HTTPS)) { |
| | | SSLContext sslContext = getSslContextWithVerify(protocol); |
| | | HttpsURLConnection.setDefaultHostnameVerifier(new TheRealHostnameVerifier()); |
| | | HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory()); |
| | | return (HttpsURLConnection) uUrl.openConnection(); |
| | | } |
| | | return (HttpURLConnection) uUrl.openConnection(); |
| | | } |
| | | |
| | | private static SSLContext getSslContext(String protocol) throws UnsupportProtocolException, |
| | | NoSuchAlgorithmException, NoSuchProviderException, KeyManagementException { |
| | | if (!Constant.GM_PROTOCOL.equals(protocol) && !Constant.INTERNATIONAL_PROTOCOL.equals(protocol)) { |
| | | LOGGER.info("Unsupport protocol: {}, Only support GMTLS TLSv1.2", protocol); |
| | | throw new UnsupportProtocolException("Unsupport protocol, Only support GMTLS TLSv1.2"); |
| | | } |
| | | // Create a trust manager that does not validate certificate chains |
| | | TrustAllManager[] trust = {new TrustAllManager()}; |
| | | KeyManager[] kms = null; |
| | | SSLContext sslContext; |
| | | |
| | | sslContext = SSLContext.getInstance(Constant.INTERNATIONAL_PROTOCOL, "SunJSSE"); |
| | | |
| | | if (Constant.GM_PROTOCOL.equals(protocol)) { |
| | | Security.insertProviderAt(new BGMProvider(), 1); |
| | | sslContext = SSLContext.getInstance(Constant.GM_PROTOCOL, "BGMProvider"); |
| | | } |
| | | SecureRandom secureRandom = getSecureRandom(); |
| | | sslContext.init(kms, trust, secureRandom); |
| | | sslContext.getServerSessionContext().setSessionCacheSize(8192); |
| | | sslContext.getServerSessionContext().setSessionTimeout(3600); |
| | | return sslContext; |
| | | } |
| | | |
| | | private static SSLContext getSslContextWithVerify(String protocol) |
| | | throws UnsupportProtocolException, NoSuchAlgorithmException, NoSuchProviderException, KeyManagementException, |
| | | KeyStoreException { |
| | | if (!Constant.GM_PROTOCOL.equals(protocol) && !Constant.INTERNATIONAL_PROTOCOL.equals(protocol)) { |
| | | LOGGER.info("Unsupport protocol: {}, Only support GMTLS TLSv1.2", protocol); |
| | | throw new UnsupportProtocolException("Unsupport protocol, Only support GMTLS TLSv1.2"); |
| | | } |
| | | KeyManager[] kms = null; |
| | | SSLContext sslContext = SSLContext.getInstance(Constant.INTERNATIONAL_PROTOCOL, "SunJSSE"); |
| | | SecureRandom secureRandom = getSecureRandom(); |
| | | |
| | | if (Constant.GM_PROTOCOL.equals(protocol)) { |
| | | Security.insertProviderAt(new BGMProvider(), 1); |
| | | sslContext = SSLContext.getInstance(Constant.GM_PROTOCOL, "BGMProvider"); |
| | | } |
| | | |
| | | TrustManagerFactory tmf = TrustManagerFactory.getInstance(Constant.TRUST_MANAGER_FACTORY); |
| | | tmf.init((KeyStore) null); |
| | | TrustManager[] verify = tmf.getTrustManagers(); |
| | | sslContext.init(kms, verify, secureRandom); |
| | | |
| | | sslContext.getServerSessionContext().setSessionCacheSize(8192); |
| | | sslContext.getServerSessionContext().setSessionTimeout(3600); |
| | | return sslContext; |
| | | } |
| | | |
| | | // 不校验域名 |
| | | private static class TrustAllHostnameVerifier implements HostnameVerifier { |
| | | public boolean verify(String hostname, SSLSession session) { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | // 校验域名 |
| | | private static class TheRealHostnameVerifier implements HostnameVerifier { |
| | | public boolean verify(String hostname, SSLSession session) { |
| | | if (HostName.checkHostName(hostname)) { |
| | | return true; |
| | | } else { |
| | | HostnameVerifier hv = HttpsURLConnection.getDefaultHostnameVerifier(); |
| | | return hv.verify(hostname, session); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 不校验服务端证书 |
| | | private static class TrustAllManager implements X509TrustManager { |
| | | private X509Certificate[] issuers; |
| | | |
| | | public TrustAllManager() { |
| | | this.issuers = new X509Certificate[0]; |
| | | } |
| | | |
| | | public X509Certificate[] getAcceptedIssuers() { |
| | | return issuers; |
| | | } |
| | | |
| | | public void checkClientTrusted(X509Certificate[] chain, String authType) { |
| | | } |
| | | |
| | | public void checkServerTrusted(X509Certificate[] chain, String authType) { |
| | | } |
| | | } |
| | | |
| | | private static SecureRandom getSecureRandom() { |
| | | SecureRandom source; |
| | | try { |
| | | source = SecureRandom.getInstance(Constant.SECURE_RANDOM_ALGORITHM_NATIVE_PRNG_NON_BLOCKING); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | try { |
| | | source = SecureRandom.getInstanceStrong(); |
| | | } catch (NoSuchAlgorithmException ex) { |
| | | LOGGER.error("get SecureRandom failed", e); |
| | | throw new RuntimeException("get SecureRandom failed"); |
| | | } |
| | | } |
| | | boolean predictionResistant = true; |
| | | BlockCipher cipher = new AESEngine(); |
| | | boolean reSeed = false; |
| | | return new SP800SecureRandomBuilder(source, predictionResistant).setEntropyBitsRequired( |
| | | ENTROPY_BITS_REQUIRED).buildCTR(cipher, CIPHER_LEN, null, reSeed); |
| | | } |
| | | } |
New file |
| | |
| | | /* |
| | | * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. |
| | | */ |
| | | |
| | | package com.ruoyi.account.util.carBrand; |
| | | |
| | | public class UnsupportProtocolException extends Exception { |
| | | private static final long serialVersionUID = 4312820110480855928L; |
| | | private String msgDes; // 异常对应的描述信息 |
| | | |
| | | public UnsupportProtocolException(String message) { |
| | | super(message); |
| | | msgDes = message; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.account.wx.pojo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | private String rawData; |
| | | private String signature; |
| | | private String code; |
| | | @ApiModelProperty(value = "邀请用户id") |
| | | private Long inviteUserId; |
| | | } |
| | |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="del_flag" property="delFlag" /> |
| | | <result column="last_login_time" property="lastLoginTime" /> |
| | | <result column="invite_user_id" property="inviteUserId" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, name, phone, avatar, vip_id, vip_end_time, company_id, id_card, auth_status, wx_openid, ali_openid, points, province, province_code, city, city_code, status, create_time, del_flag, last_login_time |
| | | id, name, phone, avatar, vip_id, vip_end_time, company_id, id_card, auth_status, wx_openid, ali_openid, points, province, province_code, city, city_code, status, create_time, del_flag, last_login_time,invite_user_id |
| | | </sql> |
| | | |
| | | </mapper> |
| | |
| | | import com.ruoyi.chargingPile.service.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.GeodesyUtil; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalTime; |
| | | import java.util.*; |
| | |
| | | } |
| | | @ApiOperation(value = "获取站点分页列表", tags = {"小程序-站点管理-首页"}) |
| | | @PostMapping("/pageList") |
| | | public AjaxResult<PageInfo<SiteVO>> pageList(@Validated @RequestBody SiteQuery query){ |
| | | return AjaxResult.success(siteService.pageList(query)); |
| | | public AjaxResult<PageInfo<SiteVO>> pageList(@Validated @RequestBody SiteQuery query, HttpServletRequest request){ |
| | | int isLogin = StringUtils.isEmpty(SecurityUtils.getToken(request)) ? 0 : 1; |
| | | return AjaxResult.success(siteService.pageList(query,isLogin)); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取站点列表", tags = {"小程序-站点管理-地图导航站点"}) |
| | |
| | | if(null != dto.getSiteId()){ |
| | | dto.setAuditStatus(3); |
| | | } |
| | | Boolean flag = accountingStrategyDetailService.isStrategy24Hour(dto.getAccountingStrategyDetails()); |
| | | if(flag){ |
| | | return AjaxResult.error("计费模板时间设置有误差"); |
| | | } |
| | | Long userId = SecurityUtils.getLoginUser().getUserid(); |
| | | dto.setUserId(userId); |
| | | accountingStrategyService.save(dto); |
| | |
| | | @ApiOperation(tags = {"后台-计费策略", "管理后台-站点管理"},value = "修改计费策略") |
| | | @PostMapping(value = "/update") |
| | | public AjaxResult<Boolean> update(@RequestBody TAccountingStrategyDTO dto) { |
| | | Boolean flag = accountingStrategyDetailService.isStrategy24Hour(dto.getAccountingStrategyDetails()); |
| | | if(flag){ |
| | | return AjaxResult.error("计费模板时间设置有误差"); |
| | | } |
| | | // 删除计费策略明细信息 |
| | | accountingStrategyDetailService.remove(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, dto.getId())); |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.query.TChargingGunQuery; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | |
| | | public class TChargingPileController { |
| | | |
| | | private final TChargingPileService chargingPileService; |
| | | private final TChargingGunService chargingGunService; |
| | | |
| | | |
| | | @Autowired |
| | | public TChargingPileController(TChargingPileService chargingPileService) { |
| | | public TChargingPileController(TChargingPileService chargingPileService, TChargingGunService chargingGunService) { |
| | | this.chargingPileService = chargingPileService; |
| | | this.chargingGunService = chargingGunService; |
| | | } |
| | | |
| | | /** |
| | | * 查询充电桩列表 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-充电桩"},value = "查询充电桩列表") |
| | | @ApiOperation(tags = {"小程序-充电桩"},value = "通过站点id查询充电桩列表") |
| | | @PostMapping(value = "/list") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "siteId", value = "站点id") |
| | |
| | | .eq(TChargingPile::getSiteId,siteId))); |
| | | } |
| | | /** |
| | | * 查询充电桩列表 |
| | | */ |
| | | @ApiOperation(tags = {"通过充电桩id 查询充电枪列表"},value = "通过充电桩id 查询充电枪列表") |
| | | @PostMapping(value = "/pileList") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "pileId", value = "充电桩id") |
| | | }) |
| | | public AjaxResult<List<TChargingGun>> pileList(@RequestParam("pileId") Integer pileId) { |
| | | return AjaxResult.ok(chargingGunService.list(Wrappers.lambdaQuery(TChargingGun.class) |
| | | .eq(TChargingGun::getChargingPileId,pileId))); |
| | | } |
| | | /** |
| | | * 管理后台-通过站点id获取充电桩列表 不分页 |
| | | */ |
| | | @ApiOperation(value = "管理后台-通过站点id获取充电桩列表 不分页") |
| | |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.constant.TokenConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.JwtUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.jsonwebtoken.Claims; |
| | | import org.apache.logging.log4j.core.config.Order; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.io.UnsupportedEncodingException; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | * @return |
| | | */ |
| | | |
| | | PageInfo<SiteVO> pageList(SiteQuery query); |
| | | PageInfo<SiteVO> pageList(SiteQuery query,Integer isLogin); |
| | | |
| | | /** |
| | | * 获取站点详情 |
| | |
| | | * @return |
| | | */ |
| | | StrategyPriceVO queryPrice(Integer siteId); |
| | | /** |
| | | * 判断是否满足24小时策略 |
| | | * @param accountingStrategyDetails |
| | | * @return |
| | | */ |
| | | Boolean isStrategy24Hour(List<TAccountingStrategyDetail> accountingStrategyDetails); |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.utils.ServletUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<SiteVO> pageList(SiteQuery query) { |
| | | // 获取当前登录用户id |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | // 根据id查询用户信息 |
| | | TAppUser appUser = appUserClient.getUserById(userId).getData(); |
| | | public PageInfo<SiteVO> pageList(SiteQuery query,Integer isLogin) { |
| | | TAppUser appUser = null; |
| | | if(isLogin == 1){ |
| | | // 获取当前登录用户id |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | // 根据id查询用户信息 |
| | | appUser = appUserClient.getUserById(userId).getData(); |
| | | } |
| | | PageInfo<SiteVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | List<SiteVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | if(Objects.nonNull(appUser) && Objects.nonNull(appUser.getVipId())){ |
| | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | strategyPriceVO.setServiceFeeDiscount(monthlyCardDiscount.getMonthlyCardDiscount()); |
| | | return strategyPriceVO; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean isStrategy24Hour(List<TAccountingStrategyDetail> accountingStrategyDetails) { |
| | | String START_OF_DAY = "00:00:00"; |
| | | String END_OF_DAY = "24:00:00"; |
| | | List<TAccountingStrategyDetail> sortedDetails = accountingStrategyDetails.stream() |
| | | .sorted(Comparator.comparing(TAccountingStrategyDetail::getStartTime)) |
| | | .collect(Collectors.toList()); |
| | | |
| | | boolean isFirstElementValid = sortedDetails.isEmpty() || !START_OF_DAY.equals(sortedDetails.get(0).getStartTime()); |
| | | boolean isLastElementValid = sortedDetails.isEmpty() || !END_OF_DAY.equals(sortedDetails.get(sortedDetails.size() - 1).getEndTime()); |
| | | |
| | | boolean isTimeContinuous = sortedDetails.stream() |
| | | .skip(1) |
| | | .allMatch(detail -> detail.getStartTime().equals(sortedDetails.get(sortedDetails.indexOf(detail) - 1).getEndTime())); |
| | | |
| | | return isFirstElementValid || isLastElementValid || !isTimeContinuous; |
| | | } |
| | | } |
| | |
| | | </description> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-integration</artifactId> |
| | | </dependency> |
| | | <!-- SpringCloud Alibaba Nacos --> |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
New file |
| | |
| | | package com.ruoyi.integration.controller; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-08-07 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/chargingOrder") |
| | | public class ChargingOrderController { |
| | | @Resource |
| | | private UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService; |
| | | |
| | | /** |
| | | * 远程调用 通过订单流水号 查询订单详情 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getOrderInfoByCode") |
| | | public R<UploadRealTimeMonitoringData> chargingOrderInfo(String orderId){ |
| | | UploadRealTimeMonitoringData byId = uploadRealTimeMonitoringDataService.findById(orderId); |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.iotda.enums; |
| | | |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @Date 2024/8/22 15:28 |
| | | */ |
| | | public enum SendTagMenu { |
| | | /** |
| | | * 充电桩登录认证 |
| | | */ |
| | | ONLINE ("online"), |
| | | /** |
| | | * 充电桩心跳包 |
| | | */ |
| | | PING ("ping"), |
| | | /** |
| | | * 计费模型验证请求 |
| | | */ |
| | | BILLING_MODE_VERIFY ("billing_mode_verify"), |
| | | /** |
| | | * 充电桩计费模型请求 |
| | | */ |
| | | ACQUISITION_BILLING_MODE ("acquisition_billing_mode"), |
| | | /** |
| | | * 上传实时监测数据 |
| | | */ |
| | | UPLOAD_REAL_TIME_MONITORING_DATA ("upload_real_time_monitoring_data"), |
| | | /** |
| | | * 充电握手 |
| | | */ |
| | | CHARGING_HANDSHAKE ("charging_handshake"), |
| | | /** |
| | | * 充电阶段BMS中止 |
| | | */ |
| | | BMS_ABORT ("bms_abort"), |
| | | /** |
| | | * 充电阶段充电机中止 |
| | | */ |
| | | MOTOR_ABORT ("motor_abort"), |
| | | /** |
| | | * 充电过程BMS需求、充电机输出 |
| | | */ |
| | | BMS_DEMAND_AND_CHARGER_EXPORTATION ("bms_demand_and_charger_exportation"), |
| | | /** |
| | | * 充电过程BMS信息 |
| | | */ |
| | | BMS_INFORMATION ("bms_information"), |
| | | /** |
| | | * 充电桩主动申请启动充电 |
| | | */ |
| | | CHARGING_PILE_STARTS_CHARGING ("charging_pile_starts_charging"), |
| | | /** |
| | | * 远程启机命令回复 |
| | | */ |
| | | PLATFORM_START_CHARGING_REPLY ("platform_start_charging_reply"), |
| | | /** |
| | | * 远程停机命令回复 |
| | | */ |
| | | PLATFORM_STOP_CHARGING_REPLY ("platform_stop_charging_reply"), |
| | | /** |
| | | * 交易记录 |
| | | */ |
| | | TRANSACTION_RECORD ("transaction_record"), |
| | | /** |
| | | * 余额更新应答 |
| | | */ |
| | | UPDATE_BALANCE_REPLY ("update_balance_reply"), |
| | | /** |
| | | * 卡数据同步应答 |
| | | */ |
| | | SYNCHRONIZE_OFFLINE_CARD_REPLY ("synchronize_offline_card_reply"), |
| | | /** |
| | | * 离线卡数据清除应答 |
| | | */ |
| | | CLEAR_OFFLINE_CARD_REPLY ("clear_offline_card_reply"), |
| | | /** |
| | | * 离线卡数据查询应答 |
| | | */ |
| | | QUERY_OFFLINE_CARD_REPLY ("query_offline_card_reply"), |
| | | /** |
| | | * 充电桩工作参数设置应答 |
| | | */ |
| | | WORKING_PARAMETER_SETTING_REPLY ("working_parameter_setting_reply"), |
| | | /** |
| | | * 对时设置应答 |
| | | */ |
| | | TIMING_SETTING_REPLY ("timing_setting_reply"), |
| | | /** |
| | | * 计费模型应答 |
| | | */ |
| | | SETUP_BILLING_MODEL_REPLY ("setup_billing_model_reply"), |
| | | /** |
| | | * 地锁数据上送(充电桩上送) |
| | | */ |
| | | GROUND_LOCK_REAL_TIME_DATA ("ground_lock_real_time_data"), |
| | | /** |
| | | * 充电桩返回数据(上行) |
| | | */ |
| | | CHARGING_PILE_RETURNS_GROUND_LOCK_DATA ("charging_pile_returns_ground_lock_data"), |
| | | /** |
| | | * 远程重启应答 |
| | | */ |
| | | PLATFORM_RESTART_REPLY ("platform_restart_reply"), |
| | | /** |
| | | * 远程更新应答 |
| | | */ |
| | | PLATFORM_REMOTE_UPDATE_REPLY ("platform_remote_update_reply"), |
| | | ; |
| | | private String value; |
| | | |
| | | |
| | | SendTagMenu(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.iotda.enums; |
| | | |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @Date 2024/8/22 15:28 |
| | | */ |
| | | public enum ServiceIdMenu { |
| | | /** |
| | | * 登录认证应答 |
| | | */ |
| | | ONLINE_REPLY ("online_reply"), |
| | | /** |
| | | * 登录认证应答 |
| | | */ |
| | | PONG ("pong"), |
| | | /** |
| | | * 计费模型验证请求应答 |
| | | */ |
| | | BILLING_MODE_VERIFY_REPLY ("billing_mode_verify_reply"), |
| | | /** |
| | | * 计费模型请求应答 |
| | | */ |
| | | ACQUISITION_BILLING_MODE_REPLY ("acquisition_billing_mode_reply"), |
| | | /** |
| | | * 读取实时监测数据 |
| | | */ |
| | | READ_REAL_TIME_MONITORING_DATA ("read_real_time_monitoring_data"), |
| | | /** |
| | | * 充电结束 |
| | | */ |
| | | END_CHARGE ("end_charge"), |
| | | /** |
| | | * 运营平台确认启动充电 |
| | | */ |
| | | PLATFORM_CONFIRMATION_CHARGING ("platform_confirmation_charging"), |
| | | /** |
| | | * 运营平台远程控制启机 |
| | | */ |
| | | PLATFORM_START_CHARGING ("platform_start_charging"), |
| | | /** |
| | | * 运营平台远程停机 |
| | | */ |
| | | PLATFORM_STOP_CHARGING ("platform_stop_charging"), |
| | | /** |
| | | * 交易记录确认 |
| | | */ |
| | | CONFIRM_TRANSACTION_RECORD ("confirm_transaction_record"), |
| | | /** |
| | | * 远程账户余额更新 |
| | | */ |
| | | UPDATE_BALANCE ("update_balance"), |
| | | /** |
| | | * 离线卡数据同步 |
| | | */ |
| | | SYNCHRONIZE_OFFLINE_CARD ("synchronize_offline_card"), |
| | | /** |
| | | * 离线卡数据清除 |
| | | */ |
| | | CLEAR_OFFLINE_CARD ("clear_offline_card"), |
| | | /** |
| | | * 离线卡数据查询 |
| | | */ |
| | | QUERY_OFFLINE_CARD ("query_offline_card"), |
| | | /** |
| | | * 充电桩工作参数设置 |
| | | */ |
| | | WORKING_PARAMETER_SETTING ("working_parameter_setting"), |
| | | /** |
| | | * 对时设置 |
| | | */ |
| | | TIMING_SETTING ("timing_setting"), |
| | | /** |
| | | * 计费模型设置 |
| | | */ |
| | | SETUP_BILLING_MODEL ("setup_billing_model"), |
| | | /** |
| | | * 遥控地锁升锁与降锁命令 (下行) |
| | | */ |
| | | OPEN_OR_CLOSE_GROUND_LOCK ("open_or_close_ground_lock"), |
| | | /** |
| | | * 远程重启 |
| | | */ |
| | | PLATFORM_RESTART ("platform_restart"), |
| | | /** |
| | | * 远程更新 |
| | | */ |
| | | PLATFORM_REMOTE_UPDATE ("platform_remote_update"), |
| | | ; |
| | | private String value; |
| | | |
| | | |
| | | ServiceIdMenu(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | } |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.text.MessageFormat; |
| | | import java.util.ArrayList; |
| | |
| | | * iot接口调用工具类 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | @RestController |
| | | public class IotInterfaceUtil { |
| | | |
| | | private static final String dataFormat = "json"; |
| | |
| | | |
| | | private String decodeUrl(String url) { |
| | | return MessageFormat.format(url, iotDAConfig.getProjectId()); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | * @throws IOException |
| | | */ |
| | | @PostMapping(value = "/message") |
| | | public AjaxResult<Integer> add(@RequestBody JSONObject jsonObject) throws IOException { |
| | | System.err.println(jsonObject); |
| | | public AjaxResult<String> message(@RequestBody JSONObject jsonObject) throws IOException { |
| | | log.info("接收到消息中转:{}",jsonObject); |
| | | JSONObject content = jsonObject.getJSONObject("content"); |
| | | if (content.getString("name").equals("device_status_change")){ |
| | | //设备状态改变 |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * iotda消息发送 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | @RestController |
| | | public class IotMessageProduce { |
| | | |
| | | @Autowired |
| | |
| | | * @param message 消息内容 |
| | | * @return |
| | | */ |
| | | @PostMapping("/sendMessage") |
| | | public String sendMessage(String deviceId,String name,String message){ |
| | | CreateMessageRequest request = new CreateMessageRequest(); |
| | | request.withDeviceId(deviceId); |
| | |
| | | |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.ruoyi.integration.iotda.constant.ServiceIdConstant; |
| | | import com.ruoyi.integration.mongodb.model.*; |
| | | import com.ruoyi.integration.api.model.*; |
| | | import com.ruoyi.integration.iotda.enums.ServiceIdMenu; |
| | | import com.ruoyi.integration.mongodb.service.*; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | public class MessageUtil { |
| | | |
| | | @Autowired |
| | |
| | | */ |
| | | public String onlineReply(OnlineReply onlineReply){ |
| | | onlineReplyService.create(onlineReply); |
| | | return getMessageJsonString(onlineReply, ServiceIdConstant.ONLINE_REPLY); |
| | | return getMessageJsonString(onlineReply, ServiceIdMenu.ONLINE_REPLY.getValue()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public String pong(Pong pong){ |
| | | pongService.create(pong); |
| | | return getMessageJsonString(pong, ServiceIdConstant.PONG); |
| | | return getMessageJsonString(pong, ServiceIdMenu.PONG.getValue()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public String billingModeVerifyReply(BillingModeVerifyReply billingModeVerifyReply){ |
| | | billingModeVerifyReplyService.create(billingModeVerifyReply); |
| | | return getMessageJsonString(billingModeVerifyReply, ServiceIdConstant.BILLING_MODE_VERIFY_REPLY); |
| | | return getMessageJsonString(billingModeVerifyReply, ServiceIdMenu.BILLING_MODE_VERIFY_REPLY.getValue()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public String acquisitionBillingModeReply(AcquisitionBillingModeReply acquisitionBillingModeReply){ |
| | | acquisitionBillingModeReplyService.create(acquisitionBillingModeReply); |
| | | return getMessageJsonString(acquisitionBillingModeReply, ServiceIdConstant.ACQUISITION_BILLING_MODE_REPLY); |
| | | return getMessageJsonString(acquisitionBillingModeReply, ServiceIdMenu.ACQUISITION_BILLING_MODE_REPLY.getValue()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public String readRealTimeMonitoringData(ReadRealTimeMonitoringData readRealTimeMonitoringData){ |
| | | readRealTimeMonitoringDataService.create(readRealTimeMonitoringData); |
| | | return getMessageJsonString(readRealTimeMonitoringData, ServiceIdConstant.READ_REAL_TIME_MONITORING_DATA); |
| | | return getMessageJsonString(readRealTimeMonitoringData, ServiceIdMenu.READ_REAL_TIME_MONITORING_DATA.getValue()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public String endCharge(EndCharge endCharge){ |
| | | endChargeService.create(endCharge); |
| | | return getMessageJsonString(endCharge, ServiceIdConstant.END_CHARGE); |
| | | return getMessageJsonString(endCharge, ServiceIdMenu.END_CHARGE.getValue()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public String platformConfirmationCharging(PlatformConfirmationCharging platformConfirmationCharging){ |
| | | platformConfirmationChargingService.create(platformConfirmationCharging); |
| | | return getMessageJsonString(platformConfirmationCharging, ServiceIdConstant.PLATFORM_CONFIRMATION_CHARGING); |
| | | return getMessageJsonString(platformConfirmationCharging, ServiceIdMenu.PLATFORM_CONFIRMATION_CHARGING.getValue()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public String platformConfirmationCharging(PlatformStartCharging platformStartCharging){ |
| | | platformStartChargingService.create(platformStartCharging); |
| | | return getMessageJsonString(platformStartCharging, ServiceIdConstant.PLATFORM_START_CHARGING); |
| | | return getMessageJsonString(platformStartCharging, ServiceIdMenu.PLATFORM_START_CHARGING.getValue()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public String platformStopCharging(PlatformStopCharging platformStopCharging){ |
| | | platformStopChargingService.create(platformStopCharging); |
| | | return getMessageJsonString(platformStopCharging, ServiceIdConstant.PLATFORM_STOP_CHARGING); |
| | | return getMessageJsonString(platformStopCharging, ServiceIdMenu.PLATFORM_STOP_CHARGING.getValue()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public String confirmTransactionRecord(ConfirmTransactionRecord confirmTransactionRecord){ |
| | | confirmTransactionRecordService.create(confirmTransactionRecord); |
| | | return getMessageJsonString(confirmTransactionRecord, ServiceIdConstant.CONFIRM_TRANSACTION_RECORD); |
| | | return getMessageJsonString(confirmTransactionRecord, ServiceIdMenu.CONFIRM_TRANSACTION_RECORD.getValue()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public String updateBalance(UpdateBalance updateBalance){ |
| | | updateBalanceService.create(updateBalance); |
| | | return getMessageJsonString(updateBalance, ServiceIdConstant.UPDATE_BALANCE); |
| | | return getMessageJsonString(updateBalance, ServiceIdMenu.UPDATE_BALANCE.getValue()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public String synchronizeOfflineCard(SynchronizeOfflineCard synchronizeOfflineCard){ |
| | | synchronizeOfflineCardService.create(synchronizeOfflineCard); |
| | | return getMessageJsonString(synchronizeOfflineCard, ServiceIdConstant.SYNCHRONIZE_OFFLINE_CARD); |
| | | return getMessageJsonString(synchronizeOfflineCard, ServiceIdMenu.SYNCHRONIZE_OFFLINE_CARD.getValue()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public String clearOfflineCard(ClearOfflineCard clearOfflineCard){ |
| | | clearOfflineCardService.create(clearOfflineCard); |
| | | return getMessageJsonString(clearOfflineCard, ServiceIdConstant.CLEAR_OFFLINE_CARD); |
| | | return getMessageJsonString(clearOfflineCard, ServiceIdMenu.CLEAR_OFFLINE_CARD.getValue()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public String queryOfflineCard(QueryOfflineCard queryOfflineCard){ |
| | | queryOfflineCardService.create(queryOfflineCard); |
| | | return getMessageJsonString(queryOfflineCard, ServiceIdConstant.QUERY_OFFLINE_CARD); |
| | | return getMessageJsonString(queryOfflineCard, ServiceIdMenu.QUERY_OFFLINE_CARD.getValue()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public String workingParameterSetting(WorkingParameterSetting workingParameterSetting){ |
| | | workingParameterSettingService.create(workingParameterSetting); |
| | | return getMessageJsonString(workingParameterSetting, ServiceIdConstant.WORKING_PARAMETER_SETTING); |
| | | return getMessageJsonString(workingParameterSetting, ServiceIdMenu.WORKING_PARAMETER_SETTING.getValue()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public String timingSetting(TimingSetting timingSetting){ |
| | | timingSettingService.create(timingSetting); |
| | | return getMessageJsonString(timingSetting, ServiceIdConstant.TIMING_SETTING); |
| | | return getMessageJsonString(timingSetting, ServiceIdMenu.TIMING_SETTING.getValue()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public String setupBillingModel(SetupBillingModel setupBillingModel){ |
| | | setupBillingModelService.create(setupBillingModel); |
| | | return getMessageJsonString(setupBillingModel, ServiceIdConstant.SETUP_BILLING_MODEL); |
| | | return getMessageJsonString(setupBillingModel, ServiceIdMenu.SETUP_BILLING_MODEL.getValue()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public String openOrCloseGroundLock(OpenOrCloseGroundLock openOrCloseGroundLock){ |
| | | openOrCloseGroundLockService.create(openOrCloseGroundLock); |
| | | return getMessageJsonString(openOrCloseGroundLock, ServiceIdConstant.OPEN_OR_CLOSE_GROUND_LOCK); |
| | | return getMessageJsonString(openOrCloseGroundLock, ServiceIdMenu.OPEN_OR_CLOSE_GROUND_LOCK.getValue()); |
| | | } |
| | | /** |
| | | * 远程重启 |
| | |
| | | */ |
| | | public String platformRestart(PlatformRestart platformRestart){ |
| | | platformRestartService.create(platformRestart); |
| | | return getMessageJsonString(platformRestart, ServiceIdConstant.PLATFORM_RESTART); |
| | | return getMessageJsonString(platformRestart, ServiceIdMenu.PLATFORM_RESTART.getValue()); |
| | | } |
| | | /** |
| | | * 远程更新 |
| | |
| | | */ |
| | | public String platformRemoteUpdate(PlatformRemoteUpdate platformRemoteUpdate){ |
| | | platformRemoteUpdateService.create(platformRemoteUpdate); |
| | | return getMessageJsonString(platformRemoteUpdate, ServiceIdConstant.PLATFORM_REMOTE_UPDATE); |
| | | return getMessageJsonString(platformRemoteUpdate, ServiceIdMenu.PLATFORM_REMOTE_UPDATE.getValue()); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param serviceId 服务ID |
| | | * @return |
| | | */ |
| | | private String getMessageJsonString(Object object, String serviceId){ |
| | | public String getMessageJsonString(Object object, String serviceId){ |
| | | JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(object)); |
| | | jsonObject.put("service_id", serviceId); |
| | | return jsonObject.toJSONString(); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.AcquisitionBillingModeReply; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.AcquisitionBillingModeReply; |
| | | |
| | | public interface AcquisitionBillingModeReplyService extends BaseService<AcquisitionBillingModeReply> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.AcquisitionBillingMode; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface AcquisitionBillingModeService extends BaseService<AcquisitionBillingMode> { |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.BillingModeVerifyReply; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.BillingModeVerifyReply; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | public interface BillingModeVerifyReplyService extends BaseService<BillingModeVerifyReply> { |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.BillingModeVerify; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface BillingModeVerifyService extends BaseService<BillingModeVerify> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.BmsAbort; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface BmsAbortService extends BaseService<BmsAbort> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface BmsDemandAndChargerExportationService extends BaseService<BmsDemandAndChargerExportation> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.BmsInformation; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface BmsInformationService extends BaseService<BmsInformation> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.ChargingHandshake; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface ChargingHandshakeService extends BaseService<ChargingHandshake> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.ChargingPileReturnsGroundLockData; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface ChargingPileReturnsGroundLockDataService extends BaseService<ChargingPileReturnsGroundLockData> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.ChargingPileStartsCharging; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface ChargingPileStartsChargingService extends BaseService<ChargingPileStartsCharging> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.ClearOfflineCardReply; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface ClearOfflineCardReplyService extends BaseService<ClearOfflineCardReply> { |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.ClearOfflineCard; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.ClearOfflineCard; |
| | | |
| | | public interface ClearOfflineCardService extends BaseService<ClearOfflineCard> { |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.ConfirmTransactionRecord; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.ConfirmTransactionRecord; |
| | | |
| | | public interface ConfirmTransactionRecordService extends BaseService<ConfirmTransactionRecord> { |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.EndCharge; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.EndCharge; |
| | | |
| | | public interface EndChargeService extends BaseService<EndCharge> { |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.GroundLockRealTimeData; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface GroundLockRealTimeDataService extends BaseService<GroundLockRealTimeData> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.MotorAbort; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface MotorAbortService extends BaseService<MotorAbort> { |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.OnlineReply; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.OnlineReply; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.Online; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.OpenOrCloseGroundLock; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.OpenOrCloseGroundLock; |
| | | |
| | | public interface OpenOrCloseGroundLockService extends BaseService<OpenOrCloseGroundLock> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.ParameterSetting; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface ParameterSettingService extends BaseService<ParameterSetting> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.Ping; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface PingService extends BaseService<Ping> { |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformConfirmationCharging; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.PlatformConfirmationCharging; |
| | | |
| | | public interface PlatformConfirmationChargingService extends BaseService<PlatformConfirmationCharging> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformRemoteUpdateReply; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface PlatformRemoteUpdateReplyService extends BaseService<PlatformRemoteUpdateReply> { |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformRemoteUpdate; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.PlatformRemoteUpdate; |
| | | |
| | | public interface PlatformRemoteUpdateService extends BaseService<PlatformRemoteUpdate> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformRestartReply; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface PlatformRestartReplyService extends BaseService<PlatformRestartReply> { |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformRestart; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.PlatformRestart; |
| | | |
| | | public interface PlatformRestartService extends BaseService<PlatformRestart> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformStartChargingReply; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface PlatformStartChargingReplyService extends BaseService<PlatformStartChargingReply> { |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformStartCharging; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.PlatformStartCharging; |
| | | |
| | | public interface PlatformStartChargingService extends BaseService<PlatformStartCharging> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformStopChargingReply; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface PlatformStopChargingReplyService extends BaseService<PlatformStopChargingReply> { |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.PlatformStopCharging; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.PlatformStopCharging; |
| | | |
| | | public interface PlatformStopChargingService extends BaseService<PlatformStopCharging> { |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.Pong; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.Online; |
| | | import com.ruoyi.integration.mongodb.model.Pong; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 心跳包应答接口 |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.QueryOfflineCardReply; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface QueryOfflineCardReplyService extends BaseService<QueryOfflineCardReply> { |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.QueryOfflineCard; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.QueryOfflineCard; |
| | | |
| | | public interface QueryOfflineCardService extends BaseService<QueryOfflineCard> { |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.ReadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.ReadRealTimeMonitoringData; |
| | | |
| | | public interface ReadRealTimeMonitoringDataService extends BaseService<ReadRealTimeMonitoringData> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.SetupBillingModelReply; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface SetupBillingModelReplyService extends BaseService<SetupBillingModelReply> { |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.SetupBillingModel; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.SetupBillingModel; |
| | | |
| | | public interface SetupBillingModelService extends BaseService<SetupBillingModel> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.SynchronizeOfflineCardReply; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface SynchronizeOfflineCardReplyService extends BaseService<SynchronizeOfflineCardReply> { |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.SynchronizeOfflineCard; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.SynchronizeOfflineCard; |
| | | |
| | | public interface SynchronizeOfflineCardService extends BaseService<SynchronizeOfflineCard> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.TimingSettingReply; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface TimingSettingReplyService extends BaseService<TimingSettingReply> { |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.TimingSetting; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.TimingSetting; |
| | | |
| | | public interface TimingSettingService extends BaseService<TimingSetting> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.TransactionRecord; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface TransactionRecordService extends BaseService<TransactionRecord> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.UpdateBalanceReply; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface UpdateBalanceReplyService extends BaseService<UpdateBalanceReply> { |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.UpdateBalance; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.UpdateBalance; |
| | | |
| | | public interface UpdateBalanceService extends BaseService<UpdateBalance> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface UploadRealTimeMonitoringDataService extends BaseService<UploadRealTimeMonitoringData> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.WorkingParameterSettingReply; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | public interface WorkingParameterSettingReplyService extends BaseService<WorkingParameterSettingReply> { |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.WorkingParameterSetting; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.WorkingParameterSetting; |
| | | |
| | | public interface WorkingParameterSettingService extends BaseService<WorkingParameterSetting> { |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.api.model.AcquisitionBillingModeReply; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.AcquisitionBillingModeReply; |
| | | import com.ruoyi.integration.mongodb.service.AcquisitionBillingModeReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.api.model.AcquisitionBillingMode; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.service.AcquisitionBillingModeService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class AcquisitionBillingModeServiceImpl implements AcquisitionBillingModeService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(AcquisitionBillingMode acquisitionBillingMode) { |
| | | mongoTemplate.save(acquisitionBillingMode); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public AcquisitionBillingMode findById(String id) { |
| | | return mongoTemplate.findById(id, AcquisitionBillingMode.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<AcquisitionBillingMode> findAll() { |
| | | return mongoTemplate.findAll(AcquisitionBillingMode.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.BillingModeVerifyReply; |
| | | import com.ruoyi.integration.api.model.BillingModeVerifyReply; |
| | | import com.ruoyi.integration.mongodb.service.BillingModeVerifyReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.BillingModeVerify; |
| | | import com.ruoyi.integration.mongodb.service.BillingModeVerifyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class BillingModeVerifyServiceImpl implements BillingModeVerifyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(BillingModeVerify billingModeVerify) { |
| | | mongoTemplate.save(billingModeVerify); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public BillingModeVerify findById(String id) { |
| | | return mongoTemplate.findById(id, BillingModeVerify.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<BillingModeVerify> findAll() { |
| | | return mongoTemplate.findAll(BillingModeVerify.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.BmsAbort; |
| | | import com.ruoyi.integration.mongodb.service.BmsAbortService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class BmsAbortServiceImpl implements BmsAbortService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(BmsAbort bmsAbort) { |
| | | mongoTemplate.save(bmsAbort); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public BmsAbort findById(String id) { |
| | | return mongoTemplate.findById(id, BmsAbort.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<BmsAbort> findAll() { |
| | | return mongoTemplate.findAll(BmsAbort.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; |
| | | import com.ruoyi.integration.mongodb.service.BmsDemandAndChargerExportationService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class BmsDemandAndChargerExportationServiceImpl implements BmsDemandAndChargerExportationService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(BmsDemandAndChargerExportation bmsDemandAndChargerExportation) { |
| | | mongoTemplate.save(bmsDemandAndChargerExportation); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public BmsDemandAndChargerExportation findById(String id) { |
| | | return mongoTemplate.findById(id, BmsDemandAndChargerExportation.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<BmsDemandAndChargerExportation> findAll() { |
| | | return mongoTemplate.findAll(BmsDemandAndChargerExportation.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.BmsInformation; |
| | | import com.ruoyi.integration.mongodb.service.BmsInformationService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class BmsInformationServiceImpl implements BmsInformationService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(BmsInformation bmsInformation) { |
| | | mongoTemplate.save(bmsInformation); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public BmsInformation findById(String id) { |
| | | return mongoTemplate.findById(id, BmsInformation.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<BmsInformation> findAll() { |
| | | return mongoTemplate.findAll(BmsInformation.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.ChargingHandshake; |
| | | import com.ruoyi.integration.mongodb.service.ChargingHandshakeService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class ChargingHandshakeServiceImpl implements ChargingHandshakeService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(ChargingHandshake chargingHandshake) { |
| | | mongoTemplate.save(chargingHandshake); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public ChargingHandshake findById(String id) { |
| | | return mongoTemplate.findById(id, ChargingHandshake.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ChargingHandshake> findAll() { |
| | | return mongoTemplate.findAll(ChargingHandshake.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.ChargingPileReturnsGroundLockData; |
| | | import com.ruoyi.integration.mongodb.service.ChargingPileReturnsGroundLockDataService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class ChargingPileReturnsGroundLockDataServiceImpl implements ChargingPileReturnsGroundLockDataService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(ChargingPileReturnsGroundLockData chargingPileReturnsGroundLockData) { |
| | | mongoTemplate.save(chargingPileReturnsGroundLockData); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public ChargingPileReturnsGroundLockData findById(String id) { |
| | | return mongoTemplate.findById(id, ChargingPileReturnsGroundLockData.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ChargingPileReturnsGroundLockData> findAll() { |
| | | return mongoTemplate.findAll(ChargingPileReturnsGroundLockData.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.ChargingPileStartsCharging; |
| | | import com.ruoyi.integration.mongodb.service.ChargingPileStartsChargingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class ChargingPileStartsChargingServiceImpl implements ChargingPileStartsChargingService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(ChargingPileStartsCharging chargingPileStartsCharging) { |
| | | mongoTemplate.save(chargingPileStartsCharging); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public ChargingPileStartsCharging findById(String id) { |
| | | return mongoTemplate.findById(id, ChargingPileStartsCharging.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ChargingPileStartsCharging> findAll() { |
| | | return mongoTemplate.findAll(ChargingPileStartsCharging.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.ClearOfflineCardReply; |
| | | import com.ruoyi.integration.mongodb.service.ClearOfflineCardReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class ClearOfflineCardReplyServiceImpl implements ClearOfflineCardReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(ClearOfflineCardReply clearOfflineCardReply) { |
| | | mongoTemplate.save(clearOfflineCardReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public ClearOfflineCardReply findById(String id) { |
| | | return mongoTemplate.findById(id, ClearOfflineCardReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ClearOfflineCardReply> findAll() { |
| | | return mongoTemplate.findAll(ClearOfflineCardReply.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.ClearOfflineCard; |
| | | import com.ruoyi.integration.api.model.ClearOfflineCard; |
| | | import com.ruoyi.integration.mongodb.service.ClearOfflineCardService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.ConfirmTransactionRecord; |
| | | 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; |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.EndCharge; |
| | | import com.ruoyi.integration.mongodb.model.Pong; |
| | | 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; |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.GroundLockRealTimeData; |
| | | import com.ruoyi.integration.mongodb.service.GroundLockRealTimeDataService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class GroundLockRealTimeDataServiceImpl implements GroundLockRealTimeDataService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(GroundLockRealTimeData groundLockRealTimeData) { |
| | | mongoTemplate.save(groundLockRealTimeData); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public GroundLockRealTimeData findById(String id) { |
| | | return mongoTemplate.findById(id, GroundLockRealTimeData.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<GroundLockRealTimeData> findAll() { |
| | | return mongoTemplate.findAll(GroundLockRealTimeData.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | 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.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class MotorAbortServiceImpl implements MotorAbortService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(MotorAbort motorAbort) { |
| | | mongoTemplate.save(motorAbort); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public MotorAbort findById(String id) { |
| | | return mongoTemplate.findById(id, MotorAbort.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<MotorAbort> findAll() { |
| | | return mongoTemplate.findAll(MotorAbort.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.OnlineReply; |
| | | 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; |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.Online; |
| | | 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; |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.OpenOrCloseGroundLock; |
| | | import com.ruoyi.integration.api.model.OpenOrCloseGroundLock; |
| | | import com.ruoyi.integration.mongodb.service.OpenOrCloseGroundLockService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.ParameterSetting; |
| | | import com.ruoyi.integration.mongodb.service.ParameterSettingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class ParameterSettingServiceImpl implements ParameterSettingService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(ParameterSetting parameterSetting) { |
| | | mongoTemplate.save(parameterSetting); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public ParameterSetting findById(String id) { |
| | | return mongoTemplate.findById(id, ParameterSetting.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ParameterSetting> findAll() { |
| | | return mongoTemplate.findAll(ParameterSetting.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.Ping; |
| | | import com.ruoyi.integration.mongodb.service.PingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class PingServiceImpl implements PingService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(Ping ping) { |
| | | mongoTemplate.save(ping); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public Ping findById(String id) { |
| | | return mongoTemplate.findById(id, Ping.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<Ping> findAll() { |
| | | return mongoTemplate.findAll(Ping.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.PlatformConfirmationCharging; |
| | | import com.ruoyi.integration.api.model.PlatformConfirmationCharging; |
| | | import com.ruoyi.integration.mongodb.service.PlatformConfirmationChargingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.PlatformRemoteUpdateReply; |
| | | import com.ruoyi.integration.mongodb.service.PlatformRemoteUpdateReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class PlatformRemoteUpdateReplyServiceImpl implements PlatformRemoteUpdateReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(PlatformRemoteUpdateReply platformRemoteUpdateReply) { |
| | | mongoTemplate.save(platformRemoteUpdateReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformRemoteUpdateReply findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformRemoteUpdateReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformRemoteUpdateReply> findAll() { |
| | | return mongoTemplate.findAll(PlatformRemoteUpdateReply.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.PlatformRemoteUpdate; |
| | | import com.ruoyi.integration.api.model.PlatformRemoteUpdate; |
| | | import com.ruoyi.integration.mongodb.service.PlatformRemoteUpdateService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.PlatformRestartReply; |
| | | import com.ruoyi.integration.mongodb.service.PlatformRestartReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class PlatformRestartReplyServiceImpl implements PlatformRestartReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(PlatformRestartReply platformRestartReply) { |
| | | mongoTemplate.save(platformRestartReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformRestartReply findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformRestartReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformRestartReply> findAll() { |
| | | return mongoTemplate.findAll(PlatformRestartReply.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.PlatformRestart; |
| | | import com.ruoyi.integration.api.model.PlatformRestart; |
| | | import com.ruoyi.integration.mongodb.service.PlatformRestartService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.PlatformStartChargingReply; |
| | | import com.ruoyi.integration.mongodb.service.PlatformStartChargingReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class PlatformStartChargingReplyServiceImpl implements PlatformStartChargingReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(PlatformStartChargingReply platformStartChargingReply) { |
| | | mongoTemplate.save(platformStartChargingReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformStartChargingReply findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformStartChargingReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformStartChargingReply> findAll() { |
| | | return mongoTemplate.findAll(PlatformStartChargingReply.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.PlatformStartCharging; |
| | | 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; |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.PlatformStopChargingReply; |
| | | import com.ruoyi.integration.mongodb.service.PlatformStopChargingReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class PlatformStopChargingReplyServiceImpl implements PlatformStopChargingReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(PlatformStopChargingReply platformStopChargingReply) { |
| | | mongoTemplate.save(platformStopChargingReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformStopChargingReply findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformStopChargingReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformStopChargingReply> findAll() { |
| | | return mongoTemplate.findAll(PlatformStopChargingReply.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.PlatformStopCharging; |
| | | import com.ruoyi.integration.api.model.PlatformStopCharging; |
| | | import com.ruoyi.integration.mongodb.service.PlatformStopChargingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.Online; |
| | | import com.ruoyi.integration.mongodb.model.Pong; |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.Pong; |
| | | import com.ruoyi.integration.mongodb.service.OnlineService; |
| | | import com.ruoyi.integration.mongodb.service.PongService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.QueryOfflineCardReply; |
| | | import com.ruoyi.integration.mongodb.service.QueryOfflineCardReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class QueryOfflineCardReplyServiceImpl implements QueryOfflineCardReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(QueryOfflineCardReply queryOfflineCardReply) { |
| | | mongoTemplate.save(queryOfflineCardReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public QueryOfflineCardReply findById(String id) { |
| | | return mongoTemplate.findById(id, QueryOfflineCardReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<QueryOfflineCardReply> findAll() { |
| | | return mongoTemplate.findAll(QueryOfflineCardReply.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.QueryOfflineCard; |
| | | import com.ruoyi.integration.api.model.QueryOfflineCard; |
| | | import com.ruoyi.integration.mongodb.service.QueryOfflineCardService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.ReadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.model.ReadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.mongodb.service.ReadRealTimeMonitoringDataService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | 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.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class SetupBillingModelReplyServiceImpl implements SetupBillingModelReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(SetupBillingModelReply setupBillingModelReply) { |
| | | mongoTemplate.save(setupBillingModelReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public SetupBillingModelReply findById(String id) { |
| | | return mongoTemplate.findById(id, SetupBillingModelReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<SetupBillingModelReply> findAll() { |
| | | return mongoTemplate.findAll(SetupBillingModelReply.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.SetupBillingModel; |
| | | 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; |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.SetupBillingModel; |
| | | import com.ruoyi.integration.api.model.SynchronizeOfflineCardReply; |
| | | import com.ruoyi.integration.mongodb.service.SynchronizeOfflineCardReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class SynchronizeOfflineCardReplyServiceImpl implements SynchronizeOfflineCardReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(SynchronizeOfflineCardReply synchronizeOfflineCardReply) { |
| | | mongoTemplate.save(synchronizeOfflineCardReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public SynchronizeOfflineCardReply findById(String id) { |
| | | return mongoTemplate.findById(id, SynchronizeOfflineCardReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<SynchronizeOfflineCardReply> findAll() { |
| | | return mongoTemplate.findAll(SynchronizeOfflineCardReply.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.SynchronizeOfflineCard; |
| | | import com.ruoyi.integration.api.model.SynchronizeOfflineCard; |
| | | import com.ruoyi.integration.mongodb.service.SynchronizeOfflineCardService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.TimingSettingReply; |
| | | import com.ruoyi.integration.mongodb.service.TimingSettingReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class TimingSettingReplyServiceImpl implements TimingSettingReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(TimingSettingReply timingSettingReply) { |
| | | mongoTemplate.save(timingSettingReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public TimingSettingReply findById(String id) { |
| | | return mongoTemplate.findById(id, TimingSettingReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<TimingSettingReply> findAll() { |
| | | return mongoTemplate.findAll(TimingSettingReply.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.TimingSetting; |
| | | import com.ruoyi.integration.api.model.TimingSetting; |
| | | import com.ruoyi.integration.mongodb.service.TimingSettingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.TimingSetting; |
| | | import com.ruoyi.integration.api.model.TransactionRecord; |
| | | import com.ruoyi.integration.mongodb.service.TransactionRecordService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class TransactionRecordServiceImpl implements TransactionRecordService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(TransactionRecord transactionRecord) { |
| | | mongoTemplate.save(transactionRecord); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public TransactionRecord findById(String id) { |
| | | return mongoTemplate.findById(id, TransactionRecord.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<TransactionRecord> findAll() { |
| | | return mongoTemplate.findAll(TransactionRecord.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.TransactionRecord; |
| | | import com.ruoyi.integration.api.model.UpdateBalanceReply; |
| | | import com.ruoyi.integration.mongodb.service.UpdateBalanceReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class UpdateBalanceReplyServiceImpl implements UpdateBalanceReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(UpdateBalanceReply updateBalanceReply) { |
| | | mongoTemplate.save(updateBalanceReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public UpdateBalanceReply findById(String id) { |
| | | return mongoTemplate.findById(id, UpdateBalanceReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<UpdateBalanceReply> findAll() { |
| | | return mongoTemplate.findAll(UpdateBalanceReply.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.UpdateBalance; |
| | | import com.ruoyi.integration.api.model.UpdateBalance; |
| | | import com.ruoyi.integration.mongodb.service.UpdateBalanceService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class UploadRealTimeMonitoringDataServiceImpl implements UploadRealTimeMonitoringDataService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(UploadRealTimeMonitoringData uploadRealTimeMonitoringData) { |
| | | mongoTemplate.save(uploadRealTimeMonitoringData); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public UploadRealTimeMonitoringData findById(String id) { |
| | | return mongoTemplate.findById(id, UploadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<UploadRealTimeMonitoringData> findAll() { |
| | | return mongoTemplate.findAll(UploadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.WorkingParameterSettingReply; |
| | | import com.ruoyi.integration.mongodb.service.WorkingParameterSettingReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class WorkingParameterSettingReplyServiceImpl implements WorkingParameterSettingReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(WorkingParameterSettingReply workingParameterSettingReply) { |
| | | mongoTemplate.save(workingParameterSettingReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public WorkingParameterSettingReply findById(String id) { |
| | | return mongoTemplate.findById(id, WorkingParameterSettingReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<WorkingParameterSettingReply> findAll() { |
| | | return mongoTemplate.findAll(WorkingParameterSettingReply.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.WorkingParameterSetting; |
| | | import com.ruoyi.integration.api.model.WorkingParameterSetting; |
| | | import com.ruoyi.integration.mongodb.service.WorkingParameterSettingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.AcquisitionBillingMode; |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.mongodb.service.AcquisitionBillingModeService; |
| | | import com.ruoyi.integration.rocket.model.AcquisitionBillingModeMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class AcquisitionBillingModeMessageListener extends EnhanceMessageHandler<AcquisitionBillingModeMessage> implements RocketMQListener<AcquisitionBillingModeMessage> { |
| | | |
| | | @Autowired |
| | | private AcquisitionBillingModeService acquisitionBillingModeService; |
| | | |
| | | @Override |
| | | protected void handleMessage(AcquisitionBillingModeMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("充电桩计费模型请求-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | AcquisitionBillingMode acquisitionBillingMode = new AcquisitionBillingMode(); |
| | | BeanUtils.copyProperties(message,acquisitionBillingMode); |
| | | acquisitionBillingModeService.create(acquisitionBillingMode); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(AcquisitionBillingModeMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(AcquisitionBillingModeMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(AcquisitionBillingModeMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.AcquisitionBillingMode; |
| | | import com.ruoyi.integration.api.model.BillingModeVerify; |
| | | import com.ruoyi.integration.mongodb.service.BillingModeVerifyService; |
| | | import com.ruoyi.integration.rocket.model.BillingModeVerifyMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class BillingModeVerifyMessageListener extends EnhanceMessageHandler<BillingModeVerifyMessage> implements RocketMQListener<BillingModeVerifyMessage> { |
| | | |
| | | @Autowired |
| | | private BillingModeVerifyService billingModeVerifyService; |
| | | |
| | | @Override |
| | | protected void handleMessage(BillingModeVerifyMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("计费模型验证请求-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | BillingModeVerify billingModeVerify = new BillingModeVerify(); |
| | | BeanUtils.copyProperties(message,billingModeVerify); |
| | | billingModeVerifyService.create(billingModeVerify); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(BillingModeVerifyMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(BillingModeVerifyMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(BillingModeVerifyMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/EnhanceMemberMessageListener.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/BmsAbortMessageListener.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/EnhanceMemberMessageListener.java |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.rocket.test.MemberMessage; |
| | | import com.ruoyi.integration.api.model.BillingModeVerify; |
| | | import com.ruoyi.integration.api.model.BmsAbort; |
| | | import com.ruoyi.integration.mongodb.service.BmsAbortService; |
| | | import com.ruoyi.integration.rocket.model.BmsAbortMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class EnhanceMemberMessageListener extends EnhanceMessageHandler<MemberMessage> implements RocketMQListener<MemberMessage> { |
| | | public class BmsAbortMessageListener extends EnhanceMessageHandler<BmsAbortMessage> implements RocketMQListener<BmsAbortMessage> { |
| | | |
| | | @Autowired |
| | | private BmsAbortService bmsAbortService; |
| | | @Override |
| | | protected void handleMessage(MemberMessage message) throws Exception { |
| | | protected void handleMessage(BmsAbortMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | System.out.println("业务消息处理:"+message.getUserName()); |
| | | log.info("充电阶段BMS中止-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | BmsAbort bmsAbort = new BmsAbort(); |
| | | BeanUtils.copyProperties(message,bmsAbort); |
| | | bmsAbortService.create(bmsAbort); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(MemberMessage message) { |
| | | protected void handleMaxRetriesExceeded(BmsAbortMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(MemberMessage message) { |
| | | protected boolean filter(BmsAbortMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(MemberMessage memberMessage) { |
| | | super.dispatchMessage(memberMessage); |
| | | public void onMessage(BmsAbortMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.BmsAbort; |
| | | import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; |
| | | import com.ruoyi.integration.mongodb.service.BmsDemandAndChargerExportationService; |
| | | import com.ruoyi.integration.rocket.model.BmsDemandAndChargerExportationMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class BmsDemandAndChargerExportationMessageListener extends EnhanceMessageHandler<BmsDemandAndChargerExportationMessage> implements RocketMQListener<BmsDemandAndChargerExportationMessage> { |
| | | |
| | | @Autowired |
| | | private BmsDemandAndChargerExportationService bmsDemandAndChargerExportationService; |
| | | @Override |
| | | protected void handleMessage(BmsDemandAndChargerExportationMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("充电过程BMS需求、充电机输出-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | BmsDemandAndChargerExportation bmsDemandAndChargerExportation = new BmsDemandAndChargerExportation(); |
| | | BeanUtils.copyProperties(message,bmsDemandAndChargerExportation); |
| | | bmsDemandAndChargerExportationService.create(bmsDemandAndChargerExportation); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(BmsDemandAndChargerExportationMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(BmsDemandAndChargerExportationMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(BmsDemandAndChargerExportationMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; |
| | | import com.ruoyi.integration.api.model.BmsInformation; |
| | | import com.ruoyi.integration.mongodb.service.BmsInformationService; |
| | | import com.ruoyi.integration.rocket.model.BmsInformationMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class BmsInformationMessageListener extends EnhanceMessageHandler<BmsInformationMessage> implements RocketMQListener<BmsInformationMessage> { |
| | | @Autowired |
| | | private BmsInformationService bmsInformationService; |
| | | |
| | | @Override |
| | | protected void handleMessage(BmsInformationMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("充电过程BMS信息-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | BmsInformation bmsInformation = new BmsInformation(); |
| | | BeanUtils.copyProperties(message,bmsInformation); |
| | | bmsInformationService.create(bmsInformation); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(BmsInformationMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(BmsInformationMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(BmsInformationMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.BmsInformation; |
| | | import com.ruoyi.integration.api.model.ChargingHandshake; |
| | | import com.ruoyi.integration.mongodb.service.ChargingHandshakeService; |
| | | import com.ruoyi.integration.rocket.model.ChargingHandshakeMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class ChargingHandshakeMessageListener extends EnhanceMessageHandler<ChargingHandshakeMessage> implements RocketMQListener<ChargingHandshakeMessage> { |
| | | |
| | | @Autowired |
| | | private ChargingHandshakeService chargingHandshakeService; |
| | | @Override |
| | | protected void handleMessage(ChargingHandshakeMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("充电握手-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | ChargingHandshake chargingHandshake = new ChargingHandshake(); |
| | | BeanUtils.copyProperties(message,chargingHandshake); |
| | | chargingHandshakeService.create(chargingHandshake); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(ChargingHandshakeMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(ChargingHandshakeMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(ChargingHandshakeMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.ChargingHandshake; |
| | | import com.ruoyi.integration.api.model.ChargingPileReturnsGroundLockData; |
| | | import com.ruoyi.integration.mongodb.service.ChargingPileReturnsGroundLockDataService; |
| | | import com.ruoyi.integration.rocket.model.ChargingPileReturnsGroundLockDataMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class ChargingPileReturnsGroundLockDataMessageListener extends EnhanceMessageHandler<ChargingPileReturnsGroundLockDataMessage> implements RocketMQListener<ChargingPileReturnsGroundLockDataMessage> { |
| | | |
| | | @Autowired |
| | | private ChargingPileReturnsGroundLockDataService chargingPileReturnsGroundLockDataService; |
| | | @Override |
| | | protected void handleMessage(ChargingPileReturnsGroundLockDataMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("充电桩返回数据(上行)-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | ChargingPileReturnsGroundLockData chargingPileReturnsGroundLockData = new ChargingPileReturnsGroundLockData(); |
| | | BeanUtils.copyProperties(message,chargingPileReturnsGroundLockData); |
| | | chargingPileReturnsGroundLockDataService.create(chargingPileReturnsGroundLockData); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(ChargingPileReturnsGroundLockDataMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(ChargingPileReturnsGroundLockDataMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(ChargingPileReturnsGroundLockDataMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.ChargingPileReturnsGroundLockData; |
| | | import com.ruoyi.integration.api.model.ChargingPileStartsCharging; |
| | | import com.ruoyi.integration.mongodb.service.ChargingPileStartsChargingService; |
| | | import com.ruoyi.integration.rocket.model.ChargingPileStartsChargingMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class ChargingPileStartsChargingMessageListener extends EnhanceMessageHandler<ChargingPileStartsChargingMessage> implements RocketMQListener<ChargingPileStartsChargingMessage> { |
| | | |
| | | @Autowired |
| | | private ChargingPileStartsChargingService chargingPileStartsChargingService; |
| | | @Override |
| | | protected void handleMessage(ChargingPileStartsChargingMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("充电桩主动申请启动充电-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | ChargingPileStartsCharging chargingPileStartsCharging = new ChargingPileStartsCharging(); |
| | | BeanUtils.copyProperties(message,chargingPileStartsCharging); |
| | | chargingPileStartsChargingService.create(chargingPileStartsCharging); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(ChargingPileStartsChargingMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(ChargingPileStartsChargingMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(ChargingPileStartsChargingMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.ChargingPileStartsCharging; |
| | | import com.ruoyi.integration.api.model.ClearOfflineCardReply; |
| | | import com.ruoyi.integration.mongodb.service.ClearOfflineCardReplyService; |
| | | import com.ruoyi.integration.rocket.model.ClearOfflineCardReplyMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class ClearOfflineCardReplyMessageListener extends EnhanceMessageHandler<ClearOfflineCardReplyMessage> implements RocketMQListener<ClearOfflineCardReplyMessage> { |
| | | |
| | | @Autowired |
| | | private ClearOfflineCardReplyService clearOfflineCardReplyService; |
| | | @Override |
| | | protected void handleMessage(ClearOfflineCardReplyMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("离线卡数据清除应答-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | ClearOfflineCardReply clearOfflineCardReply = new ClearOfflineCardReply(); |
| | | BeanUtils.copyProperties(message,clearOfflineCardReply); |
| | | clearOfflineCardReplyService.create(clearOfflineCardReply); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(ClearOfflineCardReplyMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(ClearOfflineCardReplyMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(ClearOfflineCardReplyMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.ClearOfflineCardReply; |
| | | import com.ruoyi.integration.api.model.GroundLockRealTimeData; |
| | | import com.ruoyi.integration.mongodb.service.GroundLockRealTimeDataService; |
| | | import com.ruoyi.integration.rocket.model.GroundLockRealTimeDataMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class GroundLockRealTimeDataMessageListener extends EnhanceMessageHandler<GroundLockRealTimeDataMessage> implements RocketMQListener<GroundLockRealTimeDataMessage> { |
| | | |
| | | @Autowired |
| | | private GroundLockRealTimeDataService groundLockRealTimeDataService; |
| | | @Override |
| | | protected void handleMessage(GroundLockRealTimeDataMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("地锁数据上送(充电桩上送)-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | GroundLockRealTimeData groundLockRealTimeData = new GroundLockRealTimeData(); |
| | | BeanUtils.copyProperties(message,groundLockRealTimeData); |
| | | groundLockRealTimeDataService.create(groundLockRealTimeData); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(GroundLockRealTimeDataMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(GroundLockRealTimeDataMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(GroundLockRealTimeDataMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/EnhanceMemberMessageListener.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/MotorAbortMessageListener.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/EnhanceMemberMessageListener.java |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.rocket.test.MemberMessage; |
| | | import com.ruoyi.integration.api.model.GroundLockRealTimeData; |
| | | import com.ruoyi.integration.api.model.MotorAbort; |
| | | import com.ruoyi.integration.mongodb.service.MotorAbortService; |
| | | import com.ruoyi.integration.rocket.model.MotorAbortMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class EnhanceMemberMessageListener extends EnhanceMessageHandler<MemberMessage> implements RocketMQListener<MemberMessage> { |
| | | public class MotorAbortMessageListener extends EnhanceMessageHandler<MotorAbortMessage> implements RocketMQListener<MotorAbortMessage> { |
| | | |
| | | @Autowired |
| | | private MotorAbortService motorAbortService; |
| | | @Override |
| | | protected void handleMessage(MemberMessage message) throws Exception { |
| | | protected void handleMessage(MotorAbortMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | System.out.println("业务消息处理:"+message.getUserName()); |
| | | log.info("充电阶段充电机中止-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | MotorAbort motorAbort = new MotorAbort(); |
| | | BeanUtils.copyProperties(message,motorAbort); |
| | | motorAbortService.create(motorAbort); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(MemberMessage message) { |
| | | protected void handleMaxRetriesExceeded(MotorAbortMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(MemberMessage message) { |
| | | protected boolean filter(MotorAbortMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(MemberMessage memberMessage) { |
| | | super.dispatchMessage(memberMessage); |
| | | public void onMessage(MotorAbortMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/EnhanceMemberMessageListener.java |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.rocket.test.MemberMessage; |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.mongodb.service.OnlineService; |
| | | import com.ruoyi.integration.rocket.model.OnlineMessage; |
| | | import com.ruoyi.integration.rocket.model.OnlineMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class EnhanceMemberMessageListener extends EnhanceMessageHandler<MemberMessage> implements RocketMQListener<MemberMessage> { |
| | | public class OnlineMessageListener extends EnhanceMessageHandler<OnlineMessage> implements RocketMQListener<OnlineMessage> { |
| | | |
| | | @Autowired |
| | | private OnlineService onlineService; |
| | | |
| | | @Override |
| | | protected void handleMessage(MemberMessage message) throws Exception { |
| | | protected void handleMessage(OnlineMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | System.out.println("业务消息处理:"+message.getUserName()); |
| | | log.info("充电桩登录认证业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | Online online = new Online(); |
| | | BeanUtils.copyProperties(message,online); |
| | | onlineService.create(online); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(MemberMessage message) { |
| | | protected void handleMaxRetriesExceeded(OnlineMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(MemberMessage message) { |
| | | protected boolean filter(OnlineMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(MemberMessage memberMessage) { |
| | | super.dispatchMessage(memberMessage); |
| | | public void onMessage(OnlineMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/EnhanceMemberMessageListener.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/ParameterSettingMessageListener.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/EnhanceMemberMessageListener.java |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.rocket.test.MemberMessage; |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.ParameterSetting; |
| | | import com.ruoyi.integration.mongodb.service.ParameterSettingService; |
| | | import com.ruoyi.integration.rocket.model.ParameterSettingMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class EnhanceMemberMessageListener extends EnhanceMessageHandler<MemberMessage> implements RocketMQListener<MemberMessage> { |
| | | public class ParameterSettingMessageListener extends EnhanceMessageHandler<ParameterSettingMessage> implements RocketMQListener<ParameterSettingMessage> { |
| | | |
| | | @Autowired |
| | | private ParameterSettingService parameterSettingService; |
| | | |
| | | @Override |
| | | protected void handleMessage(MemberMessage message) throws Exception { |
| | | protected void handleMessage(ParameterSettingMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | System.out.println("业务消息处理:"+message.getUserName()); |
| | | log.info("业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | ParameterSetting parameterSetting = new ParameterSetting(); |
| | | BeanUtils.copyProperties(message,parameterSetting); |
| | | parameterSettingService.create(parameterSetting); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(MemberMessage message) { |
| | | protected void handleMaxRetriesExceeded(ParameterSettingMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(MemberMessage message) { |
| | | protected boolean filter(ParameterSettingMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(MemberMessage memberMessage) { |
| | | super.dispatchMessage(memberMessage); |
| | | public void onMessage(ParameterSettingMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/EnhanceMemberMessageListener.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/PingMessageListener.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/EnhanceMemberMessageListener.java |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.rocket.test.MemberMessage; |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.Ping; |
| | | import com.ruoyi.integration.mongodb.service.OnlineService; |
| | | import com.ruoyi.integration.mongodb.service.PingService; |
| | | import com.ruoyi.integration.rocket.model.PingMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class EnhanceMemberMessageListener extends EnhanceMessageHandler<MemberMessage> implements RocketMQListener<MemberMessage> { |
| | | public class PingMessageListener extends EnhanceMessageHandler<PingMessage> implements RocketMQListener<PingMessage> { |
| | | |
| | | @Autowired |
| | | private PingService pingService; |
| | | |
| | | @Override |
| | | protected void handleMessage(MemberMessage message) throws Exception { |
| | | protected void handleMessage(PingMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | System.out.println("业务消息处理:"+message.getUserName()); |
| | | log.info("充电桩心跳包-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | Ping ping = new Ping(); |
| | | BeanUtils.copyProperties(message,ping); |
| | | pingService.create(ping); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(MemberMessage message) { |
| | | protected void handleMaxRetriesExceeded(PingMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(MemberMessage message) { |
| | | protected boolean filter(PingMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(MemberMessage memberMessage) { |
| | | super.dispatchMessage(memberMessage); |
| | | public void onMessage(PingMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.PlatformRemoteUpdateReply; |
| | | import com.ruoyi.integration.mongodb.service.PlatformRemoteUpdateReplyService; |
| | | import com.ruoyi.integration.rocket.model.PlatformRemoteUpdateReplyMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class PlatformRemoteUpdateReplyMessageListener extends EnhanceMessageHandler<PlatformRemoteUpdateReplyMessage> implements RocketMQListener<PlatformRemoteUpdateReplyMessage> { |
| | | |
| | | @Autowired |
| | | private PlatformRemoteUpdateReplyService platformRemoteUpdateReplyService; |
| | | |
| | | @Override |
| | | protected void handleMessage(PlatformRemoteUpdateReplyMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("远程更新应答-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | PlatformRemoteUpdateReply platformRemoteUpdateReply = new PlatformRemoteUpdateReply(); |
| | | BeanUtils.copyProperties(message,platformRemoteUpdateReply); |
| | | platformRemoteUpdateReplyService.create(platformRemoteUpdateReply); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(PlatformRemoteUpdateReplyMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(PlatformRemoteUpdateReplyMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(PlatformRemoteUpdateReplyMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.PlatformRestartReply; |
| | | import com.ruoyi.integration.mongodb.service.PlatformRestartReplyService; |
| | | import com.ruoyi.integration.rocket.model.PlatformRestartReplyMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class PlatformRestartReplyMessageListener extends EnhanceMessageHandler<PlatformRestartReplyMessage> implements RocketMQListener<PlatformRestartReplyMessage> { |
| | | |
| | | @Autowired |
| | | private PlatformRestartReplyService platformRestartReplyService; |
| | | |
| | | @Override |
| | | protected void handleMessage(PlatformRestartReplyMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("远程重启应答-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | PlatformRestartReply platformRestartReply = new PlatformRestartReply(); |
| | | BeanUtils.copyProperties(message,platformRestartReply); |
| | | platformRestartReplyService.create(platformRestartReply); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(PlatformRestartReplyMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(PlatformRestartReplyMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(PlatformRestartReplyMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.PlatformStartChargingReply; |
| | | import com.ruoyi.integration.mongodb.service.PlatformStartChargingReplyService; |
| | | import com.ruoyi.integration.rocket.model.PlatformStartChargingReplyMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class PlatformStartChargingReplyMessageListener extends EnhanceMessageHandler<PlatformStartChargingReplyMessage> implements RocketMQListener<PlatformStartChargingReplyMessage> { |
| | | |
| | | @Autowired |
| | | private PlatformStartChargingReplyService platformStartChargingReplyService; |
| | | |
| | | @Override |
| | | protected void handleMessage(PlatformStartChargingReplyMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("远程启机命令回复-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | PlatformStartChargingReply platformStartChargingReply = new PlatformStartChargingReply(); |
| | | BeanUtils.copyProperties(message,platformStartChargingReply); |
| | | platformStartChargingReplyService.create(platformStartChargingReply); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(PlatformStartChargingReplyMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(PlatformStartChargingReplyMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(PlatformStartChargingReplyMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.PlatformStopChargingReply; |
| | | import com.ruoyi.integration.mongodb.service.PlatformStopChargingReplyService; |
| | | import com.ruoyi.integration.rocket.model.PlatformStopChargingReplyMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class PlatformStopChargingReplyMessageListener extends EnhanceMessageHandler<PlatformStopChargingReplyMessage> implements RocketMQListener<PlatformStopChargingReplyMessage> { |
| | | @Autowired |
| | | private PlatformStopChargingReplyService platformStopChargingReplyService; |
| | | |
| | | @Override |
| | | protected void handleMessage(PlatformStopChargingReplyMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("远程停机命令回复-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | PlatformStopChargingReply platformStopChargingReply = new PlatformStopChargingReply(); |
| | | BeanUtils.copyProperties(message,platformStopChargingReply); |
| | | platformStopChargingReplyService.create(platformStopChargingReply); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(PlatformStopChargingReplyMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(PlatformStopChargingReplyMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(PlatformStopChargingReplyMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.QueryOfflineCardReply; |
| | | import com.ruoyi.integration.mongodb.service.QueryOfflineCardReplyService; |
| | | import com.ruoyi.integration.rocket.model.QueryOfflineCardReplyMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class QueryOfflineCardReplyMessageListener extends EnhanceMessageHandler<QueryOfflineCardReplyMessage> implements RocketMQListener<QueryOfflineCardReplyMessage> { |
| | | |
| | | @Autowired |
| | | private QueryOfflineCardReplyService queryOfflineCardReplyService; |
| | | @Override |
| | | protected void handleMessage(QueryOfflineCardReplyMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("离线卡数据查询应答-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | QueryOfflineCardReply queryOfflineCardReply = new QueryOfflineCardReply(); |
| | | BeanUtils.copyProperties(message,queryOfflineCardReply); |
| | | queryOfflineCardReplyService.create(queryOfflineCardReply); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(QueryOfflineCardReplyMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(QueryOfflineCardReplyMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(QueryOfflineCardReplyMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.SetupBillingModelReply; |
| | | import com.ruoyi.integration.mongodb.service.SetupBillingModelReplyService; |
| | | import com.ruoyi.integration.rocket.model.SetupBillingModelReplyMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class SetupBillingModelReplyMessageListener extends EnhanceMessageHandler<SetupBillingModelReplyMessage> implements RocketMQListener<SetupBillingModelReplyMessage> { |
| | | |
| | | @Autowired |
| | | private SetupBillingModelReplyService setupBillingModelReplyService; |
| | | |
| | | @Override |
| | | protected void handleMessage(SetupBillingModelReplyMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("计费模型应答-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | SetupBillingModelReply setupBillingModelReply = new SetupBillingModelReply(); |
| | | BeanUtils.copyProperties(message,setupBillingModelReply); |
| | | setupBillingModelReplyService.create(setupBillingModelReply); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(SetupBillingModelReplyMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(SetupBillingModelReplyMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(SetupBillingModelReplyMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.SynchronizeOfflineCardReply; |
| | | import com.ruoyi.integration.mongodb.service.SynchronizeOfflineCardReplyService; |
| | | import com.ruoyi.integration.rocket.model.SynchronizeOfflineCardReplyMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class SynchronizeOfflineCardReplyMessageListener extends EnhanceMessageHandler<SynchronizeOfflineCardReplyMessage> implements RocketMQListener<SynchronizeOfflineCardReplyMessage> { |
| | | |
| | | @Autowired |
| | | private SynchronizeOfflineCardReplyService synchronizeOfflineCardReplyService; |
| | | @Override |
| | | protected void handleMessage(SynchronizeOfflineCardReplyMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("卡数据同步应答-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | SynchronizeOfflineCardReply synchronizeOfflineCardReply = new SynchronizeOfflineCardReply(); |
| | | BeanUtils.copyProperties(message,synchronizeOfflineCardReply); |
| | | synchronizeOfflineCardReplyService.create(synchronizeOfflineCardReply); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(SynchronizeOfflineCardReplyMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(SynchronizeOfflineCardReplyMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(SynchronizeOfflineCardReplyMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.TimingSettingReply; |
| | | import com.ruoyi.integration.mongodb.service.TimingSettingReplyService; |
| | | import com.ruoyi.integration.rocket.model.TimingSettingReplyMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class TimingSettingReplyMessageListener extends EnhanceMessageHandler<TimingSettingReplyMessage> implements RocketMQListener<TimingSettingReplyMessage> { |
| | | |
| | | @Autowired |
| | | private TimingSettingReplyService timingSettingReplyService; |
| | | @Override |
| | | protected void handleMessage(TimingSettingReplyMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("对时设置应答-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | TimingSettingReply timingSettingReply = new TimingSettingReply(); |
| | | BeanUtils.copyProperties(message,timingSettingReply); |
| | | timingSettingReplyService.create(timingSettingReply); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(TimingSettingReplyMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(TimingSettingReplyMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(TimingSettingReplyMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.TransactionRecord; |
| | | import com.ruoyi.integration.mongodb.service.TransactionRecordService; |
| | | import com.ruoyi.integration.rocket.model.TransactionRecordMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class TransactionRecordMessageListener extends EnhanceMessageHandler<TransactionRecordMessage> implements RocketMQListener<TransactionRecordMessage> { |
| | | |
| | | @Autowired |
| | | private TransactionRecordService transactionRecordService; |
| | | @Override |
| | | protected void handleMessage(TransactionRecordMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("交易记录-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | TransactionRecord transactionRecord = new TransactionRecord(); |
| | | BeanUtils.copyProperties(message,transactionRecord); |
| | | transactionRecordService.create(transactionRecord); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(TransactionRecordMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(TransactionRecordMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(TransactionRecordMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.UpdateBalanceReply; |
| | | import com.ruoyi.integration.mongodb.service.UpdateBalanceReplyService; |
| | | import com.ruoyi.integration.rocket.model.UpdateBalanceReplyMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class UpdateBalanceReplyMessageListener extends EnhanceMessageHandler<UpdateBalanceReplyMessage> implements RocketMQListener<UpdateBalanceReplyMessage> { |
| | | |
| | | @Autowired |
| | | private UpdateBalanceReplyService updateBalanceReplyService; |
| | | @Override |
| | | protected void handleMessage(UpdateBalanceReplyMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("余额更新应答-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | UpdateBalanceReply updateBalanceReply = new UpdateBalanceReply(); |
| | | BeanUtils.copyProperties(message,updateBalanceReply); |
| | | updateBalanceReplyService.create(updateBalanceReply); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(UpdateBalanceReplyMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(UpdateBalanceReplyMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(UpdateBalanceReplyMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import com.ruoyi.integration.rocket.model.UploadRealTimeMonitoringDataMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class UploadRealTimeMonitoringDataMessageListener extends EnhanceMessageHandler<UploadRealTimeMonitoringDataMessage> implements RocketMQListener<UploadRealTimeMonitoringDataMessage> { |
| | | |
| | | @Autowired |
| | | private UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService; |
| | | @Override |
| | | protected void handleMessage(UploadRealTimeMonitoringDataMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("上传实时监测数据-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | UploadRealTimeMonitoringData uploadRealTimeMonitoringData = new UploadRealTimeMonitoringData(); |
| | | BeanUtils.copyProperties(message,uploadRealTimeMonitoringData); |
| | | uploadRealTimeMonitoringDataService.create(uploadRealTimeMonitoringData); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(UploadRealTimeMonitoringDataMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(UploadRealTimeMonitoringDataMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(UploadRealTimeMonitoringDataMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.WorkingParameterSettingReply; |
| | | import com.ruoyi.integration.mongodb.service.WorkingParameterSettingReplyService; |
| | | import com.ruoyi.integration.rocket.model.WorkingParameterSettingReplyMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class WorkingParameterSettingReplyMessageListener extends EnhanceMessageHandler<WorkingParameterSettingReplyMessage> implements RocketMQListener<WorkingParameterSettingReplyMessage> { |
| | | |
| | | @Autowired |
| | | private WorkingParameterSettingReplyService workingParameterSettingReplyService; |
| | | @Override |
| | | protected void handleMessage(WorkingParameterSettingReplyMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("充电桩工作参数设置应答-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | WorkingParameterSettingReply workingParameterSettingReply = new WorkingParameterSettingReply(); |
| | | BeanUtils.copyProperties(message,workingParameterSettingReply); |
| | | workingParameterSettingReplyService.create(workingParameterSettingReply); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(WorkingParameterSettingReplyMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(WorkingParameterSettingReplyMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(WorkingParameterSettingReplyMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.model; |
| | | |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 充电桩计费模型请求 |
| | | **/ |
| | | |
| | | @Data |
| | | public class AcquisitionBillingModeMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | |
| | | } |
| | | |
| | | |
| | | |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/BillingModeVerify.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/BillingModeVerifyMessage.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/BillingModeVerify.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.rocket.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 = "billing_mode_verify") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BillingModeVerify { |
| | | public class BillingModeVerifyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String billing_model_code;// "计费模型编号,首次连接到平台时置零 |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/BmsAbort.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/BmsAbortMessage.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/BmsAbort.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.rocket.model; |
| | | |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 充电阶段BMS中止 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "bms_abort") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BmsAbort { |
| | | public class BmsAbortMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/BmsDemandAndChargerExportation.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/BmsDemandAndChargerExportationMessage.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/BmsDemandAndChargerExportation.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.rocket.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 = "bms_demand_and_charger_exportation") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BmsDemandAndChargerExportation { |
| | | public class BmsDemandAndChargerExportationMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/BmsInformation.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/BmsInformationMessage.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/BmsInformation.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.rocket.model; |
| | | |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 充电过程BMS信息 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "bms_information") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BmsInformation { |
| | | public class BmsInformationMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/ChargingHandshake.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/ChargingHandshakeMessage.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/ChargingHandshake.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.rocket.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 = "charging_handshake") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ChargingHandshake { |
| | | public class ChargingHandshakeMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number;// 交易流水号 |
| | | private String charging_pile_code;// 桩编码 |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/ChargingPileReturnsGroundLockData.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/ChargingPileReturnsGroundLockDataMessage.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/ChargingPileReturnsGroundLockData.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.rocket.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 = "charging_pile_returns_ground_lock_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ChargingPileReturnsGroundLockData { |
| | | public class ChargingPileReturnsGroundLockDataMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String charging_gun_code; // 抢号 |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/ChargingPileStartsCharging.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/ChargingPileStartsChargingMessage.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/ChargingPileStartsCharging.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.rocket.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 = "charging_pile_starts_charging") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ChargingPileStartsCharging { |
| | | public class ChargingPileStartsChargingMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/ClearOfflineCardReply.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/ClearOfflineCardReplyMessage.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/ClearOfflineCardReply.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.rocket.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 = "clear_offline_card_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ClearOfflineCardReply { |
| | | public class ClearOfflineCardReplyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String physical_card1; // 第 1 个卡物理卡号,离线卡物理卡号 |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/GroundLockRealTimeData.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/GroundLockRealTimeDataMessage.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/GroundLockRealTimeData.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.rocket.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 = "ground_lock_real_time_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class GroundLockRealTimeData { |
| | | public class GroundLockRealTimeDataMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String charging_gun_code; // 抢号 |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/MotorAbort.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/MotorAbortMessage.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/MotorAbort.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.rocket.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 = "motor_abort") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class MotorAbort { |
| | | public class MotorAbortMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/Online.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/OnlineMessage.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/Online.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.rocket.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 = "online") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class Online { |
| | | public class OnlineMessage extends BaseMessage { |
| | | private String charging_pile_code;// 充电桩编号 |
| | | private Integer charging_pile_type;// 充电桩类型(0 表示直流桩,1 表示交流桩) |
| | | private Integer charging_gun_number;// 充电枪数量 |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/ParameterSetting.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/ParameterSettingMessage.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/ParameterSetting.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.rocket.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 = "parameter_setting") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ParameterSetting { |
| | | public class ParameterSettingMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/Ping.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/PingMessage.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/Ping.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.rocket.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 = "ping") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class Ping { |
| | | public class PingMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/PlatformRemoteUpdateReply.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/PlatformRemoteUpdateReplyMessage.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/PlatformRemoteUpdateReply.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.rocket.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 = "platform_remote_update_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformRemoteUpdateReply { |
| | | public class PlatformRemoteUpdateReplyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer escalation_state; // 升级状态(0:成功,1:编码错误,2:程序与桩型号不符,3:下载更新文件超时) |
New file |
| | |
| | | package com.ruoyi.integration.rocket.model; |
| | | |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 远程重启应答 |
| | | **/ |
| | | |
| | | @Data |
| | | public class PlatformRestartReplyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer set_result; // 设置结果(0:失败,1:成功) |
| | | |
| | | } |
| | | |
| | | |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/PlatformStartChargingReply.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/PlatformStartChargingReplyMessage.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/PlatformStartChargingReply.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.rocket.model; |
| | | |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 远程启机命令回复 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "platform_start_charging_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformStartChargingReply { |
| | | public class PlatformStartChargingReplyMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/PlatformStopChargingReply.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/PlatformStopChargingReplyMessage.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/PlatformStopChargingReply.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.rocket.model; |
| | | |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 远程停机命令回复 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "platform_stop_charging_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformStopChargingReply { |
| | | public class PlatformStopChargingReplyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/QueryOfflineCardReply.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/QueryOfflineCardReplyMessage.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/QueryOfflineCardReply.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.rocket.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 = "query_offline_card_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class QueryOfflineCardReply { |
| | | public class QueryOfflineCardReplyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String physical_card1; // 第 1 个卡物理卡号,离线卡物理卡号 |
New file |
| | |
| | | package com.ruoyi.integration.rocket.model; |
| | | |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 计费模型应答 |
| | | **/ |
| | | |
| | | @Data |
| | | public class SetupBillingModelReplyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String set_result; //设置结果(0:失败,1:成功) |
| | | |
| | | } |
| | | |
| | | |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/SynchronizeOfflineCardReply.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/SynchronizeOfflineCardReplyMessage.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/SynchronizeOfflineCardReply.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.rocket.model; |
| | | |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 卡数据同步应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "synchronize_offline_card_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class SynchronizeOfflineCardReply { |
| | | public class SynchronizeOfflineCardReplyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer save_result; // 保存结果(0:失败,1:成功) |
New file |
| | |
| | | package com.ruoyi.integration.rocket.model; |
| | | |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 对时设置应答 |
| | | **/ |
| | | |
| | | @Data |
| | | public class TimingSettingReplyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String current_time; //当前时间 |
| | | } |
| | | |
| | | |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/TransactionRecord.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/TransactionRecordMessage.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/TransactionRecord.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.rocket.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 = "transaction_record") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class TransactionRecord { |
| | | public class TransactionRecordMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number;// 交易流水号 |
| | | private String charging_pile_code;// 桩编码 |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/UpdateBalanceReply.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/UpdateBalanceReplyMessage.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/UpdateBalanceReply.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.rocket.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 = "update_balance_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class UpdateBalanceReply { |
| | | public class UpdateBalanceReplyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String physical_card_number; //物理卡号 |
copy from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/UploadRealTimeMonitoringData.java
copy to ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/model/UploadRealTimeMonitoringDataMessage.java
File was copied from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/UploadRealTimeMonitoringData.java |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | package com.ruoyi.integration.rocket.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 = "upload_real_time_monitoring_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class UploadRealTimeMonitoringData { |
| | | public class UploadRealTimeMonitoringDataMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
New file |
| | |
| | | package com.ruoyi.integration.rocket.model; |
| | | |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 充电桩工作参数设置应答 |
| | | **/ |
| | | |
| | | @Data |
| | | public class WorkingParameterSettingReplyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer set_result; //设置结果(0:失败,1:成功) |
| | | } |
| | | |
| | | |
| | |
| | | package com.ruoyi.integration.rocket.produce; |
| | | |
| | | import com.ruoyi.integration.rocket.test.MemberMessage; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.integration.iotda.enums.SendTagMenu; |
| | | import com.ruoyi.integration.rocket.model.*; |
| | | import com.ruoyi.integration.rocket.util.RocketMQEnhanceTemplate; |
| | | import lombok.Setter; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.client.producer.SendResult; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.UUID; |
| | | |
| | | @RestController |
| | |
| | | @Setter(onMethod_ = @Autowired) |
| | | private RocketMQEnhanceTemplate rocketMQEnhanceTemplate; |
| | | |
| | | private static final String topic = "rocket_enhance"; |
| | | private static final String tag = "member"; |
| | | private static final String TOPIC = "rocket_enhance"; |
| | | |
| | | /** |
| | | * 发送实体消息 |
| | | * 充电桩登录认证 |
| | | */ |
| | | @GetMapping("/member") |
| | | public SendResult member() { |
| | | String key = UUID.randomUUID().toString(); |
| | | MemberMessage message = new MemberMessage(); |
| | | public SendResult onlineMessage(JSONObject jsonObject) { |
| | | OnlineMessage message = JSON.parseObject(jsonObject.toJSONString(),OnlineMessage.class); |
| | | // 设置业务key |
| | | message.setKey(key); |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource("MEMBER"); |
| | | // 业务消息内容 |
| | | message.setUserName("Java日知录"); |
| | | message.setBirthday(LocalDate.now()); |
| | | message.setSource(SendTagMenu.ONLINE.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.ONLINE.getValue(), message); |
| | | } |
| | | |
| | | return rocketMQEnhanceTemplate.send(topic, tag, message); |
| | | /** |
| | | * 充电桩心跳包 |
| | | */ |
| | | public SendResult pingMessage(JSONObject jsonObject) { |
| | | PingMessage message = JSON.parseObject(jsonObject.toJSONString(),PingMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.PING.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.PING.getValue(), message); |
| | | } |
| | | |
| | | /** |
| | | * 计费模型验证请求 |
| | | */ |
| | | public SendResult billingModeVerifyMessage(JSONObject jsonObject) { |
| | | BillingModeVerifyMessage message = JSON.parseObject(jsonObject.toJSONString(),BillingModeVerifyMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.BILLING_MODE_VERIFY.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.BILLING_MODE_VERIFY.getValue(), message); |
| | | } |
| | | |
| | | /** |
| | | * 充电桩计费模型请求 |
| | | */ |
| | | public SendResult acquisitionBillingModeMessage(JSONObject jsonObject) { |
| | | AcquisitionBillingModeMessage message = JSON.parseObject(jsonObject.toJSONString(),AcquisitionBillingModeMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.ACQUISITION_BILLING_MODE.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.ACQUISITION_BILLING_MODE.getValue(), message); |
| | | } |
| | | |
| | | /** |
| | | * 上传实时监测数据 |
| | | */ |
| | | public SendResult uploadRealTimeMonitoringDataMessage(JSONObject jsonObject) { |
| | | UploadRealTimeMonitoringDataMessage message = JSON.parseObject(jsonObject.toJSONString(),UploadRealTimeMonitoringDataMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.UPLOAD_REAL_TIME_MONITORING_DATA.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.UPLOAD_REAL_TIME_MONITORING_DATA.getValue(), message); |
| | | } |
| | | |
| | | /** |
| | | * 充电握手 |
| | | */ |
| | | public SendResult chargingHandshakeMessage(JSONObject jsonObject) { |
| | | ChargingHandshakeMessage message = JSON.parseObject(jsonObject.toJSONString(),ChargingHandshakeMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.CHARGING_HANDSHAKE.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.CHARGING_HANDSHAKE.getValue(), message); |
| | | } |
| | | |
| | | /** |
| | | * 充电阶段BMS中止 |
| | | */ |
| | | public SendResult bmsAbortMessage(JSONObject jsonObject) { |
| | | BmsAbortMessage message = JSON.parseObject(jsonObject.toJSONString(),BmsAbortMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.BMS_ABORT.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.BMS_ABORT.getValue(), message); |
| | | } |
| | | |
| | | /** |
| | | * 充电阶段充电机中止 |
| | | */ |
| | | public SendResult motorAbortMessage(JSONObject jsonObject) { |
| | | MotorAbortMessage message = JSON.parseObject(jsonObject.toJSONString(),MotorAbortMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.MOTOR_ABORT.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.MOTOR_ABORT.getValue(), message); |
| | | } |
| | | |
| | | /** |
| | | * 充电过程BMS需求、充电机输出 |
| | | */ |
| | | public SendResult bmsDemandAndChargerExportationMessage(JSONObject jsonObject) { |
| | | BmsDemandAndChargerExportationMessage message = JSON.parseObject(jsonObject.toJSONString(),BmsDemandAndChargerExportationMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.BMS_DEMAND_AND_CHARGER_EXPORTATION.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.BMS_DEMAND_AND_CHARGER_EXPORTATION.getValue(), message); |
| | | } |
| | | |
| | | /** |
| | | * 充电过程BMS信息 |
| | | */ |
| | | public SendResult bmsInformationMessage(JSONObject jsonObject) { |
| | | BmsInformationMessage message = JSON.parseObject(jsonObject.toJSONString(),BmsInformationMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.BMS_INFORMATION.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.BMS_INFORMATION.getValue(), message); |
| | | } |
| | | |
| | | /** |
| | | * 充电桩主动申请启动充电 |
| | | */ |
| | | public SendResult chargingPileStartsChargingMessage(JSONObject jsonObject) { |
| | | ChargingPileStartsChargingMessage message = JSON.parseObject(jsonObject.toJSONString(),ChargingPileStartsChargingMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.CHARGING_PILE_STARTS_CHARGING.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.CHARGING_PILE_STARTS_CHARGING.getValue(), message); |
| | | } |
| | | |
| | | /** |
| | | * 远程启机命令回复 |
| | | */ |
| | | public SendResult platformStartChargingReplyMessage(JSONObject jsonObject) { |
| | | PlatformStartChargingReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),PlatformStartChargingReplyMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.PLATFORM_START_CHARGING_REPLY.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.PLATFORM_START_CHARGING_REPLY.getValue(), message); |
| | | } |
| | | |
| | | /** |
| | | * 远程停机命令回复 |
| | | */ |
| | | public SendResult platformStopChargingReplyMessage(JSONObject jsonObject) { |
| | | PlatformStopChargingReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),PlatformStopChargingReplyMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.PLATFORM_STOP_CHARGING_REPLY.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.PLATFORM_STOP_CHARGING_REPLY.getValue(), message); |
| | | } |
| | | |
| | | /** |
| | | * 交易记录 |
| | | */ |
| | | public SendResult transactionRecordMessage(JSONObject jsonObject) { |
| | | TransactionRecordMessage message = JSON.parseObject(jsonObject.toJSONString(),TransactionRecordMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.TRANSACTION_RECORD.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.TRANSACTION_RECORD.getValue(), message); |
| | | } |
| | | |
| | | /** |
| | | * 余额更新应答 |
| | | */ |
| | | public SendResult updateBalanceReplyMessage(JSONObject jsonObject) { |
| | | UpdateBalanceReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),UpdateBalanceReplyMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.UPDATE_BALANCE_REPLY.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.UPDATE_BALANCE_REPLY.getValue(), message); |
| | | } |
| | | |
| | | /** |
| | | * 卡数据同步应答 |
| | | */ |
| | | public SendResult synchronizeOfflineCardReplyMessage(JSONObject jsonObject) { |
| | | SynchronizeOfflineCardReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),SynchronizeOfflineCardReplyMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.SYNCHRONIZE_OFFLINE_CARD_REPLY.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.SYNCHRONIZE_OFFLINE_CARD_REPLY.getValue(), message); |
| | | } |
| | | |
| | | /** |
| | | * 离线卡数据清除应答 |
| | | */ |
| | | public SendResult clearOfflineCardReplyMessage(JSONObject jsonObject) { |
| | | ClearOfflineCardReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),ClearOfflineCardReplyMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.CLEAR_OFFLINE_CARD_REPLY.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.CLEAR_OFFLINE_CARD_REPLY.getValue(), message); |
| | | } |
| | | |
| | | /** |
| | | * 充电桩工作参数设置应答 |
| | | */ |
| | | public SendResult workingParameterSettingReplyMessage(JSONObject jsonObject) { |
| | | WorkingParameterSettingReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),WorkingParameterSettingReplyMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.WORKING_PARAMETER_SETTING_REPLY.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.WORKING_PARAMETER_SETTING_REPLY.getValue(), message); |
| | | } |
| | | |
| | | /** |
| | | * 对时设置应答 |
| | | */ |
| | | public SendResult timingSettingReplyMessage(JSONObject jsonObject) { |
| | | TimingSettingReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),TimingSettingReplyMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.TIMING_SETTING_REPLY.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.TIMING_SETTING_REPLY.getValue(), message); |
| | | } |
| | | |
| | | /** |
| | | * 计费模型应答 |
| | | */ |
| | | public SendResult setupBillingModelReplyMessage(JSONObject jsonObject) { |
| | | SetupBillingModelReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),SetupBillingModelReplyMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.SETUP_BILLING_MODEL_REPLY.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.SETUP_BILLING_MODEL_REPLY.getValue(), message); |
| | | } |
| | | |
| | | /** |
| | | * 地锁数据上送(充电桩上送) |
| | | */ |
| | | public SendResult groundLockRealTimeDataMessage(JSONObject jsonObject) { |
| | | GroundLockRealTimeDataMessage message = JSON.parseObject(jsonObject.toJSONString(),GroundLockRealTimeDataMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.GROUND_LOCK_REAL_TIME_DATA.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.GROUND_LOCK_REAL_TIME_DATA.getValue(), message); |
| | | } |
| | | |
| | | /** |
| | | * 充电桩返回数据(上行) |
| | | */ |
| | | public SendResult chargingPileReturnsGroundLockDataMessage(JSONObject jsonObject) { |
| | | ChargingPileReturnsGroundLockDataMessage message = JSON.parseObject(jsonObject.toJSONString(),ChargingPileReturnsGroundLockDataMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.CHARGING_PILE_RETURNS_GROUND_LOCK_DATA.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.CHARGING_PILE_RETURNS_GROUND_LOCK_DATA.getValue(), message); |
| | | } |
| | | |
| | | /** |
| | | * 远程重启应答 |
| | | */ |
| | | public SendResult platformRestartReplyMessage(JSONObject jsonObject) { |
| | | PlatformRestartReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),PlatformRestartReplyMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.PLATFORM_RESTART_REPLY.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.PLATFORM_RESTART_REPLY.getValue(), message); |
| | | } |
| | | |
| | | /** |
| | | * 远程更新应答 |
| | | */ |
| | | public SendResult platformRemoteUpdateReplyMessage(JSONObject jsonObject) { |
| | | PlatformRemoteUpdateReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),PlatformRemoteUpdateReplyMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.PLATFORM_REMOTE_UPDATE_REPLY.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.PLATFORM_REMOTE_UPDATE_REPLY.getValue(), message); |
| | | } |
| | | } |
| | |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-integration</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-account</artifactId> |
| | | </dependency> |
| | | <!-- ruoyi-modules-chargingPile-api --> |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.chargingPile.api.vo.SiteVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | |
| | | @Resource |
| | | private AliPaymentClient aliPaymentClient; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private AppUserClient appUserClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/chargingOrder") |
| | | @ApiOperation(value = "充电桩订单列表", tags = {"管理后台-订单管理"}) |
| | | public AjaxResult<TCharingOrderVO> chargingOrder(@RequestBody ChargingOrderQuery dto){ |
| | | List<Long> data = appUserClient.getUserIdsByPhone(dto.getPhone()).getData(); |
| | | dto.setUserIds(data); |
| | | TCharingOrderVO res = chargingOrderService.chargingOrder(dto); |
| | | return AjaxResult.success(res); |
| | | } |
| | | @ResponseBody |
| | | @PostMapping(value = "/chargingOrderInfo") |
| | | @ApiOperation(value = "充电桩订单列表查看详情", tags = {"管理后台-订单管理"}) |
| | | public AjaxResult<TCharingOrderVO> chargingOrderInfo(String orderId){ |
| | | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/addEvaluate") |
| | |
| | | case 1: |
| | | for (int i = 0; i < split.length-1; i++) { |
| | | Integer reduce = tShoppingOrderService.list(new QueryWrapper<TShoppingOrder>() |
| | | .eq("order_type",1) |
| | | .eq("goods_id", split[i]) |
| | | .eq("payment_status", 2) |
| | | .ne("refund_status", 2)) |
| | |
| | | case 2: |
| | | for (int i = 0; i < split.length-1; i++) { |
| | | Integer reduce = exchangeOrderService.list(new QueryWrapper<TExchangeOrder>() |
| | | .eq("order_type",1) |
| | | .ne("status",4) |
| | | .eq("goods_id", split[i]) |
| | | ) |
| | | .stream().map(TExchangeOrder::getPurchaseQuantity).reduce(0, Integer::sum); |
| | |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | // @PostMapping("/create") |
| | | // public R<Long> shopCreate(@RequestBody ExchangeDto exchangeDto){ |
| | | // TShoppingOrder shoppingOrder = new TShoppingOrder(); |
| | | // shoppingOrder.setCode(OrderCodeUtil.getOrderCode("GW")); |
| | | // shoppingOrder.setAppUserId(exchangeDto.getUserId()); |
| | | // shoppingOrder.setOrderType(exchangeDto.getGoodType()); |
| | | // if (exchangeDto.getGoodType()==1) { |
| | | // shoppingOrder.setGoodsId(exchangeDto.getGoodId()); |
| | | // }else { |
| | | // shoppingOrder.setCouponId(exchangeDto.getGoodId()); |
| | | // } |
| | | // shoppingOrder.setPurchaseQuantity(exchangeDto.getNum()); |
| | | // shoppingOrder.setAppUserAddressId(Long.valueOf(exchangeDto.getAddressId())); |
| | | // shoppingOrder.setOrderAmount(new BigDecimal("0")); |
| | | // shoppingOrder.setAppCouponId(0L); |
| | | // shoppingOrder.setCouponDiscountAmount(new BigDecimal("0")); |
| | | // shoppingOrder.setVipDiscount(new BigDecimal("0")); |
| | | // shoppingOrder.setVipDiscountAmount(new BigDecimal("0")); |
| | | // shoppingOrder.setPaymentAmount(new BigDecimal("0")); |
| | | // shoppingOrder.setPaymentStatus(0); |
| | | // shoppingOrder.setPaymentType(0); |
| | | // shoppingOrder.setSerialNumber(""); |
| | | // shoppingOrder.setRemark(""); |
| | | // shoppingOrder.setStatus(0); |
| | | // shoppingOrder.setExpressCompany(""); |
| | | // shoppingOrder.setExpressNumber(""); |
| | | // shoppingOrder.setConsignerId(0); |
| | | // shoppingOrder.setConsignerTime(LocalDateTime.now()); |
| | | // shoppingOrder.setReceivingTime(LocalDateTime.now()); |
| | | // shoppingOrder.setCancellationTime(LocalDateTime.now()); |
| | | // shoppingOrder.setCancellationId(0); |
| | | // shoppingOrder.setRefundCode(""); |
| | | // shoppingOrder.setRefundAmount(new BigDecimal("0")); |
| | | // shoppingOrder.setRefundStatus(0); |
| | | // shoppingOrder.setRefundSerialNumber(""); |
| | | // shoppingOrder.setRefundTime(LocalDateTime.now()); |
| | | // shoppingOrder.setCreateTime(LocalDateTime.now()); |
| | | // shoppingOrder.setDelFlag(false); |
| | | // |
| | | // |
| | | // |
| | | // } |
| | | @PostMapping("/create") |
| | | public R<TShoppingOrder> shopCreate(@RequestBody ExchangeDto exchangeDto){ |
| | | TShoppingOrder shoppingOrder = new TShoppingOrder(); |
| | | shoppingOrder.setCode(OrderCodeUtil.getOrderCode("GW")); |
| | | shoppingOrder.setAppUserId(exchangeDto.getUserId()); |
| | | shoppingOrder.setOrderType(exchangeDto.getGoodType()); |
| | | if (exchangeDto.getGoodType()==1) { |
| | | shoppingOrder.setGoodsId(exchangeDto.getGoodId()); |
| | | }else { |
| | | shoppingOrder.setCouponId(exchangeDto.getGoodId()); |
| | | } |
| | | shoppingOrder.setPurchaseQuantity(exchangeDto.getNum()); |
| | | shoppingOrder.setAppUserAddressId(Long.valueOf(exchangeDto.getAddressId())); |
| | | shoppingOrder.setOrderAmount(exchangeDto.getOrderPrice()); |
| | | if (exchangeDto.getCouponId()!=null) { |
| | | shoppingOrder.setAppCouponId(exchangeDto.getCouponId()); |
| | | } |
| | | shoppingOrder.setCouponDiscountAmount(exchangeDto.getDiscountPrice()); |
| | | shoppingOrder.setVipDiscount(new BigDecimal("0")); |
| | | shoppingOrder.setVipDiscountAmount(exchangeDto.getVipDiscount()); |
| | | shoppingOrder.setPaymentAmount(exchangeDto.getPayPrice()); |
| | | shoppingOrder.setPaymentStatus(1); |
| | | shoppingOrder.setPaymentType(exchangeDto.getPayMethod()); |
| | | shoppingOrder.setRemark(exchangeDto.getRemark()); |
| | | shoppingOrder.setStatus(1); |
| | | shoppingOrder.setCreateTime(LocalDateTime.now()); |
| | | shoppingOrder.setDelFlag(false); |
| | | shoppingOrderService.save(shoppingOrder); |
| | | |
| | | return R.ok(shoppingOrder); |
| | | |
| | | } |
| | | |
| | | @PostMapping("/callBack") |
| | | public R callBack(@RequestParam("code")String code,@RequestParam("outTradeNo")String outTradeNo){ |
| | | shoppingOrderService.callBack(code,outTradeNo); |
| | | return R.ok(); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.constant.TokenConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.JwtUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.jsonwebtoken.Claims; |
| | | import org.apache.logging.log4j.core.config.Order; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | * @return |
| | | */ |
| | | List<MyShoppingOrderList> getNoInvoicedOrder(GetNoInvoicedOrder query); |
| | | |
| | | void callBack(String code,String outTradeNo); |
| | | } |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.feignClient.AppUserCarClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | |
| | | import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | | import com.ruoyi.payment.api.vo.*; |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneOffset; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | |
| | | @Resource |
| | | private RedisService redisService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取小程序充电记录列表数据 |
| | | * @param query |
| | |
| | | @Override |
| | | public TCharingOrderVO chargingOrder(ChargingOrderQuery dto) { |
| | | TCharingOrderVO tCharingOrderVO = new TCharingOrderVO(); |
| | | |
| | | |
| | | String startTime1 = null; |
| | | String startTime2 = null; |
| | | String endTime1 = null; |
| | |
| | | } |
| | | PageInfo<ChargingOrderVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); |
| | | List<ChargingOrderVO> list = this.baseMapper.chargingOrder(pageInfo,dto,startTime1,startTime2,endTime1,endTime2); |
| | | |
| | | BigDecimal total = new BigDecimal("0"); |
| | | long time = 0L; |
| | | BigDecimal income = new BigDecimal("0"); |
| | | BigDecimal electronicMoney = new BigDecimal("0"); |
| | | BigDecimal serviceMoney = new BigDecimal("0"); |
| | | for (ChargingOrderVO chargingOrderVO : list) { |
| | | total = total.add(chargingOrderVO.getChargingCapacity()); |
| | | // 充电订单 明细记录 |
| | | List<TChargingOrderAccountingStrategy> chargingOrderId = chargingOrderAccountingStrategyService.list(new QueryWrapper<TChargingOrderAccountingStrategy>() |
| | | .eq("charging_order_id", chargingOrderVO.getId())); |
| | | // 单个订单累计电费 |
| | | BigDecimal electronicMoney1 = new BigDecimal("0"); |
| | | // 单个订单累计服务费 |
| | | BigDecimal serviceMoney1 = new BigDecimal("0"); |
| | | LocalDateTime startTime = chargingOrderVO.getStartTime(); |
| | | LocalDateTime endTime = chargingOrderVO.getEndTime(); |
| | | // 计算时间差 秒 充电时长 |
| | | long between = ChronoUnit.SECONDS.between(startTime, endTime); |
| | | chargingOrderVO.setChargingSecond(between); |
| | | time += between; |
| | | // 总收入 |
| | | if (chargingOrderVO.getRefundStatus() == 2){ |
| | | income = income.add(chargingOrderVO.getPaymentAmount().subtract(chargingOrderVO.getRefundAmount())); |
| | | }else{ |
| | | income = income.add(chargingOrderVO.getPaymentAmount()); |
| | | } |
| | | for (TChargingOrderAccountingStrategy tChargingOrderAccountingStrategy : chargingOrderId) { |
| | | // 累计电费 |
| | | electronicMoney1 = electronicMoney1.add(tChargingOrderAccountingStrategy.getElectrovalence() |
| | | .multiply(tChargingOrderAccountingStrategy.getChargingCapacity())); |
| | | electronicMoney = electronicMoney.add(electronicMoney1); |
| | | // 累计服务费 |
| | | serviceMoney1 = serviceMoney1.add(tChargingOrderAccountingStrategy.getServiceCharge()); |
| | | serviceMoney = serviceMoney.add(serviceMoney1); |
| | | } |
| | | chargingOrderVO.setServiceCharge(serviceMoney1); |
| | | chargingOrderVO.setElectrovalence(electronicMoney1); |
| | | // 充电时段数 |
| | | int size = chargingOrderId.size(); |
| | | chargingOrderVO.setCount(size); |
| | | // 用户手机号 |
| | | TAppUser data = appUserClient.getUserById(chargingOrderVO.getAppUserId()).getData(); |
| | | if (data!=null){ |
| | | // 车牌号 |
| | | chargingOrderVO.setPhone(data.getPhone()); |
| | | List<Long> longs = new ArrayList<>(); |
| | | longs.add(chargingOrderVO.getAppUserCarId()); |
| | | List<TAppUserCar> data1 = appUserCarClient.getCarByIds(longs).getData(); |
| | | if (!data1.isEmpty()){ |
| | | chargingOrderVO.setLicensePlate(data1.get(0).getLicensePlate()); |
| | | } |
| | | } |
| | | } |
| | | tCharingOrderVO.setTotal(total); |
| | | tCharingOrderVO.setTime(time); |
| | | tCharingOrderVO.setIncome(income); |
| | | tCharingOrderVO.setElectronicMoney(electronicMoney); |
| | | tCharingOrderVO.setServiceMoney(serviceMoney); |
| | | pageInfo.setRecords(list); |
| | | tCharingOrderVO.setList(pageInfo); |
| | | return tCharingOrderVO; |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.dto.GrantCouponDto; |
| | | import com.ruoyi.account.api.feignClient.AppCouponClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserAddressClient; |
| | | import com.ruoyi.account.api.model.TAppUserAddress; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | |
| | | 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.List; |
| | |
| | | |
| | | @Resource |
| | | private AppUserAddressClient appUserAddressClient; |
| | | @Resource |
| | | private AppCouponClient appCouponClient; |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | return pageList; |
| | | } |
| | | |
| | | @Override |
| | | public void callBack(String code,String outTradeNo) { |
| | | //改变订单状态 |
| | | TShoppingOrder shoppingOrder = this.baseMapper.selectOne(Wrappers.lambdaQuery(TShoppingOrder.class).eq(TShoppingOrder::getCode, code)); |
| | | shoppingOrder.setPaymentStatus(2); |
| | | shoppingOrder.setSerialNumber(outTradeNo); |
| | | this.updateById(shoppingOrder); |
| | | //如果是优惠券,赠送优惠券 |
| | | if (shoppingOrder.getOrderType()==2){ |
| | | GrantCouponDto grantCouponDto = new GrantCouponDto(); |
| | | grantCouponDto.setType(3); |
| | | grantCouponDto.setUserIds(String.valueOf(shoppingOrder.getAppUserId())); |
| | | grantCouponDto.setCouponId(shoppingOrder.getCouponId()); |
| | | grantCouponDto.setWaysToObtain(2); |
| | | grantCouponDto.setEndTime(LocalDateTime.now()); |
| | | appCouponClient.grantCoupon(grantCouponDto); |
| | | } |
| | | } |
| | | } |
| | |
| | | <groupId>io.netty</groupId> |
| | | <artifactId>netty-all</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-payment</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | |
| | | @ApiOperation(tags = {"小程序-广告管理"},value = "广告列表查询") |
| | | @GetMapping(value = "/list") |
| | | public AjaxResult<List<TAdvertising>> list() { |
| | | public AjaxResult<List<TAdvertising>> list(@RequestParam("position") Integer position) { |
| | | return AjaxResult.ok(advertisingService.list(Wrappers.lambdaQuery(TAdvertising.class) |
| | | .eq(TAdvertising::getStatus, AdvertisingStatusEnum.YES.getCode()))); |
| | | .eq(TAdvertising::getStatus, AdvertisingStatusEnum.YES.getCode()) |
| | | .eq(TAdvertising::getPosition,position))); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.other.controller; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.ruoyi.account.api.dto.GrantCouponDto; |
| | | import com.ruoyi.account.api.feignClient.AppCouponClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppCoupon; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.AppGoodQuery; |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | | import com.ruoyi.common.core.dto.ExchangeDto; |
| | |
| | | import com.ruoyi.other.service.TActivityService; |
| | | import com.ruoyi.other.service.TCouponService; |
| | | import com.ruoyi.other.service.TGoodsService; |
| | | import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | | import com.ruoyi.payment.api.vo.PaymentOrder; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.swing.*; |
| | | import java.util.Arrays; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private TGoodsService goodsService; |
| | | @Autowired |
| | | private TActivityService activityService; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | |
| | | private AppCouponClient appCouponClient; |
| | | @Resource |
| | | private TCouponService couponService; |
| | | @Resource |
| | | private WxPaymentClient wxPaymentClient; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | // @ApiOperation(tags = {"小程序-兑换商城"},value = "支付商品") |
| | | // @PostMapping(value = "/app/pay") |
| | | // public AjaxResult<PageInfo<TGoods>> pay(@RequestBody ExchangeDto exchangeDto) { |
| | | // |
| | | // //创建订单 |
| | | // |
| | | // //计算价格 |
| | | // |
| | | // //调起支付 |
| | | // |
| | | // |
| | | // |
| | | // } |
| | | @ApiOperation(tags = {"小程序-现金商城"},value = "支付商品") |
| | | @PostMapping(value = "/app/pay") |
| | | public R<Map<String, Object>> pay(@RequestBody ExchangeDto exchangeDto) { |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | TAppUser user = appUserClient.getUserById(userId).getData(); |
| | | boolean isVip = false; |
| | | if (user.getVipEndTime().isAfter(LocalDateTime.now())){ |
| | | isVip = true; |
| | | } |
| | | //计算价格 |
| | | BigDecimal orderPrice = new BigDecimal(0); |
| | | BigDecimal payPrice = new BigDecimal(0); |
| | | BigDecimal discountPrice = new BigDecimal(0); |
| | | BigDecimal vipDiscount = new BigDecimal(0); |
| | | if (exchangeDto.getGoodType()==1){ |
| | | TGoods good = goodsService.getById(exchangeDto.getGoodId()); |
| | | BigDecimal originalPrice = good.getPreferentialPrice(); |
| | | if (isVip){ |
| | | if (good.getVipPrice()!=null){ |
| | | vipDiscount = originalPrice.subtract(good.getVipPrice()).multiply(BigDecimal.valueOf(exchangeDto.getNum())); |
| | | originalPrice = good.getVipPrice(); |
| | | } |
| | | } |
| | | orderPrice.add(originalPrice.multiply(BigDecimal.valueOf(exchangeDto.getNum()))); |
| | | }else { |
| | | TCoupon coupon = couponService.getById(exchangeDto.getGoodId()); |
| | | BigDecimal originalPrice = coupon.getPaymentAmount(); |
| | | if (isVip){ |
| | | if (coupon.getVipPaymentAmount()!=null) { |
| | | vipDiscount = originalPrice.subtract(coupon.getVipPaymentAmount()).multiply(BigDecimal.valueOf(exchangeDto.getNum())); |
| | | originalPrice = coupon.getVipPaymentAmount(); |
| | | } |
| | | } |
| | | orderPrice.add(originalPrice); |
| | | } |
| | | |
| | | exchangeDto.setOrderPrice(orderPrice); |
| | | //查看是否使用优惠券 |
| | | if(exchangeDto.getCouponId()!=null) { |
| | | TAppCoupon appCoupon = appUserClient.couponGetById(exchangeDto.getCouponId()).getData(); |
| | | TCoupon coupon = JSON.toJavaObject(JSON.parseObject(appCoupon.getCouponJson()), TCoupon.class); |
| | | if (coupon.getValidityPeriodMode()==1){ |
| | | if (orderPrice.compareTo(coupon.getMeetTheConditions())<0){ |
| | | return R.fail("不满足使用优惠券条件"); |
| | | } |
| | | |
| | | } |
| | | payPrice = orderPrice.subtract(coupon.getDiscountAmount()); |
| | | discountPrice = coupon.getDiscountAmount(); |
| | | } |
| | | exchangeDto.setPayPrice(payPrice); |
| | | exchangeDto.setDiscountPrice(discountPrice); |
| | | exchangeDto.setVipDiscount(vipDiscount); |
| | | //创建订单 |
| | | TShoppingOrder shopOrder = orderClient.shopCreate(exchangeDto).getData(); |
| | | if (exchangeDto.getPayMethod()==1) { |
| | | //调起支付 |
| | | PaymentOrder paymentOrder = new PaymentOrder(); |
| | | paymentOrder.setCode(shopOrder.getCode()); |
| | | paymentOrder.setAmount(shopOrder.getPaymentAmount()); |
| | | paymentOrder.setOpenId(user.getWxOpenid()); |
| | | paymentOrder.setDescription("购买商品"); |
| | | return wxPaymentClient.orderPay(paymentOrder); |
| | | }else { |
| | | //todo 罗 支付宝支付 |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.other.api.domain.THtml; |
| | | import com.ruoyi.other.api.domain.TIntegralRule; |
| | | import com.ruoyi.other.api.dto.SaveHtml; |
| | | import com.ruoyi.other.service.THtmlService; |
| | | import com.ruoyi.other.service.TIntegralRuleService; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | return R.ok(res); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/saveSet") |
| | | @ApiOperation(tags = {"管理后台-积分管理"},value = "保存积分设置") |
| | | public R saveSet(@RequestBody TIntegralRule dto) { |
| | | // JSONObject jsonObject = JSONObject.parseObject(dto); |
| | | // String chargeCredit = jsonObject.getString("chargeCredit"); |
| | | // String credit = jsonObject.getString("credit"); |
| | | // String inviteUsersToEarnPoints = jsonObject.getString("inviteUsersToEarnPoints"); |
| | | // String addVehiclesEarnsPoints = jsonObject.getString("addVehiclesEarnsPoints"); |
| | | // String signInForPoints = jsonObject.getString("signInForPoints"); |
| | | // TIntegralRule tIntegralRule = new TIntegralRule(); |
| | | // tIntegralRule.setAddVehiclesEarnsPoints(signInForPoints); |
| | | // tIntegralRule.setChargeCredit(chargeCredit); |
| | | // tIntegralRule.setCredit(credit); |
| | | // tIntegralRule.setSignInForPoints(addVehiclesEarnsPoints); |
| | | // tIntegralRule.setInviteUsersToEarnPoints(inviteUsersToEarnPoints); |
| | | // TIntegralRule one = integralRuleService.getOne(null); |
| | | // if (one!=null){ |
| | | // one.setAddVehiclesEarnsPoints(signInForPoints); |
| | | // one.setChargeCredit(chargeCredit); |
| | | // one.setCredit(credit); |
| | | // one.setSignInForPoints(addVehiclesEarnsPoints); |
| | | // one.setInviteUsersToEarnPoints(inviteUsersToEarnPoints); |
| | | // integralRuleService.updateById(one); |
| | | // }else{ |
| | | // integralRuleService.save(tIntegralRule); |
| | | // } |
| | | TIntegralRule one = integralRuleService.getOne(null); |
| | | if (one!=null){ |
| | | dto.setId(one.getId()); |
| | |
| | | |
| | | |
| | | |
| | | @GetMapping("/saveInfo") |
| | | @PostMapping("/saveInfo") |
| | | @ApiOperation(tags = {"管理后台-积分管理"},value = "保存积分说明") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "info", value = "内容", required = true), |
| | | @ApiImplicitParam(name = "type", value = "type 1=积分规则说明,\" +\n" + |
| | | " \"2=会员折扣说明,\" +\n" + |
| | | " \"3=优惠券说明,\" +\n" + |
| | | " \"4=双倍积分说明,\" +\n" + |
| | | " \"5=商城专享价说明,\" +\n" + |
| | | " \"6=会员协议,\" +\n" + |
| | | " \"7=用户协议,\" +\n" + |
| | | " \"8=隐私协议,\" +\n" + |
| | | " \"9=邀请好友说明,\" +\n" + |
| | | " \"10=资质证明,\" +\n" + |
| | | " \"11=开票说明\"", required = true), |
| | | |
| | | }) |
| | | public R saveInfo(String info,Integer type) { |
| | | THtml g = htmlService.getOne(new QueryWrapper<THtml>().eq("type",type)); |
| | | public R saveInfo(@RequestBody SaveHtml dto) { |
| | | THtml g = htmlService.getOne(new QueryWrapper<THtml>().eq("type",dto.getType())); |
| | | if (g == null){ |
| | | THtml tHtml = new THtml(); |
| | | tHtml.setType(type); |
| | | tHtml.setContent(info); |
| | | tHtml.setType(dto.getType()); |
| | | tHtml.setContent(dto.getInfo()); |
| | | htmlService.save(tHtml); |
| | | }else{ |
| | | g.setContent(info); |
| | | g.setContent(dto.getInfo()); |
| | | htmlService.updateById(g); |
| | | } |
| | | return R.ok(); |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.other.api.domain.TNotice; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | } |
| | | |
| | | @ApiOperation(tags = {"小程序-首页-公告管理"},value = "查询") |
| | | @GetMapping(value = "/list") |
| | | public AjaxResult<List<TNotice>> list() { |
| | | return AjaxResult.success(noticeService.list(Wrappers.lambdaQuery(TNotice.class) |
| | | .le(TNotice::getStartTime, LocalDate.now()) |
| | | .ge(TNotice::getEndTime,LocalDate.now()))); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | .last("LIMIT 1"))); |
| | | case 2: |
| | | return R.ok(vipService.getOne(Wrappers.lambdaQuery(TVip.class) |
| | | .eq(TVip::getReveal,1) |
| | | .eq(TVip::getReveal,1).eq(TVip::getType,1) |
| | | .orderByAsc(TVip::getMonthlyCard) |
| | | .last("LIMIT 1"))); |
| | | default: |
| | |
| | | |
| | | @ApiOperation(value = "会员信息", tags = {"小程序-个人中心"}) |
| | | @PostMapping("/vipInfo") |
| | | public AjaxResult vipInfo() { |
| | | public AjaxResult<VipInfoDto> vipInfo() { |
| | | List<VipInfoDto> vipInfoDtos = new ArrayList<>(); |
| | | List<TVip> vips = vipService.lambdaQuery().eq(TVip::getReveal, 1).list(); |
| | | for (TVip vip : vips) { |
| | |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.constant.TokenConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.JwtUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.jsonwebtoken.Claims; |
| | | import org.apache.logging.log4j.core.config.Order; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | <result column="status" property="status" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="del_flag" property="delFlag" /> |
| | | <result column="applet_id" property="appletId" /> |
| | | <result column="applet_name" property="appletName" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, name, img, start_time, end_time, position, jump_type, jump_url, status, create_time, del_flag |
| | | id, name, img, start_time, end_time, position, jump_type, jump_url, status, create_time, del_flag, |
| | | applet_id, applet_name |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.other.api.domain.TAdvertising"> |
| | | select * from t_advertising |
| | |
| | | |
| | | <select id="pageList1" resultType="com.ruoyi.other.api.domain.TGoods"> |
| | | SELECT |
| | | id,name,redeem_points,inventory |
| | | id,name,redeem_points,inventory,original_price,preferential_price,vip_price |
| | | FROM |
| | | t_goods |
| | | WHERE `status` = 1 and del_flag = 0 and type = #{appGoodQuery.type} |
| | | UNION ALL |
| | | SELECT |
| | | id,name,redeem_points,inventory_quantity as inventory |
| | | id,name,redeem_points,inventory_quantity as inventory,payment_amount as preferential_price,vip_payment_amount as vip_price |
| | | FROM |
| | | t_coupon |
| | | WHERE `status`= 1 and del_flag = 0 and type = #{appGoodQuery.type} |
| | |
| | | public R<Map<String, Object>> payNotify(HttpServletRequest request) throws Exception { |
| | | try { |
| | | Map<String, Object> params = wxV3Pay.verifyNotify(request, new TypeReference<Map<String, Object>>() {}); |
| | | log.info("支付回调:{}", params); |
| | | String outRefundNo = (String) params.get("out_refund_no"); |
| | | String out_trade_no = params.get("out_trade_no").toString(); |
| | | String substring = outRefundNo.substring(0, 2); |
| | | switch (substring){ |
| | | //购物订单 |
| | | case "GW": |
| | | //更改订单状态 |
| | | //如果是优惠卷赠送优惠卷 |
| | | |
| | | break; |
| | | } |
| | | |
| | | log.info("支付回调:{}", params); |
| | | return R.ok(params); |
| | | } catch (Exception e) { |
| | | log.error("支付回调异常:{}", e, e); |
| | |
| | | package com.ruoyi.payment.wx.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.ToString; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.boot.context.properties.NestedConfigurationProperty; |
| | |
| | | * @return secret ID |
| | | */ |
| | | private String secretId; |
| | | /** |
| | | * 回调地址 |
| | | */ |
| | | private String callBackUrl; |
| | | |
| | | public String getSecretId() { |
| | | return secretId; |