From ab53b52282c4ee0e57ae0fdb398de23b0949651a Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期五, 25 十月 2024 19:11:37 +0800 Subject: [PATCH] bug修改 --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java | 10 +++- ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TParkingRecordMapper.xml | 3 - ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java | 54 +++++++++++++++------------ ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java | 11 +++-- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java | 1 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java | 26 ++++++------- 6 files changed, 57 insertions(+), 48 deletions(-) diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java index e90a7ce..ff411ec 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java @@ -60,10 +60,10 @@ private final TChargingPileService chargingPileService; private final TChargingGunService chargingGunService; - + @Resource private RedisService redisService; - + @Resource private TFaultMessageService faultMessageService; @@ -113,7 +113,7 @@ return R.ok(chargingPileService.list(Wrappers.lambdaQuery(TChargingPile.class) .in(!siteIds.isEmpty(),TChargingPile::getSiteId,siteIds))); } - + @ResponseBody @GetMapping("/pageChargingPileList") @ApiOperation(value = "获取充电桩列表数据", tags = {"管理后台-充电桩信息"}) @@ -121,7 +121,7 @@ PageInfo<PageChargingPileListDTO> list = chargingPileService.pageChargingPileList(page); return AjaxResult.success(list); } - + @ResponseBody @Log(title = "【充电桩信息】添加充电桩数据", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) @PostMapping("/addChargingPile") @@ -129,8 +129,8 @@ public AjaxResult addChargingPile(@RequestBody TChargingPile chargingPile){ return chargingPileService.addChargingPile(chargingPile); } - - + + @ResponseBody @GetMapping("/getChargingPile/{id}") @ApiOperation(value = "获取充电桩详情数据", tags = {"管理后台-充电桩信息"}) @@ -138,8 +138,8 @@ TChargingPile chargingPile = chargingPileService.getChargingPile(id); return AjaxResult.success(chargingPile); } - - + + @ResponseBody @Log(title = "【充电桩信息】编辑充电桩数据", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) @PostMapping("/editChargingPile") @@ -147,9 +147,9 @@ public AjaxResult editChargingPile(@RequestBody TChargingPile chargingPile){ return chargingPileService.editChargingPile(chargingPile); } - - - + + + @ResponseBody @DeleteMapping("/delChargingPile") @Log(title = "【充电桩信息】删除充电桩", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) @@ -160,8 +160,8 @@ public AjaxResult delChargingPile(@RequestParam("id") Integer[] id){ return chargingPileService.delChargingPile(id); } - - + + @ResponseBody @Log(title = "【充电桩信息】批量设置计费策略", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) @PostMapping("/batchSetAccountingStrategy") @@ -170,8 +170,8 @@ chargingPileService.batchSetAccountingStrategy(setAccountingStrategy); return AjaxResult.success(); } - - + + @ResponseBody @GetMapping("/chargeMonitoring/{siteId}") @ApiOperation(value = "获取充电设施监控数据", tags = {"管理后台-充电设备监控"}) @@ -188,8 +188,8 @@ ChargingGunCountMonitoring chargingGunCountMonitoring = chargingPileService.getChargingGunCountMonitoring(siteId); return AjaxResult.success(chargingGunCountMonitoring); } - - + + @ResponseBody @GetMapping("/getChargingGunMonitoring") @ApiOperation(value = "获取充电枪监控数据", tags = {"管理后台-充电设备监控"}) @@ -197,8 +197,8 @@ PageInfo<ChargingGunMonitoring> chargingGunMonitoring = chargingPileService.getChargingGunMonitoring(query); return AjaxResult.success(chargingGunMonitoring); } - - + + /** * 根据id获取充电桩信息 * @param id @@ -210,8 +210,8 @@ TChargingPile chargingPile = chargingPileService.getById(id); return R.ok(chargingPile); } - - + + /** * 更新充电桩状态 * @param code @@ -223,7 +223,8 @@ TChargingPile chargingPile = chargingPileService.getOne(new LambdaQueryWrapper<TChargingPile>() .eq(TChargingPile::getCode, code).eq(TChargingPile::getDelFlag, 0)); if(null != chargingPile){ - if(chargingPile.getStatus() == 1){ + //充电桩正常,返回异常,处理充电桩状态和添加故障记录 + if(chargingPile.getStatus() == 1 && 1 == status){ TFaultMessage faultMessage = faultMessageService.getOne(new LambdaQueryWrapper<TFaultMessage>().eq(TFaultMessage::getChargingPileId, chargingPile.getId()) .eq(TFaultMessage::getStatus, 2).eq(TFaultMessage::getDelFlag, 0).isNull(TFaultMessage::getEndTime)); if(null == faultMessage){ @@ -236,7 +237,7 @@ faultMessage.setDelFlag(false); faultMessage.setContent("设备故障"); faultMessageService.save(faultMessage); - + chargingPile.setStatus(0 == status ? 1 : 3); chargingPileService.updateById(chargingPile); } @@ -248,9 +249,14 @@ one.setEndTime(LocalDateTime.now()); faultMessageService.updateById(one); } + + chargingPile.setStatus(0 == status ? 1 : 3); + chargingPileService.updateById(chargingPile); } if(0 == status){ - redisService.getCacheMap("charging_pile_online").put(code, System.currentTimeMillis()); + Map<String, Object> charging_pile_online = redisService.getCacheMap("charging_pile_online"); + charging_pile_online.put(code, System.currentTimeMillis()); + redisService.setCacheMap("charging_pile_online", charging_pile_online); } } } diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java index 437fb00..d0c11ff 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java @@ -589,20 +589,18 @@ if(datas.size() > 0){ for (TChargingPile data : datas) { - if(data.getStatus() == 1){ - TFaultMessage faultMessage = faultMessageService.getOne(new LambdaQueryWrapper<TFaultMessage>().eq(TFaultMessage::getChargingPileId, data.getId()) - .eq(TFaultMessage::getStatus, 1).eq(TFaultMessage::getDelFlag, 0).isNull(TFaultMessage::getEndTime)); - if(null == faultMessage){ - faultMessage = new TFaultMessage(); - faultMessage.setSiteId(data.getSiteId()); - faultMessage.setChargingPileId(data.getId()); - faultMessage.setStatus(1); - faultMessage.setDownTime(LocalDateTime.now()); - faultMessage.setCreateTime(LocalDateTime.now()); - faultMessage.setDelFlag(false); - faultMessage.setContent("设备离线"); - faultMessageService.save(faultMessage); - } + TFaultMessage faultMessage = faultMessageService.getOne(new LambdaQueryWrapper<TFaultMessage>().eq(TFaultMessage::getChargingPileId, data.getId()) + .eq(TFaultMessage::getStatus, 1).eq(TFaultMessage::getDelFlag, 0).isNull(TFaultMessage::getEndTime)); + if(null == faultMessage){ + faultMessage = new TFaultMessage(); + faultMessage.setSiteId(data.getSiteId()); + faultMessage.setChargingPileId(data.getId()); + faultMessage.setStatus(1); + faultMessage.setDownTime(LocalDateTime.now()); + faultMessage.setCreateTime(LocalDateTime.now()); + faultMessage.setDelFlag(false); + faultMessage.setContent("设备离线"); + faultMessageService.save(faultMessage); } } this.updateBatchById(datas); diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TParkingRecordMapper.xml b/ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TParkingRecordMapper.xml index 3cb2293..e88746d 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TParkingRecordMapper.xml +++ b/ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TParkingRecordMapper.xml @@ -79,8 +79,7 @@ </if> AND status = 3 </where> - group by create_time - ORDER BY create_time DESC + </select> <select id="parkingData" resultType="java.util.Map"> SELECT diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java index c1b037f..09f102d 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java @@ -316,11 +316,11 @@ chargingBillPayExport.setPlatformPay("支付宝小程序支付"); } - TChargingOrderRefund one = tChargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getChargingOrderId, tChargingOrder.getId()).one(); - if (one!=null){ - chargingBillRefundExport.setRechargeSerialNumber(one.getSerailNumber()); - chargingBillRefundExport.setCode(one.getCode()); - chargingBillRefundExport.setPayTime(tChargingOrder.getPayTime()!=null?DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",DateUtils.toDate(tChargingOrder.getPayTime())):""); + List<TChargingOrderRefund> one1 = tChargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getChargingOrderId, tChargingOrder.getId()).list(); + for (TChargingOrderRefund one : one1) { + chargingBillRefundExport.setRechargeSerialNumber(tChargingOrder.getRechargeSerialNumber()); + chargingBillRefundExport.setCode(tChargingOrder.getCode()); + chargingBillRefundExport.setPayTime(tChargingOrder.getCreateTime()!=null?DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",DateUtils.toDate(tChargingOrder.getCreateTime())):""); if (tChargingOrder.getRefundTime()!=null){ chargingBillRefundExport.setRefundTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",DateUtils.toDate(tChargingOrder.getRefundTime()))); } @@ -330,6 +330,7 @@ chargingBillRefundExport.setRefundSerialNumber(one.getRefundSerialNumber()); chargingBillRefundExports.add(chargingBillRefundExport); } + // 支付信息 chargingBillPayExport.setId(i+""); chargingBillPayExport.setRechargeSerialNumber(tChargingOrder.getRechargeSerialNumber()); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java index a66da4c..0100bb5 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java @@ -813,6 +813,7 @@ ChargingOrderAndUploadRealTimeMonitoringDataDto dataDto = new ChargingOrderAndUploadRealTimeMonitoringDataDto(); BeanUtils.copyProperties(uploadRealTimeMonitoringData,dataDto); ChargingOrderQuery dto = new ChargingOrderQuery(); + dto.setCode(uploadRealTimeMonitoringData.getTransaction_serial_number()); TCharingOrderVO vo = chargingOrderService.chargingOrder(dto); if (!vo.getList().getRecords().isEmpty()) { ChargingOrderVO chargingOrderVO = vo.getList().getRecords().get(0); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java index 9a17619..c41c544 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java @@ -608,12 +608,16 @@ if(times > m){ //充电时间跨度两个计费策略,需要继续对下一个策略进行计算 serviceCharge = s_server_amount.multiply(new BigDecimal(m)); - discountAmount = discountAmount.add(serviceCharge.multiply(new BigDecimal(1).subtract(discount))); rechargeAmount1 = rechargeAmount1.subtract(s_total_amount.multiply(new BigDecimal(m))); + if(null != discount){ + discountAmount = discountAmount.add(serviceCharge.multiply(new BigDecimal(1).subtract(discount))); + } nowTimeMillis = null; }else{ serviceCharge = s_server_amount.multiply(new BigDecimal(times)); - discountAmount = discountAmount.add(serviceCharge.multiply(new BigDecimal(1).subtract(discount))); + if(null != discount){ + discountAmount = discountAmount.add(serviceCharge.multiply(new BigDecimal(1).subtract(discount))); + } break; } } @@ -2556,7 +2560,7 @@ tSettlementConfirm.setIncomePercentage(0+"%"); tSettlementConfirm.setIncomePercentage(0+"%"); }else{ - BigDecimal subtract = income.subtract(beforeIncome).divide(beforeIncome).setScale(2, RoundingMode.HALF_DOWN).multiply(new BigDecimal("100")); + BigDecimal subtract = income.subtract(beforeIncome).divide(beforeIncome,2,RoundingMode.HALF_DOWN).multiply(new BigDecimal("100")); tSettlementConfirm.setIncomePercentage(subtract+"%"); tSettlementConfirm.setIncomePercentage(subtract+"%"); -- Gitblit v1.7.1