| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.chargingPile.tulaidian.domain.ChargeRecord; |
| | | import com.ruoyi.chargingPile.tulaidian.domain.ChargeStatus; |
| | | import com.ruoyi.chargingPile.tulaidian.domain.ConnectorStatusInfos; |
| | | import com.ruoyi.chargingPile.tulaidian.domain.TContent; |
| | | import com.ruoyi.chargingPile.tulaidian.service.IContentService; |
| | | import com.ruoyi.chargingPile.tulaidian.util.AesEncryption; |
| | | import com.ruoyi.chargingPile.tulaidian.util.HMacMD5Util; |
| | | import com.ruoyi.chargingPile.tulaidian.util.SequenceGenerator; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | |
| | | // 结束充电后 特来电主动 推送充电订单信息 |
| | | @ResponseBody |
| | | @PostMapping("/notification_charge_order_info") |
| | | public R notification_charge_order_info(@RequestBody String json) throws ParseException { |
| | | public Map<String, Object> notification_charge_order_info(@RequestBody String json) throws ParseException { |
| | | TContent tContent = new TContent(); |
| | | tContent.setType(5); |
| | | tContent.setType(1); |
| | | tContent.setContent(json); |
| | | tContent.setCreateTime(new Date()); |
| | | contentService.save(tContent); |
| | |
| | | if(orderIdR.getCode() == 200){ |
| | | // TODO 充电明细 |
| | | } |
| | | return R.ok(); |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("StartChargeSeq",chargeRecord.getStartChargeSeq()); |
| | | map.put("ConnectorID",chargeRecord.getConnectorID()); |
| | | map.put("ConfirmResult",0); |
| | | return map; |
| | | } |
| | | |
| | | // @ResponseBody |
| | | // @PostMapping("/notification_equip_charge_status") |
| | | // public R notification_equip_charge_status(@RequestBody String json) throws ParseException { |
| | | // TContent tContent = new TContent(); |
| | | // tContent.setType(2); |
| | | // tContent.setContent(json); |
| | | // tContent.setCreateTime(new Date()); |
| | | // contentService.save(tContent); |
| | | // JSONObject jsonObject1 = JSONObject.parseObject(json); |
| | | // String data = jsonObject1.getString("Data"); |
| | | // String decrypt = AesEncryption.decrypt(DataSecret, DataSecretIV, data); |
| | | // System.err.println(decrypt); |
| | | // JSONObject jsonObject = JSONObject.parseObject(decrypt); |
| | | // System.err.println("特来电主动推送订单状态"); |
| | | // ChargeStatus chargeStatus = JSON.parseObject(jsonObject.toJSONString(), ChargeStatus.class); |
| | | // R<TChargingOrder> chargeOrderR = chargingOrderClient.getChargingOrderByStartChargeSeq(chargeStatus.getStartChargeSeq()); |
| | | // TChargingOrder chargingOrder = chargeOrderR.getData(); |
| | | // if (chargingOrder!=null){ |
| | | // // 修改订单状态 |
| | | // chargingOrder.setStatus(chargeStatus.getStartChargeSeqStat()); |
| | | // chargingOrderClient.updateChargingOrder(chargingOrder); |
| | | // } |
| | | // return R.ok(); |
| | | // } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/notification_equip_charge_status") |
| | | public R notification_equip_charge_status(@RequestBody String json) throws ParseException { |
| | | @PostMapping("/notification_stationStatus") |
| | | public Map<String,Integer> notification_stationStatus(@RequestBody String json) { |
| | | TContent tContent = new TContent(); |
| | | tContent.setType(1); |
| | | tContent.setType(3); |
| | | tContent.setContent(json); |
| | | tContent.setCreateTime(new Date()); |
| | | contentService.save(tContent); |
| | |
| | | String decrypt = AesEncryption.decrypt(DataSecret, DataSecretIV, data); |
| | | System.err.println(decrypt); |
| | | JSONObject jsonObject = JSONObject.parseObject(decrypt); |
| | | System.err.println("特来电主动推送订单状态"); |
| | | ChargeStatus chargeStatus = JSON.parseObject(jsonObject.toJSONString(), ChargeStatus.class); |
| | | R<TChargingOrder> chargeOrderR = chargingOrderClient.getChargingOrderByStartChargeSeq(chargeStatus.getStartChargeSeq()); |
| | | TChargingOrder chargingOrder = chargeOrderR.getData(); |
| | | if (chargingOrder!=null){ |
| | | System.err.println("特来电主动推送设备状态"); |
| | | ConnectorStatusInfos connectorStatusInfos = JSON.parseObject(jsonObject.toJSONString(), ConnectorStatusInfos.class); |
| | | TChargingGun chargingGun = chargingGunService.getOne(Wrappers.lambdaQuery(TChargingGun.class) |
| | | .eq(TChargingGun::getCode, connectorStatusInfos.getConnectorID())); |
| | | if (Objects.nonNull(chargingGun)){ |
| | | // 修改订单状态 |
| | | chargingOrder.setStatus(chargeStatus.getStartChargeSeqStat()); |
| | | chargingOrderClient.updateChargingOrder(chargingOrder); |
| | | switch (connectorStatusInfos.getStatus()){ |
| | | case 0: |
| | | chargingGun.setStatus(1); |
| | | break; |
| | | case 1: |
| | | chargingGun.setStatus(2); |
| | | break; |
| | | case 2: |
| | | chargingGun.setStatus(3); |
| | | break; |
| | | case 3: |
| | | chargingGun.setStatus(4); |
| | | break; |
| | | case 4: |
| | | chargingGun.setStatus(6); |
| | | break; |
| | | case 255: |
| | | chargingGun.setStatus(7); |
| | | break; |
| | | } |
| | | chargingGunService.updateById(chargingGun); |
| | | } |
| | | return R.ok(); |
| | | Map<String,Integer> map = new HashMap<>(); |
| | | map.put("Status",0); |
| | | return map; |
| | | } |
| | | } |