Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
| | |
| | | private Integer points; |
| | | @ApiModelProperty("当前优惠卷数量") |
| | | private Integer couponNum; |
| | | @ApiModelProperty("是否第一次添加车") |
| | | private Integer firstAdd; |
| | | @ApiModelProperty("当前绑定的车辆") |
| | | private List<TAppUserCar> userCars; |
| | | } |
| | |
| | | @ApiModelProperty(value = "积分") |
| | | @TableField("points") |
| | | private Integer points; |
| | | @ApiModelProperty(value = "积分") |
| | | @TableField("first_add") |
| | | private Integer firstAdd; |
| | | |
| | | @ApiModelProperty(value = "省名称") |
| | | @TableField("province") |
| | |
| | | @TableField("license_plate") |
| | | private String licensePlate; |
| | | |
| | | |
| | | @ApiModelProperty(value = "车牌") |
| | | @TableField("pic") |
| | | private String pic; |
| | | |
| | | |
| | | @ApiModelProperty(value = "车辆品牌") |
| | | @TableField("vehicle_brand") |
| | | private String vehicleBrand; |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.dto; |
| | | |
| | | import com.ruoyi.chargingPile.api.model.TApplyChargingPile; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "TApplyChargingPileDTO对象",description = "申请建桩") |
| | | public class TApplyChargingPileDTO extends TApplyChargingPile { |
| | | |
| | | @ApiModelProperty(value = "验证码") |
| | | private String code; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "充电枪总数数量") |
| | | private Integer totalCount; |
| | | |
| | | public ChargingGunCountVO(Integer freeCount, Integer totalCount) { |
| | | this.freeCount = freeCount; |
| | | this.totalCount = totalCount; |
| | | } |
| | | public ChargingGunCountVO() { |
| | | } |
| | | } |
| | |
| | | @ApiModel(value = "SiteDetailVO对象",description = "站点详情VO") |
| | | public class SiteDetailVO extends Site { |
| | | |
| | | @ApiModelProperty(value = "合作商名称") |
| | | private String partnerName; |
| | | @ApiModelProperty(value = "绑定车牌提示文案") |
| | | private String bindCarTips; |
| | | @ApiModelProperty(value = "距离") |
New file |
| | |
| | | package com.ruoyi.integration.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.*; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 充电桩服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class UploadRealTimeMonitoringDataFallbackFactory implements FallbackFactory<UploadRealTimeMonitoringDataClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(UploadRealTimeMonitoringDataFallbackFactory.class); |
| | | |
| | | @Override |
| | | public UploadRealTimeMonitoringDataClient create(Throwable throwable) { |
| | | log.error("调用充电桩实时监测数据失败:{}", throwable.getMessage()); |
| | | return new UploadRealTimeMonitoringDataClient() { |
| | | |
| | | |
| | | @Override |
| | | public R<UploadRealTimeMonitoringData> chargingOrderInfo(String orderId) { |
| | | return R.fail("查询充电桩实时监测数据失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<UploadRealTimeMonitoringData>> getDataByOrderCode(String code) { |
| | | return R.fail("根据订单编号获取所有监测数据失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.integration.api.factory.UploadRealTimeMonitoringDataFallbackFactory; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | 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/8/26 18:20 |
| | | */ |
| | | @FeignClient(contextId = "UploadRealTimeMonitoringDataClient", value = ServiceNameConstants.INTEGRATION_SERVICE, fallbackFactory = UploadRealTimeMonitoringDataFallbackFactory.class) |
| | | public interface UploadRealTimeMonitoringDataClient { |
| | | |
| | | /** |
| | | * 通过订单编号获取充电桩实时监测数据 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | @PostMapping("/uploadRealTimeMonitoringData/getOrderInfoByCode") |
| | | R<UploadRealTimeMonitoringData> chargingOrderInfo(String orderId); |
| | | |
| | | /** |
| | | * 根据订单编号获取所有监测数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @PostMapping("/uploadRealTimeMonitoringData/getDataByOrderCode") |
| | | R<List<UploadRealTimeMonitoringData>> getDataByOrderCode(@RequestParam("code") String code); |
| | | } |
| | |
| | | @Data |
| | | @Document(collection = "acquisition_billing_mode") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class AcquisitionBillingMode { |
| | | public class AcquisitionBillingMode extends BaseModel { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | |
| | |
| | | @Data |
| | | @Document(collection = "acquisition_billing_mode_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class AcquisitionBillingModeReply { |
| | | public class AcquisitionBillingModeReply extends BaseModel { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String billing_model_code;// "计费模型编号 |
New file |
| | |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/26 19:05 |
| | | */ |
| | | @Data |
| | | public class BaseModel { |
| | | |
| | | private Date create_time = new Date(); |
| | | } |
| | |
| | | @Data |
| | | @Document(collection = "billing_mode_verify") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BillingModeVerify { |
| | | public class BillingModeVerify extends BaseModel { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String billing_model_code;// "计费模型编号,首次连接到平台时置零 |
| | |
| | | @Data |
| | | @Document(collection = "billing_mode_verify_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BillingModeVerifyReply { |
| | | public class BillingModeVerifyReply extends BaseModel { |
| | | |
| | | private String charging_pile_code; // 桩编 |
| | | private String billing_model_code; // 计费模型编 |
| | |
| | | @Data |
| | | @Document(collection = "bms_abort") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BmsAbort { |
| | | public class BmsAbort extends BaseModel { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | |
| | | @Data |
| | | @Document(collection = "bms_demand_and_charger_exportation") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BmsDemandAndChargerExportation { |
| | | public class BmsDemandAndChargerExportation extends BaseModel { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | |
| | | @Data |
| | | @Document(collection = "bms_information") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BmsInformation { |
| | | public class BmsInformation extends BaseModel { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | |
| | | @Data |
| | | @Document(collection = "charging_handshake") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ChargingHandshake { |
| | | public class ChargingHandshake extends BaseModel { |
| | | |
| | | private String transaction_serial_number;// 交易流水号 |
| | | private String charging_pile_code;// 桩编码 |
| | |
| | | @Data |
| | | @Document(collection = "charging_pile_returns_ground_lock_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ChargingPileReturnsGroundLockData { |
| | | public class ChargingPileReturnsGroundLockData extends BaseModel { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | |
| | | @Data |
| | | @Document(collection = "charging_pile_starts_charging") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ChargingPileStartsCharging { |
| | | public class ChargingPileStartsCharging extends BaseModel { |
| | | |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | |
| | | @Data |
| | | @Document(collection = "clear_offline_card") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ClearOfflineCard { |
| | | public class ClearOfflineCard extends BaseModel { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer physical_card_number; // 清除离线卡的个数,最大 24 个 |
| | |
| | | @Data |
| | | @Document(collection = "clear_offline_card_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ClearOfflineCardReply { |
| | | public class ClearOfflineCardReply extends BaseModel { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String physical_card1; // 第 1 个卡物理卡号,离线卡物理卡号 |
| | |
| | | @Data |
| | | @Document(collection = "confirm_transaction_record") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ConfirmTransactionRecord { |
| | | public class ConfirmTransactionRecord extends BaseModel { |
| | | |
| | | private String transaction_serial_number;// 桩编码 |
| | | private Integer confirm_result;// 确认结果(0:上传成功,1:非法账单) |
| | |
| | | @Data |
| | | @Document(collection = "end_charge") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class EndCharge { |
| | | public class EndCharge extends BaseModel { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | |
| | | @Data |
| | | @Document(collection = "error_message") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ErrorMessage { |
| | | public class ErrorMessage extends BaseModel { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | |
| | | @Data |
| | | @Document(collection = "ground_lock_real_time_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class GroundLockRealTimeData { |
| | | public class GroundLockRealTimeData extends BaseModel { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | |
| | | @Data |
| | | @Document(collection = "motor_abort") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class MotorAbort { |
| | | public class MotorAbort extends BaseModel { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | |
| | | @Data |
| | | @Document(collection = "online") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class Online { |
| | | public class Online extends BaseModel { |
| | | private String charging_pile_code;// 充电桩编号 |
| | | private Integer charging_pile_type;// 充电桩类型(0 表示直流桩,1 表示交流桩) |
| | | private Integer charging_gun_number;// 充电枪数量 |
| | |
| | | @Data |
| | | @Document(collection = "online_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class OnlineReply { |
| | | public class OnlineReply extends BaseModel { |
| | | private String charging_pile_code;// 桩编码 |
| | | private Integer online_result;// 登陆结果(0:成功,1:失败) |
| | | } |
| | |
| | | @Data |
| | | @Document(collection = "open_or_close_ground_lock") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class OpenOrCloseGroundLock { |
| | | public class OpenOrCloseGroundLock extends BaseModel { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | |
| | | @Data |
| | | @Document(collection = "parameter_setting") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ParameterSetting { |
| | | public class ParameterSetting extends BaseModel { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | |
| | | @Data |
| | | @Document(collection = "ping") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class Ping { |
| | | public class Ping extends BaseModel { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | |
| | | @Data |
| | | @Document(collection = "platform_confirmation_charging") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformConfirmationCharging { |
| | | public class PlatformConfirmationCharging extends BaseModel { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | |
| | | @Data |
| | | @Document(collection = "platform_remote_update") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformRemoteUpdate { |
| | | public class PlatformRemoteUpdate extends BaseModel { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer charging_pile_type; // 桩型号(1:直流,2:交流) |
| | |
| | | @Data |
| | | @Document(collection = "platform_remote_update_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformRemoteUpdateReply { |
| | | public class PlatformRemoteUpdateReply extends BaseModel { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer escalation_state; // 升级状态(0:成功,1:编码错误,2:程序与桩型号不符,3:下载更新文件超时) |
| | |
| | | @Data |
| | | @Document(collection = "platform_restart") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformRestart { |
| | | public class PlatformRestart extends BaseModel { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer operate; // 执行控制 (1:立即执行,2:空闲执行) |
| | |
| | | @Data |
| | | @Document(collection = "platform_restart_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformRestartReply { |
| | | public class PlatformRestartReply extends BaseModel { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer set_result; // 设置结果(0:失败,1:成功) |
| | |
| | | @Data |
| | | @Document(collection = "platform_start_charging") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformStartCharging { |
| | | public class PlatformStartCharging extends BaseModel { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | |
| | | @Data |
| | | @Document(collection = "platform_start_charging_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformStartChargingReply { |
| | | public class PlatformStartChargingReply extends BaseModel { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | |
| | | @Data |
| | | @Document(collection = "platform_stop_charging") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformStopCharging { |
| | | public class PlatformStopCharging extends BaseModel { |
| | | |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | |
| | | @Data |
| | | @Document(collection = "platform_stop_charging_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformStopChargingReply { |
| | | public class PlatformStopChargingReply extends BaseModel { |
| | | |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | |
| | | @Data |
| | | @Document(collection = "pong") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class Pong { |
| | | public class Pong extends BaseModel { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | |
| | | @Data |
| | | @Document(collection = "query_offline_card") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class QueryOfflineCard { |
| | | public class QueryOfflineCard extends BaseModel { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer physical_card_number; //桩编码 |
| | |
| | | @Data |
| | | @Document(collection = "query_offline_card_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class QueryOfflineCardReply { |
| | | public class QueryOfflineCardReply extends BaseModel { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String physical_card1; // 第 1 个卡物理卡号,离线卡物理卡号 |
| | |
| | | @Data |
| | | @Document(collection = "read_real_time_monitoring_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ReadRealTimeMonitoringData { |
| | | public class ReadRealTimeMonitoringData extends BaseModel { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | |
| | | @Data |
| | | @Document(collection = "setup_billing_model") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class SetupBillingModel { |
| | | public class SetupBillingModel extends BaseModel { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String billing_model_code; // 计费模型编号 |
| | |
| | | @Data |
| | | @Document(collection = "setup_billing_model_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class SetupBillingModelReply { |
| | | public class SetupBillingModelReply extends BaseModel { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String set_result; //设置结果(0:失败,1:成功) |
| | |
| | | @Data |
| | | @Document(collection = "synchronize_offline_card") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class SynchronizeOfflineCard { |
| | | public class SynchronizeOfflineCard extends BaseModel { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer card_number; // 下发卡个数 |
| | |
| | | @Data |
| | | @Document(collection = "synchronize_offline_card_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class SynchronizeOfflineCardReply { |
| | | public class SynchronizeOfflineCardReply extends BaseModel { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer save_result; // 保存结果(0:失败,1:成功) |
| | |
| | | @Data |
| | | @Document(collection = "timing_setting") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class TimingSetting { |
| | | public class TimingSetting extends BaseModel { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String current_time; //当前时间 |
| | |
| | | @Data |
| | | @Document(collection = "timing_setting_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class TimingSettingReply { |
| | | public class TimingSettingReply extends BaseModel { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String current_time; //当前时间 |
| | |
| | | @Data |
| | | @Document(collection = "transaction_record") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class TransactionRecord { |
| | | public class TransactionRecord extends BaseModel { |
| | | |
| | | private String transaction_serial_number;// 交易流水号 |
| | | private String charging_pile_code;// 桩编码 |
| | |
| | | @Data |
| | | @Document(collection = "update_balance") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class UpdateBalance { |
| | | public class UpdateBalance extends BaseModel { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | |
| | | @Data |
| | | @Document(collection = "update_balance_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class UpdateBalanceReply { |
| | | public class UpdateBalanceReply extends BaseModel { |
| | | |
| | | private String charging_pile_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; |
| | |
| | | @Data |
| | | @Document(collection = "upload_real_time_monitoring_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class UploadRealTimeMonitoringData { |
| | | public class UploadRealTimeMonitoringData extends BaseModel { |
| | | |
| | | @Id |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | |
| | | @Data |
| | | @Document(collection = "working_parameter_setting") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class WorkingParameterSetting { |
| | | public class WorkingParameterSetting extends BaseModel { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer allow_work;// 是否允许工作(0:表示允许正常工作,1:表示停止使用,锁定充电桩) |
| | |
| | | @Data |
| | | @Document(collection = "working_parameter_setting_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class WorkingParameterSettingReply { |
| | | public class WorkingParameterSettingReply extends BaseModel { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer set_result; //设置结果(0:失败,1:成功) |
| | |
| | | com.ruoyi.integration.api.factory.IntegrationFallbackFactory |
| | | com.ruoyi.integration.api.factory.UploadRealTimeMonitoringDataFallbackFactory |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "SiteDetailEvaluateVO对象",description = "站点详情订单评价") |
| | | public class SiteDetailEvaluateVO extends TOrderEvaluate { |
| | | public class SiteDetailEvaluateVO implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "好评率") |
| | | private BigDecimal reviewRate; |
| | |
| | | loginLog.setUserId(userId); |
| | | loginLog.setUsername(username); |
| | | loginLog.setIpAddress(headerData.get("ip")); |
| | | loginLog.setAddress("");// todo 待完善 https://www.juhe.cn/docs/api/id/1 |
| | | loginLog.setAddress(""); |
| | | loginLog.setBrowserType(headerData.get("browser")); |
| | | loginLog.setOperatingSystem(headerData.get("os")); |
| | | loginLog.setLoginTime(LocalDateTime.now()); |
| | |
| | | public static final String DATE_FORMATTER_TIME = "yyyy-MM-dd HH:mm:ss"; |
| | | public static final String DATE_FORMATTER_DATE = "yyyy-MM-dd"; |
| | | /** |
| | | * 后缀 |
| | | * 修改手机号后缀 |
| | | */ |
| | | public static final String APPLET = "_applet"; |
| | | public static final String UPDATE_PHONE = "_updatePhone"; |
| | | /** |
| | | * 申请建桩后缀 |
| | | */ |
| | | public static final String APPLY_CHARGING = "_applyCharging"; |
| | | /** |
| | | * 定时任务违规的字符 |
| | | */ |
| | |
| | | public static final String SEND_URL = "http://112.35.1.155:1992/sms/tmpsubmit"; |
| | | /** 更换手机号短信验证码 TEMPLATE_ID */ |
| | | public static final String CODE_TEMPLATE_ID = "5bf3949463e54c03a25c6fce3ad48139"; |
| | | /** 建桩申请短信验证码 TEMPLATE_ID */ |
| | | public static final String APPLY_TEMPLATE_ID = "44ac24b86a9f4dd6bee41577e2703472"; |
| | | |
| | | /** 停车占位提醒 TEMPLATE_ID */ |
| | | public static final String STOP_TEMPLATE_ID = "4940ce98a3f94f67aa9f5cd2d4e05cbd"; |
| | |
| | | public static final String FAULT_TEMPLATE_ID = "37956469a14a47e484a747a1e7e462de"; |
| | | /** 更换手机号短信验证码 AP_ID */ |
| | | public static final String CODE_AP_ID = "GH123"; |
| | | /** 建桩短信验证码 AP_ID */ |
| | | public static final String APPLY_AP_ID = "JZ123"; |
| | | |
| | | /** 停车占位提醒 AP_ID */ |
| | | public static final String STOP_AP_ID = "TC123"; |
| | |
| | | return encode; |
| | | } |
| | | |
| | | /** |
| | | * 更换手机号:【签名】验证码:XXX,用于更换手机号。请勿转发。 |
| | | * @param phone 手机号 |
| | | * @param code 验证码 |
| | | * @return |
| | | */ |
| | | public static String applyCodeMsg(String phone,String code){ |
| | | SubmitTempletReq submitReq = new SubmitTempletReq(); |
| | | String[] paramss = {code}; |
| | | submitReq.setApId(MsgConstants.APPLY_AP_ID); |
| | | submitReq.setEcName(ecName); |
| | | submitReq.setSecretKey(secretKey); |
| | | submitReq.setParams(JSON.toJSONString(paramss)); |
| | | submitReq.setMobiles(phone); |
| | | submitReq.setAddSerial(""); |
| | | submitReq.setSign(sign); |
| | | submitReq.setTemplateId(MsgConstants.APPLY_TEMPLATE_ID); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | stringBuffer.append(submitReq.getEcName()); |
| | | stringBuffer.append(submitReq.getApId()); |
| | | stringBuffer.append(submitReq.getSecretKey()); |
| | | stringBuffer.append(submitReq.getTemplateId()); |
| | | stringBuffer.append(submitReq.getMobiles()); |
| | | stringBuffer.append(submitReq.getParams()); |
| | | stringBuffer.append(submitReq.getSign()); |
| | | stringBuffer.append(submitReq.getAddSerial()); |
| | | submitReq.setMac(MD5Util.getMD5(stringBuffer.toString())); |
| | | String reqText = JSON.toJSONString(submitReq); |
| | | //加密 |
| | | String encode = Base64.encodeBase64String(reqText.getBytes()); |
| | | System.err.println(encode); |
| | | return encode; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 停车占位提醒:车辆已在3小时前完成充电,请及时取车,避免长时间占用充电资源。 |
| | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | |
| | | return R.ok(tAppCouponService.pagelist(couponId)); |
| | | } |
| | | |
| | | @ApiOperation(value = "优惠卷可用数量", tags = {"小程序-站点管理-站点详情"}) |
| | | @GetMapping(value = "/couponCount") |
| | | public R<Long> couponCount() { |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | return R.ok(tAppCouponService.lambdaQuery().le(TAppCoupon::getStartTime, now).ge(TAppCoupon::getEndTime, now).eq(TAppCoupon::getStatus, 1).count()); |
| | | } |
| | | |
| | | @Autowired |
| | | private TAppUserTagService appUserTagService; |
| | | @Autowired |
| | |
| | | tAppUserCar.setUid(tAppUserCar.getId().toString()); |
| | | } |
| | | appUserInfoDto.setUserCars(list); |
| | | appUserInfoDto.setFirstAdd(byId.getFirstAdd()!=null?byId.getFirstAdd():0); |
| | | return R.ok(appUserInfoDto); |
| | | |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "优惠卷列表不分页(1可使用2不可用)", tags = {"小程序-个人中心"}) |
| | | |
| | | @ApiOperation(value = "优惠卷详情(1可使用2不可用)", tags = {"小程序-个人中心"}) |
| | | @PostMapping(value = "/user/coupon/getById") |
| | | public R<TAppCoupon> couponGetById(@RequestParam("id")Long id) { |
| | | TAppCoupon appCoupon = appCouponService.getById(id); |
| | |
| | | @ApiOperation(value = "更换手机号", tags = {"小程序-用户管理-更换手机号"}) |
| | | @PostMapping(value = "/user/updatePhone") |
| | | public AjaxResult<String> updatePhone(@Validated @RequestBody UpdatePhoneDTO dto) { |
| | | String code = redisService.getCacheObject(dto.getPhone() + Constants.APPLET); |
| | | String code = redisService.getCacheObject(dto.getPhone() + Constants.UPDATE_PHONE); |
| | | if(StringUtils.isEmpty(code)){ |
| | | return AjaxResult.error("验证码已过期,请重新获取验证码!"); |
| | | } |
| | |
| | | //增加积分记录 |
| | | pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()+point,5,userId,appUserCar.getLicensePlate(),""); |
| | | byId.setPoints(byId.getPoints()+point); |
| | | byId.setFirstAdd(1); |
| | | appUserService.updateById(byId); |
| | | |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "根据品牌获取车型", tags = {"小程序-个人中心-车辆"}) |
| | | @ApiOperation(value = "根据品牌获取车系", tags = {"小程序-个人中心-车辆"}) |
| | | @GetMapping(value = "/user/car/getModel") |
| | | public R getModel(String id) throws Exception { |
| | | String modelById = CarBrandUtil.getModelById(id); |
| | |
| | | } |
| | | return R.ok(backList); |
| | | } |
| | | @ApiOperation(value = "根据车系获取车型", tags = {"小程序-个人中心-车辆"}) |
| | | @GetMapping(value = "/user/car/getSeries") |
| | | public R getSeries(String id) throws Exception { |
| | | String modelById = CarBrandUtil.getSeriesById(id); |
| | | JSONObject jsonObject = JSON.parseObject(modelById); |
| | | JSONArray data = jsonObject.getJSONArray("data"); |
| | | JSONArray backList = new JSONArray(); |
| | | for (Object datum : data) { |
| | | JSONObject jsonObject1 = JSON.parseObject(datum.toString()); |
| | | JSONArray list = jsonObject1.getJSONArray("list"); |
| | | backList.addAll(list); |
| | | } |
| | | return R.ok(backList); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | |
| | | |
| | | public static String getSeriesById(String brandId) throws Exception { |
| | | // Create a new request. |
| | | Request httpClientRequest = new Request(); |
| | | try { |
| | | // Set the request parameters. |
| | | // AppKey, AppSecrect, Method and Url are required parameters. |
| | | // Directly writing AK/SK in code is risky. For security, encrypt your AK/SK and store them in the configuration file or environment variables. |
| | | // In this example, the AK/SK are stored in environment variables for identity authentication. |
| | | // Before running this example, set environment variables HUAWEICLOUD_SDK_AK and HUAWEICLOUD_SDK_SK. |
| | | httpClientRequest.setKey("9a4a2b69afe141718f6843c5d39961ec"); |
| | | httpClientRequest.setSecret("541845f206324bbc933065b44fc98c47"); |
| | | httpClientRequest.setMethod("POST"); |
| | | // Set a request URL in the format of https://{Endpoint}/{URI}. |
| | | httpClientRequest.setUrl("https://vehiclequery.apistore.huaweicloud.com/vehicle/query/model"); |
| | | httpClientRequest.addHeader("Content-Type", "text/plain"); |
| | | httpClientRequest.addQueryStringParam("seriesId",brandId); |
| | | // Set a body for http request. |
| | | // httpClientRequest.setBody("put your request body here"); |
| | | } catch (Exception e) { |
| | | // LOGGER.error(e.getMessage()); |
| | | return ""; |
| | | } |
| | | CloseableHttpClient client = null; |
| | | try { |
| | | // Sign the request. |
| | | HttpRequestBase signedRequest = Client.sign(httpClientRequest, Constant.SIGNATURE_ALGORITHM_SDK_HMAC_SHA256); |
| | | if (Constant.DO_VERIFY) { |
| | | // creat httpClient and verify ssl certificate |
| | | HostName.setUrlHostName(httpClientRequest.getHost()); |
| | | client = (CloseableHttpClient) SSLCipherSuiteUtil.createHttpClientWithVerify(Constant.INTERNATIONAL_PROTOCOL); |
| | | } else { |
| | | // creat httpClient and do not verify ssl certificate |
| | | client = (CloseableHttpClient) SSLCipherSuiteUtil.createHttpClient(Constant.INTERNATIONAL_PROTOCOL); |
| | | } |
| | | HttpResponse response = client.execute(signedRequest); |
| | | // Print the body of the response. |
| | | HttpEntity resEntity = response.getEntity(); |
| | | if (resEntity != null) { |
| | | // LOGGER.info("Processing Body with name: {} and value: {}", System.getProperty("line.separator"), |
| | | // EntityUtils.toString(resEntity, "UTF-8")); |
| | | String string = EntityUtils.toString(resEntity, "UTF-8"); |
| | | return string; |
| | | } |
| | | } catch (Exception e) { |
| | | LOGGER.error(e.getMessage()); |
| | | } finally { |
| | | if (client != null) { |
| | | client.close(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | } |
| | |
| | | import org.openeuler.BGMProvider; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import okhttp3.OkHttpClient; |
| | | import shade.okhttp3.OkHttpClient; |
| | | |
| | | import javax.net.ssl.*; |
| | | import java.net.HttpURLConnection; |
| | |
| | | t1.del_flag = 0 |
| | | AND t1.app_user_id = #{userId} |
| | | AND t1.status = 1 |
| | | and t1.endTime >= now() |
| | | and t1.end_time >= now() |
| | | GROUP BY |
| | | t1.coupon_id, |
| | | t1.end_time |
| | | t1.app_user_id, |
| | | t1.coupon_id |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-order</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-integration</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | |
| | | <version>3.3.0</version> |
| | | <type>pom</type> |
| | | </dependency> |
| | | |
| | | <!--二维码--> |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>core</artifactId> |
| | | <version>3.3.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>javase</artifactId> |
| | | <version>3.3.0</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | import com.ruoyi.common.core.utils.MsgUtil; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.Objects; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | @RestController |
| | | @RequestMapping("/code") |
| | | public class CodeController { |
| | | |
| | | @Autowired |
| | |
| | | * @return 结果 |
| | | */ |
| | | @ApiOperation(value = "获取验证码",notes = "获取验证码",tags = {"更换手机号获取验证码"}) |
| | | @GetMapping("getCode") |
| | | @GetMapping("/getCode") |
| | | public AjaxResult getCode(@RequestParam("phone") String phone) |
| | | { |
| | | TAppUser appUser = appUserClient.selectByPhone(phone).getData(); |
| | |
| | | return AjaxResult.error("该手机号已绑定账号"); |
| | | } |
| | | String code = MsgUtil.createCode(); |
| | | redisService.setCacheObject(phone+ Constants.APPLET,code,5L, TimeUnit.MINUTES); |
| | | redisService.setCacheObject(phone+ Constants.UPDATE_PHONE,code,5L, TimeUnit.MINUTES); |
| | | String reqStr = MsgUtil.codeMsg(phone, code); |
| | | String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | // 记录短信发送 |
| | |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | /** |
| | | * 获取验证码 |
| | | * |
| | | * @param phone 手机号 |
| | | * @return 结果 |
| | | */ |
| | | @ApiOperation(value = "获取验证码",notes = "获取验证码",tags = {"申请建桩获取验证码"}) |
| | | @GetMapping("/getApplyCode") |
| | | public AjaxResult getApplyCode(@RequestParam("phone") String phone) |
| | | { |
| | | String code = MsgUtil.createCode(); |
| | | redisService.setCacheObject(phone+ Constants.APPLY_CHARGING,code,5L, TimeUnit.MINUTES); |
| | | String reqStr = MsgUtil.applyCodeMsg(phone, code); |
| | | String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | // 记录短信发送 |
| | | chargingPileNotificationService.saveData(1,null,null,phone,"验证码:"+code+",用于申请建桩。请勿转发。"); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | } |
| | |
| | | @PostMapping("/getDetailById") |
| | | public AjaxResult<SiteDetailVO> getDetailById(@Validated @RequestBody SiteDetailQuery query){ |
| | | SiteDetailVO siteDetailVO = siteService.getDetailById(query.getSiteId()); |
| | | // 查询合作商名称 |
| | | Partner partner = partnerService.getById(siteDetailVO.getPartnerId()); |
| | | if(Objects.nonNull(partner)){ |
| | | siteDetailVO.setPartnerName(partner.getName()); |
| | | } |
| | | // 计算距离 |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(query.getLat() + "," + query.getLon(), siteDetailVO.getLat() + "," + siteDetailVO.getLon()); |
| | | siteDetailVO.setDistance(distance.get("WGS84")); |
| | |
| | | @ApiOperation(value = "获取站点下充电桩及充电枪列表", tags = {"小程序-站点管理-站点详情"}) |
| | | @GetMapping("/getChargingGunList") |
| | | public AjaxResult<List<TChargingPileVO>> getChargingGunList(@RequestParam(value = "siteId")@ApiParam(value = "站点id", required = true)Integer siteId, |
| | | @RequestParam(value = "siteId",required = false)@ApiParam(value = "类型 1=超充,2=快充,3=慢充")Integer type){ |
| | | @RequestParam(value = "type",required = false)@ApiParam(value = "类型 1=超充,2=快充,3=慢充")Integer type){ |
| | | return AjaxResult.success(chargingPileService.getChargingGunList(siteId,type)); |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategy; |
| | | 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.common.core.exception.ServiceException; |
| | |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.time.LocalTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | |
| | | @RequestMapping("/t-accounting-strategy-detail") |
| | | public class TAccountingStrategyDetailController { |
| | | |
| | | private final ISiteService siteService; |
| | | private final TAccountingStrategyService accountingStrategyService; |
| | | private final TAccountingStrategyDetailService accountingStrategyDetailService; |
| | | |
| | | @Autowired |
| | | public TAccountingStrategyDetailController(TAccountingStrategyService accountingStrategyService, TAccountingStrategyDetailService accountingStrategyDetailService) { |
| | | public TAccountingStrategyDetailController(ISiteService siteService, TAccountingStrategyService accountingStrategyService, TAccountingStrategyDetailService accountingStrategyDetailService) { |
| | | this.siteService = siteService; |
| | | this.accountingStrategyService = accountingStrategyService; |
| | | this.accountingStrategyDetailService = accountingStrategyDetailService; |
| | | } |
| | |
| | | @ApiOperation(tags = {"小程序-站点管理-站点详情"},value = "通过站点id查询计费策略明细列表") |
| | | @GetMapping(value = "/queryAccountingStrategyDetailBySiteId") |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryAccountingStrategyDetailBySiteId(@RequestParam("siteId") Integer siteId) { |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getOne(Wrappers.lambdaQuery(TAccountingStrategy.class) |
| | | .eq(TAccountingStrategy::getSiteId, siteId) |
| | | .last("limit 1")); |
| | | Site site = siteService.getById(siteId); |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getById(site.getAccountingStrategyId()); |
| | | if(Objects.isNull(accountingStrategy)){ |
| | | throw new ServiceException("未查询到计费策略"); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.chargingPile.api.dto.ApplyChargingQuery; |
| | | import com.ruoyi.chargingPile.api.dto.ApplyChargingRemarkDto; |
| | | import com.ruoyi.chargingPile.api.dto.TApplyChargingPileDTO; |
| | | import com.ruoyi.chargingPile.api.model.TApplyChargingPile; |
| | | import com.ruoyi.chargingPile.dto.TApplyChargingPileExportDto; |
| | | import com.ruoyi.chargingPile.service.TApplyChargingPileService; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.codec.CharEncoding; |
| | |
| | | |
| | | private final TApplyChargingPileService applyChargingPileService; |
| | | private final TokenService tokenService; |
| | | private final RedisService redisService; |
| | | |
| | | @Autowired |
| | | public TApplyChargingPileController(TApplyChargingPileService applyChargingPileService, TokenService tokenService) { |
| | | public TApplyChargingPileController(TApplyChargingPileService applyChargingPileService, TokenService tokenService, RedisService redisService) { |
| | | this.applyChargingPileService = applyChargingPileService; |
| | | this.tokenService = tokenService; |
| | | this.redisService = redisService; |
| | | } |
| | | |
| | | /** |
| | |
| | | @Log(title = "建桩申请", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) |
| | | @ApiOperation(tags = {"小程序-建桩申请"},value = "建桩申请") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@RequestBody TApplyChargingPile dto) { |
| | | public AjaxResult<Boolean> add(@RequestBody TApplyChargingPileDTO dto) { |
| | | // 验证验证码 |
| | | String code = redisService.getCacheObject(dto.getLandlordPhone() + Constants.APPLY_CHARGING); |
| | | if(StringUtils.isEmpty(code)){ |
| | | return AjaxResult.error("验证码已过期,请重新获取验证码!"); |
| | | } |
| | | if(!code.equals(dto.getCode())){ |
| | | return AjaxResult.error("验证码错误!"); |
| | | } |
| | | // 用户id |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | dto.setAppUserId(userId); |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import cn.hutool.core.img.ImgUtil; |
| | | import cn.hutool.core.io.FileUtil; |
| | | import com.ruoyi.chargingPile.api.dto.TChargingGunDTO; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.chargingPile.util.QRCodeUtils; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BaseDelete; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.BufferedReader; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileReader; |
| | | import java.io.PrintWriter; |
| | | import java.net.URLEncoder; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | |
| | | @ApiOperation(tags = {"管理后台-充电桩信息"},value = "下载二维码") |
| | | @GetMapping(value = "/downloadQRCode/{id}") |
| | | public void downloadQRCode(@PathVariable Integer id, HttpServletResponse response){ |
| | | // todo 待完善 |
| | | try { |
| | | TChargingGun chargingGun = chargingGunService.getById(id); |
| | | String fileName = URLEncoder.encode(chargingGun.getCode(), "UTF-8") + ".jpg"; |
| | | response.setContentType("application/force-download"); |
| | | response.addHeader("Content-Disposition", "attachment;fileName=" + fileName); |
| | | String url = "https://www.baidu.com?id=" + id; |
| | | String filePath = "D:/Program Files/nginx-1.20.2/html"; |
| | | QRCodeUtils.encode(url, filePath); |
| | | FileInputStream inputStream = new FileInputStream(filePath); |
| | | ServletOutputStream out = response.getOutputStream(); |
| | | int len = 0; |
| | | byte[] buf = new byte[1024]; |
| | | while ((len = inputStream.read(buf, 0, 1024)) != -1) { |
| | | out.write(buf); |
| | | } |
| | | out.flush(); |
| | | out.close(); |
| | | inputStream.close(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | * 查询充电桩列表 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-充电桩"},value = "通过站点id查询充电桩列表") |
| | | @PostMapping(value = "/list") |
| | | @GetMapping(value = "/list") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "siteId", value = "站点id") |
| | | }) |
| | |
| | | accountingStrategyDetailVO.setEndTime("23:59:59".equals(accountingStrategyDetailVO.getEndTime())? "00:00":accountingStrategyDetailVO.getEndTime()); |
| | | accountingStrategyDetailNext = list.stream().filter(detail -> detail.getStartTime().compareTo(accountingStrategyDetailVO.getEndTime()) == 0) |
| | | .findFirst().orElseThrow(() -> new ServiceException("未查询到下一时间段的计费策略明细")); |
| | | if(Objects.nonNull(vip) && vip.getType() == 2){ |
| | | accountingStrategyDetailVO.setDiscount(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge()).multiply(vip.getDiscount())); |
| | | accountingStrategyDetailNext.setDiscount(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge()).multiply(vip.getDiscount())); |
| | | if(Objects.nonNull(vip)) { |
| | | if (vip.getType() == 2) { |
| | | accountingStrategyDetailVO.setTotalPrice(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge()).multiply(vip.getDiscount())); |
| | | accountingStrategyDetailNext.setTotalPrice(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge()).multiply(vip.getDiscount())); |
| | | }else { |
| | | accountingStrategyDetailVO.setDiscount(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge()).multiply(accountingStrategy.getDiscount())); |
| | | accountingStrategyDetailNext.setDiscount(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge()).multiply(accountingStrategy.getDiscount())); |
| | | accountingStrategyDetailVO.setTotalPrice(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge()).multiply(accountingStrategy.getDiscount())); |
| | | accountingStrategyDetailNext.setTotalPrice(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge()).multiply(accountingStrategy.getDiscount())); |
| | | } |
| | | }else { |
| | | accountingStrategyDetailVO.setTotalPrice(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge())); |
| | | accountingStrategyDetailNext.setTotalPrice(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge())); |
| | | } |
| | | list = new ArrayList<>(); |
| | | list.add(accountingStrategyDetailVO); |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.chargingPile.api.dto.TChargingGunDTO; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.query.TChargingGunQuery; |
| | | import com.ruoyi.chargingPile.api.vo.ChargingGunCountVO; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | |
| | | import com.ruoyi.chargingPile.mapper.TChargingGunMapper; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.enums.status.ChargingGunModeEnum; |
| | | import com.ruoyi.common.core.enums.status.ChargingGunStatusEnum; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | @Autowired |
| | | private TChargingPileService chargingPileService; |
| | | |
| | | |
| | | |
| | |
| | | @Override |
| | | public Map<String, ChargingGunCountVO> getChargingGunCount(Integer siteId) { |
| | | Map<String, ChargingGunCountVO> map = new HashMap<>(4); |
| | | //查询充电桩 |
| | | List<TChargingPile> pileList = chargingPileService.list(Wrappers.lambdaQuery(TChargingPile.class) |
| | | .eq(TChargingPile::getSiteId, siteId)); |
| | | if(CollectionUtils.isEmpty(pileList)){ |
| | | map.put("superSufficient", new ChargingGunCountVO(0,0)); |
| | | map.put("fastSufficient", new ChargingGunCountVO(0,0)); |
| | | map.put("slowSufficient", new ChargingGunCountVO(0,0)); |
| | | map.put("totalSufficient", new ChargingGunCountVO(0,0)); |
| | | return map; |
| | | } |
| | | Set<Integer> pileIds = pileList.stream().map(TChargingPile::getId).collect(Collectors.toSet()); |
| | | // 查询全部充电枪 |
| | | List<TChargingGun> list = this.list(Wrappers.lambdaQuery(TChargingGun.class).eq(TChargingGun::getSiteId, siteId)); |
| | | List<TChargingGun> list = this.list(Wrappers.lambdaQuery(TChargingGun.class).eq(TChargingGun::getSiteId, siteId) |
| | | .in(TChargingGun::getChargingPileId, pileIds)); |
| | | int freeCount = 0; |
| | | // 超级充 |
| | | ChargingGunCountVO superSufficient = getGunCount(ChargingGunModeEnum.SUPER_SUFFICIENT.getCode(), list); |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderAccountingStrategyClient; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | |
| | | |
| | | @Resource |
| | | private AppUserCarClient appUserCarClient; |
| | | |
| | | @Resource |
| | | private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; |
| | | |
| | | |
| | | |
| | |
| | | @Override |
| | | public List<TChargingPileVO> getChargingGunList(Integer siteId,Integer type) { |
| | | List<TChargingPileVO> chargingPileVOS = this.baseMapper.getChargingGunList(siteId); |
| | | List<TChargingGun> chargingGuns = chargingGunService.list(Wrappers.lambdaQuery(TChargingGun.class) |
| | | .eq(TChargingGun::getSiteId, siteId) |
| | | .eq(TChargingGun::getChargeMode, type)); |
| | | LambdaQueryWrapper<TChargingGun> wrapper = new LambdaQueryWrapper<>(); |
| | | if(Objects.nonNull(type)){ |
| | | wrapper.eq(TChargingGun::getChargeMode, type); |
| | | } |
| | | wrapper.eq(TChargingGun::getSiteId, siteId); |
| | | List<TChargingGun> chargingGuns = chargingGunService.list(wrapper); |
| | | // 查询充电枪信息 |
| | | chargingPileVOS.forEach(item -> { |
| | | item.setChargingGunList(chargingGuns.stream().filter(gun -> gun.getChargingPileId().equals(item.getId())).collect(Collectors.toList())); |
| | |
| | | }else{ |
| | | siteIds.add(query.getSiteId()); |
| | | } |
| | | // todo 待完善 |
| | | |
| | | if(null != query.getStatus() && 0 < query.getStatus().size()){ |
| | | if(query.getStatus().contains(3)){ |
| | | query.getStatus().add(6); |
| | |
| | | TAppUserCar tAppUserCar = appUserCarClient.getCarByIds(Arrays.asList(appUserCarId)).getData().get(0); |
| | | gunMonitoring.setLicensePlate(tAppUserCar.getLicensePlate()); |
| | | } |
| | | |
| | | UploadRealTimeMonitoringData data = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); |
| | | gunMonitoring.setChargingRatio(BigDecimal.valueOf(data.getSoc())); |
| | | gunMonitoring.setElectricQuantity(data.getCharging_degree().toString()); |
| | | gunMonitoring.setSoc(data.getSoc().toString()); |
| | | gunMonitoring.setElectricCurrent(data.getOutput_current().toString()); |
| | | gunMonitoring.setVoltage(data.getOutput_voltage().toString()); |
| | | switch (data.getHardware_fault()){ |
| | | case 1: |
| | | gunMonitoring.setFaultCause("急停按钮动作故障"); |
| | | break; |
| | | case 2: |
| | | gunMonitoring.setFaultCause("无可用整流模块"); |
| | | break; |
| | | case 3: |
| | | gunMonitoring.setFaultCause("出风口温度过高"); |
| | | break; |
| | | case 4: |
| | | gunMonitoring.setFaultCause("交流防雷故障"); |
| | | break; |
| | | case 5: |
| | | gunMonitoring.setFaultCause("交直流模块 DC20 通信中断"); |
| | | break; |
| | | case 6: |
| | | gunMonitoring.setFaultCause("绝缘检测模块 FC08 通信中断"); |
| | | break; |
| | | case 7: |
| | | gunMonitoring.setFaultCause("电度表通信中断"); |
| | | break; |
| | | case 8: |
| | | gunMonitoring.setFaultCause("读卡器通信中断"); |
| | | break; |
| | | case 9: |
| | | gunMonitoring.setFaultCause("RC10 通信中断"); |
| | | break; |
| | | case 10: |
| | | gunMonitoring.setFaultCause("风扇调速板故障"); |
| | | break; |
| | | case 11: |
| | | gunMonitoring.setFaultCause("直流熔断器故障"); |
| | | break; |
| | | case 12: |
| | | gunMonitoring.setFaultCause("高压接触器故障"); |
| | | break; |
| | | case 13: |
| | | gunMonitoring.setFaultCause("门打开"); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | return pageInfo.setRecords(chargingGunMonitoring); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.util; |
| | | |
| | | import com.google.zxing.*; |
| | | import com.google.zxing.client.j2se.BufferedImageLuminanceSource; |
| | | import com.google.zxing.common.BitMatrix; |
| | | import com.google.zxing.common.HybridBinarizer; |
| | | import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import java.awt.*; |
| | | import java.awt.geom.RoundRectangle2D; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.File; |
| | | import java.io.OutputStream; |
| | | import java.util.Hashtable; |
| | | import java.util.Random; |
| | | |
| | | /** |
| | | * 二维码工具类 |
| | | */ |
| | | public class QRCodeUtils { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(QRCodeUtils.class); |
| | | |
| | | private static final String CHARSET = "utf-8"; |
| | | private static final String FORMAT_NAME = "JPG"; |
| | | // 二维码尺寸 |
| | | private static final int QRCODE_SIZE = 300; |
| | | // LOGO宽度 |
| | | private static final int WIDTH = 60; |
| | | // LOGO高度 |
| | | private static final int HEIGHT = 60; |
| | | |
| | | private static BufferedImage createImage(String content, String imgPath, |
| | | boolean needCompress) throws Exception { |
| | | Hashtable<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>(); |
| | | hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); |
| | | hints.put(EncodeHintType.CHARACTER_SET, CHARSET); |
| | | hints.put(EncodeHintType.MARGIN, 1); |
| | | BitMatrix bitMatrix = new MultiFormatWriter().encode(content, |
| | | BarcodeFormat.QR_CODE, QRCODE_SIZE, QRCODE_SIZE, hints); |
| | | int width = bitMatrix.getWidth(); |
| | | int height = bitMatrix.getHeight(); |
| | | BufferedImage image = new BufferedImage(width, height, |
| | | BufferedImage.TYPE_INT_RGB); |
| | | for (int x = 0; x < width; x++) { |
| | | for (int y = 0; y < height; y++) { |
| | | image.setRGB(x, y, bitMatrix.get(x, y) ? 0xFF000000 |
| | | : 0xFFFFFFFF); |
| | | } |
| | | } |
| | | if (imgPath == null || "".equals(imgPath)) { |
| | | return image; |
| | | } |
| | | // 插入图片 |
| | | QRCodeUtils.insertImage(image, imgPath, needCompress); |
| | | return image; |
| | | } |
| | | |
| | | /** |
| | | * 插入LOGO |
| | | * |
| | | * @param source |
| | | * 二维码图片 |
| | | * @param imgPath |
| | | * LOGO图片地址 |
| | | * @param needCompress |
| | | * 是否压缩 |
| | | * @throws Exception |
| | | */ |
| | | private static void insertImage(BufferedImage source, String imgPath, |
| | | boolean needCompress) throws Exception { |
| | | File file = new File(imgPath); |
| | | if (!file.exists()) { |
| | | logger.debug(""+imgPath+" 该文件不存在!"); |
| | | return; |
| | | } |
| | | Image src = ImageIO.read(new File(imgPath)); |
| | | int width = src.getWidth(null); |
| | | int height = src.getHeight(null); |
| | | if (needCompress) { // 压缩LOGO |
| | | if (width > WIDTH) { |
| | | width = WIDTH; |
| | | } |
| | | if (height > HEIGHT) { |
| | | height = HEIGHT; |
| | | } |
| | | Image image = src.getScaledInstance(width, height, |
| | | Image.SCALE_SMOOTH); |
| | | BufferedImage tag = new BufferedImage(width, height, |
| | | BufferedImage.TYPE_INT_RGB); |
| | | Graphics g = tag.getGraphics(); |
| | | g.drawImage(image, 0, 0, null); // 绘制缩小后的图 |
| | | g.dispose(); |
| | | src = image; |
| | | } |
| | | // 插入LOGO |
| | | Graphics2D graph = source.createGraphics(); |
| | | int x = (QRCODE_SIZE - width) / 2; |
| | | int y = (QRCODE_SIZE - height) / 2; |
| | | graph.drawImage(src, x, y, width, height, null); |
| | | Shape shape = new RoundRectangle2D.Float(x, y, width, width, 6, 6); |
| | | graph.setStroke(new BasicStroke(3f)); |
| | | graph.draw(shape); |
| | | graph.dispose(); |
| | | } |
| | | |
| | | /** |
| | | * 生成二维码(内嵌LOGO) |
| | | * |
| | | * @param content |
| | | * 内容 |
| | | * @param imgPath |
| | | * LOGO地址 |
| | | * @param destPath |
| | | * 存放目录 |
| | | * @param needCompress |
| | | * 是否压缩LOGO |
| | | * @throws Exception |
| | | */ |
| | | public static String encode(String content, String imgPath, String destPath, |
| | | boolean needCompress) throws Exception { |
| | | BufferedImage image = QRCodeUtils.createImage(content, imgPath, |
| | | needCompress); |
| | | mkdirs(destPath); |
| | | ImageIO.write(image, FORMAT_NAME, new File(destPath)); |
| | | return destPath; |
| | | } |
| | | |
| | | /** |
| | | * 当文件夹不存在时,mkdirs会自动创建多层目录,区别于mkdir.(mkdir如果父目录不存在则会抛出异常) |
| | | * @date 2013-12-11 上午10:16:36 |
| | | * @param destPath 存放目录 |
| | | */ |
| | | public static void mkdirs(String destPath) { |
| | | File file =new File(destPath); |
| | | //当文件夹不存在时,mkdirs会自动创建多层目录,区别于mkdir.(mkdir如果父目录不存在则会抛出异常) |
| | | if (!file.exists() && !file.isDirectory()) { |
| | | file.mkdirs(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 生成二维码(内嵌LOGO) |
| | | * |
| | | * @param content |
| | | * 内容 |
| | | * @param imgPath |
| | | * LOGO地址 |
| | | * @param destPath |
| | | * 存储地址 |
| | | * @throws Exception |
| | | */ |
| | | public static void encode(String content, String imgPath, String destPath) |
| | | throws Exception { |
| | | QRCodeUtils.encode(content, imgPath, destPath, false); |
| | | } |
| | | |
| | | /** |
| | | * 生成二维码 |
| | | * |
| | | * @param content |
| | | * 内容 |
| | | * @param destPath |
| | | * 存储地址 |
| | | * @param needCompress |
| | | * 是否压缩LOGO |
| | | * @throws Exception |
| | | */ |
| | | public static void encode(String content, String destPath, |
| | | boolean needCompress) throws Exception { |
| | | QRCodeUtils.encode(content, null, destPath, needCompress); |
| | | } |
| | | |
| | | /** |
| | | * 生成二维码 |
| | | * |
| | | * @param content |
| | | * 内容 |
| | | * @param destPath |
| | | * 存储地址 |
| | | * @throws Exception |
| | | */ |
| | | public static void encode(String content, String destPath) throws Exception { |
| | | QRCodeUtils.encode(content, null, destPath, false); |
| | | } |
| | | |
| | | /** |
| | | * 生成二维码(内嵌LOGO) |
| | | * |
| | | * @param content |
| | | * 内容 |
| | | * @param imgPath |
| | | * LOGO地址 |
| | | * @param output |
| | | * 输出流 |
| | | * @param needCompress |
| | | * 是否压缩LOGO |
| | | * @throws Exception |
| | | */ |
| | | public static void encode(String content, String imgPath, |
| | | OutputStream output, boolean needCompress) throws Exception { |
| | | BufferedImage image = QRCodeUtils.createImage(content, imgPath, |
| | | needCompress); |
| | | ImageIO.write(image, FORMAT_NAME, output); |
| | | } |
| | | |
| | | /** |
| | | * 生成二维码 |
| | | * |
| | | * @param content |
| | | * 内容 |
| | | * @param output |
| | | * 输出流 |
| | | * @throws Exception |
| | | */ |
| | | public static void encode(String content, OutputStream output) |
| | | throws Exception { |
| | | QRCodeUtils.encode(content, null, output, false); |
| | | } |
| | | |
| | | /** |
| | | * 解析二维码 |
| | | * |
| | | * @param file |
| | | * 二维码图片 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String decode(File file) throws Exception { |
| | | BufferedImage image; |
| | | image = ImageIO.read(file); |
| | | if (image == null) { |
| | | return null; |
| | | } |
| | | BufferedImageLuminanceSource source = new BufferedImageLuminanceSource( |
| | | image); |
| | | BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source)); |
| | | Result result; |
| | | Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>(); |
| | | hints.put(DecodeHintType.CHARACTER_SET, CHARSET); |
| | | result = new MultiFormatReader().decode(bitmap, hints); |
| | | String resultStr = result.getText(); |
| | | return resultStr; |
| | | } |
| | | |
| | | /** |
| | | * 解析二维码 |
| | | * |
| | | * @param path |
| | | * 二维码图片地址 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String decode(String path) throws Exception { |
| | | return QRCodeUtils.decode(new File(path)); |
| | | } |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | String text = "http://www.baidu.com"; //这里设置自定义网站url |
| | | String logoPath = "C:\\Users\\admin\\Desktop\\test\\test.jpg"; |
| | | String destPath = "C:\\Users\\admin\\Desktop\\test\\"; |
| | | logger.debug(QRCodeUtils.encode(text, logoPath, destPath, true)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.controller; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-08-07 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/uploadRealTimeMonitoringData") |
| | | public class UploadRealTimeMonitoringDataController { |
| | | @Resource |
| | | private UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService; |
| | | |
| | | /** |
| | | * 远程调用 通过订单流水号 查询订单详情 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getOrderInfoByCode") |
| | | public R<UploadRealTimeMonitoringData> chargingOrderInfo(@RequestParam("orderId") String orderId){ |
| | | List<UploadRealTimeMonitoringData> dataByOrderCode = uploadRealTimeMonitoringDataService.getDataByOrderCode(orderId); |
| | | if(dataByOrderCode.size() > 0){ |
| | | UploadRealTimeMonitoringData uploadRealTimeMonitoringData = dataByOrderCode.get(dataByOrderCode.size() - 1); |
| | | return R.ok(uploadRealTimeMonitoringData); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据订单编号获取所有监测数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getDataByOrderCode") |
| | | public R<List<UploadRealTimeMonitoringData>> getDataByOrderCode(@RequestParam("code") String code){ |
| | | List<UploadRealTimeMonitoringData> list = uploadRealTimeMonitoringDataService.getDataByOrderCode(code); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface UploadRealTimeMonitoringDataService extends BaseService<UploadRealTimeMonitoringData> { |
| | | |
| | | /** |
| | | * 根据订单号查询监控数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | List<UploadRealTimeMonitoringData> getDataByOrderCode(String code); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | return mongoTemplate.findAll(UploadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据订单号查询监控数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<UploadRealTimeMonitoringData> getDataByOrderCode(String code) { |
| | | Query query = new Query(); |
| | | if(StringUtils.isNotEmpty(code)){ |
| | | query.addCriteria(Criteria.where("transaction_serial_number").is(code)); |
| | | } |
| | | List<UploadRealTimeMonitoringData> uploadRealTimeMonitoringData = mongoTemplate.find( |
| | | query.with(Sort.by("create_time")) |
| | | , UploadRealTimeMonitoringData.class); |
| | | return uploadRealTimeMonitoringData; |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | @ApiOperation(tags = {"小程序-订单评价"},value = "充电订单评价标签及数量查询") |
| | | @PostMapping(value = "/getTagCount") |
| | | @GetMapping(value = "/getTagCount") |
| | | public AjaxResult<List<TEvaluationTagVO>> getTagCount() { |
| | | return AjaxResult.ok(orderEvaluateService.getTagCount()); |
| | | } |
| | |
| | | @ApiModelProperty("阶段费用明细") |
| | | private List<TChargingOrderAccountingStrategy> stageCost; |
| | | @ApiModelProperty("电流电压曲线") |
| | | private Map<String, Object> currentAndVoltage; |
| | | private List<Map<String, Object>> currentAndVoltage; |
| | | @ApiModelProperty("功率曲线") |
| | | private Map<String, Object> power; |
| | | private List<Map<String, Object>> power; |
| | | @ApiModelProperty("是否可申诉(0=否,1=是)") |
| | | private Integer actionable; |
| | | } |
| | |
| | | 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.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TChargingOrderAccountingStrategy; |
| | | import com.ruoyi.order.api.query.ChargingOrderQuery; |
| | |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @Resource |
| | | private RedisService redisService; |
| | | |
| | | @Resource |
| | | private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取小程序充电记录列表数据 |
| | |
| | | .orderByAsc(TChargingOrderAccountingStrategy::getStartTime) |
| | | ); |
| | | myChargingOrderInfo.setStageCost(stageCost); |
| | | // todo 待完善 |
| | | //再MongoDB中获取数据 |
| | | myChargingOrderInfo.setCurrentAndVoltage(null); |
| | | //再MongoDB中获取数据 |
| | | myChargingOrderInfo.setPower(null); |
| | | List<UploadRealTimeMonitoringData> dataList = uploadRealTimeMonitoringDataClient.getDataByOrderCode(chargingOrder.getCode()).getData(); |
| | | if(null != dataList){ |
| | | //在MongoDB中获取数据 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); |
| | | List<String> time = dataList.stream().map(s -> sdf.format(s.getCreate_time())).collect(Collectors.toList()); |
| | | List<BigDecimal> outputVoltage = dataList.stream().map(UploadRealTimeMonitoringData::getOutput_voltage).collect(Collectors.toList()); |
| | | List<BigDecimal> outputCurrent = dataList.stream().map(UploadRealTimeMonitoringData::getOutput_current).collect(Collectors.toList()); |
| | | List<Map<String, Object>> currentAndVoltage = new ArrayList<>(); |
| | | for (int i = 0; i < time.size(); i++) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("time", time.get(i)); |
| | | //电流 |
| | | map.put("electricity", outputCurrent.get(i)); |
| | | //电压 |
| | | map.put("voltage", outputVoltage.get(i)); |
| | | currentAndVoltage.add(map); |
| | | } |
| | | myChargingOrderInfo.setCurrentAndVoltage(currentAndVoltage); |
| | | //在MongoDB中获取数据 |
| | | List<Integer> soc = dataList.stream().map(UploadRealTimeMonitoringData::getSoc).collect(Collectors.toList()); |
| | | List<BigDecimal> po = dataList.stream().map(s -> s.getOutput_current().multiply(s.getOutput_voltage()).divide(new BigDecimal(1000))).collect(Collectors.toList()); |
| | | List<Map<String, Object>> power = new ArrayList<>(); |
| | | for (int i = 0; i < time.size(); i++) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("time", time.get(i)); |
| | | //soc |
| | | map.put("soc", soc.get(i)); |
| | | //电压 |
| | | map.put("power", po.get(i)); |
| | | power.add(map); |
| | | } |
| | | myChargingOrderInfo.setPower(power); |
| | | } |
| | | myChargingOrderInfo.setActionable(myChargingOrderInfo.getEndTime() + 604800000L > System.currentTimeMillis() ? 0 : 1); |
| | | return myChargingOrderInfo; |
| | | } |
| | |
| | | <select id="getOrderEvaluateBySiteId" resultType="com.ruoyi.order.api.vo.TOrderEvaluateVO"> |
| | | select id, order_type, order_id, app_user_id,app_user_car_id, mark, content, img_url, evaluation_response, |
| | | create_time, response_time, del_flag |
| | | from t_order_evaluate toe |
| | | where toe.order_id in |
| | | (select toc.order_id |
| | | from t_charging_order toc |
| | | where toc.site_id = #{siteId} |
| | | and toc.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()}) |
| | | from t_order_evaluate |
| | | where order_id in |
| | | (select order_id |
| | | from t_charging_order |
| | | where site_id = #{siteId} |
| | | and del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()}) |
| | | </select> |
| | | |
| | | |