Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
Conflicts:
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppCoupon.java
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrder.java
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
1 文件已重命名
102个文件已修改
1个文件已删除
16个文件已添加
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<List<TAppUser>> selectByPhoneLike(String phone) { |
| | | return R.fail("通过手机号模糊查询用户失败:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R refundPoints(String param) { |
| | | return R.fail("后台兑换订单退款回退用户积分失败:"+throwable.getMessage()); |
| | | } |
| | |
| | | @GetMapping("/t-app-user/user/selectByPhone") |
| | | R<TAppUser> selectByPhone(@RequestParam("phone") String phone); |
| | | /** |
| | | * 通过手机号模糊查询用户 |
| | | * @param phone |
| | | * @return |
| | | */ |
| | | @GetMapping("/t-app-user/user/selectByPhoneLike") |
| | | R<List<TAppUser>> selectByPhoneLike(@RequestParam("phone") String phone); |
| | | /** |
| | | * 远程调用 积分兑换订单 退款回退积分 |
| | | * @return |
| | | */ |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @ApiModel(value = "校验计费模版是否准确DTO") |
| | | public class CheckChargingStrategyDTO implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "桩编号code") |
| | | private String code; |
| | | |
| | | @ApiModelProperty(value = "计费模型编号 id") |
| | | private Integer strategyDetailId; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.api.factory; |
| | | |
| | | import com.ruoyi.chargingPile.api.dto.CheckChargingStrategyDTO; |
| | | import com.ruoyi.chargingPile.api.feignClient.AccountingStrategyDetailClient; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | import com.ruoyi.common.core.domain.R; |
| | |
| | | public R<TAccountingStrategyDetail> getNowData(Integer accountingStrategyId) { |
| | | return R.fail("获取当前有效的计费策略明细失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TAccountingStrategyDetail> getDetailBySiteId(Integer siteId) { |
| | | return R.fail("通过站点id查询当前时段使用的策略明细失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TAccountingStrategyDetail> getDetailByCode(String code) { |
| | | return R.fail("通过桩编号查询当前时段使用的策略明细失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<Boolean> checkChargingStrategy(CheckChargingStrategyDTO dto) { |
| | | return R.fail("校验充电桩计费模版是否准确失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.api.feignClient; |
| | | |
| | | import com.ruoyi.chargingPile.api.dto.CheckChargingStrategyDTO; |
| | | import com.ruoyi.chargingPile.api.factory.AccountingStrategyDetailFallbackFactory; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/t-accounting-strategy-detail/getNowData") |
| | | R<TAccountingStrategyDetail> getNowData(@RequestParam("accountingStrategyId") Integer accountingStrategyId); |
| | | /** |
| | | * 通过站点id查询当前时段使用的策略明细 |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-accounting-strategy-detail/getDetailBySiteId") |
| | | R<TAccountingStrategyDetail> getDetailBySiteId(@RequestParam("siteId") Integer siteId); |
| | | /** |
| | | * 通过桩编号查询当前时段使用的策略明细 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-accounting-strategy-detail/getDetailByCode") |
| | | R<TAccountingStrategyDetail> getDetailByCode(@RequestParam("code") String code); |
| | | /** |
| | | * 校验充电桩计费模版是否准确 |
| | | * @param |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-accounting-strategy-detail/checkChargingStrategy") |
| | | R<Boolean> checkChargingStrategy(@RequestBody CheckChargingStrategyDTO dto); |
| | | } |
| | |
| | | @TableField("two_audit_time") |
| | | private LocalDateTime twoAuditTime; |
| | | |
| | | |
| | | @ApiModelProperty(value = "父级id 上一次已审核通过的id 为空则代表是新增,或者本次数据状态审核中或已拒绝") |
| | | @TableField("parent_id") |
| | | private Integer parentId; |
| | | |
| | | } |
| | |
| | | return R.fail("读取实时监测数据调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> endCharge(EndCharge endCharge) { |
| | | return R.fail("充电结束调用失败:" + throwable.getMessage()); |
| | | } |
| | | // @Override |
| | | // public R<String> endCharge(EndCharge endCharge) { |
| | | // return R.fail("充电结束调用失败:" + throwable.getMessage()); |
| | | // } |
| | | |
| | | @Override |
| | | public R<String> platformConfirmationCharging(PlatformConfirmationCharging platformConfirmationCharging) { |
| | |
| | | * @param endCharge 实体对象 |
| | | * @return |
| | | */ |
| | | @PostMapping("/sendMessage/sendMessageendCharge") |
| | | public R<String> endCharge(@RequestBody EndCharge endCharge); |
| | | // @PostMapping("/sendMessage/sendMessageendCharge") |
| | | // public R<String> endCharge(@RequestBody EndCharge endCharge); |
| | | |
| | | /** |
| | | * 运营平台确认启动充电 |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "acquisition_billing_mode") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class AcquisitionBillingMode extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code;// 桩编码 |
| | | |
| | | } |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | @Document(collection = "acquisition_billing_mode_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class AcquisitionBillingModeReply extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code;// 桩编码 |
| | | private String billing_model_code;// "计费模型编号 |
| | | private BigDecimal sharp_peak_electricity_rate;// 尖费电费费率(精确到五位小数) |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "billing_mode_verify") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BillingModeVerify extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code;// 桩编码 |
| | | private String billing_model_code;// "计费模型编号,首次连接到平台时置零 |
| | | |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "billing_mode_verify_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BillingModeVerifyReply extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; // 桩编 |
| | | private String billing_model_code; // 计费模型编 |
| | | private Integer billing_model_result; // 验证结果(0:桩计费模型与平台一致,1:桩计费模型与平台不一致) |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | @Document(collection = "bms_abort") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BmsAbort extends BaseModel { |
| | | |
| | | @Id |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | @Document(collection = "bms_demand_and_charger_exportation") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BmsDemandAndChargerExportation extends BaseModel { |
| | | |
| | | @Id |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | @Document(collection = "bms_information") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BmsInformation extends BaseModel { |
| | | |
| | | @Id |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "upload_real_time_monitoring_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ChargingOrderAndUploadRealTimeMonitoringDataDto extends BaseModel { |
| | | |
| | | @Id |
| | | private String id; |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "charging_pile_returns_ground_lock_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ChargingPileReturnsGroundLockData extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; //桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer control_state; // 地锁控制返回标志(1:鉴权成功,0:鉴权失败) |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "charging_pile_starts_charging") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ChargingPileStartsCharging extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer start_method; // 启动方式(1:表示通过刷卡启动充电,2:表示通过帐号启动充电(暂不支持),3:表示vin码启动充电) |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "clear_offline_card") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ClearOfflineCard extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer physical_card_number; // 清除离线卡的个数,最大 24 个 |
| | | private String physical_card1; // 第 1 个卡物理卡号,离线卡物理卡号 |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "clear_offline_card_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ClearOfflineCardReply extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; //桩编码 |
| | | private String physical_card1; // 第 1 个卡物理卡号,离线卡物理卡号 |
| | | private String physical_card2; |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "confirm_transaction_record") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ConfirmTransactionRecord extends BaseModel { |
| | | |
| | | @Id |
| | | private String transaction_serial_number;// 桩编码 |
| | | private Integer confirm_result;// 确认结果(0:上传成功,1:非法账单) |
| | | |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | @Document(collection = "end_charge") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class EndCharge extends BaseModel { |
| | | |
| | | @Id |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | @Document(collection = "error_message") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ErrorMessage extends BaseModel { |
| | | |
| | | @Id |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "ground_lock_real_time_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class GroundLockRealTimeData extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; //桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer parking_lock_status; // 车位锁状态(0:未到位状态,1:升锁到位状态,2:降锁到位状态) |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "motor_abort") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class MotorAbort extends BaseModel { |
| | | |
| | | @Id |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "online") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class Online extends BaseModel { |
| | | @Id |
| | | private String charging_pile_code;// 充电桩编号 |
| | | private Integer charging_pile_type;// 充电桩类型(0 表示直流桩,1 表示交流桩) |
| | | private Integer charging_gun_number;// 充电枪数量 |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "online_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class OnlineReply extends BaseModel { |
| | | @Id |
| | | private String charging_pile_code;// 桩编码 |
| | | private Integer online_result;// 登陆结果(0:成功,1:失败) |
| | | } |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "open_or_close_ground_lock") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class OpenOrCloseGroundLock extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; //桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer operate; // 升/降地锁(1:升锁,2:降锁) |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | @Document(collection = "parameter_setting") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ParameterSetting extends BaseModel { |
| | | |
| | | @Id |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "ping") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class Ping extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | private Integer charging_gun_status;// 抢状态(0:正常,1:故障) |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | @Document(collection = "platform_confirmation_charging") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformConfirmationCharging extends BaseModel { |
| | | |
| | | @Id |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "platform_remote_update") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformRemoteUpdate extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer charging_pile_type; // 桩型号(1:直流,2:交流) |
| | | private Integer charging_pile_power; // 桩功率 |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "platform_remote_update_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformRemoteUpdateReply extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer escalation_state; // 升级状态(0:成功,1:编码错误,2:程序与桩型号不符,3:下载更新文件超时) |
| | | |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "platform_restart") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformRestart extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer operate; // 执行控制 (1:立即执行,2:空闲执行) |
| | | |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "platform_restart_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformRestartReply extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer set_result; // 设置结果(0:失败,1:成功) |
| | | |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | @Document(collection = "platform_start_charging_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformStartChargingReply extends BaseModel { |
| | | |
| | | @Id |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "platform_stop_charging") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformStopCharging extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | @Document(collection = "platform_stop_charging_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformStopChargingReply extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer stop_result; // 停止结果(0:失败,1:成功) |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "pong") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class Pong extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | private Integer charging_gun_status;// 心跳应答(0) |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "query_offline_card") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class QueryOfflineCard extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer physical_card_number; //桩编码 |
| | | private String physical_card1; // 第 1 个卡物理卡号,离线卡物理卡号 |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "query_offline_card_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class QueryOfflineCardReply extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; //桩编码 |
| | | private String physical_card1; // 第 1 个卡物理卡号,离线卡物理卡号 |
| | | private String physical_card2; |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "read_real_time_monitoring_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ReadRealTimeMonitoringData extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | @Document(collection = "setup_billing_model") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class SetupBillingModel extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; //桩编码 |
| | | private String billing_model_code; // 计费模型编号 |
| | | private BigDecimal sharp_peak_electricity_rate; // 尖费电费费率(精确到五位小数) |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "setup_billing_model_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class SetupBillingModelReply extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; //桩编码 |
| | | private String set_result; //设置结果(0:失败,1:成功) |
| | | |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "synchronize_offline_card") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class SynchronizeOfflineCard extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer card_number; // 下发卡个数 |
| | | private String card1; // 第 1 个卡逻辑卡号,离线卡逻辑卡号 |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | @Document(collection = "synchronize_offline_card_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class SynchronizeOfflineCardReply extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer save_result; // 保存结果(0:失败,1:成功) |
| | | private Integer failure_cause; // 失败原因(1:卡号格式错误,2:储存空间不足) |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "timing_setting") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class TimingSetting extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; //桩编码 |
| | | private String current_time; //当前时间 |
| | | } |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "timing_setting_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class TimingSettingReply extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; //桩编码 |
| | | private String current_time; //当前时间 |
| | | } |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | @Document(collection = "transaction_record") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class TransactionRecord extends BaseModel { |
| | | |
| | | @Id |
| | | private String transaction_serial_number;// 交易流水号 |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | @Document(collection = "update_balance") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class UpdateBalance extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | private String physical_card_number;// 物理卡号 |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | @Document(collection = "update_balance_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class UpdateBalanceReply extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; //桩编码 |
| | | private String physical_card_number; //物理卡号 |
| | | private BigDecimal account_balance; //修改结果(:0:修改成功,1:设备编号错误,2:卡号错误) |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | @Document(collection = "upload_real_time_monitoring_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class UploadRealTimeMonitoringData extends BaseModel { |
| | | |
| | | @Id |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | |
| | | |
| | | private BigDecimal period_service_price;// @ApiModelProperty("时段服务费") |
| | | |
| | | private BigDecimal period_charging_degree;// @ApiModelProperty("时段充电度数") |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "working_parameter_setting") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class WorkingParameterSetting extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer allow_work;// 是否允许工作(0:表示允许正常工作,1:表示停止使用,锁定充电桩) |
| | | private Integer maximum_output_power; // 充电桩最大允许输出功率 |
| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | |
| | | @Document(collection = "working_parameter_setting_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class WorkingParameterSettingReply extends BaseModel { |
| | | |
| | | @Id |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer set_result; //设置结果(0:失败,1:成功) |
| | | } |
| | |
| | | @Override |
| | | public void chargeMonitoring(UploadRealTimeMonitoringDataQuery query) { |
| | | } |
| | | |
| | | @Override |
| | | public R<TChargingOrder> getOrderByCode(String code) { |
| | | return R.fail("通过流水号查询订单调用失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.order.api.query.TChargingCountQuery; |
| | | import com.ruoyi.order.api.query.UploadRealTimeMonitoringDataQuery; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | @PostMapping(value = "/t-charging-order/chargeMonitoring") |
| | | void chargeMonitoring(@RequestBody UploadRealTimeMonitoringDataQuery query); |
| | | |
| | | /** |
| | | * 通过流水号查询订单 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/t-charging-order/getOrderByCode/{code}") |
| | | R<TChargingOrder> getOrderByCode(@PathVariable("code") String code); |
| | | } |
| | |
| | | @TableField("refund_amount") |
| | | private BigDecimal refundAmount; |
| | | |
| | | @ApiModelProperty(value = "累计服务费") |
| | | @TableField("service_charge") |
| | | private BigDecimal serviceCharge; |
| | | |
| | | @ApiModelProperty(value = "累计电费") |
| | | @TableField("electrovalence") |
| | | private BigDecimal electrovalence; |
| | | |
| | | @ApiModelProperty(value = "退款状态(1=退款中,2=退款成功)") |
| | | @TableField("refund_status") |
| | | private Integer refundStatus; |
| | |
| | | @TableField("pay_time") |
| | | private LocalDateTime payTime; |
| | | |
| | | @ApiModelProperty(value = "累计服务费") |
| | | @TableField("service_charge") |
| | | private BigDecimal serviceCharge; |
| | | |
| | | @ApiModelProperty(value = "累计电费") |
| | | @TableField("electrovalence") |
| | | private BigDecimal electrovalence; |
| | | } |
| | |
| | | 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 io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "开票时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @TableField("billing_time") |
| | | private LocalDateTime billingTime; |
| | | |
| | |
| | | @ApiModelProperty(value = "增值服务费税率") |
| | | @TableField("added_service_tariff") |
| | | private BigDecimal addedServiceTariff; |
| | | |
| | | @ApiModelProperty(value = "'电费'") |
| | | @TableField("electrovalence") |
| | | private BigDecimal electrovalence; |
| | | @ApiModelProperty(value = "'服务费'") |
| | | @TableField("service_charge") |
| | | private BigDecimal serviceCharge; |
| | | @ApiModelProperty(value = "'增值服务费'") |
| | | @TableField("added_service") |
| | | private BigDecimal addedService; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.query; |
| | | |
| | | import com.ruoyi.common.core.query.TimeRangePageQuery; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "发票管理Query") |
| | | public class TOrderInvoiceQuery extends TimeRangePageQuery { |
| | | |
| | | @ApiModelProperty(value = "开票公司") |
| | | private String invoicingCompany; |
| | | |
| | | @ApiModelProperty(value = "发票类型") |
| | | private String invoiceType; |
| | | |
| | | @ApiModelProperty(value = "抬头类型(1=个人,2=企业)") |
| | | private Integer invoicingObjectType; |
| | | |
| | | @ApiModelProperty(value = "发票种类(1=纸质发票,2=电子发票)") |
| | | private Integer invoiceMaterial; |
| | | |
| | | @ApiModelProperty(value = "开票方式(1=人工,2=自动)") |
| | | private Integer invoicingMethod; |
| | | |
| | | @ApiModelProperty(value = "申请人电话") |
| | | private String userPhone; |
| | | |
| | | @ApiModelProperty(value = "申请人姓名") |
| | | private String nickName; |
| | | |
| | | @ApiModelProperty(value = "公司名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "用户id 前端忽略") |
| | | private List<Long> userIds; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.vo; |
| | | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "ChargingBillVO对象",description = "充电算帐单") |
| | | public class ChargingBillVO { |
| | | @ApiModelProperty(value = "充电总度数") |
| | | private BigDecimal chargingCapacity; |
| | | @ApiModelProperty(value = "实收金额") |
| | | private BigDecimal paymentAmount; |
| | | @ApiModelProperty(value = "订单总金额") |
| | | private BigDecimal orderAmount; |
| | | @ApiModelProperty(value = "累计电费") |
| | | private BigDecimal electrovalence; |
| | | @ApiModelProperty(value = "累计服务费") |
| | | private BigDecimal serviceCharge; |
| | | @ApiModelProperty(value = "订单数量") |
| | | private Integer orderCount; |
| | | @ApiModelProperty(value = "平台手续费") |
| | | private String commissionAmount; |
| | | @ApiModelProperty(value = "三方平台分佣") |
| | | private String sharingAmount; |
| | | @ApiModelProperty(value = "优惠抵扣") |
| | | private String discount; |
| | | @ApiModelProperty(value = "列表数据") |
| | | private PageInfo<ChargingOrderListVO> list; |
| | | } |
| | |
| | | @ApiModelProperty(value = "手机号") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "累计电费") |
| | | private BigDecimal electrovalence; |
| | | @ApiModelProperty(value = "累计服务费") |
| | | private BigDecimal serviceCharge; |
| | | |
| | | @ApiModelProperty(value = "时段数") |
| | | private Integer count; |
| | | @ApiModelProperty(value = "1明星充电 2快电 3新电途") |
| | |
| | | private String gunName; |
| | | @ApiModelProperty(value = "枪号") |
| | | private String gunNumber; |
| | | @ApiModelProperty(value = "结束方式(0=异常终止,1=主动终止,2=满电终止,3=费用不足终止)") |
| | | private Integer endMode; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.vo; |
| | | |
| | | import com.ruoyi.order.api.model.TOrderInvoice; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "发票管理VO") |
| | | public class TOrderInvoiceVO extends TOrderInvoice { |
| | | |
| | | @ApiModelProperty(value = "电费税率") |
| | | private BigDecimal electricityTariff; |
| | | |
| | | @ApiModelProperty(value = "服务费税率") |
| | | private BigDecimal serviceTariff; |
| | | |
| | | @ApiModelProperty(value = "增值服务费税率") |
| | | private BigDecimal addedServiceTariff; |
| | | @ApiModelProperty(value = "电费") |
| | | private BigDecimal electrovalence; |
| | | @ApiModelProperty(value = "服务费") |
| | | private BigDecimal serviceCharge; |
| | | @ApiModelProperty(value = "增值服务费") |
| | | private BigDecimal addedService; |
| | | @ApiModelProperty(value = "用户电话") |
| | | private String userPhone; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserRoleClient; |
| | | import com.ruoyi.system.api.model.*; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Component |
| | | public class SysUserRoleFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory<SysUserRoleClient> { |
| | | @Override |
| | | public SysUserRoleClient create(Throwable cause) { |
| | | return new SysUserRoleClient(){ |
| | | |
| | | |
| | | @Override |
| | | public R<List<SysUserRoleVo>> getRoleByUserId(Long userId) { |
| | | return R.fail("根据用户id获取角色失败:" + cause.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.factory.SysUserRoleFallbackFactory; |
| | | import com.ruoyi.system.api.model.SysUserRoleVo; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2024/9/4 9:49 |
| | | */ |
| | | @FeignClient(contextId = "SysUserRoleClient", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = SysUserRoleFallbackFactory.class) |
| | | public interface SysUserRoleClient { |
| | | |
| | | |
| | | /** |
| | | * 根据用户id获取角色 |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @PostMapping("/userRole/getRoleByUserId") |
| | | R<List<SysUserRoleVo>> getRoleByUserId(@RequestParam("userId") Long userId); |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.api.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | |
| | | /** |
| | | * 用户和角色关联 sys_user_role |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SysUserRoleVo |
| | | { |
| | | /** 用户ID */ |
| | | @TableField("user_id") |
| | | private Long userId; |
| | | |
| | | /** 角色ID */ |
| | | @TableField("role_id") |
| | | private Long roleId; |
| | | |
| | | public Long getUserId() |
| | | { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Long userId) |
| | | { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public Long getRoleId() |
| | | { |
| | | return roleId; |
| | | } |
| | | |
| | | public void setRoleId(Long roleId) |
| | | { |
| | | this.roleId = roleId; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("userId", getUserId()) |
| | | .append("roleId", getRoleId()) |
| | | .toString(); |
| | | } |
| | | } |
| | |
| | | com.ruoyi.system.api.factory.SysUserFallbackFactory |
| | | com.ruoyi.system.api.factory.SysRoleFallbackFactory |
| | | com.ruoyi.system.api.factory.SysLoginLogFallbackFactory |
| | | com.ruoyi.system.api.factory.SysUserRoleFallbackFactory |
| | |
| | | return LocalTime.parse(time, formatter); |
| | | } |
| | | |
| | | /** |
| | | * localdatetime转为字符串 |
| | | * |
| | | * @param time localdatetime |
| | | * @return 字符串 |
| | | */ |
| | | public static String localDateTimeToString(LocalDateTime time) { |
| | | DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | return df.format(time); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.controller; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.model.SysUserRoleVo; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | | import com.ruoyi.system.service.ISysUserRoleService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | |
| | | public AjaxResult remove(@PathVariable Long[] userIds) { |
| | | return toAjax(sysUserRoleService.deleteSysUserRoleByUserIds(userIds)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据用户id获取角色 |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @PostMapping("/getRoleByUserId") |
| | | public R<List<SysUserRoleVo>> getRoleByUserId(@RequestParam("userId") Long userId){ |
| | | List<SysUserRole> list = sysUserRoleService.list(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId)); |
| | | List<SysUserRoleVo> data = new ArrayList<>(); |
| | | for (SysUserRole sysUserRole : list) { |
| | | SysUserRoleVo vo = new SysUserRoleVo(); |
| | | BeanUtils.copyProperties(sysUserRole, vo); |
| | | data.add(vo); |
| | | } |
| | | return R.ok(data); |
| | | } |
| | | } |
| | |
| | | .eq(TAppUser::getPhone,phone) |
| | | .last("LIMIT 1"))); |
| | | } |
| | | /** |
| | | * 通过手机号模糊查询用户 |
| | | * @param phone |
| | | * @return |
| | | */ |
| | | @GetMapping("/user/selectByPhoneLike") |
| | | public R<List<TAppUser>> selectByPhoneLike(@RequestParam("phone") String phone){ |
| | | return R.ok(appUserService.list(Wrappers.lambdaQuery(TAppUser.class) |
| | | .eq(TAppUser::getPhone,phone))); |
| | | } |
| | | |
| | | @ApiOperation(value = "签到", tags = {"小程序-个人中心-签到"}) |
| | | @GetMapping(value = "/user/sign") |
| | |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.SteategyPassDto; |
| | | import com.ruoyi.common.core.enums.AuditStateEnum; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BaseDelete; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | |
| | | import java.time.LocalTime; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | import static com.ruoyi.common.core.context.SecurityContextHolder.getUserId; |
| | | |
| | |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryAccountingStrategyDetailByStrategyId(@RequestParam("strategyId") Integer strategyId) { |
| | | List<TAccountingStrategyDetailVO> list = accountingStrategyDetailService.queryAccountingStrategyDetailByStrategyId(strategyId); |
| | | list.forEach(detail -> { |
| | | detail.setTotalPrice(detail.getElectrovalence().add(detail.getElectrovalence())); |
| | | detail.setTotalPrice(detail.getElectrovalence().add(detail.getServiceCharge())); |
| | | }); |
| | | return AjaxResult.ok(list); |
| | | } |
| | |
| | | // 添加明细 |
| | | dto.getAccountingStrategyDetails().forEach(detail -> detail.setAccountingStrategyId(dto.getId())); |
| | | accountingStrategyDetailService.saveBatch(dto.getAccountingStrategyDetails()); |
| | | // TODO 硬件 同步策略到充电桩 |
| | | return AjaxResult.ok(dto.getId()); |
| | | } |
| | | |
| | |
| | | @Log(title = "修改计费策略", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-计费策略", "管理后台-站点管理"},value = "修改计费策略") |
| | | @PostMapping(value = "/update") |
| | | public AjaxResult<Boolean> update(@RequestBody TAccountingStrategyDTO dto) { |
| | | public AjaxResult<String> update(@RequestBody TAccountingStrategyDTO dto) { |
| | | Boolean flag = accountingStrategyDetailService.isStrategy24Hour(dto.getAccountingStrategyDetails()); |
| | | if(flag){ |
| | | return AjaxResult.error("计费模板时间设置有误差"); |
| | | } |
| | | // 判断修改的计费策略是否为已通过 |
| | | if(dto.getAuditStatus() == 3 || dto.getAuditStatus() == 4){ |
| | | // 查询是否有下级审核中的策略 |
| | | TAccountingStrategy children = accountingStrategyService.getOne(Wrappers.lambdaQuery(TAccountingStrategy.class) |
| | | .eq(TAccountingStrategy::getParentId, dto.getId()) |
| | | .ne(TAccountingStrategy::getAuditStatus, Arrays.asList(3,4))); |
| | | if(Objects.nonNull(children)){ |
| | | // 删除计费策略明细信息 |
| | | accountingStrategyDetailService.remove(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, dto.getId())); |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, children.getId())); |
| | | dto.setAuditStatus(1); |
| | | accountingStrategyService.updateById(dto); |
| | | // 添加明细 |
| | | dto.getAccountingStrategyDetails().forEach(detail -> detail.setAccountingStrategyId(dto.getId())); |
| | | // TODO 硬件 同步策略到充电桩 |
| | | return AjaxResult.ok(accountingStrategyDetailService.saveBatch(dto.getAccountingStrategyDetails())); |
| | | accountingStrategyDetailService.saveBatch(dto.getAccountingStrategyDetails()); |
| | | }else { |
| | | Long userId = SecurityUtils.getLoginUser().getUserid(); |
| | | dto.setUserId(userId); |
| | | dto.setAuditStatus(1); |
| | | dto.setId(null); |
| | | dto.setParentId(dto.getId()); |
| | | accountingStrategyService.save(dto); |
| | | // 添加明细 |
| | | List<TAccountingStrategyDetail> accountingStrategyDetails = dto.getAccountingStrategyDetails(); |
| | | accountingStrategyDetails.forEach(detail -> { |
| | | detail.setAccountingStrategyId(dto.getId()); |
| | | detail.setId(null); |
| | | }); |
| | | accountingStrategyDetailService.saveBatch(accountingStrategyDetails); |
| | | } |
| | | }else { |
| | | // 删除计费策略明细信息 |
| | | accountingStrategyDetailService.remove(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, dto.getId())); |
| | | dto.setAuditStatus(1); |
| | | accountingStrategyService.updateById(dto); |
| | | // 添加明细 |
| | | dto.getAccountingStrategyDetails().forEach(detail -> detail.setAccountingStrategyId(dto.getId())); |
| | | accountingStrategyDetailService.saveBatch(dto.getAccountingStrategyDetails()); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 查看计费策略详情-修改后 |
| | | */ |
| | | @ApiOperation(tags = {"后台-计费策略", "管理后台-站点管理"},value = "查看计费策略详情修改后children的数据") |
| | | @GetMapping(value = "/getDetailChildrenById") |
| | | public AjaxResult<TAccountingStrategyVO> getDetailChildrenById(@RequestParam("id") Integer id) { |
| | | TAccountingStrategyVO accountingStrategyVO = new TAccountingStrategyVO(); |
| | | // 先查询children对象 |
| | | TAccountingStrategy children = accountingStrategyService.getOne(Wrappers.lambdaQuery(TAccountingStrategy.class) |
| | | .eq(TAccountingStrategy::getParentId, id) |
| | | .orderByDesc(TAccountingStrategy::getCreateTime) |
| | | .last("LIMIT 1")); |
| | | if(Objects.nonNull(children)){ |
| | | BeanUtils.copyProperties(children,accountingStrategyVO); |
| | | // 查询用户信息 |
| | | if(null != children.getFirstUserId()){ |
| | | String firstUserName = sysUserClient.getSysUser(children.getFirstUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setFirstUserName(firstUserName); |
| | | } |
| | | if(null != children.getTwoUserId()){ |
| | | String twoUserName = sysUserClient.getSysUser(children.getTwoUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setTwoUserName(twoUserName); |
| | | } |
| | | accountingStrategyVO.setAccountingStrategyDetailList(accountingStrategyDetailService.list(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, children.getId()))); |
| | | }else { |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getById(id); |
| | | BeanUtils.copyProperties(accountingStrategy,accountingStrategyVO); |
| | | // 查询用户信息 |
| | | if(null != accountingStrategy.getFirstUserId()){ |
| | | String firstUserName = sysUserClient.getSysUser(accountingStrategy.getFirstUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setFirstUserName(firstUserName); |
| | | } |
| | | if(null != accountingStrategy.getTwoUserId()){ |
| | | String twoUserName = sysUserClient.getSysUser(accountingStrategy.getTwoUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setTwoUserName(twoUserName); |
| | | } |
| | | accountingStrategyVO.setAccountingStrategyDetailList(accountingStrategyDetailService.list(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, id))); |
| | | } |
| | | return AjaxResult.ok(accountingStrategyVO); |
| | | } |
| | | |
| | | /** |
| | | * 删除计费策略 |
| | | */ |
| | | @Log(title = "删除计费策略", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-计费策略"},value = "删除计费策略") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam("id") Integer id) { |
| | | // 判断策略是否在使用 |
| | | long count = siteService.count(Wrappers.lambdaQuery(Site.class) |
| | | .eq(Site::getAccountingStrategyId, id)); |
| | | if(count>0){ |
| | | return AjaxResult.error("该计费策略正在使用中,无法删除"); |
| | | } |
| | | // 刪除计费策略明细信息 |
| | | accountingStrategyDetailService.remove(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, id)); |
| | |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public AjaxResult<Boolean> deleteByIds(@RequestParam String ids) { |
| | | String[] split = ids.split(","); |
| | | // 判断策略是否在使用 |
| | | long count = siteService.count(Wrappers.lambdaQuery(Site.class) |
| | | .in(Site::getAccountingStrategyId, Arrays.asList(split))); |
| | | if(count>0){ |
| | | return AjaxResult.error("该计费策略正在使用中,无法删除"); |
| | | } |
| | | // 刪除计费策略明细信息 |
| | | accountingStrategyDetailService.remove(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .in(TAccountingStrategyDetail::getAccountingStrategyId, Arrays.asList(split))); |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.dto.CheckChargingStrategyDTO; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.vo.StrategyPriceVO; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyDetailVO; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyDetailService; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | |
| | | public class TAccountingStrategyDetailController { |
| | | |
| | | private final ISiteService siteService; |
| | | private final TChargingPileService chargingPileService; |
| | | private final TAccountingStrategyService accountingStrategyService; |
| | | private final TAccountingStrategyDetailService accountingStrategyDetailService; |
| | | |
| | | @Autowired |
| | | public TAccountingStrategyDetailController(ISiteService siteService, TAccountingStrategyService accountingStrategyService, TAccountingStrategyDetailService accountingStrategyDetailService) { |
| | | public TAccountingStrategyDetailController(ISiteService siteService, TChargingPileService chargingPileService, TAccountingStrategyService accountingStrategyService, TAccountingStrategyDetailService accountingStrategyDetailService) { |
| | | this.siteService = siteService; |
| | | this.chargingPileService = chargingPileService; |
| | | this.accountingStrategyService = accountingStrategyService; |
| | | this.accountingStrategyDetailService = accountingStrategyDetailService; |
| | | } |
| | |
| | | .last(" and DATE_FORMAT(now(), '%H:%i') between start_time and end_time")); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | /** |
| | | * 通过站点id查询当前时段使用的策略明细 |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | @PostMapping("/getDetailBySiteId") |
| | | public R<TAccountingStrategyDetail> getDetailBySiteId(@RequestParam("siteId") Integer siteId){ |
| | | Site site = siteService.getById(siteId); |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getById(site.getAccountingStrategyId()); |
| | | TAccountingStrategyDetail one = accountingStrategyDetailService.getOne(Wrappers.<TAccountingStrategyDetail>lambdaQuery() |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, accountingStrategy.getId()) |
| | | .last(" and DATE_FORMAT(now(), '%H:%i') between start_time and end_time")); |
| | | return R.ok(one); |
| | | } |
| | | /** |
| | | * 通过桩id查询当前时段使用的策略明细 |
| | | * @param code 设备编号 |
| | | * @return |
| | | */ |
| | | @PostMapping("/getDetailByCode") |
| | | public R<TAccountingStrategyDetail> getDetailByPileId(@RequestParam("code") String code){ |
| | | // 查询桩 |
| | | TChargingPile chargingPile = chargingPileService.getOne(Wrappers.lambdaQuery(TChargingPile.class) |
| | | .eq(TChargingPile::getCode,code) |
| | | .last("LIMIT 1")); |
| | | if(Objects.isNull(chargingPile)){ |
| | | return R.fail("未查询到该桩设备"); |
| | | } |
| | | Site site = siteService.getById(chargingPile.getSiteId()); |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getById(site.getAccountingStrategyId()); |
| | | TAccountingStrategyDetail one = accountingStrategyDetailService.getOne(Wrappers.<TAccountingStrategyDetail>lambdaQuery() |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, accountingStrategy.getId()) |
| | | .last(" and DATE_FORMAT(now(), '%H:%i') between start_time and end_time")); |
| | | return R.ok(one); |
| | | } |
| | | /** |
| | | * 校验充电桩计费模版是否准确 |
| | | * @param |
| | | * @return |
| | | */ |
| | | @PostMapping("/checkChargingStrategy") |
| | | public R<Boolean> checkChargingStrategy(@RequestBody CheckChargingStrategyDTO dto){ |
| | | // 查询桩 |
| | | TChargingPile chargingPile = chargingPileService.getOne(Wrappers.lambdaQuery(TChargingPile.class) |
| | | .eq(TChargingPile::getCode,dto.getCode()) |
| | | .last("LIMIT 1")); |
| | | if(Objects.isNull(chargingPile)){ |
| | | return R.ok(false); |
| | | } |
| | | Site site = siteService.getById(chargingPile.getSiteId()); |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getById(site.getAccountingStrategyId()); |
| | | TAccountingStrategyDetail one = accountingStrategyDetailService.getOne(Wrappers.<TAccountingStrategyDetail>lambdaQuery() |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, accountingStrategy.getId()) |
| | | .last(" and DATE_FORMAT(now(), '%H:%i') between start_time and end_time")); |
| | | return R.ok(dto.getStrategyDetailId().equals(one.getId())); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.integration.api.feignClient.IntegrationClient; |
| | | import com.ruoyi.integration.api.model.EndCharge; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @RequestMapping("/t-charging-gun") |
| | | public class TChargingGunController { |
| | | |
| | | private final TChargingGunService chargingGunService; |
| | | @Autowired |
| | | private TChargingGunService chargingGunService; |
| | | @Autowired |
| | | private IntegrationClient integrationClient; |
| | | |
| | | @Resource |
| | | private TChargingPileService chargingPileService; |
| | | @Resource |
| | | private ISiteService siteService; |
| | | |
| | | @Autowired |
| | | public TChargingGunController(TChargingGunService chargingGunService) { |
| | | this.chargingGunService = chargingGunService; |
| | | } |
| | | |
| | | /** |
| | | * 查询充电枪列表 |
| | |
| | | @PutMapping(value = "/stopCharging") |
| | | public AjaxResult<String> stopCharging(@RequestParam("id") Integer id) { |
| | | // TODO 硬件 结束充电 |
| | | // EndCharge endCharge = new EndCharge(); |
| | | // integrationClient.endCharge(endCharge); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserRoleClient; |
| | | import com.ruoyi.system.api.model.SysUserRoleVo; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private AppUserClient appUserClient; |
| | | @Resource |
| | | private VipClient vipClient; |
| | | @Resource |
| | | private SysUserRoleClient sysUserRoleClient; |
| | | |
| | | |
| | | |
| | |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(sysUser.getRoleId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | if(data2.size() > 0){ |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | | data.addAll(data1); |
| | | } |
| | | ids = new HashSet<>(data); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.query.TAccountingStrategyQuery; |
| | |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public PageInfo<TAccountingStrategyVO> pageList(TAccountingStrategyQuery query) { |
| | | PageInfo<TAccountingStrategyVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | List<TAccountingStrategyVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | List<Integer> parentIds = list.stream().map(TAccountingStrategyVO::getId).collect(Collectors.toList()); |
| | | List<TAccountingStrategy> list1 = this.list(Wrappers.lambdaQuery(TAccountingStrategy.class) |
| | | .in(TAccountingStrategy::getParentId, parentIds) |
| | | .in(TAccountingStrategy::getAuditStatus, Arrays.asList(1,2))); |
| | | for (TAccountingStrategyVO tAccountingStrategyVO : list) { |
| | | SysUser data = sysUserClient.getSysUser(tAccountingStrategyVO.getUserId()).getData(); |
| | | tAccountingStrategyVO.setUserName(data.getNickName()); |
| | |
| | | SysUser two = sysUserClient.getSysUser(tAccountingStrategyVO.getUserId()).getData(); |
| | | tAccountingStrategyVO.setTwoUserName(two==null?null:two.getNickName()); |
| | | } |
| | | // 匹配编辑后的未审核的 |
| | | List<TAccountingStrategy> accountingStrategies = list1.stream().filter(e -> e.getParentId().equals(tAccountingStrategyVO.getId())) |
| | | .sorted(Comparator.comparing(TAccountingStrategy::getCreateTime).reversed()).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(accountingStrategies)){ |
| | | TAccountingStrategy tAccountingStrategy = accountingStrategies.get(0); |
| | | tAccountingStrategyVO.setAuditStatus(tAccountingStrategy.getAuditStatus()); |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | |
| | | </sql> |
| | | <select id="queryAccountingStrategyDetailByStrategyId" resultType="com.ruoyi.chargingPile.api.vo.TAccountingStrategyDetailVO"> |
| | | SELECT |
| | | tasd.id, tasd.accounting_strategy_id, tasd.`type`, tasd.start_time, tasd.end_time, tasd.electrovalence, tasd.service_charge, |
| | | tasd.cost_service_charge,tas.discount |
| | | tasd.id, tasd.accounting_strategy_id, tasd.`type`, tasd.start_time, tasd.end_time, ROUND(tasd.electrovalence,4) AS electrovalence, |
| | | ROUND(tasd.service_charge,4) AS serviceCharge,ROUND(tasd.cost_service_charge,4) AS costServiceCharge,tas.discount |
| | | FROM t_accounting_strategy_detail tasd |
| | | LEFT JOIN t_accounting_strategy tas ON tas.id = tasd.accounting_strategy_id |
| | | <where> |
| | |
| | | <result column="two_audit_time" property="twoAuditTime" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="del_flag" property="delFlag" /> |
| | | <result column="parent_id" property="parentId" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, site_id, `name`, description, discount,first_user_id,two_user_id,first_remark,two_remark,audit_status,first_audit_time,two_audit_time, create_time, del_flag |
| | | id, site_id, `name`, description, discount,first_user_id,two_user_id,first_remark,two_remark,audit_status,first_audit_time,two_audit_time, create_time, del_flag,parent_id |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.chargingPile.api.vo.TAccountingStrategyVO"> |
| | | SELECT |
| | | id, site_id, `name`, description, discount,first_user_id,two_user_id,first_remark,two_remark,audit_status,first_audit_time,two_audit_time, create_time, del_flag,user_id |
| | | id, site_id, `name`, description, discount,first_user_id,two_user_id,first_remark,two_remark,audit_status,first_audit_time,two_audit_time, create_time, del_flag,user_id,parent_id |
| | | FROM t_accounting_strategy |
| | | <where> |
| | | <if test="query.name != null and query.name != ''"> |
| | |
| | | AND audit_status = #{query.auditStatus} |
| | | </if> |
| | | AND site_id IS NULL |
| | | AND (parent_id IS NULL OR audit_status = 3 OR audit_status = 4) |
| | | AND del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY create_time DESC |
| | |
| | | |
| | | <select id="getPlatformAccountingStrategy" resultType="com.ruoyi.chargingPile.api.vo.TAccountingStrategyVO"> |
| | | SELECT |
| | | id, site_id, `name`, description, discount,first_user_id,two_user_id,first_remark,two_remark,audit_status,first_audit_time,two_audit_time, create_time, del_flag |
| | | id, site_id, `name`, description, discount,first_user_id,two_user_id,first_remark,two_remark,audit_status,first_audit_time,two_audit_time, create_time, del_flag,parent_id |
| | | FROM t_accounting_strategy where del_flag = 0 and site_id is not null order by create_time desc |
| | | </select> |
| | | </mapper> |
| | |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-order</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-chargingPile</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
New file |
| | |
| | | package com.ruoyi.integration.iotda.constant; |
| | | |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @Date 2024/8/22 15:28 |
| | | */ |
| | | public class SendTagConstant { |
| | | /** |
| | | * 充电桩登录认证 |
| | | */ |
| | | public static final String ONLINE ="online"; |
| | | /** |
| | | * 充电桩心跳包 |
| | | */ |
| | | public static final String PING ="ping"; |
| | | /** |
| | | * 充电结束 |
| | | */ |
| | | public static final String END_CHARGE = "end_charge"; |
| | | /** |
| | | * 计费模型验证请求 |
| | | */ |
| | | public static final String BILLING_MODE_VERIFY ="billing_mode_verify"; |
| | | /** |
| | | * 充电桩计费模型请求 |
| | | */ |
| | | public static final String ACQUISITION_BILLING_MODE ="acquisition_billing_mode"; |
| | | /** |
| | | * 上传实时监测数据 |
| | | */ |
| | | public static final String UPLOAD_REAL_TIME_MONITORING_DATA ="upload_real_time_monitoring_data"; |
| | | /** |
| | | * 充电握手 |
| | | */ |
| | | public static final String CHARGING_HANDSHAKE ="charging_handshake"; |
| | | /** |
| | | * 充电阶段BMS中止 |
| | | */ |
| | | public static final String BMS_ABORT ="bms_abort"; |
| | | /** |
| | | * 充电阶段充电机中止 |
| | | */ |
| | | public static final String MOTOR_ABORT ="motor_abort"; |
| | | /** |
| | | * 充电过程BMS需求、充电机输出 |
| | | */ |
| | | public static final String BMS_DEMAND_AND_CHARGER_EXPORTATION ="bms_demand_and_charger_exportation"; |
| | | /** |
| | | * 充电过程BMS信息 |
| | | */ |
| | | public static final String BMS_INFORMATION ="bms_information"; |
| | | /** |
| | | * 充电桩主动申请启动充电 |
| | | */ |
| | | public static final String CHARGING_PILE_STARTS_CHARGING ="charging_pile_starts_charging"; |
| | | /** |
| | | * 远程启机命令回复 |
| | | */ |
| | | public static final String PLATFORM_START_CHARGING_REPLY ="platform_start_charging_reply"; |
| | | /** |
| | | * 远程停机命令回复 |
| | | */ |
| | | public static final String PLATFORM_STOP_CHARGING_REPLY ="platform_stop_charging_reply"; |
| | | /** |
| | | * 交易记录 |
| | | */ |
| | | public static final String TRANSACTION_RECORD ="transaction_record"; |
| | | /** |
| | | * 余额更新应答 |
| | | */ |
| | | public static final String UPDATE_BALANCE_REPLY ="update_balance_reply"; |
| | | /** |
| | | * 卡数据同步应答 |
| | | */ |
| | | public static final String SYNCHRONIZE_OFFLINE_CARD_REPLY ="synchronize_offline_card_reply"; |
| | | /** |
| | | * 离线卡数据清除应答 |
| | | */ |
| | | public static final String CLEAR_OFFLINE_CARD_REPLY ="clear_offline_card_reply"; |
| | | /** |
| | | * 离线卡数据查询应答 |
| | | */ |
| | | public static final String QUERY_OFFLINE_CARD_REPLY ="query_offline_card_reply"; |
| | | /** |
| | | * 充电桩工作参数设置应答 |
| | | */ |
| | | public static final String WORKING_PARAMETER_SETTING_REPLY ="working_parameter_setting_reply"; |
| | | /** |
| | | * 对时设置应答 |
| | | */ |
| | | public static final String TIMING_SETTING_REPLY ="timing_setting_reply"; |
| | | /** |
| | | * 计费模型应答 |
| | | */ |
| | | public static final String SETUP_BILLING_MODEL_REPLY ="setup_billing_model_reply"; |
| | | /** |
| | | * 地锁数据上送(充电桩上送) |
| | | */ |
| | | public static final String GROUND_LOCK_REAL_TIME_DATA ="ground_lock_real_time_data"; |
| | | /** |
| | | * 充电桩返回数据(上行) |
| | | */ |
| | | public static final String CHARGING_PILE_RETURNS_GROUND_LOCK_DATA ="charging_pile_returns_ground_lock_data"; |
| | | /** |
| | | * 远程重启应答 |
| | | */ |
| | | public static final String PLATFORM_RESTART_REPLY ="platform_restart_reply"; |
| | | /** |
| | | * 远程更新应答 |
| | | */ |
| | | public final static String PLATFORM_REMOTE_UPDATE_REPLY ="platform_remote_update_reply"; |
| | | } |
| | |
| | | * @param endCharge 实体对象 |
| | | * @return |
| | | */ |
| | | @PostMapping("/endCharge") |
| | | public String endCharge(@RequestBody EndCharge endCharge){ |
| | | return iotMessageProduce.sendMessage(endCharge.getCharging_pile_code(), ServiceIdMenu.END_CHARGE.getKey(),messageUtil.endCharge(endCharge)); |
| | | } |
| | | // @PostMapping("/endCharge") |
| | | // public String endCharge(@RequestBody EndCharge endCharge){ |
| | | // return iotMessageProduce.sendMessage(endCharge.getCharging_pile_code(), ServiceIdMenu.END_CHARGE.getKey(),messageUtil.endCharge(endCharge)); |
| | | // } |
| | | |
| | | /** |
| | | * 运营平台确认启动充电 |
| | |
| | | * 读取实时监测数据 |
| | | */ |
| | | READ_REAL_TIME_MONITORING_DATA ("读取实时监测数据","read_real_time_monitoring_data"), |
| | | /** |
| | | * 充电结束 |
| | | */ |
| | | END_CHARGE ("充电结束","end_charge"), |
| | | // /** |
| | | // * 充电结束 |
| | | // */ |
| | | // END_CHARGE ("充电结束","end_charge"), |
| | | /** |
| | | * 运营平台确认启动充电 |
| | | */ |
| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.integration.iotda.constant.SendTagConstant; |
| | | import com.ruoyi.integration.rocket.produce.EnhanceProduce; |
| | | 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.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | |
| | | @RestController |
| | | public class IotMessageListener { |
| | | |
| | | @Autowired |
| | | private EnhanceProduce enhanceProduce; |
| | | |
| | | /** |
| | | * 设备消息监听 |
| | |
| | | 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")){ |
| | | //设备状态改变 |
| | | String service_id = content.getString("service_id"); |
| | | log.info("服务id:{}",service_id); |
| | | SendResult sendResult; |
| | | // 设备消息下发 |
| | | switch (service_id){ |
| | | case SendTagConstant.ONLINE: |
| | | sendResult = enhanceProduce.onlineMessage(content); |
| | | break; |
| | | case SendTagConstant.PING: |
| | | sendResult = enhanceProduce.pingMessage(content); |
| | | break; |
| | | case SendTagConstant.END_CHARGE: |
| | | sendResult = enhanceProduce.endChargeMessage(content); |
| | | break; |
| | | case SendTagConstant.BILLING_MODE_VERIFY: |
| | | sendResult = enhanceProduce.billingModeVerifyMessage(content); |
| | | break; |
| | | case SendTagConstant.ACQUISITION_BILLING_MODE: |
| | | sendResult = enhanceProduce.acquisitionBillingModeMessage(content); |
| | | break; |
| | | case SendTagConstant.UPLOAD_REAL_TIME_MONITORING_DATA: |
| | | sendResult = enhanceProduce.uploadRealTimeMonitoringDataMessage(content); |
| | | break; |
| | | case SendTagConstant.CHARGING_HANDSHAKE: |
| | | sendResult = enhanceProduce.chargingHandshakeMessage(content); |
| | | break; |
| | | case SendTagConstant.BMS_ABORT: |
| | | sendResult = enhanceProduce.bmsAbortMessage(content); |
| | | break; |
| | | case SendTagConstant.MOTOR_ABORT: |
| | | sendResult = enhanceProduce.motorAbortMessage(content); |
| | | break; |
| | | case SendTagConstant.BMS_DEMAND_AND_CHARGER_EXPORTATION: |
| | | sendResult = enhanceProduce.bmsDemandAndChargerExportationMessage(content); |
| | | break; |
| | | case SendTagConstant.BMS_INFORMATION: |
| | | sendResult = enhanceProduce.bmsInformationMessage(content); |
| | | break; |
| | | case SendTagConstant.CHARGING_PILE_STARTS_CHARGING: |
| | | sendResult = enhanceProduce.chargingPileStartsChargingMessage(content); |
| | | break; |
| | | case SendTagConstant.PLATFORM_START_CHARGING_REPLY: |
| | | sendResult = enhanceProduce.platformStartChargingReplyMessage(content); |
| | | break; |
| | | case SendTagConstant.PLATFORM_STOP_CHARGING_REPLY: |
| | | sendResult = enhanceProduce.platformStopChargingReplyMessage(content); |
| | | break; |
| | | case SendTagConstant.TRANSACTION_RECORD: |
| | | sendResult = enhanceProduce.transactionRecordMessage(content); |
| | | break; |
| | | case SendTagConstant.UPDATE_BALANCE_REPLY: |
| | | sendResult = enhanceProduce.updateBalanceReplyMessage(content); |
| | | break; |
| | | case SendTagConstant.SYNCHRONIZE_OFFLINE_CARD_REPLY: |
| | | sendResult = enhanceProduce.synchronizeOfflineCardReplyMessage(content); |
| | | break; |
| | | case SendTagConstant.CLEAR_OFFLINE_CARD_REPLY: |
| | | sendResult = enhanceProduce.clearOfflineCardReplyMessage(content); |
| | | break; |
| | | case SendTagConstant.WORKING_PARAMETER_SETTING_REPLY: |
| | | sendResult = enhanceProduce.workingParameterSettingReplyMessage(content); |
| | | break; |
| | | case SendTagConstant.TIMING_SETTING_REPLY: |
| | | sendResult = enhanceProduce.timingSettingReplyMessage(content); |
| | | break; |
| | | case SendTagConstant.SETUP_BILLING_MODEL_REPLY: |
| | | sendResult = enhanceProduce.setupBillingModelReplyMessage(content); |
| | | break; |
| | | case SendTagConstant.GROUND_LOCK_REAL_TIME_DATA: |
| | | sendResult = enhanceProduce.groundLockRealTimeDataMessage(content); |
| | | break; |
| | | case SendTagConstant.CHARGING_PILE_RETURNS_GROUND_LOCK_DATA: |
| | | sendResult = enhanceProduce.chargingPileReturnsGroundLockDataMessage(content); |
| | | break; |
| | | case SendTagConstant.PLATFORM_RESTART_REPLY: |
| | | sendResult = enhanceProduce.platformRestartReplyMessage(content); |
| | | break; |
| | | default: |
| | | sendResult = enhanceProduce.platformRemoteUpdateReplyMessage(content); |
| | | break; |
| | | } |
| | | log.info("rocketmq消息下发结果:{}",sendResult); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | * @param endCharge 实体对象 |
| | | * @return |
| | | */ |
| | | public String endCharge(EndCharge endCharge){ |
| | | endChargeService.create(endCharge); |
| | | return getMessageJsonString(endCharge, ServiceIdMenu.END_CHARGE.getValue()); |
| | | } |
| | | // public String endCharge(EndCharge endCharge){ |
| | | // endChargeService.create(endCharge); |
| | | // return getMessageJsonString(endCharge, ServiceIdMenu.END_CHARGE.getValue()); |
| | | // } |
| | | |
| | | /** |
| | | * 运营平台确认启动充电 |
New file |
| | |
| | | package com.ruoyi.integration.iotda.utils.tools; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Slf4j |
| | | public class StrategyUtil implements Serializable { |
| | | |
| | | |
| | | /** |
| | | * 校验计费模版是否准确 |
| | | * @return |
| | | */ |
| | | public static boolean checkStrategy() { |
| | | return true; |
| | | } |
| | | |
| | | } |
| | |
| | | List<UploadRealTimeMonitoringData> getDataByOrderCode(String code); |
| | | List<UploadRealTimeMonitoringData> getDataAll(Set<String> values, Integer page, Integer size); |
| | | |
| | | /** |
| | | * 查询订单最新一条数据 |
| | | * @param transaction_serial_number |
| | | * @return |
| | | */ |
| | | UploadRealTimeMonitoringData getLastDataById(String transaction_serial_number); |
| | | |
| | | } |
| | |
| | | return uploadRealTimeMonitoringData; |
| | | } |
| | | |
| | | @Override |
| | | public UploadRealTimeMonitoringData getLastDataById(String transaction_serial_number) { |
| | | Query query = new Query(); |
| | | if (StringUtils.isNotEmpty(transaction_serial_number)){ |
| | | query.addCriteria(Criteria.where("transaction_serial_number").is(transaction_serial_number)); |
| | | } |
| | | // 按照 createdAt 字段降序排序 |
| | | query.with(Sort.by(Sort.Direction.DESC, "create_time")); |
| | | // 限制结果只返回一条记录 |
| | | query.limit(1); |
| | | return mongoTemplate.findOne(query, UploadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.chargingPile.api.dto.CheckChargingStrategyDTO; |
| | | import com.ruoyi.chargingPile.api.feignClient.AccountingStrategyDetailClient; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | import com.ruoyi.integration.api.model.AcquisitionBillingMode; |
| | | import com.ruoyi.integration.api.model.BillingModeVerify; |
| | | import com.ruoyi.integration.api.model.BillingModeVerifyReply; |
| | | import com.ruoyi.integration.iotda.enums.ServiceIdMenu; |
| | | import com.ruoyi.integration.iotda.utils.produce.IotMessageProduce; |
| | | import com.ruoyi.integration.iotda.utils.tools.MessageUtil; |
| | | import com.ruoyi.integration.mongodb.service.BillingModeVerifyReplyService; |
| | | import com.ruoyi.integration.mongodb.service.BillingModeVerifyService; |
| | | import com.ruoyi.integration.rocket.model.BillingModeVerifyMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | |
| | | |
| | | @Autowired |
| | | private BillingModeVerifyService billingModeVerifyService; |
| | | @Autowired |
| | | private IotMessageProduce iotMessageProduce; |
| | | @Autowired |
| | | private MessageUtil messageUtil; |
| | | @Autowired |
| | | private AccountingStrategyDetailClient accountingStrategyDetailClient; |
| | | |
| | | @Override |
| | | protected void handleMessage(BillingModeVerifyMessage message) throws Exception { |
| | |
| | | BeanUtils.copyProperties(message,billingModeVerify); |
| | | billingModeVerifyService.create(billingModeVerify); |
| | | // 业务处理 |
| | | BillingModeVerifyReply billingModeVerifyReply = new BillingModeVerifyReply(); |
| | | if(message.getBilling_model_code().equals("0")){ |
| | | // 首次 |
| | | billingModeVerifyReply.setCharging_pile_code(billingModeVerify.getCharging_pile_code()); |
| | | billingModeVerifyReply.setBilling_model_code("0"); |
| | | billingModeVerifyReply.setBilling_model_result(1); |
| | | }else { |
| | | // 查询桩使用的模版 |
| | | CheckChargingStrategyDTO dto = new CheckChargingStrategyDTO(); |
| | | dto.setCode(message.getBilling_model_code()); |
| | | dto.setStrategyDetailId(Integer.valueOf(message.getBilling_model_code())); |
| | | Boolean check = accountingStrategyDetailClient.checkChargingStrategy(dto).getData(); |
| | | // 校验计费模版是否准确 |
| | | billingModeVerifyReply.setCharging_pile_code(billingModeVerify.getCharging_pile_code()); |
| | | billingModeVerifyReply.setBilling_model_code(message.getBilling_model_code()); |
| | | if(check){ |
| | | billingModeVerifyReply.setBilling_model_result(0); |
| | | }else { |
| | | billingModeVerifyReply.setBilling_model_result(1); |
| | | } |
| | | } |
| | | iotMessageProduce.sendMessage(billingModeVerifyReply.getCharging_pile_code(), ServiceIdMenu.BILLING_MODE_VERIFY_REPLY.getKey(),messageUtil.billingModeVerifyReply(billingModeVerifyReply)); |
| | | } |
| | | |
| | | @Override |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.EndCharge; |
| | | import com.ruoyi.integration.api.model.Ping; |
| | | import com.ruoyi.integration.api.model.Pong; |
| | | import com.ruoyi.integration.iotda.enums.ServiceIdMenu; |
| | | import com.ruoyi.integration.iotda.utils.produce.IotMessageProduce; |
| | | import com.ruoyi.integration.iotda.utils.tools.MessageUtil; |
| | | import com.ruoyi.integration.mongodb.service.EndChargeService; |
| | | import com.ruoyi.integration.mongodb.service.PingService; |
| | | import com.ruoyi.integration.rocket.model.EndChargeMessage; |
| | | 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 |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class EndChargeMessageListener extends EnhanceMessageHandler<EndChargeMessage> implements RocketMQListener<EndChargeMessage> { |
| | | |
| | | @Autowired |
| | | private EndChargeService endChargeService; |
| | | @Autowired |
| | | private MessageUtil messageUtil; |
| | | @Autowired |
| | | private IotMessageProduce iotMessageProduce; |
| | | @Override |
| | | protected void handleMessage(EndChargeMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("充电结束-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | EndCharge endCharge = new EndCharge(); |
| | | BeanUtils.copyProperties(message,endCharge); |
| | | endChargeService.create(endCharge); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(EndChargeMessage 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(EndChargeMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(EndChargeMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.OnlineReply; |
| | | import com.ruoyi.integration.iotda.enums.ServiceIdMenu; |
| | | import com.ruoyi.integration.iotda.utils.produce.IotMessageProduce; |
| | | import com.ruoyi.integration.iotda.utils.tools.MessageUtil; |
| | | import com.ruoyi.integration.mongodb.service.OnlineService; |
| | | import com.ruoyi.integration.rocket.model.OnlineMessage; |
| | | import com.ruoyi.integration.rocket.model.OnlineMessage; |
| | |
| | | |
| | | @Autowired |
| | | private OnlineService onlineService; |
| | | @Autowired |
| | | private MessageUtil messageUtil; |
| | | @Autowired |
| | | private IotMessageProduce iotMessageProduce; |
| | | |
| | | @Override |
| | | protected void handleMessage(OnlineMessage message) throws Exception { |
| | |
| | | Online online = new Online(); |
| | | BeanUtils.copyProperties(message,online); |
| | | onlineService.create(online); |
| | | // 业务处理 |
| | | // 业务处理 登录认证应答 |
| | | OnlineReply onlineReply = new OnlineReply(); |
| | | onlineReply.setCharging_pile_code(message.getCharging_pile_code()); |
| | | onlineReply.setOnline_result(0); |
| | | String result = iotMessageProduce.sendMessage(onlineReply.getCharging_pile_code(), ServiceIdMenu.ONLINE_REPLY.getKey(), messageUtil.onlineReply(onlineReply)); |
| | | log.info("充电桩登录认证-返回结果:{}",result); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.Ping; |
| | | import com.ruoyi.integration.api.model.Pong; |
| | | import com.ruoyi.integration.iotda.enums.ServiceIdMenu; |
| | | import com.ruoyi.integration.iotda.utils.produce.IotMessageProduce; |
| | | import com.ruoyi.integration.iotda.utils.tools.MessageUtil; |
| | | import com.ruoyi.integration.mongodb.service.OnlineService; |
| | | import com.ruoyi.integration.mongodb.service.PingService; |
| | | import com.ruoyi.integration.rocket.model.PingMessage; |
| | |
| | | |
| | | @Autowired |
| | | private PingService pingService; |
| | | |
| | | @Autowired |
| | | private MessageUtil messageUtil; |
| | | @Autowired |
| | | private IotMessageProduce iotMessageProduce; |
| | | @Override |
| | | protected void handleMessage(PingMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | |
| | | BeanUtils.copyProperties(message,ping); |
| | | pingService.create(ping); |
| | | // 业务处理 |
| | | Pong pong = new Pong(); |
| | | pong.setCharging_pile_code(message.getCharging_pile_code()); |
| | | pong.setCharging_gun_code(message.getCharging_gun_code()); |
| | | pong.setCharging_gun_status(0); |
| | | String result = iotMessageProduce.sendMessage(pong.getCharging_pile_code(), ServiceIdMenu.PONG.getKey(), messageUtil.pong(pong)); |
| | | log.info("充电桩心跳包-返回结果:{}",result); |
| | | } |
| | | |
| | | @Override |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.api.model.ConfirmTransactionRecord; |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.TransactionRecord; |
| | | import com.ruoyi.integration.iotda.enums.ServiceIdMenu; |
| | | import com.ruoyi.integration.iotda.utils.produce.IotMessageProduce; |
| | | import com.ruoyi.integration.iotda.utils.tools.MessageUtil; |
| | | import com.ruoyi.integration.mongodb.service.TransactionRecordService; |
| | | import com.ruoyi.integration.rocket.model.TransactionRecordMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | |
| | | |
| | | @Autowired |
| | | private TransactionRecordService transactionRecordService; |
| | | @Autowired |
| | | private IotMessageProduce iotMessageProduce; |
| | | @Autowired |
| | | private MessageUtil messageUtil; |
| | | @Override |
| | | protected void handleMessage(TransactionRecordMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | |
| | | BeanUtils.copyProperties(message,transactionRecord); |
| | | transactionRecordService.create(transactionRecord); |
| | | // 业务处理 |
| | | ConfirmTransactionRecord confirmTransactionRecord = new ConfirmTransactionRecord(); |
| | | confirmTransactionRecord.setTransaction_serial_number(message.getTransaction_serial_number()); |
| | | confirmTransactionRecord.setConfirm_result(0); |
| | | iotMessageProduce.sendMessage(confirmTransactionRecord.getTransaction_serial_number(), ServiceIdMenu.CONFIRM_TRANSACTION_RECORD.getKey(),messageUtil.confirmTransactionRecord(confirmTransactionRecord)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.chargingPile.api.feignClient.AccountingStrategyDetailClient; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | 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 com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.query.UploadRealTimeMonitoringDataQuery; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.Objects; |
| | | |
| | | @Slf4j |
| | | @Component |
| | |
| | | |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private AccountingStrategyDetailClient accountingStrategyDetailClient; |
| | | |
| | | |
| | | @Override |
| | |
| | | // 持久化消息 |
| | | UploadRealTimeMonitoringData uploadRealTimeMonitoringData = new UploadRealTimeMonitoringData(); |
| | | BeanUtils.copyProperties(message,uploadRealTimeMonitoringData); |
| | | // 查询mogondb上一条数据 |
| | | UploadRealTimeMonitoringData data = uploadRealTimeMonitoringDataService.getLastDataById(message.getTransaction_serial_number()); |
| | | // 查询订单 |
| | | TChargingOrder chargingOrder = chargingOrderClient.getOrderByCode(message.getTransaction_serial_number()).getData(); |
| | | // 查询当前时间段的计费策略 |
| | | TAccountingStrategyDetail accountingStrategyDetail = accountingStrategyDetailClient.getDetailBySiteId(chargingOrder.getSiteId()).getData(); |
| | | uploadRealTimeMonitoringData.setElectrovalence_all(accountingStrategyDetail.getElectrovalence()); |
| | | uploadRealTimeMonitoringData.setService_charge(accountingStrategyDetail.getServiceCharge()); |
| | | if (Objects.nonNull(data)) { |
| | | uploadRealTimeMonitoringData.setLast_time(data.getLast_time()); |
| | | uploadRealTimeMonitoringData.setPeriod_electric_price(message.getPaid_amount().divide(data.getPaid_amount())); |
| | | uploadRealTimeMonitoringData.setPeriod_charging_degree(message.getCharging_degree().divide(data.getCharging_degree())); |
| | | uploadRealTimeMonitoringData.setPeriod_service_price(message.getCharging_degree().multiply(accountingStrategyDetail.getServiceCharge()).setScale(4, RoundingMode.HALF_UP)); |
| | | }else { |
| | | log.info("首次上传实时监测数据"); |
| | | uploadRealTimeMonitoringData.setPeriod_electric_price(message.getPaid_amount()); |
| | | uploadRealTimeMonitoringData.setPeriod_charging_degree(message.getCharging_degree()); |
| | | uploadRealTimeMonitoringData.setPeriod_service_price(message.getCharging_degree().multiply(accountingStrategyDetail.getServiceCharge()).setScale(4, RoundingMode.HALF_UP)); |
| | | } |
| | | uploadRealTimeMonitoringDataService.create(uploadRealTimeMonitoringData); |
| | | // 业务处理 |
| | | UploadRealTimeMonitoringDataQuery query = new UploadRealTimeMonitoringDataQuery(); |
| | | BeanUtils.copyProperties(uploadRealTimeMonitoringData, query); |
| | | chargingOrderClient.chargeMonitoring(query); |
| | | |
| | | } |
| | | |
| | | @Override |
New file |
| | |
| | | package com.ruoyi.integration.rocket.model; |
| | | |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 充电结束 |
| | | **/ |
| | | |
| | | @Data |
| | | public class EndChargeMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private BigDecimal bms_battery_charging_status; // BMS 中止荷电状态 SOC |
| | | private BigDecimal bms_minimum_battery_voltage; // BMS 动力蓄电池单体最低电压 |
| | | private BigDecimal bms_maximum_battery_voltage; // BMS 动力蓄电池单体最高电压 |
| | | private Integer bms_minimum_battery_temperature; // BMS 动力蓄电池最低温度 |
| | | private Integer bms_maximum_battery_temperature; // BMS 动力蓄电池最高温度 |
| | | private BigDecimal cumulative_charging_time; // 电桩累计充电时间 |
| | | private BigDecimal output_energy; // 电桩输出能量 |
| | | private String charger_code; // 电桩充电机编号 |
| | | |
| | | } |
| | | |
| | | |
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/produce/EnhanceProduceController.java |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.integration.iotda.enums.SendTagMenu; |
| | | import com.ruoyi.integration.iotda.constant.SendTagConstant; |
| | | 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.stereotype.Component; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.UUID; |
| | | |
| | | @RestController |
| | | @RequestMapping("enhance") |
| | | @Slf4j |
| | | public class EnhanceProduceController { |
| | | @Component |
| | | public class EnhanceProduce { |
| | | |
| | | //注入增强后的模板,可以自动实现环境隔离,日志记录 |
| | | @Setter(onMethod_ = @Autowired) |
| | |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.ONLINE.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.ONLINE.getValue(), message); |
| | | message.setSource(SendTagConstant.ONLINE); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.ONLINE, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.PING.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.PING.getValue(), message); |
| | | message.setSource(SendTagConstant.PING); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.PING, message); |
| | | } |
| | | /** |
| | | * 充电结束 |
| | | */ |
| | | public SendResult endChargeMessage(JSONObject jsonObject) { |
| | | PingMessage message = JSON.parseObject(jsonObject.toJSONString(),PingMessage.class); |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagConstant.END_CHARGE); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.END_CHARGE, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.BILLING_MODE_VERIFY.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.BILLING_MODE_VERIFY.getValue(), message); |
| | | message.setSource(SendTagConstant.BILLING_MODE_VERIFY); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.BILLING_MODE_VERIFY, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.ACQUISITION_BILLING_MODE.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.ACQUISITION_BILLING_MODE.getValue(), message); |
| | | message.setSource(SendTagConstant.ACQUISITION_BILLING_MODE); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.ACQUISITION_BILLING_MODE, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务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); |
| | | message.setSource(SendTagConstant.UPLOAD_REAL_TIME_MONITORING_DATA); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.UPLOAD_REAL_TIME_MONITORING_DATA, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.CHARGING_HANDSHAKE.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.CHARGING_HANDSHAKE.getValue(), message); |
| | | message.setSource(SendTagConstant.CHARGING_HANDSHAKE); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.CHARGING_HANDSHAKE, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.BMS_ABORT.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.BMS_ABORT.getValue(), message); |
| | | message.setSource(SendTagConstant.BMS_ABORT); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.BMS_ABORT, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.MOTOR_ABORT.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.MOTOR_ABORT.getValue(), message); |
| | | message.setSource(SendTagConstant.MOTOR_ABORT); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.MOTOR_ABORT, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务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); |
| | | message.setSource(SendTagConstant.BMS_DEMAND_AND_CHARGER_EXPORTATION); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.BMS_DEMAND_AND_CHARGER_EXPORTATION, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.BMS_INFORMATION.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.BMS_INFORMATION.getValue(), message); |
| | | message.setSource(SendTagConstant.BMS_INFORMATION); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.BMS_INFORMATION, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务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); |
| | | message.setSource(SendTagConstant.CHARGING_PILE_STARTS_CHARGING); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.CHARGING_PILE_STARTS_CHARGING, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务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); |
| | | message.setSource(SendTagConstant.PLATFORM_START_CHARGING_REPLY); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.PLATFORM_START_CHARGING_REPLY, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务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); |
| | | message.setSource(SendTagConstant.PLATFORM_STOP_CHARGING_REPLY); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.PLATFORM_STOP_CHARGING_REPLY, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.TRANSACTION_RECORD.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.TRANSACTION_RECORD.getValue(), message); |
| | | message.setSource(SendTagConstant.TRANSACTION_RECORD); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.TRANSACTION_RECORD, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.UPDATE_BALANCE_REPLY.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.UPDATE_BALANCE_REPLY.getValue(), message); |
| | | message.setSource(SendTagConstant.UPDATE_BALANCE_REPLY); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.UPDATE_BALANCE_REPLY, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务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); |
| | | message.setSource(SendTagConstant.SYNCHRONIZE_OFFLINE_CARD_REPLY); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.SYNCHRONIZE_OFFLINE_CARD_REPLY, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务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); |
| | | message.setSource(SendTagConstant.CLEAR_OFFLINE_CARD_REPLY); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.CLEAR_OFFLINE_CARD_REPLY, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务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); |
| | | message.setSource(SendTagConstant.WORKING_PARAMETER_SETTING_REPLY); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.WORKING_PARAMETER_SETTING_REPLY, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.TIMING_SETTING_REPLY.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.TIMING_SETTING_REPLY.getValue(), message); |
| | | message.setSource(SendTagConstant.TIMING_SETTING_REPLY); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.TIMING_SETTING_REPLY, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务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); |
| | | message.setSource(SendTagConstant.SETUP_BILLING_MODEL_REPLY); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.SETUP_BILLING_MODEL_REPLY, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务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); |
| | | message.setSource(SendTagConstant.GROUND_LOCK_REAL_TIME_DATA); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.GROUND_LOCK_REAL_TIME_DATA, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务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); |
| | | message.setSource(SendTagConstant.CHARGING_PILE_RETURNS_GROUND_LOCK_DATA); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.CHARGING_PILE_RETURNS_GROUND_LOCK_DATA, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagMenu.PLATFORM_RESTART_REPLY.getValue()); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.PLATFORM_RESTART_REPLY.getValue(), message); |
| | | message.setSource(SendTagConstant.PLATFORM_RESTART_REPLY); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.PLATFORM_RESTART_REPLY, message); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设置业务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); |
| | | message.setSource(SendTagConstant.PLATFORM_REMOTE_UPDATE_REPLY); |
| | | return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.PLATFORM_REMOTE_UPDATE_REPLY, message); |
| | | } |
| | | } |
| | |
| | | <scope>test</scope> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>cn.afterturn</groupId> |
| | | <artifactId>easypoi-spring-boot-starter</artifactId> |
| | | <version>4.0.0</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <artifactId>guava</artifactId> |
| | | <groupId>com.google.guava</groupId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
New file |
| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserCarClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.api.vo.ChargingBillVO; |
| | | import com.ruoyi.order.api.vo.ChargingOrderTimeVO; |
| | | import com.ruoyi.order.dto.ChargingBillQuery; |
| | | import com.ruoyi.order.dto.ChargingListQuery; |
| | | import com.ruoyi.order.service.*; |
| | | import com.ruoyi.order.vo.ChargingOrderListInfoVO; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | | import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-08-07 |
| | | */ |
| | | @Api(tags = "充电算帐单") |
| | | @RestController |
| | | @RequestMapping("/chargingBill") |
| | | public class ChargingBillController { |
| | | |
| | | @Resource |
| | | private TChargingOrderService chargingOrderService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private TOrderEvaluateService orderEvaluateService; |
| | | |
| | | @Resource |
| | | private WxPaymentClient wxPaymentClient; |
| | | |
| | | @Resource |
| | | private RedisService redisService; |
| | | |
| | | @Resource |
| | | private AliPaymentClient aliPaymentClient; |
| | | @Resource |
| | | private TShoppingOrderService shoppingOrderService; |
| | | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Resource |
| | | private TVipOrderService vipOrderService; |
| | | @Resource |
| | | private ParkingLotClient parkingLotClient; |
| | | @Resource |
| | | private TChargingOrderRefundService chargingOrderRefundService; |
| | | |
| | | @Resource |
| | | private TShoppingOrderRefundService shoppingOrderRefundService; |
| | | @Resource |
| | | private TVipOrderRefundService vipOrderRefundService; |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | @Resource |
| | | private ChargingPileClient chargingPileClient; |
| | | @Resource |
| | | private ChargingGunClient chargingGunClient; |
| | | @Resource |
| | | private AppUserCarClient appUserCarClient; |
| | | @Resource |
| | | private TChargingOrderAccountingStrategyService chargingOrderAccountingStrategyService; |
| | | @ResponseBody |
| | | @PostMapping(value = "/chargingList") |
| | | @ApiOperation(value = "充电算帐单列表查询", tags = {"管理后台-充电算账单"}) |
| | | public AjaxResult<ChargingBillVO> chargingList(@RequestBody ChargingListQuery dto) { |
| | | |
| | | return AjaxResult.success(null); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | | import com.ruoyi.order.api.query.VipShoppingOrderQuery; |
| | | import com.ruoyi.order.vo.ChargingOrderListInfoVO; |
| | | import com.ruoyi.order.api.vo.ChargingOrderTimeVO; |
| | | import com.ruoyi.order.dto.ChargingListQuery; |
| | | import com.ruoyi.order.dto.PayOrderDto; |
| | | import com.ruoyi.order.dto.PayOrderQueryDto; |
| | | import com.ruoyi.order.service.*; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | | import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | ChargingOrderTimeVO res = chargingOrderService.chargingList(dto); |
| | | return AjaxResult.success(res); |
| | | } |
| | | @ResponseBody |
| | | @GetMapping(value = "/chargingInfo") |
| | | @ApiOperation(value = "充电时段统计列表-查看详情", tags = {"管理后台-财务结算"}) |
| | | public AjaxResult<ChargingOrderListInfoVO> chargingInfo(String uid) { |
| | | ChargingOrderListInfoVO res = chargingOrderService.chargingInfo(uid); |
| | | return AjaxResult.success(res); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.order.controller; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.google.common.collect.Lists; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | @ApiOperation(value = "列表", tags = {"管理后台-支付订单-订单信息"}) |
| | | public R<PageInfo<PayOrderDto>> payOrderList(@RequestBody PayOrderQueryDto payOrderQueryDto) { |
| | | return chargingOrderService.payOrderQuery(payOrderQueryDto); |
| | | } |
| | | @ResponseBody |
| | | @PostMapping(value = "/pay/order/refund") |
| | | @ApiOperation(value = "列表", tags = {"管理后台-支付订单-订单信息"}) |
| | | public R refund(@RequestBody PayOrderRefundDto payOrderQueryDto) { |
| | | return chargingOrderService.payRefund(payOrderQueryDto); |
| | | } |
| | | |
| | | @ResponseBody |
| | |
| | | .eq(TChargingOrder::getDelFlag, 0).eq(TChargingOrder::getStatus, 3)); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping(value = "/getMyChargingOrderList") |
| | |
| | | public void chargeMonitoring(@RequestBody UploadRealTimeMonitoringDataQuery query){ |
| | | chargingOrderService.chargeMonitoring(query); |
| | | } |
| | | /** |
| | | * 通过流水号查询订单 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getOrderByCode/{code}") |
| | | public R<TChargingOrder> getOrderByCode(@PathVariable("code") String code){ |
| | | return R.ok(chargingOrderService.getOne(Wrappers.lambdaQuery(TChargingOrder.class) |
| | | .eq(TChargingOrder::getCode,code))); |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | public R manageFeedback(@RequestBody ManageFeedbackDto manageFeedbackDto) { |
| | | TOrderAppeal byId = orderAppealService.getById(manageFeedbackDto.getId()); |
| | | byId.setFeedback(manageFeedbackDto.getFeedback()); |
| | | byId.setStatus(2); |
| | | orderAppealService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.core.utils.WebUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.order.api.model.TOrderInvoice; |
| | | import com.ruoyi.order.api.query.TOrderInvoiceQuery; |
| | | import com.ruoyi.order.api.vo.TOrderInvoiceVO; |
| | | import com.ruoyi.order.dto.AddOrderInvoice; |
| | | import com.ruoyi.order.dto.GetOrderInvoiceList; |
| | | import com.ruoyi.order.dto.MyOrderInvoiceInfo; |
| | | import com.ruoyi.order.dto.OrderInvoiceList; |
| | | import com.ruoyi.order.export.OrderInvoiceExport; |
| | | import com.ruoyi.order.service.TOrderInvoiceService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | return orderInvoiceService.addOrderInvoice(addOrderInvoice); |
| | | } |
| | | |
| | | @PostMapping("/pageList") |
| | | @ApiOperation(value = "查询开票分页列表", tags = {"管理后台-发票管理"}) |
| | | public AjaxResult<PageInfo<TOrderInvoiceVO>> pageList(@RequestBody TOrderInvoiceQuery query){ |
| | | return AjaxResult.success(orderInvoiceService.pageList(query)); |
| | | } |
| | | |
| | | @GetMapping("/uploadPdf") |
| | | @ApiOperation(value = "上传发票", tags = {"管理后台-发票管理"}) |
| | | public AjaxResult<String> uploadPdf(@RequestParam("id") Long id, |
| | | @RequestParam("invoiceUrl") String invoiceUrl){ |
| | | TOrderInvoice orderInvoice = orderInvoiceService.getById(id); |
| | | orderInvoice.setInvoiceUrl(invoiceUrl); |
| | | orderInvoiceService.updateById(orderInvoice); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @PostMapping("/statusCount") |
| | | @ApiOperation(value = "查询开票状态数量", tags = {"管理后台-发票管理"}) |
| | | public AjaxResult<Map<String,Integer>> statusCount(@RequestBody TOrderInvoiceQuery query){ |
| | | return AjaxResult.success(orderInvoiceService.statusCount(query)); |
| | | } |
| | | |
| | | /** |
| | | * 发票管理导出 |
| | | */ |
| | | @ApiOperation(value = "发票管理导出") |
| | | @Log(title = "发票管理导出", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(@RequestBody TOrderInvoiceQuery query) |
| | | { |
| | | List<TOrderInvoiceVO> list = orderInvoiceService.export(query); |
| | | List<OrderInvoiceExport> orderInvoiceExports = new ArrayList<>(); |
| | | for (TOrderInvoiceVO orderInvoiceVO : list) { |
| | | OrderInvoiceExport orderInvoiceExport = new OrderInvoiceExport(); |
| | | BeanUtils.copyProperties(orderInvoiceVO,orderInvoiceExport); |
| | | orderInvoiceExport.setBillingTime(DateUtils.localDateTimeToString(orderInvoiceVO.getBillingTime())); |
| | | orderInvoiceExports.add(orderInvoiceExport); |
| | | } |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), OrderInvoiceExport.class, orderInvoiceExports); |
| | | HttpServletResponse response = WebUtils.response(); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("发票导出.xls", "utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getMyOrderInvoiceList") |
New file |
| | |
| | | package com.ruoyi.order.dto; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ChargingBillQuery extends BasePage { |
| | | @ApiModelProperty("订单编号") |
| | | private String code; |
| | | |
| | | @ApiModelProperty("电站id") |
| | | private Integer siteId; |
| | | @ApiModelProperty("状态(0=未知,1=等待中,2=启动中,3=充电中,4=停止中,5=已结束)") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("手机号") |
| | | private String phone; |
| | | @ApiModelProperty("车牌号") |
| | | private String licensePlate; |
| | | |
| | | @ApiModelProperty("订单类型(1=充电订单(小程序),2=充电订单(刷卡))") |
| | | private Integer orderType; |
| | | |
| | | @ApiModelProperty("开始时间 2020-01-01 12:00:00 - 2020-01-01 23:00:00") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty("结束时间 2020-01-01 12:00:00 - 2020-01-01 23:00:00") |
| | | private String endTime; |
| | | @ApiModelProperty("用户ids 前端忽略") |
| | | private List<Long> userIds; |
| | | @ApiModelProperty("车辆ids 前端忽略") |
| | | private List<Long> carIds; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.order.dto; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "充电账单列表查询参数") |
| | | public class ChargingListQuery extends BasePage { |
| | | @ApiModelProperty("订单编号") |
| | | private String code; |
| | | |
| | | @ApiModelProperty("电站id") |
| | | private Integer siteId; |
| | | @ApiModelProperty("状态(0=未知,1=等待中,2=启动中,3=充电中,4=停止中,5=已结束)") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("手机号") |
| | | private String phone; |
| | | @ApiModelProperty("车牌号") |
| | | private String licensePlate; |
| | | |
| | | @ApiModelProperty("订单类型(1=充电订单(小程序),2=充电订单(刷卡))") |
| | | private Integer orderType; |
| | | |
| | | @ApiModelProperty("开始时间 2020-01-01 12:00:00 - 2020-01-01 23:00:00") |
| | | @ApiModelProperty("订单分类 1全站 2各个站点") |
| | | private String category; |
| | | @ApiModelProperty("账单周期2020-01-01 - 2020-01-01") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty("结束时间 2020-01-01 12:00:00 - 2020-01-01 23:00:00") |
| | | private String endTime; |
| | | @ApiModelProperty("用户ids 前端忽略") |
| | | private List<Long> userIds; |
| | | @ApiModelProperty("车辆ids 前端忽略") |
| | | private List<Long> carIds; |
| | | |
| | | @ApiModelProperty("1已出账 2未出账") |
| | | private Integer state; |
| | | } |
| | |
| | | package com.ruoyi.order.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @ApiModel("支付订单返回Dto") |
| | | public class PayOrderDto { |
| | | private String id; |
| | | @ApiModelProperty("1充电订单2购物订单3vip订单4停车订单") |
| | |
| | | package com.ruoyi.order.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | @Data |
| | | @ApiModel("支付订单查询dto") |
| | | public class PayOrderQueryDto extends BasePage { |
| | | @ApiModelProperty("订单编号") |
| | | private String code; |
| | |
| | | private Integer isRefund; |
| | | |
| | | @ApiModelProperty("下单时间1") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime1; |
| | | @ApiModelProperty("下单时间2") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime2; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.dto; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class PayOrderRefundDto{ |
| | | private Long orderId; |
| | | @ApiModelProperty("1充电订单2购物订单3vip订单4停车订单") |
| | | private Integer type; |
| | | private BigDecimal refundAmount; |
| | | private String reason; |
| | | private String remark; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.export; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "导出发票") |
| | | public class OrderInvoiceExport implements Serializable { |
| | | |
| | | @Excel(name = "申请单编号",width = 30) |
| | | private String code; |
| | | |
| | | @Excel(name = "申请日期",width = 30) |
| | | private String billingTime; |
| | | |
| | | @Excel(name = "开票公司",width = 30) |
| | | private String invoicingCompany; |
| | | |
| | | @Excel(name = "发票类型",width = 30) |
| | | private String invoiceType; |
| | | |
| | | @Excel(name = "发票种类",replace = {"纸质发票_1","电子发票_2"},width = 30) |
| | | private Integer invoiceMaterial; |
| | | |
| | | @Excel(name = "开票方式",replace = {"人工_1","自动_2"},width = 30) |
| | | private Integer invoicingMethod; |
| | | |
| | | @Excel(name = "开票总金额",width = 30) |
| | | private BigDecimal totalAmount; |
| | | |
| | | @Excel(name = "服务费",width = 30) |
| | | private BigDecimal serviceCharge; |
| | | |
| | | @Excel(name = "服务费税率",width = 30) |
| | | private BigDecimal serviceTariff; |
| | | |
| | | @Excel(name = "增值服务费",width = 30) |
| | | private BigDecimal addedService; |
| | | |
| | | @Excel(name = "增值服务费税率",width = 30) |
| | | private BigDecimal addedServiceTariff; |
| | | |
| | | // @Excel(name = "开票订单类型",replace = {"充电订单_1","购物订单_2","兑换订单_3","会员订单_4"},width = 30) |
| | | // private Integer orderType; |
| | | |
| | | @Excel(name = "抬头类型",replace = {"个人_1","企业_2"},width = 30) |
| | | private Integer invoicingObjectType; |
| | | |
| | | @Excel(name = "发票抬头",width = 30) |
| | | private String name; |
| | | |
| | | @Excel(name = "开户银行",width = 30) |
| | | private String depositBank; |
| | | |
| | | @Excel(name = "银行账户",width = 30) |
| | | private String bankAccount; |
| | | |
| | | @Excel(name = "公司电话",width = 30) |
| | | private String companyPhone; |
| | | |
| | | @Excel(name = "纳税识别号",width = 30) |
| | | private String taxIdentificationNumber; |
| | | |
| | | @Excel(name = "公司地址",width = 30) |
| | | private String companyAddress; |
| | | |
| | | @Excel(name = "邮箱",width = 30) |
| | | private String mailbox; |
| | | |
| | | @Excel(name = "状态",replace = {"待开票_1","开票中_2","已开票_3"},width = 30) |
| | | private Integer status; |
| | | |
| | | @Excel(name = "用户电话",width = 30) |
| | | private String userPhone; |
| | | } |
| | |
| | | package com.ruoyi.order.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TOrderInvoice; |
| | | import com.ruoyi.order.api.query.TOrderInvoiceQuery; |
| | | import com.ruoyi.order.api.vo.TOrderInvoiceVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Mapper |
| | | public interface TOrderInvoiceMapper extends BaseMapper<TOrderInvoice> { |
| | | |
| | | /** |
| | | * 发票分页查询 |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TOrderInvoiceVO> pageList(@Param("query") TOrderInvoiceQuery query, @Param("pageInfo")PageInfo<TOrderInvoiceVO> pageInfo); |
| | | |
| | | /** |
| | | * 查询开票状态数量 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | Map<String, Integer> statusCount(@Param("query")TOrderInvoiceQuery query); |
| | | |
| | | /** |
| | | * 导出 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | List<TOrderInvoiceVO> export(@Param("query")TOrderInvoiceQuery query); |
| | | |
| | | } |
| | |
| | | import com.ruoyi.order.api.vo.ChargingOrderVO; |
| | | import com.ruoyi.order.api.vo.TCharingOrderVO; |
| | | import com.ruoyi.order.dto.*; |
| | | import com.ruoyi.order.vo.ChargingOrderListInfoVO; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | |
| | | ChargingOrderTimeVO chargingList(ChargingListQuery dto); |
| | | |
| | | R payRefund(PayOrderRefundDto payOrderQueryDto); |
| | | |
| | | ChargingOrderListInfoVO chargingInfo(String uid); |
| | | |
| | | |
| | | /** |
| | | * 处理充电订单实时监控数据相关的业务逻辑 |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TOrderInvoice; |
| | | import com.ruoyi.order.api.query.TOrderInvoiceQuery; |
| | | import com.ruoyi.order.api.vo.TOrderInvoiceVO; |
| | | import com.ruoyi.order.dto.AddOrderInvoice; |
| | | import com.ruoyi.order.dto.GetOrderInvoiceList; |
| | | import com.ruoyi.order.dto.MyOrderInvoiceInfo; |
| | | import com.ruoyi.order.dto.OrderInvoiceList; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @return |
| | | */ |
| | | MyOrderInvoiceInfo getMyOrderInvoiceInfo(String id); |
| | | |
| | | /** |
| | | * 查询开票分页列表 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<TOrderInvoiceVO> pageList(TOrderInvoiceQuery query); |
| | | |
| | | /** |
| | | * 查询开票状态数量 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | Map<String,Integer> statusCount(TOrderInvoiceQuery query); |
| | | |
| | | /** |
| | | * 发票管理导出 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | List<TOrderInvoiceVO> export(TOrderInvoiceQuery query); |
| | | |
| | | } |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.ChargingHandshakeClient; |
| | | import com.ruoyi.integration.api.feignClient.PlatformStartChargingReplyClient; |
| | | import com.ruoyi.integration.api.feignClient.SendMessageClient; |
| | | import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.ChargingHandshake; |
| | | import com.ruoyi.integration.api.model.PlatformStartCharging; |
| | | import com.ruoyi.integration.api.model.PlatformStartChargingReply; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.feignClient.*; |
| | | import com.ruoyi.integration.api.model.*; |
| | | import com.ruoyi.integration.api.vo.GetPlatformStopChargingReply; |
| | |
| | | import com.ruoyi.order.service.TOrderEvaluateService; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | | import com.ruoyi.order.vo.ChargingOrderListInfoVO; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | | import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | | import com.ruoyi.payment.api.model.RefundReq; |
| | | import com.ruoyi.payment.api.model.RefundResp; |
| | | import com.ruoyi.payment.api.model.WxPaymentRefundModel; |
| | | import com.ruoyi.payment.api.vo.*; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | BigDecimal electronicMoney1 = new BigDecimal("0"); |
| | | // 单个订单累计服务费 |
| | | BigDecimal serviceMoney1 = new BigDecimal("0"); |
| | | // todo 调用第三方获取充电时长 秒 |
| | | |
| | | UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrderVO.getCode()).getData(); |
| | | chargingOrderVO.setChargingSecond(data5.getTime_remaining()*60L); |
| | | // 总收入 |
| | | if (chargingOrderVO.getRefundStatus() !=null && chargingOrderVO.getRefundStatus() == 2){ |
| | | income = income.add(chargingOrderVO.getPaymentAmount().subtract(chargingOrderVO.getRefundAmount())); |
| | |
| | | public List<Map<String, BigDecimal>> getYearData(List<Long> chargingOrderIds) { |
| | | return this.baseMapper.getYearData(chargingOrderIds); |
| | | } |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | @Resource |
| | | private UserSiteClient userSiteClient; |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | @Override |
| | | public ChargingOrderTimeVO chargingList(ChargingListQuery dto) { |
| | | String startTime1 = null; |
| | |
| | | startTime1 = split[0]; |
| | | startTime2 = split[1]; |
| | | } |
| | | if (StringUtils.hasLength(dto.getEndTime())){ |
| | | String[] split = dto.getEndTime().split(" - "); |
| | | endTime1 = split[0]; |
| | | endTime2 = split[1]; |
| | | } |
| | | ChargingOrderTimeVO chargingOrderTimeVO = new ChargingOrderTimeVO(); |
| | | |
| | | |
| | | PageInfo<ChargingOrderListVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); |
| | | List<ChargingOrderListVO> list = this.baseMapper.chargingList(pageInfo,dto,startTime1,startTime2,endTime1,endTime2); |
| | | for (ChargingOrderListVO chargingOrderListVO : list) { |
| | | chargingOrderListVO.setUid(chargingOrderListVO.getId()+""); |
| | | List<Integer> integers = new ArrayList<>(); |
| | | integers.add(chargingOrderListVO.getSiteId()); |
| | | List<Site> data = siteClient.getSiteByIds(integers).getData(); |
| | |
| | | if (data2 != null && data1 != null) { |
| | | chargingOrderListVO.setTerminalName(data2.getName() + "-" + data1.getName()); |
| | | } |
| | | // todo 充电时长 调用第三方获取 |
| | | // 获取充电时间 |
| | | UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrderListVO.getCode()).getData(); |
| | | if (data5!=null){ |
| | | if (data5.getTime_remaining()!=null){ |
| | | chargingOrderListVO.setChargingSecond(data5.getTime_remaining()*60L); |
| | | |
| | | } |
| | | } |
| | | // 获取开始SOC 结束soc |
| | | List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataClient.getDataByOrderCode(chargingOrderListVO.getCode()).getData(); |
| | | if (!data6.isEmpty()){ |
| | | // 第一条数据soc为开始 最后一条数据soc为结束soc |
| | | chargingOrderListVO.setStartSoc(data6.get(0).getSoc().toString()); |
| | | chargingOrderListVO.setEndSoc(data6.get(data6.size()-1).getSoc().toString()); |
| | | } |
| | | TAppUser data3 = appUserClient.getUserById(chargingOrderListVO.getAppUserId()).getData(); |
| | | List<Long> carId = new ArrayList<>(); |
| | | if (chargingOrderListVO.getAppUserCarId() != null) { |
| | |
| | | return chargingOrderTimeVO; |
| | | } |
| | | |
| | | @Override |
| | | public R payRefund(PayOrderRefundDto payOrderQueryDto) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public ChargingOrderListInfoVO chargingInfo(String uid) { |
| | | TChargingOrder chargingOrder= this.getById(uid); |
| | | |
| | | ChargingOrderListInfoVO chargingOrderListInfoVO = new ChargingOrderListInfoVO(); |
| | | chargingOrderListInfoVO.setCode(chargingOrder.getCode()); |
| | | List<Site> data = siteClient.getSiteByIds(Arrays.asList(chargingOrder.getSiteId())).getData(); |
| | | if (!data.isEmpty()){ |
| | | chargingOrderListInfoVO.setSiteName(data.get(0).getName()); |
| | | chargingOrderListInfoVO.setSiteAddress(data.get(0).getAddress()); |
| | | } |
| | | TChargingGun data1 = chargingGunClient.getChargingGunById(chargingOrder.getChargingGunId()).getData(); |
| | | TChargingPile data2 = chargingPileClient.getChargingPileById(data1.getChargingPileId()).getData(); |
| | | |
| | | if (data1!=null){ |
| | | chargingOrderListInfoVO.setGunCode(data1.getCode()); |
| | | chargingOrderListInfoVO.setTerminalName(data2.getName()+data1.getName()); |
| | | } |
| | | chargingOrderListInfoVO.setEndMode(chargingOrder.getEndMode()); |
| | | // todo 周一完善 |
| | | // 获取开始SOC 结束soc |
| | | List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataClient.getDataByOrderCode(chargingOrder.getCode()).getData(); |
| | | if (!data6.isEmpty()){ |
| | | // 第一条数据soc为开始 最后一条数据soc为结束soc |
| | | chargingOrderListInfoVO.setStartSoc(data6.get(0).getSoc().toString()); |
| | | chargingOrderListInfoVO.setEndSoc(data6.get(data6.size()-1).getSoc().toString()); |
| | | chargingOrderListInfoVO.setChargingCapacity(data6.get(data6.size()-1).getCharging_degree()); |
| | | chargingOrderListInfoVO.setChargingSecond(data6.get(data6.size()-1).getCumulative_charging_time()*60+""); |
| | | |
| | | } |
| | | if (chargingOrder.getAppUserCarId()!=null){ |
| | | List<TAppUserCar> data3 = appUserCarClient.getCarByIds(Collections.singletonList(chargingOrder.getAppUserCarId())).getData(); |
| | | if (!data3.isEmpty())chargingOrderListInfoVO.setLicensePlate(data3.get(0).getLicensePlate()); |
| | | } |
| | | chargingOrderListInfoVO.setStartTime(chargingOrder.getStartTime()); |
| | | chargingOrderListInfoVO.setEndTime(chargingOrder.getEndTime()); |
| | | chargingOrderListInfoVO.setId(chargingOrder.getId()); |
| | | chargingOrderListInfoVO.setUid(chargingOrder.getId().toString()); |
| | | chargingOrderListInfoVO.setList(data6); |
| | | chargingOrderListInfoVO.setCouponDiscountAmount(chargingOrder.getCouponDiscountAmount()); |
| | | chargingOrderListInfoVO.setVipDiscountAmount(chargingOrder.getVipDiscountAmount()); |
| | | chargingOrderListInfoVO.setSharingAmount(chargingOrder.getSharingAmount()); |
| | | chargingOrderListInfoVO.setCommissionAmount(chargingOrder.getCommissionAmount()); |
| | | // 查询费用明细列表 |
| | | List<TChargingOrderAccountingStrategy> list = chargingOrderAccountingStrategyService.lambdaQuery() |
| | | .eq(TChargingOrderAccountingStrategy::getChargingOrderId, chargingOrder.getId()) |
| | | .list(); |
| | | chargingOrderListInfoVO.setList1(list); |
| | | return chargingOrderListInfoVO; |
| | | } |
| | | |
| | | /** |
| | | * 处理充电订单实时监控数据相关的业务逻辑 |
| | |
| | | if (item.getOrderType() == 1) { |
| | | TChargingOrder tChargingOrder = chargingOrders.stream().filter(chargingOrder -> chargingOrder.getId().equals(item.getOrderId())).findFirst().orElse(null); |
| | | if(Objects.nonNull(tChargingOrder)){ |
| | | item.setChargingOrder(chargingOrders.stream().filter(chargingOrder -> chargingOrder.getId().equals(item.getOrderId())).findFirst().orElse(null)); |
| | | item.setChargingOrder(tChargingOrder); |
| | | SiteNameVO siteNameVO = chargingGunClient.getAllInfoById(tChargingOrder.getChargingGunId()).getData(); |
| | | item.setGunName(siteNameVO.getGunName()); |
| | | item.setGunNumber(siteNameVO.getGunNumber()); |
| | | item.setPileName(siteNameVO.getPileName()); |
| | | item.setPileNumber(siteNameVO.getPileNumber()); |
| | | item.setSiteName(siteNameVO.getSiteName()); |
| | | item.setEndMode(tChargingOrder.getEndMode()); |
| | | } |
| | | }else if (item.getOrderType() == 2) { |
| | | TShoppingOrder tShoppingOrder = shoppingOrders.stream().filter(shoppingOrder -> shoppingOrder.getId().equals(item.getOrderId())).findFirst().orElse(null); |
| | |
| | | BeanUtils.copyProperties(orderAppeal,orderAppealVO); |
| | | // 查询申诉详情 |
| | | if (orderAppeal.getOrderType() == 1) { |
| | | orderAppealVO.setChargingOrder(chargingOrderMapper.selectById(orderAppeal.getOrderId())); |
| | | TChargingOrder tChargingOrder = chargingOrderMapper.selectById(orderAppeal.getOrderId()); |
| | | orderAppealVO.setChargingOrder(tChargingOrder); |
| | | if(Objects.nonNull(tChargingOrder)){ |
| | | orderAppealVO.setEndMode(tChargingOrder.getEndMode()); |
| | | } |
| | | }else if (orderAppeal.getOrderType() == 2) { |
| | | TShoppingOrder tShoppingOrder = shoppingOrderMapper.selectById(orderAppeal.getOrderId()); |
| | | setGoodsInfo(orderAppealVO,tShoppingOrder); |
| | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | 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.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | 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.service.TokenService; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TOrderInvoice; |
| | | import com.ruoyi.order.api.model.TOrderInvoiceDetail; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.query.TOrderInvoiceQuery; |
| | | import com.ruoyi.order.api.vo.TOrderEvaluateVO; |
| | | import com.ruoyi.order.api.vo.TOrderInvoiceVO; |
| | | import com.ruoyi.order.dto.*; |
| | | import com.ruoyi.order.mapper.TOrderInvoiceMapper; |
| | | import com.ruoyi.order.service.TChargingOrderService; |
| | |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | |
| | | |
| | | @Resource |
| | | private CouponClient couponClient; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | return myOrderInvoiceInfo; |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<TOrderInvoiceVO> pageList(TOrderInvoiceQuery query) { |
| | | // 查询申请用户 |
| | | List<TAppUser> userList = appUserClient.selectByPhoneLike(query.getUserPhone()).getData(); |
| | | if(CollectionUtils.isEmpty(userList)){ |
| | | return new PageInfo<>(); |
| | | } |
| | | query.setUserIds(userList.stream().map(TAppUser::getId).collect(Collectors.toList())); |
| | | PageInfo<TOrderInvoiceVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | List<TOrderInvoiceVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | |
| | | List<Long> ids = list.stream().map(TOrderInvoiceVO::getId).collect(Collectors.toList()); |
| | | |
| | | List<TOrderInvoiceDetail> orderInvoiceDetailList = orderInvoiceDetailService.list(new LambdaQueryWrapper<TOrderInvoiceDetail>() |
| | | .in(TOrderInvoiceDetail::getOrderInvoiceId, ids)); |
| | | |
| | | list.forEach(e->{ |
| | | e.setServiceTariff(orderInvoiceDetailList.get(0).getServiceTariff()); |
| | | e.setElectricityTariff(orderInvoiceDetailList.get(0).getElectricityTariff()); |
| | | e.setAddedServiceTariff(orderInvoiceDetailList.get(0).getAddedServiceTariff()); |
| | | e.setAddedService(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getAddedService).reduce(BigDecimal::add).get()); |
| | | e.setElectrovalence(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getElectrovalence).reduce(BigDecimal::add).get()); |
| | | e.setServiceCharge(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getServiceCharge).reduce(BigDecimal::add).get()); |
| | | e.setUserPhone(userList.stream().filter(m->m.getId().equals(Long.parseLong(e.getBillingUserId().toString()))).findFirst().get().getPhone()); |
| | | }); |
| | | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Integer> statusCount(TOrderInvoiceQuery query) { |
| | | Map<String, Integer> map = new HashMap<>(); |
| | | List<TAppUser> userList = appUserClient.selectByPhoneLike(query.getUserPhone()).getData(); |
| | | if(CollectionUtils.isEmpty(userList)){ |
| | | map.put("notAccepted",0); |
| | | map.put("processing",0); |
| | | map.put("finished",0); |
| | | return map; |
| | | } |
| | | query.setUserIds(userList.stream().map(TAppUser::getId).collect(Collectors.toList())); |
| | | map = this.baseMapper.statusCount(query); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public List<TOrderInvoiceVO> export(TOrderInvoiceQuery query) { |
| | | // 查询申请用户 |
| | | List<TAppUser> userList = appUserClient.selectByPhoneLike(query.getUserPhone()).getData(); |
| | | if(CollectionUtils.isEmpty(userList)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | query.setUserIds(userList.stream().map(TAppUser::getId).collect(Collectors.toList())); |
| | | PageInfo<TOrderInvoiceVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | List<TOrderInvoiceVO> list = this.baseMapper.export(query); |
| | | List<Long> ids = list.stream().map(TOrderInvoiceVO::getId).collect(Collectors.toList()); |
| | | List<TOrderInvoiceDetail> orderInvoiceDetailList = orderInvoiceDetailService.list(new LambdaQueryWrapper<TOrderInvoiceDetail>() |
| | | .in(TOrderInvoiceDetail::getOrderInvoiceId, ids)); |
| | | list.forEach(e->{ |
| | | e.setServiceTariff(orderInvoiceDetailList.get(0).getServiceTariff()); |
| | | e.setElectricityTariff(orderInvoiceDetailList.get(0).getElectricityTariff()); |
| | | e.setAddedServiceTariff(orderInvoiceDetailList.get(0).getAddedServiceTariff()); |
| | | e.setAddedService(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getAddedService).reduce(BigDecimal::add).get()); |
| | | e.setElectrovalence(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getElectrovalence).reduce(BigDecimal::add).get()); |
| | | e.setServiceCharge(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getServiceCharge).reduce(BigDecimal::add).get()); |
| | | e.setUserPhone(userList.stream().filter(m->m.getId().equals(Long.parseLong(e.getBillingUserId().toString()))).findFirst().get().getPhone()); |
| | | }); |
| | | return list; |
| | | } |
| | | } |
| | |
| | | if(1 == paymentType){ |
| | | WxPaymentRefundModel model = new WxPaymentRefundModel(); |
| | | model.setOut_trade_no(shoppingOrder.getCode()); |
| | | model.setTransaction_id(shoppingOrder.getSerialNumber()); |
| | | model.setOut_refund_no(shoppingOrderRefund.getRefundCode()); |
| | | model.setReason("取消订单"); |
| | | model.setNotify_url("http://127.0.0.1:9000/order/t-shopping-order/cancelShoppingOrderWxRefund"); |
New file |
| | |
| | | package com.ruoyi.order.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.order.api.model.TChargingOrderAccountingStrategy; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "ChargingOrderListInfoVO对象",description = "充电时段统计列表查看详情VO") |
| | | public class ChargingOrderListInfoVO { |
| | | @ApiModelProperty(value = "订单编号") |
| | | private String code; |
| | | @ApiModelProperty(value = "电站名称") |
| | | private String siteName; |
| | | @ApiModelProperty(value = "电站地址") |
| | | private String siteAddress; |
| | | @ApiModelProperty(value = "终端编号") |
| | | private String gunCode; |
| | | @ApiModelProperty(value = "充电终端名称 桩+枪") |
| | | private String terminalName; |
| | | @ApiModelProperty(value = "结束原因 (0=异常终止,1=主动终止,2=满电终止,3=费用不足终止)") |
| | | private Integer endMode; |
| | | @ApiModelProperty(value = "开始soc") |
| | | private String startSoc; |
| | | @ApiModelProperty(value = "结束soc") |
| | | private String endSoc; |
| | | @ApiModelProperty(value = "充电电流 度") |
| | | private BigDecimal chargingCapacity; |
| | | @ApiModelProperty(value = "电站id") |
| | | private Integer siteId; |
| | | @ApiModelProperty(value = "充电桩id") |
| | | private Integer chargingPileId; |
| | | @ApiModelProperty(value = "用户id") |
| | | private Long appUserId; |
| | | @ApiModelProperty(value = "用户车辆id") |
| | | private Long appUserCarId; |
| | | @ApiModelProperty(value = "充电枪id") |
| | | private Integer chargingGunId; |
| | | @ApiModelProperty(value = "订单类型(1=充电订单(小程序),2=充电订单(刷卡))") |
| | | private String orderType; |
| | | @ApiModelProperty(value = "充电时间 秒") |
| | | private String chargingSecond; |
| | | @ApiModelProperty(value = "车牌号") |
| | | private String licensePlate; |
| | | @ApiModelProperty(value = "客户手机号") |
| | | private String phone; |
| | | @ApiModelProperty(value = "充电到账金额") |
| | | private BigDecimal paymentAmount; |
| | | @ApiModelProperty(value = "累计电费") |
| | | private BigDecimal electrovalence; |
| | | @ApiModelProperty(value = "累计服务费") |
| | | private BigDecimal serviceCharge; |
| | | @ApiModelProperty(value = "开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime startTime; |
| | | @ApiModelProperty(value = "结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime endTime; |
| | | @ApiModelProperty(value = "订单id") |
| | | private Long id; |
| | | @ApiModelProperty(value = "订单uid") |
| | | private String uid; |
| | | @ApiModelProperty(value = "费用明细-优惠券优惠金额") |
| | | private BigDecimal couponDiscountAmount; |
| | | @ApiModelProperty(value = "费用明细-会员优惠金额") |
| | | private BigDecimal vipDiscountAmount; |
| | | @ApiModelProperty(value = "费用明细-平台分佣") |
| | | private BigDecimal sharingAmount; |
| | | @ApiModelProperty(value = "费用明细-手续费") |
| | | private BigDecimal commissionAmount; |
| | | @ApiModelProperty(value = "充电信息") |
| | | List<UploadRealTimeMonitoringData> list; |
| | | @ApiModelProperty(value = "费用明细-费用列表") |
| | | List<TChargingOrderAccountingStrategy> list1; |
| | | } |
| | |
| | | payment_amount , |
| | | create_time, |
| | | end_time, |
| | | pay_time |
| | | pay_time, |
| | | refund_status, |
| | | (payment_amount-refund_amount) as final_amount, |
| | | del_flag |
| | | FROM |
| | | charging_pile_order.t_charging_order UNION ALL |
| | | SELECT |
| | |
| | | payment_amount , |
| | | create_time, |
| | | receiving_time as end_time, |
| | | pay_time |
| | | pay_time, |
| | | refund_status, |
| | | (payment_amount-refund_amount) as final_amount, |
| | | del_flag |
| | | FROM |
| | | charging_pile_order.t_shopping_order UNION ALL |
| | | SELECT |
| | |
| | | payment_amount , |
| | | create_time, |
| | | create_time as end_time, |
| | | pay_time |
| | | pay_time, |
| | | refund_status, |
| | | (payment_amount-refund_amount) as final_amount, |
| | | del_flag |
| | | FROM |
| | | charging_pile_order.t_vip_order UNION ALL |
| | | SELECT |
| | |
| | | order_amount as payment_amount, |
| | | create_time, |
| | | out_parking_time as end_time, |
| | | out_parking_time as pay_time |
| | | out_parking_time as pay_time, |
| | | null as refund_status, |
| | | 0 as final_amount, |
| | | 0 as del_flag |
| | | FROM |
| | | charging_pile_service.t_parking_record ) o |
| | | <where> |
| | | o.del_flag = 0 |
| | | <if test="data.code != null and data.code != ''"> |
| | | AND o.code LIKE CONCAT('%',#{data.code},'%') |
| | | </if> |
| | |
| | | <if test="data.type != null"> |
| | | AND o.type = #{data.type} |
| | | </if> |
| | | <if test="data.status != null"> |
| | | AND o.status = #{data.status} |
| | | </if> |
| | | <if test="data.createTime1 != null"> |
| | | AND o.create_time >= #{data.createTime1} |
| | | </if> |
| | |
| | | AND o.create_time <= #{data.createTime2} |
| | | </if> |
| | | </where> |
| | | |
| | | ORDER BY o.create_time desc |
| | | |
| | | </select> |
| | | <select id="getRefundList" resultType="com.ruoyi.order.api.model.TChargingOrderRefund"> |
| | |
| | | <result column="electricity_tariff" property="electricityTariff" /> |
| | | <result column="service_tariff" property="serviceTariff" /> |
| | | <result column="added_service_tariff" property="addedServiceTariff" /> |
| | | <result column="electrovalence" property="electrovalence" /> |
| | | <result column="service_charge" property="serviceCharge" /> |
| | | <result column="added_service" property="addedService" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, order_invoice_id, order_type, order_id, invoice_amount, electricity_tariff, service_tariff, added_service_tariff |
| | | id, order_invoice_id, order_type, order_id, invoice_amount, electricity_tariff, service_tariff, added_service_tariff,electrovalence,service_charge,added_service |
| | | </sql> |
| | | |
| | | </mapper> |
| | |
| | | <sql id="Base_Column_List"> |
| | | id, code, app_user_id, order_type, invoicing_company, invoice_type_id, invoice_type, invoice_material, invoicing_method, invoicing_object_type, name, tax_identification_number, company_address, company_phone, deposit_bank, bank_account, total_amount, invoice_url, mailbox, status, create_time, billing_time, billing_user_id |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.order.api.vo.TOrderInvoiceVO"> |
| | | select toi.id, toi.code, toi.app_user_id, toi.order_type, toi.invoicing_company, toi.invoice_type_id, toi.invoice_type, toi.invoice_material, |
| | | toi.invoicing_method, toi.invoicing_object_type, toi.name, toi.tax_identification_number, toi.company_address, toi.company_phone, |
| | | toi.deposit_bank, toi.bank_account, toi.total_amount, toi.invoice_url, toi.mailbox, toi.status, toi.create_time, toi.billing_time, |
| | | toi.billing_user_id |
| | | from t_order_invoice toi |
| | | <where> |
| | | <if test="query.invoicingCompany != null and query.invoicingCompany != ''"> |
| | | AND toi.invoicing_company LIKE concat('%',#{query.invoicingCompany},'%') |
| | | </if> |
| | | <if test="query.invoiceType != null and query.invoiceType != ''"> |
| | | AND toi.invoice_type LIKE concat('%',#{query.invoiceType},'%') |
| | | </if> |
| | | <if test="query.invoicingObjectType != null"> |
| | | AND toi.invoicing_object_type = #{query.invoicingObjectType} |
| | | </if> |
| | | <if test="query.invoiceMaterial != null"> |
| | | AND toi.invoice_material = #{query.invoiceMaterial} |
| | | </if> |
| | | <if test="query.invoicingMethod != null"> |
| | | AND toi.invoicing_method = #{query.invoicingMethod} |
| | | </if> |
| | | <if test="query.name != null and query.name != ''"> |
| | | AND toi.name LIKE concat('%',#{query.name},'%') |
| | | </if> |
| | | <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> |
| | | AND toi.billing_time BETWEEN #{query.startTime} AND #{query.endTime} |
| | | </if> |
| | | <if test="query.userIds != null and query.userIds.size()>0"> |
| | | AND toi.billing_user_id IN |
| | | <foreach collection="query.userIds" close=")" open="(" item="userId" separator=","> |
| | | #{userId} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | ORDER BY toi.billing_time DESC |
| | | </select> |
| | | <select id="statusCount" resultType="java.util.Map"> |
| | | select |
| | | COUNT(CASE WHEN status = 1 THEN 1 END) AS `notAccepted`, |
| | | COUNT(CASE WHEN status = 2 THEN 1 END) AS `processing`, |
| | | COUNT(CASE WHEN status = 3 THEN 1 END) AS `finished` |
| | | from t_order_invoice toi |
| | | <where> |
| | | <if test="query.invoicingCompany != null and query.invoicingCompany != ''"> |
| | | AND toi.invoicing_company LIKE concat('%',#{query.invoicingCompany},'%') |
| | | </if> |
| | | <if test="query.invoiceType != null and query.invoiceType != ''"> |
| | | AND toi.invoice_type LIKE concat('%',#{query.invoiceType},'%') |
| | | </if> |
| | | <if test="query.invoicingObjectType != null"> |
| | | AND toi.invoicing_object_type = #{query.invoicingObjectType} |
| | | </if> |
| | | <if test="query.invoiceMaterial != null"> |
| | | AND toi.invoice_material = #{query.invoiceMaterial} |
| | | </if> |
| | | <if test="query.invoicingMethod != null"> |
| | | AND toi.invoicing_method = #{query.invoicingMethod} |
| | | </if> |
| | | <if test="query.name != null and query.name != ''"> |
| | | AND toi.name LIKE concat('%',#{query.name},'%') |
| | | </if> |
| | | <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> |
| | | AND toi.billing_time BETWEEN #{query.startTime} AND #{query.endTime} |
| | | </if> |
| | | <if test="query.userIds != null and query.userIds.size()>0"> |
| | | AND toi.billing_user_id IN |
| | | <foreach collection="query.userIds" close=")" open="(" item="userId" separator=","> |
| | | #{userId} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="export" resultType="com.ruoyi.order.api.vo.TOrderInvoiceVO"> |
| | | select toi.id, toi.code, toi.app_user_id, toi.order_type, toi.invoicing_company, toi.invoice_type_id, toi.invoice_type, toi.invoice_material, |
| | | toi.invoicing_method, toi.invoicing_object_type, toi.name, toi.tax_identification_number, toi.company_address, toi.company_phone, |
| | | toi.deposit_bank, toi.bank_account, toi.total_amount, toi.invoice_url, toi.mailbox, toi.status, toi.create_time, toi.billing_time, |
| | | toi.billing_user_id |
| | | from t_order_invoice toi |
| | | <where> |
| | | <if test="query.invoicingCompany != null and query.invoicingCompany != ''"> |
| | | AND toi.invoicing_company LIKE concat('%',#{query.invoicingCompany},'%') |
| | | </if> |
| | | <if test="query.invoiceType != null and query.invoiceType != ''"> |
| | | AND toi.invoice_type LIKE concat('%',#{query.invoiceType},'%') |
| | | </if> |
| | | <if test="query.invoicingObjectType != null"> |
| | | AND toi.invoicing_object_type = #{query.invoicingObjectType} |
| | | </if> |
| | | <if test="query.invoiceMaterial != null"> |
| | | AND toi.invoice_material = #{query.invoiceMaterial} |
| | | </if> |
| | | <if test="query.invoicingMethod != null"> |
| | | AND toi.invoicing_method = #{query.invoicingMethod} |
| | | </if> |
| | | <if test="query.name != null and query.name != ''"> |
| | | AND toi.name LIKE concat('%',#{query.name},'%') |
| | | </if> |
| | | <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> |
| | | AND toi.billing_time BETWEEN #{query.startTime} AND #{query.endTime} |
| | | </if> |
| | | <if test="query.userIds != null and query.userIds.size()>0"> |
| | | AND toi.billing_user_id IN |
| | | <foreach collection="query.userIds" close=")" open="(" item="userId" separator=","> |
| | | #{userId} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | ORDER BY toi.billing_time DESC |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | total = total.add(vip.getMaximumDeduction().multiply(BigDecimal.valueOf(vip.getDiscountTimes()))); |
| | | for (VipCouponDto vipCouponDto : vipCouponDtos) { |
| | | TCoupon tCoupon = vipCouponDto.getTCoupon(); |
| | | if (tCoupon.getPreferentialMode()==2) { |
| | | total.add(tCoupon.getMaximumDiscountAmount()); |
| | | }else { |
| | | total.add(tCoupon.getDiscountAmount()); |
| | | } |
| | | } |
| | | vipInfoDto.setTotalDiscount(total); |
| | | vipInfoDto.setTimeAmount(vip.getMaximumDeduction().multiply(BigDecimal.valueOf(vip.getDiscountTimes()))); |