From dcd97d683792b5d47cc13966b24e3bbb92ee9854 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期三, 11 十二月 2024 19:11:36 +0800
Subject: [PATCH] 修改安全相关功能和合作商权限功能

---
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java |  291 +++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 196 insertions(+), 95 deletions(-)

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 48f0d3d..1c749dd 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
@@ -19,11 +19,14 @@
 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.TParkingRecord;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.dto.ChargingOrderGroup;
 import com.ruoyi.common.core.dto.ChargingPercentProvinceDto;
 import com.ruoyi.common.core.web.domain.BasePojo;
 import com.ruoyi.common.redis.service.RedisService;
+import com.ruoyi.common.security.annotation.Logical;
+import com.ruoyi.common.security.annotation.RequiresPermissions;
 import com.ruoyi.common.security.service.TokenService;
 import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.common.core.web.page.PageInfo;
@@ -136,6 +139,12 @@
     
     @Resource
     private TOrderInvoiceService invoiceService;
+    @Resource
+    private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient;
+    
+    
+    
+    
 
     /**
      * 远程调用 增加管理后台赠送会员记录
@@ -168,6 +177,9 @@
         }
         return R.ok();
     }
+    
+    
+    @RequiresPermissions(value = {"/invoiceManagement/select_order", "/paymentOrder/order"}, logical = Logical.OR)
     @ResponseBody
     @PostMapping(value = "/pay/order/list")
     @ApiOperation(value = "列表", tags = {"管理后台-支付订单-订单信息"})
@@ -180,7 +192,9 @@
     public R refund(@RequestBody PayOrderRefundDto payOrderQueryDto) {
         return chargingOrderService.payRefund(payOrderQueryDto);
     }
-
+    
+    
+    @RequiresPermissions(value = {"/paymentOrder/order"}, logical = Logical.OR)
     @ResponseBody
     @GetMapping(value = "/pay/order/pay/detail")
     @ApiOperation(value = "支付信息", tags = {"管理后台-支付订单-订单信息"})
@@ -197,6 +211,7 @@
                 payOrderInfoDto.setPayTime(byId.getCreateTime());
                 payOrderInfoDto.setRefundAmount(byId.getRefundAmount());
                 payOrderInfoDto.setRechargeAmount(byId.getRechargeAmount());
+                payOrderInfoDto.setFinalAmount(byId.getRechargeAmount().subtract(byId.getRefundAmount()));
                 return R.ok(payOrderInfoDto);
             case 2:
                 TShoppingOrder byId1 = shoppingOrderService.getById(orderId);
@@ -209,6 +224,7 @@
                 payOrderInfoDto1.setPayTime(byId1.getCreateTime());
                 payOrderInfoDto1.setRefundAmount(byId1.getRefundAmount());
                 payOrderInfoDto1.setRechargeAmount(byId1.getPaymentAmount());
+                payOrderInfoDto1.setFinalAmount(byId1.getPaymentAmount().subtract(byId1.getRefundAmount()));
                 return R.ok(payOrderInfoDto1);
             case 3:
                 TVipOrder byId2 = vipOrderService.getById(orderId);
@@ -221,19 +237,18 @@
                 payOrderInfoDto2.setPayTime(byId2.getCreateTime());
                 payOrderInfoDto2.setRefundAmount(byId2.getRefundAmount());
                 payOrderInfoDto2.setRechargeAmount(byId2.getPaymentAmount());
+                payOrderInfoDto2.setFinalAmount(byId2.getPaymentAmount().subtract(byId2.getRefundAmount()));
                 return R.ok(payOrderInfoDto2);
             //todo luo 停车场订单
-//                case 4:
-//                    TParkingRecord byId3 = parkingLotClient.getRecordById(orderId).getData();
-//                    PayOrderInfoDto payOrderInfoDto3 = new PayOrderInfoDto();
-//                    payOrderInfoDto3.setOrderId(byId3.getId().toString());
-//                    payOrderInfoDto3.setCode(byId3.getCode());
-//                    payOrderInfoDto3.setTradeNo(byId3);
-//                    payOrderInfoDto3.setPayType(0);
-//                    payOrderInfoDto3.setPayAmount(new BigDecimal("0"));
-//                    payOrderInfoDto3.setPayTime(LocalDateTime.now());
-//                    payOrderInfoDto3.setRefundAmount(new BigDecimal("0"));
-
+                case 4:
+                    R<TParkingRecord> recordById = parkingLotClient.getRecordById(orderId);
+                    TParkingRecord byId3 =recordById.getData();
+                    PayOrderInfoDto payOrderInfoDto3 = new PayOrderInfoDto();
+                    payOrderInfoDto3.setOrderId(byId3.getId().toString());
+                    payOrderInfoDto3.setCode(byId3.getCode());
+                    payOrderInfoDto3.setPayTime(byId3.getCreateTime());
+                    payOrderInfoDto3.setRechargeAmount(byId3.getPayment());
+                    return R.ok(payOrderInfoDto3);
 
 
 
@@ -308,9 +323,10 @@
 
         return R.ok(list);
     }
-
-
-
+    
+    
+    
+    @RequiresPermissions(value = {"/paymentOrder/refund"}, logical = Logical.OR)
     @ResponseBody
     @PostMapping(value = "/pay/order/refund/list")
     @ApiOperation(value = "列表", tags = {"管理后台-支付订单-退款订单"})
@@ -329,12 +345,13 @@
         return chargingOrderService.getRefundList(chargingRefundDto);
 
     }
-
-
-
-
-
-
+    
+    
+    
+    
+    
+    
+    @RequiresPermissions(value = {"/chargingPileOrder"}, logical = Logical.OR)
     @ResponseBody
     @PostMapping(value = "/chargingOrder")
     @ApiOperation(value = "充电桩订单列表", tags = {"管理后台-订单管理"})
@@ -344,7 +361,9 @@
         TCharingOrderVO res = chargingOrderService.chargingOrder(dto);
         return AjaxResult.success(res);
     }
-
+    
+    
+    @RequiresPermissions(value = {"/chargingPileOrder/monitoring_record"}, logical = Logical.OR)
     @ResponseBody
     @GetMapping(value = "/chargingOrderInfo")
     @ApiOperation(value = "充电桩订单列表查看详情", tags = {"管理后台-订单管理"})
@@ -365,18 +384,18 @@
             }
         }
         // 时段总服务费
-        BigDecimal bigDecimal = new BigDecimal("0");
         List<TChargingOrderAccountingStrategy> list = chargingOrderAccountingStrategyService.lambdaQuery().eq(TChargingOrderAccountingStrategy::getChargingOrderId, strategyId).orderByDesc(TChargingOrderAccountingStrategy::getStartTime).list();
-
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         for (TChargingOrderAccountingStrategy tChargingOrderAccountingStrategy : list) {
-            if (byId.getVipDiscountAmount()!=null){
+            String format = tChargingOrderAccountingStrategy.getCreateTime().format(formatter);
+            tChargingOrderAccountingStrategy.setStartTime(format+" "+tChargingOrderAccountingStrategy.getStartTime());
+            tChargingOrderAccountingStrategy.setEndTime(format+" "+tChargingOrderAccountingStrategy.getEndTime());
+            if (byId.getVipDiscountAmount()!=null && byId.getServiceCharge().compareTo(BigDecimal.ZERO) != 0){
                 BigDecimal multiply = byId.getVipDiscountAmount().divide(byId.getServiceCharge(), 2)
                         .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice());
                 tChargingOrderAccountingStrategy.setVipDiscount(multiply);
             }
-            bigDecimal = bigDecimal.add(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice());
-
-            if (byId.getCouponDiscountAmount()!=null){
+            if (byId.getCouponDiscountAmount()!=null && byId.getServiceCharge().compareTo(BigDecimal.ZERO) != 0){
                 BigDecimal multiply = byId.getCouponDiscountAmount().divide(byId.getServiceCharge(), 2)
                         .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice());
                 tChargingOrderAccountingStrategy.setCouponDiscount(multiply);
@@ -483,6 +502,11 @@
     @GetMapping(value = "/getMyChargingOrderInfo")
     @ApiOperation(value = "获取充电记订单明细", tags = {"小程序-充电记录"})
     public AjaxResult<MyChargingOrderInfo> getMyChargingOrderInfo(String id) {
+        TChargingOrder tChargingOrder = chargingOrderService.getById(id);
+        Long userId = tokenService.getLoginUserApplet().getUserId();
+        if(!tChargingOrder.getAppUserId().equals(userId)){
+            return AjaxResult.error("权限不足");
+        }
         MyChargingOrderInfo myChargingOrderInfo = chargingOrderService.getMyChargingOrderInfo(id);
         return AjaxResult.success(myChargingOrderInfo);
     }
@@ -524,7 +548,7 @@
     @ResponseBody
     @PostMapping(value = "/securityDetection")
     public void securityDetection(@RequestBody SecurityDetectionVO securityDetection){
-        log.error("-------------------安全检测数据-------------------:" + securityDetection);
+        log.info("-------------------安全检测数据-------------------:" + securityDetection);
         chargingOrderService.securityDetection(securityDetection);
     }
     
@@ -535,7 +559,7 @@
     @ResponseBody
     @PostMapping(value = "/startChargeSuccessfully")
     public void startChargeSuccessfully(@RequestBody PlatformStartChargingReplyMessageVO message){
-        log.error("-------------------远程启动充电请求应答-------------------:" + message);
+        log.info("-------------------远程启动充电请求应答-------------------:" + message);
         chargingOrderService.startChargeSuccessfully(message);
     }
     
@@ -546,21 +570,10 @@
      */
     @ResponseBody
     @PostMapping(value = "/chargingOrderALICallback")
-    public void chargingOrderALICallback(@RequestBody AliQueryOrder aliQueryOrder, HttpServletResponse response) {
-        try {
-            String out_trade_no = aliQueryOrder.getOutTradeNo();
-            String transaction_id = aliQueryOrder.getTradeNo();
-            String attach = aliQueryOrder.getPassbackParams();
-            AjaxResult ajaxResult = chargingOrderService.chargingOrderCallback(2, out_trade_no, transaction_id, attach);
-            if (ajaxResult.isSuccess()) {
-                PrintWriter writer = response.getWriter();
-                writer.println("success");
-                writer.flush();
-                writer.close();
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
+    public void chargingOrderALICallback(@RequestParam("out_trade_no") String out_trade_no,
+                                         @RequestParam("transaction_id") String transaction_id,
+                                         @RequestParam("attach") String attach) {
+        chargingOrderService.chargingOrderCallback(2, out_trade_no, transaction_id, attach);
     }
     
     
@@ -623,7 +636,7 @@
      */
     @PostMapping("/terminateSuccessfulResponse")
     public void terminateSuccessfulResponse(@RequestBody PlatformStopChargingReplyVO platformStopChargingReply){
-        log.error("-------------------远程停止充电请求应答-------------------:" + platformStopChargingReply);
+        log.info("-------------------远程停止充电请求应答-------------------:" + platformStopChargingReply);
         chargingOrderService.terminateSuccessfulResponse(platformStopChargingReply);
     }
     
@@ -634,13 +647,14 @@
      */
     @PostMapping("/endChargeBillingCharge")
     public void endChargeBillingCharge(@RequestBody TransactionRecordMessageVO vo){
-        log.error("-------------------停止充电返回账单后计算费用及修改业务状态-------------------:" + vo);
+        log.info("-------------------停止充电返回账单后计算费用及修改业务状态-------------------:" + vo);
         chargingOrderService.endChargeBillingCharge(vo);
     }
     
     
     
-
+    
+    @RequiresPermissions(value = {"/platformRevenueAnalysis"}, logical = Logical.OR)
     @ResponseBody
     @GetMapping(value = "/six/charge")
     @ApiOperation(value = "电站收入分析", tags = {"后台-数据分析-平台收入分析"})
@@ -689,7 +703,8 @@
 
         return months;
     }
-
+    
+    @RequiresPermissions(value = {"/platformRevenueAnalysis"}, logical = Logical.OR)
     @ResponseBody
     @GetMapping(value = "/six/circle")
     @ApiOperation(value = "电站收入占比", tags = {"后台-数据分析-平台收入分析"})
@@ -712,8 +727,9 @@
         return R.ok(sixCircleDtos);
 
     }
-
-
+    
+    
+    @RequiresPermissions(value = {"/platformRevenueAnalysis"}, logical = Logical.OR)
     @ResponseBody
     @GetMapping(value = "/six/shop")
     @ApiOperation(value = "购物收入", tags = {"后台-数据分析-平台收入分析"})
@@ -749,7 +765,9 @@
 
         return months;
     }
-
+    
+    
+    @RequiresPermissions(value = {"/workbench"}, logical = Logical.OR)
     @ResponseBody
     @PostMapping(value = "/work/shop")
     @ApiOperation(value = "购物收入", tags = {"后台-工作台"})
@@ -759,7 +777,8 @@
         List<Map<String,Object >> shopData =  shoppingOrderService.getData(statisticsQueryDto);
         return R.ok(shopData);
     }
-
+    
+    @RequiresPermissions(value = {"/platformRevenueAnalysis"}, logical = Logical.OR)
     @ResponseBody
     @GetMapping(value = "/six/vip")
     @ApiOperation(value = "vip收入", tags = {"后台-数据分析-平台收入分析"})
@@ -769,7 +788,9 @@
         List<SixVipDto> vipDtos =  vipOrderService.sixBefore(sixBefore);
         return R.ok(vipDtos);
     }
-
+    
+    
+    @RequiresPermissions(value = {"/platformRevenueAnalysis"}, logical = Logical.OR)
     @ResponseBody
     @GetMapping(value = "/six/total")
     @ApiOperation(value = "底部数据分类", tags = {"后台-数据分析-平台收入分析"})
@@ -791,9 +812,9 @@
 
         return R.ok(map);
     }
-
-    @Resource
-    private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient;
+    
+    
+    @RequiresPermissions(value = {"/chargeOrderMonitoring"}, logical = Logical.OR)
     @ResponseBody
     @PostMapping(value = "/watch/chargingOrder")
     @ApiOperation(value = "监控订单", tags = {"管理后台-订单管理"})
@@ -844,9 +865,9 @@
 
         return R.ok(page);
     }
-
-
-
+    
+    
+    @RequiresPermissions(value = {"/chargeOrderMonitoring/del"}, logical = Logical.OR)
     @ResponseBody
     @GetMapping(value = "/watch/deletes")
     @ApiOperation(value = "监控订单-删除", tags = {"管理后台-订单管理"})
@@ -873,11 +894,11 @@
         return R.ok(chargingOrderService.getOne(Wrappers.lambdaQuery(TChargingOrder.class)
                 .eq(TChargingOrder::getCode,code)));
     }
-
-
-
-
-
+    
+    
+    
+    
+    @RequiresPermissions(value = {"/chargingOperationAnalysis"}, logical = Logical.OR)
     @ResponseBody
     @PostMapping(value = "/charging/statistics")
     @ApiOperation(value = "统计,充电订单分析", tags = {"管理后台-数据分析-充电运营分析"})
@@ -915,16 +936,13 @@
             // 获取当前日期
             LocalDate today = LocalDate.now();
             start = statisticsQueryDto.getStartTime();
-            end = statisticsQueryDto.getEndTime();
+            end = statisticsQueryDto.getEndTime().plusDays(1);
             // 获取本月1号的日期
-            YearMonth yearMonth = YearMonth.from(today);
 //            start = yearMonth.atDay(1);
 //
 //            System.out.println("本月1号是: " + start);
         }else if (statisticsQueryDto.getDayType()==4){
-            LocalDate today = LocalDate.now();
-            // 获取当前年份
-            int currentYear = today.getYear();
+
             // 获取今年1月1日的日期
             start = statisticsQueryDto.getStartTime();
             end = statisticsQueryDto.getEndTime();
@@ -933,7 +951,11 @@
             // 获取今年1月1日的日期
             start = statisticsQueryDto.getStartTime();
             end = statisticsQueryDto.getEndTime();
+            if (start.equals(end)){
+                end =  end.plusDays(1);
+            }
         }
+
         List<TChargingOrder> list = chargingOrderService.lambdaQuery().ge(TChargingOrder::getCreateTime, start).le(TChargingOrder::getCreateTime, end).in(TChargingOrder::getSiteId, siteIds).list();
         List<Long> chargingOrderIds = list.stream().map(TChargingOrder::getId).collect(Collectors.toList());
         chargingOrderIds.add(-1L);
@@ -1033,6 +1055,7 @@
             LocalDate startDate = statisticsQueryDto.getStartTime();
             LocalDate endDate = statisticsQueryDto.getEndTime();
 
+
             List<Map<String, Object>> dateRangeStatistics = new ArrayList<>();
 
             // 遍历日期范围
@@ -1062,6 +1085,8 @@
 
             LocalDate startDate = statisticsQueryDto.getStartTime();
             LocalDate endDate = statisticsQueryDto.getEndTime();
+
+
 
             List<Map<String, Object>> dateRangeStatistics = new ArrayList<>();
 
@@ -1121,6 +1146,8 @@
         } else {
             siteIds.add(statisticsQueryDto.getSiteId());
         }
+
+
         List<Map<String,Object>> maps1 =  chargingOrderService.queryPower(siteIds);
 
 
@@ -1132,8 +1159,9 @@
         return R.ok(tCharingOrderPowerMapVO);
 
     }
-
-
+    
+    
+    @RequiresPermissions(value = {"/chargingUserAnalysis"}, logical = Logical.OR)
     @ResponseBody
     @PostMapping(value = "/charging/users")
     @ApiOperation(value = "除电站流量外", tags = {"管理后台-数据分析-充电用户分析"})
@@ -1182,6 +1210,8 @@
         tCharingUserMapVO.setMap(charMap);
         tCharingUserMapVO.setMap1(charMap1);
         }else {
+
+
             List<Map<String,Object>> map =  chargingOrderService.usersByQuery(statisticsQueryDto);
 
 
@@ -1270,11 +1300,13 @@
             brands.add(objectMap.get("vehicle_brand").toString());
         }
 
-        Long count = chargingOrderService.countCar(brands);
-        Map<String, Object> others = new HashMap<>();
-        others.put("vehicle_brand","其他");
-        others.put("counts",count);
-        carBrandMap.add(others);
+        if (carBrandMap.size()>=5) {
+            Long count = chargingOrderService.countCar(brands);
+            Map<String, Object> others = new HashMap<>();
+            others.put("vehicle_brand", "其他");
+            others.put("counts", count);
+            carBrandMap.add(others);
+        }
         //本地车数量
         Map<String,Object> localCarMap = chargingOrderService.countLocalCar();
 
@@ -1288,6 +1320,9 @@
         return R.ok(tCharingUserMapVO);
 
     }
+    
+    
+    @RequiresPermissions(value = {"/chargingUserAnalysis"}, logical = Logical.OR)
     @ResponseBody
     @PostMapping(value = "/charging/sites")
     @ApiOperation(value = "电站评价", tags = {"管理后台-数据分析-充电用户分析"})
@@ -1324,14 +1359,16 @@
         List<Map<String,Object>> badTop = orderEvaluateService.badTop(siteIds);
 
         //流量分析
-        List<Map<String,Object>> sourceMap = chargingOrderService.countBySource(siteIds);
+        List<Map<String,Object>> sourceMap = chargingOrderService.countBySource(siteIds,statisticsQueryDto);
         tCharingUserEvaluateVO.setGoodTop(goodTop);
         tCharingUserEvaluateVO.setBadTop(badTop);
         tCharingUserEvaluateVO.setFlow(sourceMap);
         //流量
         return R.ok(tCharingUserEvaluateVO);
     }
-
+    
+    
+    @RequiresPermissions(value = {"/operationMaintenanceAnalysis"}, logical = Logical.OR)
     @ResponseBody
     @PostMapping(value = "/charging/equipment")
     @ApiOperation(value = "电站评价", tags = {"管理后台-数据分析-设备运维分析"})
@@ -1349,8 +1386,48 @@
         }
         //直流可用率
         List<Map<String,Object>> equipmentMap1 = chargingOrderService.equipmentUserType1(siteIds,statisticsQueryDto);
+        for (Map<String, Object> result : equipmentMap1) {
+            Object percentObj = result.get("percent");
+            if (percentObj instanceof String) {
+                try {
+                    BigDecimal percent = new BigDecimal((String) percentObj);
+                    if (percent.compareTo(BigDecimal.ZERO) < 0) {
+                        result.put("percent", percent.negate().toString());
+                    }
+                } catch (NumberFormatException e) {
+                    // 处理转换异常
+                    result.put("percent", BigDecimal.ZERO); // 或者其他默认值
+                }
+            } else if (percentObj instanceof BigDecimal) {
+                BigDecimal percent = (BigDecimal) percentObj;
+                if (percent.compareTo(BigDecimal.ZERO) < 0) {
+                    result.put("percent", percent.negate().toString());
+                }
+            }
+        }
+
         //交流可用率
         List<Map<String,Object>> equipmentMap2= chargingOrderService.equipmentUserType2(siteIds,statisticsQueryDto);
+
+        for (Map<String, Object> result : equipmentMap2) {
+            Object percentObj = result.get("percent");
+            if (percentObj instanceof String) {
+                try {
+                    BigDecimal percent = new BigDecimal((String) percentObj);
+                    if (percent.compareTo(BigDecimal.ZERO) < 0) {
+                        result.put("percent", percent.negate().toString());
+                    }
+                } catch (NumberFormatException e) {
+                    // 处理转换异常
+                    result.put("percent", BigDecimal.ZERO); // 或者其他默认值
+                }
+            } else if (percentObj instanceof BigDecimal) {
+                BigDecimal percent = (BigDecimal) percentObj;
+                if (percent.compareTo(BigDecimal.ZERO) < 0) {
+                    result.put("percent", percent.negate().toString());
+                }
+            }
+        }
 
         //取出直流可用率和交流可用率的percent的平均值保留两位小数
 
@@ -1427,7 +1504,9 @@
         // 格式化为两位小数
         return Double.parseDouble(DF.format(average));
     }
-
+    
+    
+    @RequiresPermissions(value = {"/workbench"}, logical = Logical.OR)
     @ResponseBody
     @PostMapping(value = "/work/charge")
     @ApiOperation(value = "上方充电数据统计", tags = {"管理后台-工作台"})
@@ -1451,7 +1530,7 @@
 
 
 
-        List<TChargingOrder> list = chargingOrderService.lambdaQuery().in(!siteIds.isEmpty(), TChargingOrder::getSiteId, siteIds).ge( TChargingOrder::getCreateTime,min).le(BasePojo::getCreateTime,max).eq(statisticsQueryDto.getSiteId() != null, TChargingOrder::getSiteId, statisticsQueryDto.getSiteId()).list();
+        List<TChargingOrder> list = chargingOrderService.lambdaQuery().in(!siteIds.isEmpty(), TChargingOrder::getSiteId, siteIds).ge( TChargingOrder::getCreateTime,min).le(BasePojo::getCreateTime,max).eq(TChargingOrder::getStatus,5).eq(statisticsQueryDto.getSiteId() != null, TChargingOrder::getSiteId, statisticsQueryDto.getSiteId()).list();
         //当日的订单总数
         int size = list.size();
         //计算list中paymentAmount的总和
@@ -1470,9 +1549,10 @@
         tCharingWorkVO.setTotalChargingCapacity(totalChargingCapacity);
         return R.ok(tCharingWorkVO);
     }
-
-
-
+    
+    
+    
+    @RequiresPermissions(value = {"/workbench"}, logical = Logical.OR)
     @ResponseBody
     @PostMapping(value = "/work/chargeDetail")
     @ApiOperation(value = "运营情况", tags = {"管理后台-工作台"})
@@ -1594,10 +1674,11 @@
         }
         return null;
     }
-
-
-
-
+    
+    
+    
+    
+    @RequiresPermissions(value = {"/workbench"}, logical = Logical.OR)
     @ResponseBody
     @PostMapping(value = "/work/use")
     @ApiOperation(value = "利用率", tags = {"管理后台-工作台"})
@@ -1656,8 +1737,9 @@
 
 
     }
-
     
+    
+    @RequiresPermissions(value = {"/workbench"}, logical = Logical.OR)
     @ResponseBody
     @GetMapping(value = "/work/shopOrder")
     @ApiOperation(value = "购物订单统计", tags = {"管理后台-工作台"})
@@ -1669,7 +1751,9 @@
         counts.add(count1);
         return R.ok(counts);
     }
-
+    
+    
+    @RequiresPermissions(value = {"/workbench"}, logical = Logical.OR)
     @ResponseBody
     @GetMapping(value = "/work/invoice")
     @ApiOperation(value = "开票统计", tags = {"管理后台-工作台"})
@@ -1681,7 +1765,8 @@
         counts.add(count1);
         return R.ok(counts);
     }
-
+    
+    @RequiresPermissions(value = {"/workbench"}, logical = Logical.OR)
     @ResponseBody
     @GetMapping(value = "/work/users/count")
     @ApiOperation(value = "用户数量", tags = {"管理后台-工作台"})
@@ -1754,7 +1839,7 @@
      */
     @PostMapping("/endCharge")
     public void endCharge(@RequestParam("code") String code){
-        log.error(code + ":-------------------充电桩自动结束充电-------------------");
+        log.info(code + ":-------------------充电桩自动结束充电-------------------");
         chargingOrderService.endCharge(code, 2);
     }
 
@@ -1764,7 +1849,7 @@
      */
     @PostMapping("/excelEndCharge")
     public void excelEndCharge(@RequestParam("code") String code){
-        log.error(code + ":-------------------充电异常,停止充电-------------------");
+        log.info(code + ":-------------------充电异常,停止充电-------------------");
         chargingOrderService.excelEndCharge(code);
     }
 
@@ -1801,8 +1886,8 @@
         EndOfChargePageInfo endOfChargePageInfo = chargingOrderService.getEndOfChargePageInfo(id);
         return AjaxResult.success(endOfChargePageInfo);
     }
-    
-    
+
+
     /**
      * 获取订单数据
      * @param order
@@ -1813,4 +1898,20 @@
         List<TChargingOrder> chargingOrder = chargingOrderService.getChargingOrder(order);
         return R.ok(chargingOrder);
     }
+    
+    
+    /**
+     * 根据车辆id获取指定时间范围内的数据
+     * @param carId
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    @PostMapping("/getCarChargingOrder")
+    public R<List<TChargingOrder>> getCarChargingOrder(@RequestParam("carId") Long carId, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime){
+        List<TChargingOrder> list = chargingOrderService.list(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getAppUserCarId, carId).eq(TChargingOrder::getDelFlag, 0)
+                .in(TChargingOrder::getStatus, Arrays.asList(4, 5)).between(TChargingOrder::getStartTime, startTime, endTime));
+        return R.ok(list);
+    }
+    
 }

--
Gitblit v1.7.1