| | |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.api.vo.SiteNameVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.slf4j.Logger; |
| | |
| | | public R<SiteNameVO> getAllInfoById(Integer id) { |
| | | return R.fail("通过枪id获取站点、桩、枪的名称失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TChargingGun> getChargingGunByCode(String code) { |
| | | return R.fail("根据枪编号获取充电枪失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.factory; |
| | | |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.FaultMessageClient; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.api.vo.SiteNameVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 充电桩服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class FaultMessageFallbackFactory implements FallbackFactory<FaultMessageClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(FaultMessageFallbackFactory.class); |
| | | |
| | | @Override |
| | | public FaultMessageClient create(Throwable throwable) { |
| | | log.error("充电枪调用失败:{}", throwable.getMessage()); |
| | | return new FaultMessageClient() { |
| | | |
| | | @Override |
| | | public R<String> createFaultMessage(TFaultMessage faultMessage) { |
| | | return R.fail("添加离线故障记录失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> updateFaultMessage(TFaultMessage faultMessage) { |
| | | return R.fail("修改离线故障记录失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TFaultMessage> getFaultMessageByGunId(Integer gunId) { |
| | | return R.fail("查询枪是否有离线或故障记录失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.ruoyi.chargingPile.api.factory.ChargingGunFallbackFactory; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.api.vo.SiteNameVO; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | */ |
| | | @PostMapping("/t-charging-gun/getAllInfoById/{id}") |
| | | R<SiteNameVO> getAllInfoById(@PathVariable("id") Integer id); |
| | | /** |
| | | * 根据枪编号获取充电枪 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-charging-gun/getChargingGunByCode/{code}") |
| | | R<TChargingGun> getChargingGunByCode(@PathVariable("code") String code); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.feignClient; |
| | | |
| | | import com.ruoyi.chargingPile.api.factory.ChargingGunFallbackFactory; |
| | | import com.ruoyi.chargingPile.api.factory.FaultMessageFallbackFactory; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.api.vo.SiteNameVO; |
| | | 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.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/15 19:36 |
| | | */ |
| | | @FeignClient(contextId = "FaultMessageClient", value = ServiceNameConstants.CHARGINGPILE_SERVICE, fallbackFactory = FaultMessageFallbackFactory.class) |
| | | public interface FaultMessageClient { |
| | | |
| | | /** |
| | | * 添加离线故障记录 |
| | | * @param faultMessage |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-fault-message/createFaultMessage") |
| | | R<String> createFaultMessage(@RequestBody TFaultMessage faultMessage); |
| | | /** |
| | | * 修改离线故障记录 |
| | | * @param faultMessage |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-fault-message/updateFaultMessage") |
| | | R<String> updateFaultMessage(@RequestBody TFaultMessage faultMessage); |
| | | |
| | | /** |
| | | * 查询枪是否有离线或故障记录 |
| | | * @param gunId |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-fault-message/getFaultMessageByGunId/{gunId}") |
| | | R<TFaultMessage> getFaultMessageByGunId(@PathVariable("gunId") Integer gunId); |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.api.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | @ApiModelProperty(value = "充电桩id") |
| | | @TableField("charging_pile_id") |
| | | private Integer chargingPileId; |
| | | |
| | | @ApiModelProperty(value = "充电枪id") |
| | | @TableField("charging_gun_id") |
| | | private Integer chargingGunId; |
| | | |
| | | @TableField(exist = false) |
| | | private String chargingPileName; |
| | | |
| | |
| | | private String content; |
| | | |
| | | @ApiModelProperty(value = "故障时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @TableField("down_time") |
| | | private LocalDateTime downTime; |
| | | @ApiModelProperty(value = "结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @TableField("end_time") |
| | | private LocalDateTime endTime; |
| | | |
| | | } |
| | |
| | | com.ruoyi.chargingPile.api.factory.ChargingGunFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.AccountingStrategyDetailFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.AccountingStrategyFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.ParkingRecordFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.ParkingRecordFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.FaultMessageFallbackFactory |
| | |
| | | public R<SettlementTotalVO> settlementTotalR(String time) { |
| | | return R.fail("查询结算汇总表导出列表失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> updateChargingOrder(TChargingOrder chargingOrder) { |
| | | return R.fail("修改充电订单失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | |
| | | @GetMapping(value = "/financial/settlement/settlementTotalR") |
| | | public R<SettlementTotalVO> settlementTotalR(String time); |
| | | |
| | | /** |
| | | * 修改充电订单 |
| | | * @param chargingOrder |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-charging-order/updateChargingOrder") |
| | | R<String> updateChargingOrder(@RequestBody TChargingOrder chargingOrder); |
| | | } |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @TableField("pay_time") |
| | | private LocalDateTime payTime; |
| | | |
| | | @ApiModelProperty(value = "实时需求电流") |
| | | @TableField("need_elec") |
| | | private BigDecimal needElec; |
| | | @ApiModelProperty(value = "站点名称") |
| | | @TableField(exist = false) |
| | | private String siteName; |
| | |
| | | |
| | | import cn.hutool.core.img.ImgUtil; |
| | | import cn.hutool.core.io.FileUtil; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.dto.TChargingGunDTO; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.api.query.TChargingGunQuery; |
| | | import com.ruoyi.chargingPile.api.vo.SiteNameVO; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | |
| | | siteNameVO.setSiteName(site.getName()); |
| | | return R.ok(siteNameVO); |
| | | } |
| | | /** |
| | | * 根据枪编号获取充电枪 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @PostMapping("/getChargingGunByCode/{code}") |
| | | public R<TChargingGun> getChargingGunByCode(@PathVariable("code") String code){ |
| | | return R.ok(chargingGunService.getOne(Wrappers.lambdaQuery(TChargingGun.class) |
| | | .eq(TChargingGun::getCode, code) |
| | | .last("LIMIT 1"))); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.dto.TChargingGunDTO; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.chargingPile.service.TFaultMessageService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | |
| | | faultMessageService.removeById(id); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 添加离线故障记录 |
| | | * @param faultMessage |
| | | * @return |
| | | */ |
| | | @PostMapping("/createFaultMessage") |
| | | public R<String> createFaultMessage(@RequestBody TFaultMessage faultMessage){ |
| | | faultMessageService.save(faultMessage); |
| | | return R.ok(); |
| | | } |
| | | /** |
| | | * 修改离线故障记录 |
| | | * @param faultMessage |
| | | * @return |
| | | */ |
| | | @PostMapping("/updateFaultMessage") |
| | | public R<String> updateFaultMessage(@RequestBody TFaultMessage faultMessage){ |
| | | faultMessageService.updateById(faultMessage); |
| | | return R.ok(); |
| | | } |
| | | /** |
| | | * 查询枪是否有离线或故障记录 |
| | | * @param gunId |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-fault-message/getFaultMessageByGunId/{gunId}") |
| | | public R<TFaultMessage> getFaultMessageByGunId(@PathVariable("gunId") Integer gunId){ |
| | | return R.ok(faultMessageService.getOne(Wrappers.lambdaQuery(TFaultMessage.class) |
| | | .eq(TFaultMessage::getChargingGunId,gunId) |
| | | .and(e->e.eq(TFaultMessage::getStatus,1).or().eq(TFaultMessage::getStatus,2)) |
| | | .isNull(TFaultMessage::getEndTime) |
| | | .orderByDesc(TFaultMessage::getDownTime) |
| | | .last("LIMIT 1"))); |
| | | } |
| | | } |
| | | |
| | |
| | | <result column="app_user_id" property="appUserId" /> |
| | | <result column="site_id" property="siteId" /> |
| | | <result column="charging_pile_id" property="chargingPileId" /> |
| | | <result column="charging_gun_id" property="chargingGunId" /> |
| | | <result column="status" property="status" /> |
| | | <result column="down_time" property="downTime" /> |
| | | <result column="end_time" property="endTime" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="del_flag" property="delFlag" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, app_user_id, site_id, charging_pile_id, status, down_time, create_time, del_flag |
| | | id, app_user_id, site_id, charging_pile_id, status, down_time, create_time, del_flag,charging_gun_id,end_time |
| | | </sql> |
| | | |
| | | |
| | |
| | | return IoTDAClient.newBuilder() |
| | | .withCredential(auth) |
| | | // 标准版/企业版:需自行创建Region对象,基础版:请使用IoTDARegion的region对象,如"withRegion(IoTDARegion.CN_NORTH_4)" |
| | | .withRegion(new Region("cn-north-4", IotConstant.URL)) |
| | | .withRegion(new Region("cn-south-1", IotConstant.URL)) |
| | | .build(); |
| | | } |
| | | /** |
| | |
| | | .withSk(config.getSk()); |
| | | return IamClient.newBuilder() |
| | | .withCredential(auth) |
| | | .withRegion(IamRegion.valueOf("cn-north-4")) |
| | | .withRegion(IamRegion.valueOf("cn-south-1")) |
| | | .build(); |
| | | } |
| | | |
| | |
| | | /** |
| | | * URL |
| | | */ |
| | | public static final String URL = "https://iotda.cn-north-4.myhuaweicloud.com"; |
| | | public static final String URL = "https://94cb3eb5f9.st1.iotda-app.cn-south-1.myhuaweicloud.com"; |
| | | /** |
| | | * 创建产品 |
| | | */ |
| | |
| | | */ |
| | | public static final String CHARGING_HANDSHAKE ="charging_handshake"; |
| | | /** |
| | | * 参数配置 |
| | | */ |
| | | public static final String PARAMETER_SETTING ="parameter_setting"; |
| | | /** |
| | | * 充电阶段BMS中止 |
| | | */ |
| | | public static final String BMS_ABORT ="bms_abort"; |
| | |
| | | @PostMapping(value = "/message") |
| | | public AjaxResult<String> message(@RequestBody JSONObject jsonObject) throws IOException { |
| | | log.info("接收到消息中转:{}",jsonObject); |
| | | JSONObject content = jsonObject.getJSONObject("content"); |
| | | JSONObject content = jsonObject.getJSONObject("notify_data").getJSONObject("body").getJSONObject("content"); |
| | | JSONObject header = jsonObject.getJSONObject("notify_data").getJSONObject("header"); |
| | | String deviceId = header.getString("device_id"); // 设备id |
| | | String nodeId = header.getString("node_id"); // 设备编号 |
| | | String productId = header.getString("product_id"); // 产品id |
| | | String service_id = content.getString("service_id"); |
| | | log.info("服务id:{}",service_id); |
| | | SendResult sendResult; |
| | |
| | | OnlineReply onlineReply = new OnlineReply(); |
| | | onlineReply.setCharging_pile_code(onlineMessage.getCharging_pile_code()); |
| | | onlineReply.setOnline_result(0); |
| | | result = iotMessageProduce.sendMessage(onlineReply.getCharging_pile_code(), ServiceIdMenu.ONLINE_REPLY.getKey(), messageUtil.onlineReply(onlineReply)); |
| | | result = iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.ONLINE_REPLY.getKey(), messageUtil.onlineReply(onlineReply)); |
| | | log.info("充电桩登录认证-返回结果:{}",result); |
| | | break; |
| | | case SendTagConstant.PING: |
| | |
| | | pong.setCharging_pile_code(pingMessage.getCharging_pile_code()); |
| | | pong.setCharging_gun_code(pingMessage.getCharging_gun_code()); |
| | | pong.setCharging_gun_status(0); |
| | | result = iotMessageProduce.sendMessage(pong.getCharging_pile_code(), ServiceIdMenu.PONG.getKey(), messageUtil.pong(pong)); |
| | | result = iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.PONG.getKey(), messageUtil.pong(pong)); |
| | | log.info("充电桩心跳包-返回结果:{}",result); |
| | | break; |
| | | case SendTagConstant.END_CHARGE: |
| | |
| | | billingModeVerifyReply.setBilling_model_result(1); |
| | | } |
| | | } |
| | | iotMessageProduce.sendMessage(billingModeVerifyReply.getCharging_pile_code(), ServiceIdMenu.BILLING_MODE_VERIFY_REPLY.getKey(),messageUtil.billingModeVerifyReply(billingModeVerifyReply)); |
| | | iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.BILLING_MODE_VERIFY_REPLY.getKey(),messageUtil.billingModeVerifyReply(billingModeVerifyReply)); |
| | | break; |
| | | case SendTagConstant.ACQUISITION_BILLING_MODE: |
| | | AcquisitionBillingModeMessage acquisitionBillingModeMessage = JSON.parseObject(jsonObject.toJSONString(),AcquisitionBillingModeMessage.class); |
| | |
| | | StrategyUtil.setStrategyPrice(strategyPrice,acquisitionBillingModeReply); |
| | | // 时段设置 |
| | | StrategyUtil.setTime(accountingStrategyDetails,acquisitionBillingModeReply); |
| | | iotMessageProduce.sendMessage(acquisitionBillingModeReply.getCharging_pile_code(), ServiceIdMenu.ACQUISITION_BILLING_MODE_REPLY.getKey(),messageUtil.acquisitionBillingModeReply(acquisitionBillingModeReply)); |
| | | iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.ACQUISITION_BILLING_MODE_REPLY.getKey(),messageUtil.acquisitionBillingModeReply(acquisitionBillingModeReply)); |
| | | break; |
| | | case SendTagConstant.UPLOAD_REAL_TIME_MONITORING_DATA: |
| | | UploadRealTimeMonitoringDataMessage uploadRealTimeMonitoringDataMessage = JSON.parseObject(jsonObject.toJSONString(),UploadRealTimeMonitoringDataMessage.class); |
| | |
| | | ChargingHandshakeMessage chargingHandshakeMessage = JSON.parseObject(jsonObject.toJSONString(),ChargingHandshakeMessage.class); |
| | | sendResult = enhanceProduce.chargingHandshakeMessage(chargingHandshakeMessage); |
| | | // 响应硬件 |
| | | break; |
| | | case SendTagConstant.PARAMETER_SETTING: |
| | | ParameterSettingMessage parameterSettingMessage = JSON.parseObject(jsonObject.toJSONString(),ParameterSettingMessage.class); |
| | | sendResult = enhanceProduce.parameterSettingMessage(parameterSettingMessage); |
| | | break; |
| | | case SendTagConstant.BMS_ABORT: |
| | | BmsAbortMessage bmsAbortMessage = JSON.parseObject(jsonObject.toJSONString(),BmsAbortMessage.class); |
| | |
| | | ConfirmTransactionRecord confirmTransactionRecord = new ConfirmTransactionRecord(); |
| | | confirmTransactionRecord.setTransaction_serial_number(transactionRecordMessage.getTransaction_serial_number()); |
| | | confirmTransactionRecord.setConfirm_result(0); |
| | | iotMessageProduce.sendMessage(confirmTransactionRecord.getTransaction_serial_number(), ServiceIdMenu.CONFIRM_TRANSACTION_RECORD.getKey(),messageUtil.confirmTransactionRecord(confirmTransactionRecord)); |
| | | iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.CONFIRM_TRANSACTION_RECORD.getKey(),messageUtil.confirmTransactionRecord(confirmTransactionRecord)); |
| | | break; |
| | | case SendTagConstant.UPDATE_BALANCE_REPLY: |
| | | UpdateBalanceReplyMessage updateBalanceReplyMessage = JSON.parseObject(jsonObject.toJSONString(),UpdateBalanceReplyMessage.class); |
| | |
| | | TimingSettingReply timingSettingReply = new TimingSettingReply(); |
| | | timingSettingReply.setCharging_pile_code(timingSettingMessage.getCharging_pile_code()); |
| | | timingSettingReply.setCurrent_time(CP56Time2aConverter.convertToCP56Time2a(new Date())); |
| | | iotMessageProduce.sendMessage(timingSettingReply.getCharging_pile_code(), ServiceIdMenu.TIMING_SETTING_REPLY.getKey(),messageUtil.timingSettingReply(timingSettingReply)); |
| | | iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.TIMING_SETTING_REPLY.getKey(),messageUtil.timingSettingReply(timingSettingReply)); |
| | | break; |
| | | case SendTagConstant.SETUP_BILLING_MODEL_REPLY: |
| | | SetupBillingModelReplyMessage setupBillingModelReplyMessage = JSON.parseObject(jsonObject.toJSONString(),SetupBillingModelReplyMessage.class); |
| | |
| | | import com.ruoyi.integration.mongodb.service.BmsDemandAndChargerExportationService; |
| | | import com.ruoyi.integration.rocket.model.BmsDemandAndChargerExportationMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.MessageModel; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Objects; |
| | | |
| | | @Slf4j |
| | | @Component |
| | |
| | | |
| | | @Autowired |
| | | private BmsDemandAndChargerExportationService bmsDemandAndChargerExportationService; |
| | | @Autowired |
| | | private ChargingOrderClient chargingOrderClient; |
| | | @Override |
| | | protected void handleMessage(BmsDemandAndChargerExportationMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | |
| | | BeanUtils.copyProperties(message,bmsDemandAndChargerExportation); |
| | | bmsDemandAndChargerExportationService.create(bmsDemandAndChargerExportation); |
| | | // 业务处理 |
| | | TChargingOrder chargingOrder = chargingOrderClient.getOrderByCode(message.getTransaction_serial_number()).getData(); |
| | | if(Objects.nonNull(chargingOrder)){ |
| | | chargingOrder.setNeedElec(message.getBms_current_requirements()); |
| | | chargingOrderClient.updateChargingOrder(chargingOrder); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.chargingPile.api.feignClient.AccountingStrategyDetailClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.FaultMessageClient; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.integration.api.model.Online; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.mongodb.service.UploadRealTimeMonitoringDataService; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Objects; |
| | | |
| | | @Slf4j |
| | |
| | | private ChargingOrderClient chargingOrderClient; |
| | | @Resource |
| | | private AccountingStrategyDetailClient accountingStrategyDetailClient; |
| | | @Resource |
| | | private ChargingGunClient chargingGunClient; |
| | | @Resource |
| | | private FaultMessageClient faultMessageClient; |
| | | |
| | | |
| | | @Override |
| | |
| | | BeanUtils.copyProperties(uploadRealTimeMonitoringData, query); |
| | | chargingOrderClient.chargeMonitoring(query); |
| | | |
| | | // 存储状态信息 |
| | | |
| | | |
| | | TChargingGun chargingGun = chargingGunClient.getChargingGunByCode(message.getCharging_gun_code()).getData(); |
| | | if(Objects.nonNull(chargingGun)){ |
| | | // 存储状态信息 |
| | | TFaultMessage faultMessage = new TFaultMessage(); |
| | | if(message.getCharging_gun_status().equals(0) || message.getCharging_gun_status().equals(1)){ |
| | | faultMessage.setSiteId(chargingGun.getSiteId()); |
| | | faultMessage.setChargingPileId(chargingGun.getChargingPileId()); |
| | | faultMessage.setChargingGunId(chargingGun.getId()); |
| | | switch (message.getCharging_gun_status()){ |
| | | case 0: |
| | | faultMessage.setStatus(1); |
| | | break; |
| | | case 1: |
| | | faultMessage.setStatus(2); |
| | | break; |
| | | } |
| | | faultMessage.setDownTime(LocalDateTime.now()); |
| | | faultMessageClient.createFaultMessage(faultMessage); |
| | | }else { |
| | | // 空闲 充电 查询是否该设备之前存在离线记录或者故障记录 |
| | | faultMessage = faultMessageClient.getFaultMessageByGunId(chargingGun.getId()).getData(); |
| | | if(Objects.nonNull(faultMessage)){ |
| | | faultMessage.setEndTime(LocalDateTime.now()); |
| | | faultMessageClient.updateFaultMessage(faultMessage); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.integration.api.model.ParameterSetting; |
| | | import com.ruoyi.integration.iotda.constant.SendTagConstant; |
| | | import com.ruoyi.integration.rocket.model.*; |
| | | import com.ruoyi.integration.rocket.util.RocketMQEnhanceTemplate; |
| | |
| | | message.setSource(SendTagConstant.CHARGING_HANDSHAKE); |
| | | return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.CHARGING_HANDSHAKE, SendTagConstant.CHARGING_HANDSHAKE, message); |
| | | } |
| | | /** |
| | | * 参数设置 |
| | | */ |
| | | public SendResult parameterSettingMessage(ParameterSettingMessage message) { |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagConstant.PARAMETER_SETTING); |
| | | return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.PARAMETER_SETTING, SendTagConstant.PARAMETER_SETTING, message); |
| | | } |
| | | |
| | | /** |
| | | * 充电阶段BMS中止 |
| | |
| | | TChargingOrder chargingOrder = chargingOrderService.getChargingOrderByLicensePlate(query); |
| | | return R.ok(chargingOrder); |
| | | } |
| | | /** |
| | | * 修改充电订单 |
| | | * @param chargingOrder |
| | | * @return |
| | | */ |
| | | @PostMapping("/updateChargingOrder") |
| | | public R<String> updateChargingOrder(@RequestBody TChargingOrder chargingOrder){ |
| | | chargingOrderService.updateById(chargingOrder); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | <result column="refund_status" property="refundStatus" /> |
| | | <result column="refund_serial_number" property="refundSerialNumber" /> |
| | | <result column="refund_time" property="refundTime" /> |
| | | <result column="need_elec" property="needElec" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="del_flag" property="delFlag" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, code, order_type, order_classification, app_user_id, app_user_car_id,site_id, parking_lot_id, charging_pile_id, charging_gun_id, start_time, end_time, status, recharge_amount, recharge_payment_type, recharge_payment_status, recharge_serial_number, order_amount, app_coupon_id, coupon_discount_amount, vip_discount, vip_discount_amount, payment_amount, refund_code, refund_amount, refund_status, refund_serial_number, refund_time, create_time, del_flag |
| | | id, code, order_type, order_classification, app_user_id, app_user_car_id,site_id, parking_lot_id, charging_pile_id, charging_gun_id, |
| | | start_time, end_time, status, recharge_amount, recharge_payment_type, recharge_payment_status, recharge_serial_number, |
| | | order_amount, app_coupon_id, coupon_discount_amount, vip_discount, vip_discount_amount, payment_amount, refund_code, |
| | | refund_amount, refund_status, refund_serial_number, refund_time, create_time, del_flag,need_elec |
| | | </sql> |
| | | |
| | | |