ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TVehicleRamp.java
@@ -52,6 +52,8 @@ @ApiModelProperty(value = "方向(1=入口,2=出口)") @TableField("direction") private Integer direction; @ApiModelProperty(value = "开关动作(open:开、close:关)") @TableField(exist = false) private String action; } ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/SwitchwayGateFallbackFactory.java
New file @@ -0,0 +1,34 @@ package com.ruoyi.integration.api.factory; import com.ruoyi.common.core.domain.R; import com.ruoyi.integration.api.feignClient.SendMessageClient; import com.ruoyi.integration.api.feignClient.SwitchwayGateClient; import com.ruoyi.integration.api.model.PlatformStartCharging; import com.ruoyi.integration.api.model.PlatformStopCharging; import com.ruoyi.integration.api.vo.SwitchwayGateReq; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; /** * 充电桩服务降级处理 * * @author ruoyi */ @Component public class SwitchwayGateFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory<SwitchwayGateClient> { private static final Logger log = LoggerFactory.getLogger(SwitchwayGateFallbackFactory.class); @Override public SwitchwayGateClient create(Throwable throwable) { log.error("调用道闸开关失败:{}", throwable.getMessage()); return new SwitchwayGateClient() { @Override public R<Boolean> gateService(SwitchwayGateReq req) { return R.fail("道闸开关失败:" + throwable.getMessage()); } }; } } ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/feignClient/SwitchwayGateClient.java
New file @@ -0,0 +1,25 @@ package com.ruoyi.integration.api.feignClient; import com.ruoyi.common.core.constant.ServiceNameConstants; import com.ruoyi.common.core.domain.R; import com.ruoyi.integration.api.factory.SwitchwayGateFallbackFactory; import com.ruoyi.integration.api.vo.SwitchwayGateReq; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; /** * @author zhibing.pu * @Date 2024/9/10 11:08 */ @FeignClient(contextId = "SwitchwayGateClient", value = ServiceNameConstants.INTEGRATION_SERVICE, fallbackFactory = SwitchwayGateFallbackFactory.class) public interface SwitchwayGateClient { /** * 道闸开关 * @param req * @return */ @PostMapping("/switchwayGate/gateService") R<Boolean> gateService(@RequestBody SwitchwayGateReq req); } ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/vo/SwitchwayGateReq.java
New file @@ -0,0 +1,19 @@ package com.ruoyi.integration.api.vo; import lombok.Data; /** * @author zhibing.pu * @Date 2024/9/10 10:48 */ @Data public class SwitchwayGateReq { /** * 开关动作(open:开、close:关) */ private String action; /** * 通道编号 */ private String channel; } ruoyi-api/ruoyi-api-integration/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -3,4 +3,5 @@ com.ruoyi.integration.api.factory.ChargingHandshakeFallbackFactory com.ruoyi.integration.api.factory.SendMessageFallbackFactory com.ruoyi.integration.api.factory.PlatformStartChargingReplyFallbackFactory com.ruoyi.integration.api.factory.PlatformStopChargingReplyFallbackFactory com.ruoyi.integration.api.factory.PlatformStopChargingReplyFallbackFactory com.ruoyi.integration.api.factory.SwitchwayGateFallbackFactory ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TCharingOrderMapVO.java
New file @@ -0,0 +1,19 @@ package com.ruoyi.order.api.vo; import com.ruoyi.common.core.web.page.PageInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; import java.util.List; import java.util.Map; @Data public class TCharingOrderMapVO { @ApiModelProperty("上分饼图") private List<Map<String,Object>> maps; @ApiModelProperty("下方折线图") private List<Map<String,Object>> maps1; } ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TCharingOrderPowerMapVO.java
New file @@ -0,0 +1,16 @@ package com.ruoyi.order.api.vo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; import java.util.List; import java.util.Map; @Data public class TCharingOrderPowerMapVO { @ApiModelProperty("上分折线图") List<Map<String,Object>> maps; @ApiModelProperty("下方饼图") private Map<String,Object> maps1; } ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TCharingUserEvaluateVO.java
New file @@ -0,0 +1,18 @@ package com.ruoyi.order.api.vo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.List; import java.util.Map; @Data public class TCharingUserEvaluateVO { @ApiModelProperty("评价分") Long aver; @ApiModelProperty("各个评分数量") List<Map<String,Object>> evaluate; @ApiModelProperty("差评数量") Long blackCount; } ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TCharingUserMapVO.java
New file @@ -0,0 +1,26 @@ package com.ruoyi.order.api.vo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.naming.ldap.PagedResultsControl; import java.util.List; import java.util.Map; @Data public class TCharingUserMapVO { @ApiModelProperty("上分折线图") private List<Map<String,Object>> map; @ApiModelProperty("用户标签") private List<Map<String,Object>> userMaps; @ApiModelProperty("单位消费") private List<Map<String, Object>> untiMap; @ApiModelProperty("会员标签") private List<Map<String,Object>> vipMaps; @ApiModelProperty("车辆用途") private List<Map<String, Object>> carMap; @ApiModelProperty("车辆品牌") private List<Map<String, Object>> carBrandMap; @ApiModelProperty("本地车数量") private Map<String,Object> localCarMap; } ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/VipFallbackFactory.java
@@ -1,5 +1,6 @@ package com.ruoyi.other.api.factory; import com.ruoyi.account.api.dto.GiveVipDto; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.other.api.domain.TVip; @@ -35,6 +36,11 @@ } @Override public R giveVip(GiveVipDto giveVipDto) { return R.fail("赠送会员:" + throwable.getMessage()); } @Override public R<TVip> getInfo1(Integer id) { return R.fail("根据会员id 获取会员信息:" + throwable.getMessage()); } ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/VipClient.java
@@ -1,5 +1,6 @@ package com.ruoyi.other.api.feignClient; import com.ruoyi.account.api.dto.GiveVipDto; import com.ruoyi.common.core.constant.ServiceNameConstants; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.domain.AjaxResult; @@ -8,6 +9,7 @@ import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; /** @@ -37,5 +39,6 @@ @PostMapping(value = "/vip/getInfo") R<TVip> getInfo(@RequestParam("id") Integer id); @PostMapping(value = "/t-app-user/user/give/vip") R giveVip(@RequestBody GiveVipDto giveVipDto); } ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/vo/PaymentOrder.java
@@ -29,5 +29,5 @@ /** * 回调地址 */ private String notifyUrl ="/"; private String notifyUrl ="http://192.168.110.80:9000/payment/wx/pay/notify"; } ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TVehicleRampController.java
@@ -9,11 +9,14 @@ import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.integration.api.feignClient.SwitchwayGateClient; import com.ruoyi.integration.api.vo.SwitchwayGateReq; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.Arrays; import java.util.List; @@ -31,6 +34,13 @@ public class TVehicleRampController { private final TVehicleRampService vehicleRampService; @Resource private SwitchwayGateClient switchwayGateClient; @Autowired public TVehicleRampController(TVehicleRampService vehicleRampService) { @@ -95,8 +105,11 @@ @ApiOperation(tags = {"后台-车道"},value = "开关闸车道") @PostMapping(value = "/openOrDown") public AjaxResult<String> openOrDown(@RequestBody TVehicleRamp dto) { // TODO 硬件 开关闸车道 return AjaxResult.success(); SwitchwayGateReq req = new SwitchwayGateReq(); req.setAction(dto.getAction()); req.setChannel(dto.getCarportNum()); Boolean data = switchwayGateClient.gateService(req).getData(); return data ? AjaxResult.success() : AjaxResult.error("操作失败"); } } ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/controller/CouponController.java
@@ -1,10 +1,12 @@ package com.ruoyi.integration.barrierGate.controller; import com.alibaba.fastjson.JSON; import com.ruoyi.integration.barrierGate.model.BaseResponse; import com.ruoyi.integration.barrierGate.model.GetCouponReq; import com.ruoyi.integration.barrierGate.model.GetCouponResp; import com.ruoyi.integration.barrierGate.model.UsedCoupon; import com.ruoyi.integration.barrierGate.server.CouponService; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -14,6 +16,7 @@ * @author zhibing.pu * @Date 2024/9/5 11:10 */ @Slf4j @RestController @RequestMapping("/coupon") public class CouponController { @@ -31,6 +34,7 @@ @ResponseBody @PostMapping("/getCoupon") public BaseResponse<GetCouponResp> getCoupon(@RequestBody GetCouponReq req){ log.info("停车获取优惠券请求参数:{}" + JSON.toJSONString(req)); GetCouponResp coupon = couponService.getCoupon(req); return BaseResponse.ok(coupon); } @@ -44,6 +48,7 @@ @ResponseBody @PostMapping("/usedCoupon") public BaseResponse usedCoupon(@RequestBody UsedCoupon req){ log.info("停车使用优惠券请求参数:{}" + JSON.toJSONString(req)); couponService.usedCoupon(req); return BaseResponse.ok(); } ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/controller/ParkingOrderController.java
@@ -1,7 +1,9 @@ package com.ruoyi.integration.barrierGate.controller; import com.alibaba.fastjson.JSON; import com.ruoyi.integration.barrierGate.model.*; import com.ruoyi.integration.barrierGate.server.ParkingOrderService; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -10,6 +12,7 @@ * @author zhibing.pu * @Date 2024/9/5 16:14 */ @Slf4j @RestController @RequestMapping("/parkingOrder") public class ParkingOrderController { @@ -25,6 +28,7 @@ @ResponseBody @PostMapping("/cloudParkingInOrder") public BaseResponse cloudParkingInOrder(@RequestBody CloudParkingOrder order){ log.info("云停车入场请求参数:{}" + JSON.toJSONString(order)); parkingOrderService.cloudParkingInOrder(order); return BaseResponse.ok(); } @@ -37,6 +41,7 @@ @ResponseBody @PostMapping("/cloudParkingOutOrder") public BaseResponse cloudParkingOutOrder(@RequestBody CloudParkingOrder order){ log.info("云停车出场请求参数:{}" + JSON.toJSONString(order)); parkingOrderService.cloudParkingOutOrder(order); return BaseResponse.ok(); } @@ -49,6 +54,7 @@ @ResponseBody @PostMapping("/cloudParkingSpace") public BaseResponse cloudParkingSpace(@RequestBody CloudParkingSpace parkingSpace){ log.info("云停车实时车位请求参数:{}" + JSON.toJSONString(parkingSpace)); parkingOrderService.cloudParkingSpace(parkingSpace); return BaseResponse.ok(); } @@ -62,6 +68,7 @@ @ResponseBody @PostMapping("/offlineParkingInOrder") public BaseResponse offlineParkingInOrder(@RequestBody OfflineParkingOrder order){ log.info("线下停车场入场请求参数:{}" + JSON.toJSONString(order)); parkingOrderService.offlineParkingInOrder(order); OfflineParkingResponse offlineParkingResponse = new OfflineParkingResponse(); offlineParkingResponse.setCode(0); @@ -78,6 +85,7 @@ @ResponseBody @PostMapping("/offlineParkingOutOrder") public BaseResponse offlineParkingOutOrder(@RequestBody OfflineParkingOrder order){ log.info("线下停车场出场请求参数:{}" + JSON.toJSONString(order)); parkingOrderService.offlineParkingOutOrder(order); OfflineParkingResponse offlineParkingResponse = new OfflineParkingResponse(); offlineParkingResponse.setCode(0); @@ -94,6 +102,7 @@ @ResponseBody @PostMapping("/offlineParkingSpace") public BaseResponse offlineParkingSpace(@RequestBody OfflineParkingSpace parkingSpace){ log.info("线下停车场实时车位请求参数:{}" + JSON.toJSONString(parkingSpace)); parkingOrderService.offlineParkingSpace(parkingSpace); return BaseResponse.ok(); } ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/controller/SwitchwayGateController.java
New file @@ -0,0 +1,36 @@ package com.ruoyi.integration.barrierGate.controller; import com.ruoyi.common.core.domain.R; import com.ruoyi.integration.api.vo.SwitchwayGateReq; import com.ruoyi.integration.barrierGate.server.SwitchwayGateService; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; /** * 开关道闸 * @author zhibing.pu * @Date 2024/9/10 9:43 */ @RestController @RequestMapping("/switchwayGate") public class SwitchwayGateController { @Resource private SwitchwayGateService switchwayGateService; /** * 开关道闸 * @param req * @return */ @PostMapping("/gateService") public R<Boolean> gateService(@RequestBody SwitchwayGateReq req){ Boolean aBoolean = switchwayGateService.gateService(req); return R.ok(aBoolean); } } ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/model/SwitchwayGate.java
New file @@ -0,0 +1,50 @@ package com.ruoyi.integration.barrierGate.model; import com.ruoyi.common.core.utils.MD5Util; import lombok.Data; import lombok.experimental.Accessors; import lombok.extern.slf4j.Slf4j; /** * @author zhibing.pu * @Date 2024/9/10 9:45 */ @Slf4j @Data @Accessors(chain = true) public class SwitchwayGate { /** * 停车场appkey */ private String appkey; /** * 开关动作(open:开、close:关) */ private String action; /** * 通道编号 */ private String channel; /** * 当前时间戳 */ private String timestamp; /** * 签名信息:参数升序排序,&拼接所有参数,MD5(参数+&+参数值...+签名密钥)转大写 */ private String sign; public SwitchwayGate build(String secretkey){ String str = String.format("action=%s&appkey=%s&channel=%s×tamp=%s&key=%s", this.getAction(), this.getAppkey(), this.getChannel(), this.getTimestamp(), secretkey); log.info("待签名串:{}", str); //MD5加密 String encoder = MD5Util.getMD5(str); //将签名结果转大写 encoder = encoder.toUpperCase(); log.info("签名结果:{}", encoder); this.setSign(encoder); return this; } } ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/SwitchwayGateService.java
New file @@ -0,0 +1,61 @@ package com.ruoyi.integration.barrierGate.server; import cn.hutool.http.HttpUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.ruoyi.integration.api.vo.SwitchwayGateReq; import com.ruoyi.integration.barrierGate.model.SwitchwayGate; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; /** * @author zhibing.pu * @Date 2024/9/10 9:44 */ @Slf4j @Service public class SwitchwayGateService { private final String url = "http://8.137.103.127/universal"; private final String appkey = "886621e841fc44c1ad63a823d"; private final String secretkey = "7d87c2c36bea4749b30f38f4d"; /** * 开关道闸 * @param req * @return */ public Boolean gateService(SwitchwayGateReq req){ SwitchwayGate switchwayGate = new SwitchwayGate() .setAppkey(appkey) .setAction(req.getAction()) .setChannel(req.getChannel()) .setTimestamp(System.currentTimeMillis() + "") .build(secretkey); String body = JSON.toJSONString(switchwayGate); String result = HttpUtil.post(url + "/gateService", body); JSONObject jsonObject = JSON.parseObject(result); Boolean success = jsonObject.getBoolean("success"); if(!success){ log.error("调用开关道闸失败:\n请求参数:{}\n返回结果:{}", body, result); } return success; } // public static void main(String[] args) { // SwitchwayGateService switchwayGateService = new SwitchwayGateService(); // SwitchwayGateReq req = new SwitchwayGateReq(); // req.setAction("close"); // req.setChannel("001"); // Boolean success = switchwayGateService.gateService(req); // if(success){ // log.info("调用成功"); // }else{ // log.info("调用失败"); // } // } } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
@@ -40,6 +40,7 @@ import com.ruoyi.order.api.query.ChargingOrderQuery; import com.ruoyi.order.api.query.TChargingCountQuery; import com.ruoyi.order.api.query.UploadRealTimeMonitoringDataQuery; import com.ruoyi.order.api.vo.*; import com.ruoyi.order.api.vo.ChargingOrderInfoVO; import com.ruoyi.order.api.vo.ChargingOrderVO; import com.ruoyi.order.api.vo.GetChargingOrderByLicensePlate; @@ -270,6 +271,7 @@ return chargingOrderService.getRefundList(chargingRefundDto); } @@ -593,10 +595,10 @@ @ResponseBody @GetMapping(value = "/six/total") @ApiOperation(value = "底部数据分类", tags = {"后台-数据分析-平台收入分析"}) public R<Map<String,BigDecimal>> total() { public R<Map<String,Object>> total() { //count近6个月的数据 LocalDate sixBefore = PreviousSixMonths.get(); Map<String,BigDecimal> map = chargingOrderService.countAll(sixBefore); Map<String,Object> map = chargingOrderService.countAll(sixBefore); BigDecimal data = parkingLotClient.getRecordAmount(sixBefore).getData(); map.put("parkingAmount",data); BigDecimal data1 = shoppingOrderService.getSumAmount(sixBefore); @@ -668,80 +670,196 @@ // @ResponseBody // @PostMapping(value = "/charging/statistics") // @ApiOperation(value = "统计", tags = {"管理后台-数据分析-充电运营分析"}) // public R<TCharingOrderVO> watchChargingOrder(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto){ // List<Integer> siteIds =new ArrayList<>(); // if (statisticsQueryDto.getSiteId()==null) { // Long userId = SecurityUtils.getUserId(); // //获取当前登录的siteIds // List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); // for (GetSiteListDTO datum : data) { // siteIds.add(datum.getId()); // } // }else { // siteIds.add(statisticsQueryDto.getSiteId()); // } // // // LocalDate start = null; // LocalDate end = null; // if (statisticsQueryDto.getDayType()==1){ // start = LocalDate.now(); // // }else if (statisticsQueryDto.getDayType()==2){ // LocalDate today = LocalDate.now(); // // // 获取本周一的日期 // LocalDate mondayThisWeek = today.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)); // // System.out.println("本周一是: " + mondayThisWeek); // } // else if (statisticsQueryDto.getDayType()==3){ // // 获取当前日期 // LocalDate today = LocalDate.now(); // // // 获取本月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 = LocalDate.of(currentYear, 1, 1); // System.out.println("今年1月1日是: " + start); // }else if (statisticsQueryDto.getDayType()==5){ // // // 获取今年1月1日的日期 // start = statisticsQueryDto.getStartTime(); // end = statisticsQueryDto.getEndTime(); // } // List<TChargingOrder> list = chargingOrderService.lambdaQuery().ge(TChargingOrder::getStartTime, start).le(TChargingOrder::getEndTime, end).in(TChargingOrder::getSiteId, siteIds).list(); // List<Long> chargingOrderIds = list.stream().map(TChargingOrder::getId).collect(Collectors.toList()); // //上方饼图 // List<Map<String,BigDecimal>> maps = chargingOrderService.getSumByType(chargingOrderIds); // // if (statisticsQueryDto.getDayType()==1){ // List<Map<String,BigDecimal>> maps1 = chargingOrderService.getDateData(chargingOrderIds); // // }else if (statisticsQueryDto.getDayType()==2){ // List<Map<String,BigDecimal>> maps1 = chargingOrderService.getWeekData(chargingOrderIds); // }else if (statisticsQueryDto.getDayType()==3){ // List<Map<String,BigDecimal>> maps1 = chargingOrderService.getMonthData(chargingOrderIds); // }else if (statisticsQueryDto.getDayType()==4){ // List<Map<String,BigDecimal>> maps1 = chargingOrderService.getYearData(chargingOrderIds); // } // // // // // // // } @ResponseBody @PostMapping(value = "/charging/statistics") @ApiOperation(value = "统计,充电订单分析", tags = {"管理后台-数据分析-充电运营分析"}) public R<TCharingOrderMapVO> watchChargingOrder(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto){ List<Integer> siteIds =new ArrayList<>(); if (statisticsQueryDto.getSiteId()==null) { Long userId = SecurityUtils.getUserId(); //获取当前登录的siteIds List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); for (GetSiteListDTO datum : data) { siteIds.add(datum.getId()); } }else { siteIds.add(statisticsQueryDto.getSiteId()); } TCharingOrderMapVO tCharingOrderMapVO = new TCharingOrderMapVO(); LocalDate start = null; LocalDate end = null; if (statisticsQueryDto.getDayType()==1){ start = LocalDate.now(); }else if (statisticsQueryDto.getDayType()==2){ LocalDate today = LocalDate.now(); // 获取本周一的日期 LocalDate mondayThisWeek = today.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)); System.out.println("本周一是: " + mondayThisWeek); } else if (statisticsQueryDto.getDayType()==3){ // 获取当前日期 LocalDate today = LocalDate.now(); // 获取本月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 = LocalDate.of(currentYear, 1, 1); System.out.println("今年1月1日是: " + start); }else if (statisticsQueryDto.getDayType()==5){ // 获取今年1月1日的日期 start = statisticsQueryDto.getStartTime(); end = statisticsQueryDto.getEndTime(); } List<TChargingOrder> list = chargingOrderService.lambdaQuery().ge(TChargingOrder::getStartTime, start).le(TChargingOrder::getEndTime, end).in(TChargingOrder::getSiteId, siteIds).list(); List<Long> chargingOrderIds = list.stream().map(TChargingOrder::getId).collect(Collectors.toList()); //上方饼图 List<Map<String,Object>> maps = chargingOrderService.getSumByType(chargingOrderIds); if (statisticsQueryDto.getDayType()==1){ List<Map<String,Object>> maps1 = chargingOrderService.getDateData(chargingOrderIds); tCharingOrderMapVO.setMaps1(maps1); }else if (statisticsQueryDto.getDayType()==2){ List<Map<String,Object>> maps1 = chargingOrderService.getWeekData(chargingOrderIds); tCharingOrderMapVO.setMaps1(maps1); }else if (statisticsQueryDto.getDayType()==3){ List<Map<String,Object>> maps1 = chargingOrderService.getMonthData(chargingOrderIds); tCharingOrderMapVO.setMaps1(maps1); }else if (statisticsQueryDto.getDayType()==4){ List<Map<String,Object>> maps1 = chargingOrderService.getYearData(chargingOrderIds); tCharingOrderMapVO.setMaps1(maps1); }else if (statisticsQueryDto.getDayType()==5){ List<Map<String,Object>> maps1 = chargingOrderService.getByDate(chargingOrderIds); tCharingOrderMapVO.setMaps1(maps1); } tCharingOrderMapVO.setMaps(maps); return R.ok(tCharingOrderMapVO); } @ResponseBody @PostMapping(value = "/charging/power") @ApiOperation(value = "功率", tags = {"管理后台-数据分析-充电运营分析"}) public R<TCharingOrderPowerMapVO> power(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto) { List<Integer> siteIds = new ArrayList<>(); if (statisticsQueryDto.getSiteId() == null) { Long userId = SecurityUtils.getUserId(); //获取当前登录的siteIds List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); for (GetSiteListDTO datum : data) { siteIds.add(datum.getId()); } } else { siteIds.add(statisticsQueryDto.getSiteId()); } List<Map<String,Object>> maps1 = chargingOrderService.queryPower(siteIds); Map<String,Object> map = chargingOrderService.qureryPowerLevel(siteIds,statisticsQueryDto); TCharingOrderPowerMapVO tCharingOrderPowerMapVO = new TCharingOrderPowerMapVO(); tCharingOrderPowerMapVO.setMaps1(map); tCharingOrderPowerMapVO.setMaps(maps1); return R.ok(tCharingOrderPowerMapVO); } @ResponseBody @PostMapping(value = "/charging/users") @ApiOperation(value = "除电站流量外", tags = {"管理后台-数据分析-充电用户分析"}) public R<TCharingUserMapVO> users(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto){ TCharingUserMapVO tCharingUserMapVO = new TCharingUserMapVO(); //上方折现 if (statisticsQueryDto.getDayType()==1){ List<Map<String,Object>> map = chargingOrderService.usersDay(); tCharingUserMapVO.setMap(map); }else { List<Map<String,Object>> map = chargingOrderService.usersByQuery(statisticsQueryDto); tCharingUserMapVO.setMap(map); } //用户标签 List<Map<String,Object>> maps = chargingOrderService.getUserTagCount(); //会员标签 List<Map<String,Object>> maps1 = chargingOrderService.getVipCount(); //单位消费 List<Map<String, Object>> untiMap = chargingOrderService.unitConsumption(statisticsQueryDto); //车辆用途 List<Map<String, Object>> carMap = chargingOrderService.carUserMethod(); //车辆品牌 List<Map<String, Object>> carBrandMap = chargingOrderService.carUserBrand(); //本地车数量 Map<String,Object> localCarMap = chargingOrderService.countLocalCar(); tCharingUserMapVO.setUserMaps(maps); tCharingUserMapVO.setVipMaps(maps1); tCharingUserMapVO.setUntiMap(untiMap); tCharingUserMapVO.setCarMap(carMap); tCharingUserMapVO.setCarBrandMap(carBrandMap); tCharingUserMapVO.setLocalCarMap(localCarMap); return R.ok(tCharingUserMapVO); } @ResponseBody @PostMapping(value = "/charging/sites") @ApiOperation(value = "电站评价", tags = {"管理后台-数据分析-充电用户分析"}) public R<TCharingUserEvaluateVO> sites(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto){ List<Integer> siteIds =new ArrayList<>(); if (statisticsQueryDto.getSiteId()==null) { Long userId = SecurityUtils.getUserId(); //获取当前登录的siteIds List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); for (GetSiteListDTO datum : data) { siteIds.add(datum.getId()); } }else { siteIds.add(statisticsQueryDto.getSiteId()); } //查询评价分 Long aver = chargingOrderService.getAver(siteIds); //查询各个分数 List<Map<String,Object>> evaluate = chargingOrderService.getLevelEvaluate(siteIds); //查询差评回复数 Long count = orderEvaluateService.lambdaQuery().isNotNull(TOrderEvaluate::getResponseTime).count(); TCharingUserEvaluateVO tCharingUserEvaluateVO = new TCharingUserEvaluateVO(); tCharingUserEvaluateVO.setAver(aver); tCharingUserEvaluateVO.setEvaluate(evaluate); tCharingUserEvaluateVO.setBlackCount(count); //标签 //查出好评ids // orderEvaluateService.goodTop(); //流量 return R.ok(tCharingUserEvaluateVO); } public static void main(String[] args) { // 示例数据 @@ -814,8 +932,8 @@ public void excelEndCharge(@RequestParam("code") String code){ chargingOrderService.excelEndCharge(code); } /** * 根据车牌号和时间查询有效的充电数据 * @param query ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java
@@ -65,19 +65,46 @@ List<SixCircleDto> circle(@Param("siteIds")List<Integer> siteIds,@Param("sixBefore")LocalDate sixBefore); Map<String, BigDecimal> countAll(@Param("sixBefore")LocalDate sixBefore); Map<String, Object> countAll(@Param("sixBefore")LocalDate sixBefore); List<Map<String, BigDecimal>> getSumByType(@Param("chargingOrderIds")List<Long> chargingOrderIds); List<Map<String, Object>> getSumByType(@Param("chargingOrderIds")List<Long> chargingOrderIds); List<Map<String, BigDecimal>> getDateData(List<Long> chargingOrderIds); List<Map<String, Object>> getDateData(List<Long> chargingOrderIds); List<Map<String, BigDecimal>> getWeekData(List<Long> chargingOrderIds); List<Map<String, Object>> getWeekData(List<Long> chargingOrderIds); List<Map<String, BigDecimal>> getMonthData(List<Long> chargingOrderIds); List<Map<String, Object>> getMonthData(List<Long> chargingOrderIds); List<Map<String, BigDecimal>> getYearData(List<Long> chargingOrderIds); List<Map<String, Object>> getYearData(List<Long> chargingOrderIds); List<ChargingOrderListVO> chargingList(@Param("pageInfo")PageInfo<ChargingOrderListVO> pageInfo, @Param("req") ChargingListQuery dto, @Param("startTime1")String startTime1, @Param("startTime2")String startTime2, @Param("endTime1")String endTime1, @Param("endTime2")String endTime2); List<ChargingOrderListVO> chargingList1( @Param("req")ChargingListQuery dto, @Param("startTime1")String startTime1, @Param("startTime2")String startTime2, @Param("endTime1")String endTime1, @Param("endTime2")String endTime2); List<Map<String, Object>> getByDate(List<Long> chargingOrderIds); List<Map<String, Object>> queryPower(List<Integer> siteIds); Map<String, Object> queryPowerLevel(@Param("siteIds") List<Integer> siteIds,@Param("statisticsQueryDto") ChargingStatisticsQueryDto statisticsQueryDto); List<Map<String, Object>> queryOrderCountAndMoneyBySiteIdDate(List<Integer> siteIds); List<Map<String, Object>> usersDay(); List<Map<String, Object>> usersByQuery(ChargingStatisticsQueryDto statisticsQueryDto); List<Map<String, Object>> getUserTagCount(); List<Map<String, Object>> getVipCount(); List<Map<String, Object>> unitConsumption(ChargingStatisticsQueryDto statisticsQueryDto); List<Map<String, Object>> carUserMethod(); List<Map<String, Object>> carUserBrand(); Map<String, Object> countLocalCar(); Long getAver(List<Integer> siteIds); List<Map<String, Object>> getLevelEvaluate(List<Integer> siteIds); } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java
@@ -118,17 +118,17 @@ List<SixCircleDto> circle(List<Integer> siteIds,LocalDate sixBefore); Map<String, BigDecimal> countAll(LocalDate sixBefore); Map<String, Object> countAll(LocalDate sixBefore); List<Map<String, BigDecimal>> getSumByType(List<Long> chargingOrderIds); List<Map<String, Object>> getSumByType(List<Long> chargingOrderIds); List<Map<String, BigDecimal>> getDateData(List<Long> chargingOrderIds); List<Map<String, Object>> getDateData(List<Long> chargingOrderIds); List<Map<String, BigDecimal>> getWeekData(List<Long> chargingOrderIds); List<Map<String, Object>> getWeekData(List<Long> chargingOrderIds); List<Map<String, BigDecimal>> getMonthData(List<Long> chargingOrderIds); List<Map<String, Object>> getMonthData(List<Long> chargingOrderIds); List<Map<String, BigDecimal>> getYearData(List<Long> chargingOrderIds); List<Map<String, Object>> getYearData(List<Long> chargingOrderIds); ChargingOrderTimeVO chargingList(ChargingListQuery dto); @@ -157,6 +157,35 @@ */ void excelEndCharge(String orderCode); List<Map<String, Object>> getByDate(List<Long> chargingOrderIds); List<Map<String, Object>> queryPower(List<Integer> siteIds); Map<String, Object> qureryPowerLevel(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto); List<Map<String, Object>> queryOrderCountAndMoneyBySiteIdDate(List<Integer> siteIds); List<Map<String, Object>> usersDay(); List<Map<String, Object>> usersByQuery(ChargingStatisticsQueryDto statisticsQueryDto); List<Map<String, Object>> getUserTagCount(); List<Map<String, Object>> getVipCount(); List<Map<String, Object>> unitConsumption(ChargingStatisticsQueryDto statisticsQueryDto); List<Map<String, Object>> carUserMethod(); List<Map<String, Object>> carUserBrand(); Map<String, Object> countLocalCar(); Long getAver(List<Integer> siteIds); List<Map<String, Object>> getLevelEvaluate(List<Integer> siteIds); /** * 根据车牌号和开始时间查询充电数据 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -1125,32 +1125,32 @@ } @Override public Map<String, BigDecimal> countAll(LocalDate sixBefore) { public Map<String, Object> countAll(LocalDate sixBefore) { return this.baseMapper.countAll(sixBefore); } @Override public List<Map<String, BigDecimal>> getSumByType(List<Long> chargingOrderIds) { public List<Map<String, Object>> getSumByType(List<Long> chargingOrderIds) { return this.baseMapper.getSumByType(chargingOrderIds); } @Override public List<Map<String, BigDecimal>> getDateData(List<Long> chargingOrderIds) { public List<Map<String, Object>> getDateData(List<Long> chargingOrderIds) { return this.baseMapper.getDateData(chargingOrderIds); } @Override public List<Map<String, BigDecimal>> getWeekData(List<Long> chargingOrderIds) { public List<Map<String, Object>> getWeekData(List<Long> chargingOrderIds) { return this.baseMapper.getWeekData(chargingOrderIds); } @Override public List<Map<String, BigDecimal>> getMonthData(List<Long> chargingOrderIds) { public List<Map<String, Object>> getMonthData(List<Long> chargingOrderIds) { return this.baseMapper.getMonthData(chargingOrderIds); } @Override public List<Map<String, BigDecimal>> getYearData(List<Long> chargingOrderIds) { public List<Map<String, Object>> getYearData(List<Long> chargingOrderIds) { return this.baseMapper.getYearData(chargingOrderIds); } @Resource @@ -1556,6 +1556,75 @@ endCharge(orderCode, 0); } @Override public List<Map<String, Object>> getByDate(List<Long> chargingOrderIds) { return this.baseMapper.getByDate(chargingOrderIds); } @Override public List<Map<String, Object>> queryPower(List<Integer> siteIds) { return this.baseMapper.queryPower(siteIds); } @Override public Map<String, Object> qureryPowerLevel(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto) { return this.baseMapper.queryPowerLevel(siteIds,statisticsQueryDto); } @Override public List<Map<String, Object>> queryOrderCountAndMoneyBySiteIdDate(List<Integer> siteIds) { return this.baseMapper.queryOrderCountAndMoneyBySiteIdDate(siteIds); } @Override public List<Map<String, Object>> usersDay() { return this.baseMapper.usersDay(); } @Override public List<Map<String, Object>> usersByQuery(ChargingStatisticsQueryDto statisticsQueryDto) { return this.baseMapper.usersByQuery(statisticsQueryDto); } @Override public List<Map<String, Object>> getUserTagCount() { return this.baseMapper.getUserTagCount(); } @Override public List<Map<String, Object>> getVipCount() { return this.baseMapper.getVipCount(); } @Override public List<Map<String, Object>> unitConsumption(ChargingStatisticsQueryDto statisticsQueryDto) { return this.baseMapper.unitConsumption(statisticsQueryDto); } @Override public List<Map<String, Object>> carUserMethod() { return this.baseMapper.carUserMethod(); } @Override public List<Map<String, Object>> carUserBrand() { return this.baseMapper.carUserBrand(); } @Override public Map<String, Object> countLocalCar() { return this.baseMapper.countLocalCar(); } @Override public Long getAver(List<Integer> siteIds) { return this.baseMapper.getAver(siteIds); } @Override public List<Map<String, Object>> getLevelEvaluate(List<Integer> siteIds) { return this.baseMapper.getLevelEvaluate(siteIds); } @Override ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TVipOrderServiceImpl.java
@@ -79,6 +79,6 @@ giveVipDto.setUserIds(tVipOrder.getAppUserId().toString()); giveVipDto.setVipId(tVipOrder.getVipId()); giveVipDto.setType(tVipOrder.getVipType()); // vipClient.giveVip(giveVipDto); vipClient.giveVip(giveVipDto); } } ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
@@ -358,7 +358,8 @@ SELECT DATE_FORMAT( create_time, '%Y-%m-%d %H' ) as time, SUM(service_charge) as servicecharge, SUM(electrovalence) as electrovalence SUM(electrovalence) as electrovalence, count(1) as orderCount FROM t_charging_order <where> @@ -380,7 +381,8 @@ SELECT DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, SUM(service_charge) as servicecharge, SUM(electrovalence) as electrovalence SUM(electrovalence) as electrovalence, count(1) as orderCount FROM t_charging_order <where> @@ -402,7 +404,8 @@ SELECT DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, SUM(service_charge) as servicecharge, SUM(electrovalence) as electrovalence SUM(electrovalence) as electrovalence, count(1) as orderCount FROM t_charging_order <where> @@ -424,7 +427,8 @@ SELECT DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, SUM(service_charge) as servicecharge, SUM(electrovalence) as electrovalence SUM(electrovalence) as electrovalence, count(1) as orderCount FROM t_charging_order <where> @@ -443,6 +447,337 @@ </select> <select id="getByDate" resultType="java.util.Map"> SELECT DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, SUM(service_charge) as servicecharge, SUM(electrovalence) as electrovalence, count(1) as orderCount FROM t_charging_order <where> del_flag = 0 and recharge_payment_status = 2 and ISNULL(refund_status) <if test="chargingOrderIds != null and chargingOrderIds.size() > 0"> AND id IN <foreach collection="chargingOrderIds" item="chargingOrderId" open="(" separator="," close=")"> #{chargingOrderId} </foreach> </if> </where> GROUP BY time ORDER BY time </select> <select id="queryPower" resultType="java.util.Map"> SELECT 'today' AS data_type, DATE_FORMAT(create_time, '%Y-%m-%d %H') AS TIME, SUM(power) AS power FROM t_charging_order WHERE del_flag = 0 AND recharge_payment_status = 2 AND ISNULL(refund_status) AND DATE(create_time) = CURDATE() <if test="siteIds != null and siteIds.size() > 0"> AND site_id IN <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> #{siteId} </foreach> </if> GROUP BY TIME UNION ALL SELECT 'yesterday' AS data_type, DATE_FORMAT(create_time, '%Y-%m-%d %H') AS TIME, SUM(power) AS power FROM t_charging_order WHERE del_flag = 0 AND recharge_payment_status = 2 AND ISNULL(refund_status) AND DATE(create_time) = CURDATE() - INTERVAL 1 DAY <if test="siteIds != null and siteIds.size() > 0"> AND site_id IN <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> #{siteId} </foreach> </if> GROUP BY TIME ORDER BY TIME; </select> <select id="queryPowerLevel" resultType="java.util.Map"> SELECT count(CASE WHEN power BETWEEN 0 AND 30 THEN 1 ELSE 0 END) AS count_0_30, count(CASE WHEN power BETWEEN 31 AND 60 THEN 1 ELSE 0 END) AS count_31_60, count(CASE WHEN power BETWEEN 61 AND 120 THEN 1 ELSE 0 END) AS count_61_120, count(CASE WHEN power BETWEEN 121 AND 300 THEN 1 ELSE 0 END) AS count_121_300, count(CASE WHEN power > 300 THEN 1 ELSE 0 END) AS count_above_300 FROM t_charging_order WHERE del_flag = 0 AND recharge_payment_status = 2 AND ISNULL(refund_status) <if test="siteIds != null and siteIds.size() > 0"> AND site_id IN <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> #{siteId} </foreach> </if> <if test="statisticsQueryDto.dayType =1"> AND DATE(create_time) = CURDATE() </if> <if test="statisticsQueryDto.dayType =2"> AND WEEKOFYEAR(create_time) = WEEKOFYEAR(CURDATE()) </if> <if test="statisticsQueryDto.dayType =3"> AND MONTH(create_time) = MONTH(CURDATE()) </if> <if test="statisticsQueryDto.dayType =4"> AND YEAR(create_time) = YEAR(CURDATE()) </if> <if test="statisticsQueryDto.dayType =5"> <if test="statisticsQueryDto.startTime != null"> AND create_time >= #{statisticsQueryDto.startTime} </if> <if test="statisticsQueryDto.endTime != null"> AND create_time <= #{statisticsQueryDto.endTime} </if> </if> </select> <select id="usersDay" resultType="java.util.Map"> SELECT 'today' AS data_type, '1' as type, DATE_FORMAT( create_time, '%Y-%m-%d %H' ) AS TIME, count(DISTINCT app_user_id) AS counts FROM t_charging_order WHERE del_flag = 0 AND recharge_payment_status = 2 AND ISNULL( refund_status ) AND DATE ( create_time ) = CURDATE() GROUP BY TIME UNION all SELECT 'today' AS data_type, '2' as type, DATE_FORMAT( create_time, '%Y-%m-%d %H' ) AS TIME, count(1) AS counts FROM charging_pile_account.t_app_user WHERE del_flag = 0 AND DATE ( create_time ) = CURDATE() GROUP BY TIME </select> <select id="usersByQuery" resultType="java.util.Map"> SELECT 'today' AS data_type, '1' as type, DATE_FORMAT( create_time, '%Y-%m-%d' ) AS TIME, count(DISTINCT app_user_id) AS counts FROM t_charging_order WHERE del_flag = 0 AND recharge_payment_status = 2 AND ISNULL( refund_status ) <if test="statisticsQueryDto.dayType =1 "> AND DATE(create_time) = CURDATE() </if> <if test="statisticsQueryDto.dayType =2 "> AND WEEKOFYEAR(create_time) = WEEKOFYEAR(CURDATE()) </if> <if test="statisticsQueryDto.dayType =3 "> AND MONTH(create_time) = MONTH(CURDATE()) </if> <if test="statisticsQueryDto.dayType =4"> AND YEAR(create_time) = YEAR(CURDATE()) </if> <if test="statisticsQueryDto.dayType =5"> <if test="statisticsQueryDto.startTime != null"> AND create_time >= #{statisticsQueryDto.startTime} </if> <if test="statisticsQueryDto.endTime != null"> AND create_time <= #{statisticsQueryDto.endTime} </if> </if> GROUP BY TIME UNION all SELECT 'today' AS data_type, '2' as type, DATE_FORMAT( create_time, '%Y-%m-%d' ) AS TIME, count(1) AS counts FROM charging_pile_account.t_app_user WHERE del_flag = 0 <if test="statisticsQueryDto.dayType =1 "> AND DATE(create_time) = CURDATE() </if> <if test="statisticsQueryDto.dayType =2 "> AND WEEKOFYEAR(create_time) = WEEKOFYEAR(CURDATE()) </if> <if test="statisticsQueryDto.dayType =3 "> AND MONTH(create_time) = MONTH(CURDATE()) </if> <if test="statisticsQueryDto.dayType =4"> AND YEAR(create_time) = YEAR(CURDATE()) </if> <if test="statisticsQueryDto.dayType =5"> <if test="statisticsQueryDto.startTime != null"> AND create_time >= #{statisticsQueryDto.startTime} </if> <if test="statisticsQueryDto.endTime != null"> AND create_time <= #{statisticsQueryDto.endTime} </if> </if> GROUP BY TIME </select> <select id="getUserTagCount" resultType="java.util.Map"> SELECT user_tag_id,COUNT(1) as count from ( SELECT a.app_user_id, a.user_tag_id, a.create_time FROM charging_pile_account.t_app_user_tag a JOIN ( SELECT app_user_id, MAX(create_time) AS max_create_time FROM charging_pile_account.t_app_user_tag GROUP BY app_user_id ) b ON a.app_user_id = b.app_user_id AND a.create_time = b.max_create_time ) o GROUP BY o.user_tag_id </select> <select id="getVipCount" resultType="java.util.Map"> SELECT vip_id,count(1) as Counts FROM charging_pile_account.t_app_user WHERE del_flag = 0 GROUP BY vip_id </select> <select id="unitConsumption" resultType="java.util.Map"> SELECT au.company_id as companyId, SUM( co.charging_capacity ) as chargingCapacity FROM charging_pile_order.t_charging_order co LEFT JOIN charging_pile_account.t_app_user au ON co.app_user_id = au.id <where> co.del_flag = 0 <if test="statisticsQueryDto.dayType == 1"> AND DATE( co.create_time ) = CURDATE() </if> <if test="statisticsQueryDto.dayType == 2"> AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() ) </if> <if test="statisticsQueryDto.dayType == 3"> AND MONTH( co.create_time ) = MONTH(CURDATE()) </if> <if test="statisticsQueryDto.dayType == 4"> AND YEAR( co.create_time ) = YEAR(CURDATE() ) </if> <if test="statisticsQueryDto.dayType == 5"> <if test="statisticsQueryDto.startTime != null"> AND co.create_time >= #{statisticsQueryDto.startTime} </if> <if test="statisticsQueryDto.endTime != null"> AND co.create_time <= #{statisticsQueryDto.endTime} </if> </if> </where> GROUP BY au.company_id </select> <select id="carUserMethod" resultType="java.util.Map"> SELECT count(1) as counts,vehicle_use from charging_pile_account.t_app_user_car GROUP BY vehicle_use </select> <select id="carUserBrand" resultType="java.util.Map"> SELECT count(1) as counts,vehicle_brand from charging_pile_account.t_app_user_car GROUP BY vehicle_brand </select> <select id="countLocalCar" resultType="java.util.Map"> SELECT SUM(CASE WHEN license_plate LIKE '%川J%' THEN 1 ELSE 0 END) AS localCar, SUM(CASE WHEN license_plate NOT LIKE '%川J%' THEN 1 ELSE 0 END) AS notLocalCar FROM `charging_pile_account`.`t_app_user_car` WHERE del_flag = 0 </select> <select id="getAver" resultType="java.lang.Long"> SELECT ROUND(AVG(te.mark), 2) AS average_mark FROM `t_order_evaluate` te LEFT JOIN t_charging_order co on te.order_id = co.id WHERE <if test="siteIds != null and siteIds.size() > 0"> AND co.site_id IN <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> #{siteId} </foreach> </if> te.del_flag = 0 </select> <select id="getLevelEvaluate" resultType="java.util.Map"> SELECT CASE WHEN te.mark BETWEEN 1 AND 2 THEN '1-2' WHEN te.mark = 3 THEN '3' WHEN te.mark BETWEEN 4 AND 5 THEN '4-5' ELSE 'Other' END AS score_range, COUNT(*) AS count FROM `t_order_evaluate` te LEFT JOIN t_charging_order co on te.order_id = co.id WHERE te.del_flag = 0 <if test="siteIds != null and siteIds.size() > 0"> AND co.site_id IN <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> #{siteId} </foreach> </if> GROUP BY score_range </select> <select id="chargingList" resultType="com.ruoyi.order.api.vo.ChargingOrderListVO"> select t1.* from t_charging_order t1 where 1=1 ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/utils/WxAbstractPay.java
@@ -69,7 +69,7 @@ */ protected String buildBaseParam(WxPaymentInfoModel requestBody, String notifyUrl) { // 封装基础数据 requestBody.setNotify_url(notifyUrl); // requestBody.setNotify_url(notifyUrl); String reqBody = WxJsonUtils.toJsonString(requestBody); return reqBody; }