xuhy
2024-10-12 a208b51bccff584689dc918e799c63febbcae832
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
@@ -471,6 +471,7 @@
    @ResponseBody
    @PostMapping(value = "/securityDetection")
    public void securityDetection(@RequestBody SecurityDetectionVO securityDetection){
        log.error("-------------------安全检测数据-------------------:" + securityDetection);
        chargingOrderService.securityDetection(securityDetection);
    }
    
@@ -768,16 +769,16 @@
            // 获取本月1号的日期
            YearMonth yearMonth = YearMonth.from(today);
            start = yearMonth.atDay(1);
            System.out.println("本月1号是: " + start);
//            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 = LocalDate.of(currentYear, 1, 1);
            System.out.println("今年1月1日是: " + start);
            start = statisticsQueryDto.getStartTime();
            end = statisticsQueryDto.getEndTime();
        }else if (statisticsQueryDto.getDayType()==5){
            // 获取今年1月1日的日期
@@ -1335,6 +1336,18 @@
            return R.ok(userMap);
    }
    @GetMapping(value = "/getGunIdsByUserId")
    @ApiOperation(value = "查询当前用户正在充电中的枪id集合", tags = {"小程序-首页-用户充电订单信息"})
    public R<List<Integer>> getGunIdsByUserId() {
        Long userId = tokenService.getLoginUserApplet().getUserId();
        List<TChargingOrder> list = chargingOrderService.list(Wrappers.lambdaQuery(TChargingOrder.class)
                .eq(TChargingOrder::getAppUserId, userId)
                .eq(TChargingOrder::getStatus, 3));
        List<Integer> gunIds = list.stream().map(TChargingOrder::getChargingGunId).collect(Collectors.toList());
        return R.ok(gunIds);
    }
    public static void main(String[] args) {
        // 示例数据
        List<TChargingOrder> list = getSampleData();
@@ -1395,6 +1408,7 @@
     */
    @PostMapping("/endCharge")
    public void endCharge(@RequestParam("code") String code){
        log.error(code + ":-------------------充电桩自动结束充电-------------------");
        chargingOrderService.endCharge(code, 2);
    }
@@ -1404,6 +1418,7 @@
     */
    @PostMapping("/excelEndCharge")
    public void excelEndCharge(@RequestParam("code") String code){
        log.error(code + ":-------------------充电异常,停止充电-------------------");
        chargingOrderService.excelEndCharge(code);
    }