From fb9e286342938f63af535eb2a363f783a63213db Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期三, 28 五月 2025 11:13:57 +0800 Subject: [PATCH] Merge branch 'dev' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile into dev --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java | 235 +++++- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TInvoiceTypeController.java | 1 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/RuoYiSystemApplication.java | 1 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/PhotovoltaicPowerGenerationVO.java | 15 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java | 15 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TInvoiceInformationController.java | 4 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TScreenContentService.java | 27 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TScreenContent.java | 97 ++ ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserVipDetailController.java | 5 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java | 3 ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java | 6 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrderSummaryData.java | 55 + ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java | 8 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml | 231 +++-- ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java | 3 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/EnergyRefreshService.java | 110 +++ ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/vo/LargeChargingPowerVo.java | 17 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderEvaluateController.java | 12 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TNoticeController.java | 4 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/EmissionReductionVO.java | 27 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderSummaryDataMapper.java | 11 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderSummaryDataServiceImpl.java | 15 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserAddressController.java | 7 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java | 12 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java | 7 ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/controller/LargeScreenController.java | 67 + ruoyi-auth/src/main/java/com/ruoyi/auth/controller/TokenController.java | 6 ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingGunClient.java | 9 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java | 11 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ScreenTopVO.java | 24 ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/service/TokenService.java | 9 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java | 11 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderAppealController.java | 4 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TScreenContentMapper.java | 26 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java | 7 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderInvoiceMapper.xml | 6 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java | 55 + ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/LargeScreenGunVo.java | 24 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/StatisticsOfBatteryVO.java | 19 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java | 20 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TScreenContentServiceImpl.java | 166 ++++ ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml | 3 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ScreenStorageConfigVO.java | 33 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java | 11 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java | 8 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TScreenContentMapper.xml | 25 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java | 6 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java | 73 + ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyDetailController.java | 3 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java | 226 +++-- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java | 1 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderSummaryDataMapper.xml | 5 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TAdvertisingController.java | 3 /dev/null | 10 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralRuleController.java | 1 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/EnergyStorageDischargeVO.java | 18 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/PhotovoltaicAndConsumptionVO.java | 18 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java | 2 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/ITChargingOrderSummaryDataService.java | 11 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TScreenContentController.java | 142 ++++ ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/FinancialSettlementController.java | 29 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEvaluationTagController.java | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TSystemConfigurationController.java | 1 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java | 31 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderCountByDate.java | 12 66 files changed, 1,713 insertions(+), 355 deletions(-) diff --git a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java index 8bce10c..7da496b 100644 --- a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java @@ -12,6 +12,7 @@ import org.slf4j.LoggerFactory; import org.springframework.cloud.openfeign.FallbackFactory; import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.RequestParam; import java.util.List; @@ -84,6 +85,11 @@ public R<TChargingGun> getChargingGunByFullNumber(String fullNumber) { return R.fail("根据枪唯一码查询信息失败:" + throwable.getMessage()); } + @Override + public R<List<Integer>> getGunIdsBySiteIdsAndChargeModels(List<Integer> siteIds, List<Integer> chargeModels){ + return R.fail("根据站点ids和充电模式集合查询充电枪集合失败:" + throwable.getMessage()); + } + }; } } diff --git a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingGunClient.java b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingGunClient.java index 79ee4b4..a1a1779 100644 --- a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingGunClient.java +++ b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingGunClient.java @@ -3,15 +3,12 @@ import com.ruoyi.chargingPile.api.factory.ChargingGunFallbackFactory; import com.ruoyi.chargingPile.api.model.TChargingGun; import com.ruoyi.chargingPile.api.model.TChargingPile; -import com.ruoyi.chargingPile.api.model.TFaultMessage; import com.ruoyi.chargingPile.api.vo.GetChargingGunByCode; import com.ruoyi.chargingPile.api.vo.SiteNameVO; import com.ruoyi.common.core.constant.ServiceNameConstants; import com.ruoyi.common.core.domain.R; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; - -import java.util.List; import java.util.List; @@ -111,4 +108,10 @@ */ @PostMapping("/t-charging-gun/getChargingGunByFullNumber") R<TChargingGun> getChargingGunByFullNumber(@RequestParam("fullNumber") String fullNumber); + + /** + * 大屏 根据站点ids和充电模式集合查询充电枪集合 + */ + @GetMapping("/t-charging-gun/getGunIdsBySiteIdsAndChargeModels") + R<List<Integer>> getGunIdsBySiteIdsAndChargeModels(@RequestParam("siteIds") List<Integer> siteIds ,@RequestParam("chargeModels") List<Integer> chargeModels); } diff --git a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/LargeScreenGunVo.java b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/LargeScreenGunVo.java new file mode 100644 index 0000000..bf2eb0a --- /dev/null +++ b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/LargeScreenGunVo.java @@ -0,0 +1,24 @@ +package com.ruoyi.chargingPile.api.vo; + + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel(value = "大屏对外开放区车位使用情况Vo") +public class LargeScreenGunVo { + @ApiModelProperty(value = "超级快充") + private Integer superFast=0; + @ApiModelProperty(value = "快充") + private Integer fast=0; + @ApiModelProperty(value = "快充") + private Integer v2g=0; + + @ApiModelProperty(value = "超级快充 使用") + private Integer useSuperFast=0; + @ApiModelProperty(value = "快充") + private Integer useFast=0; + @ApiModelProperty(value = "快充") + private Integer useV2g=0; +} diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java index 6d50bbe..cd782a1 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java @@ -16,8 +16,11 @@ import org.slf4j.LoggerFactory; import org.springframework.cloud.openfeign.FallbackFactory; import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestParam; +import java.math.BigDecimal; import java.util.List; /** @@ -211,6 +214,10 @@ public R tripartitePlatformStopCharge(String startChargeSeq) { return R.fail("三方平台请求停止充电失败:" + throwable.getMessage()); } + @Override + public R<BigDecimal> getSumDegreeBySiteIds(@RequestParam("siteIds") List<Integer> SiteIds){ + return R.fail("获取站点集合中总的充电量失败:" + throwable.getMessage()); + } }; } } diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java index fc03e1f..5570939 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java @@ -20,6 +20,7 @@ import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; +import java.math.BigDecimal; import java.util.List; /** @@ -307,4 +308,11 @@ */ @PostMapping("/t-charging-order/tripartitePlatformStopCharge") R tripartitePlatformStopCharge(@RequestParam("startChargeSeq") String startChargeSeq); + + /** + * 充电桩大屏 获取站点集合中总的充电量 + */ + @GetMapping("/t-charging-order/getSumDegreeBySiteIds") + R<BigDecimal> getSumDegreeBySiteIds(@RequestParam("siteIds") List<Integer> SiteIds); + } diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrderSummaryData.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrderSummaryData.java new file mode 100644 index 0000000..6cd7af5 --- /dev/null +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrderSummaryData.java @@ -0,0 +1,55 @@ +package com.ruoyi.order.api.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author zhibing.pu + * @Date 2025/5/9 11:35 + */ +@Data +@TableName("t_charging_order_summary_data") +public class TChargingOrderSummaryData { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.NONE) + private Long id; + /** + * 充电订单id + */ + @TableField("charging_order_id") + private Long chargingOrderId; + /** + * 充电时长(s) + */ + @TableField("charging_duration") + private Long chargingDuration; + /** + * 充电度数 + */ + @TableField("charging_capacity") + private BigDecimal chargingCapacity; + /** + * 收入 + */ + @TableField("income") + private BigDecimal income; + /** + * 电费 + */ + @TableField("electric_price") + private BigDecimal electricPrice; + /** + * 服务费 + */ + @TableField("service_price") + private BigDecimal servicePrice; + + +} diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TScreenContent.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TScreenContent.java new file mode 100644 index 0000000..debe154 --- /dev/null +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TScreenContent.java @@ -0,0 +1,97 @@ +package com.ruoyi.other.api.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.core.web.domain.BasePojo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Date; + +@Data +@TableName("t_screen_content") +@ApiModel("大屏设置对象") +public class TScreenContent { + + @TableId(value = "id", type = IdType.AUTO) + @ApiModelProperty("主键ID") + private Integer id; + + @TableField("site_id") + @ApiModelProperty("站点id") + private Integer siteId; + + @TableField("green_electricity_today") + @ApiModelProperty("今日绿电消纳值") + private BigDecimal greenElectricityToday; + + @TableField("car_discharge") + @ApiModelProperty("累计汽车放电量") + private BigDecimal carDischarge; + + @TableField("green_electricity") + @ApiModelProperty("累计绿电消纳电量") + private BigDecimal greenElectricity; + + @TableField("title") + @ApiModelProperty("标题") + private String title; + + @TableField("title_one") + @ApiModelProperty("标题1") + private String titleOne; + + @TableField("value_one") + @ApiModelProperty("值1") + private BigDecimal valueOne; + + @TableField("unit_one") + @ApiModelProperty("计量单位1") + private String unitOne; + + @TableField("title_two") + @ApiModelProperty("标题2") + private String titleTwo; + + @TableField("value_two") + @ApiModelProperty("值2") + private BigDecimal valueTwo; + + @TableField("unit_two") + @ApiModelProperty("计量单位2") + private String unitTwo; + + @TableField("title_three") + @ApiModelProperty("标题3") + private String titleThree; + + @TableField("value_three") + @ApiModelProperty("值3") + private BigDecimal valueThree; + + @TableField("unit_three") + @ApiModelProperty("计量单位3") + private String unitThree; + + @TableField("statistical_deadline") + @ApiModelProperty("截止统计日期") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime statisticalDeadline; + + @TableField("create_time") + @ApiModelProperty("创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @TableField("update_time") + @ApiModelProperty("更新时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; +} \ No newline at end of file diff --git a/ruoyi-auth/src/main/java/com/ruoyi/auth/controller/TokenController.java b/ruoyi-auth/src/main/java/com/ruoyi/auth/controller/TokenController.java index da2ac38..c6928db 100644 --- a/ruoyi-auth/src/main/java/com/ruoyi/auth/controller/TokenController.java +++ b/ruoyi-auth/src/main/java/com/ruoyi/auth/controller/TokenController.java @@ -67,6 +67,12 @@ Partner partner = partnerClient.getPartnerById(userInfo.getSysUser().getObjectId()).getData(); map.put("partnerName", partner.getName()); } + long time = userInfo.getSysUser().getPassWordUpdate().getTime(); + map.put("password", false); + //30天提示修改密码 + if(System.currentTimeMillis() >= (time + 2592000000L)){ + map.put("password", true); + } // 修改用户最后登录时间 SysUser sysUser = new SysUser(); sysUser.setUserId(userInfo.getSysUser().getUserId()); diff --git a/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/service/TokenService.java b/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/service/TokenService.java index d30a11f..672f09f 100644 --- a/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/service/TokenService.java +++ b/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/service/TokenService.java @@ -61,7 +61,6 @@ claimsMap.put(SecurityConstants.DETAILS_USER_ID, userId); claimsMap.put(SecurityConstants.USER_TYPE, "system"); claimsMap.put(SecurityConstants.DETAILS_USERNAME, userName); - // 接口返回信息 Map<String, Object> rspMap = new HashMap<String, Object>(); rspMap.put("access_token", JwtUtils.createToken(claimsMap)); @@ -208,8 +207,8 @@ loginUser.setLoginTime(System.currentTimeMillis()); loginUser.setExpireTime(loginUser.getLoginTime() + expireTime * MILLIS_MINUTE); // 根据uuid将loginUser缓存 - String userKey = getTokenKey(loginUser.getToken()); - redisService.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES); + String tokenKey = getTokenKey(loginUser.getToken()); + redisService.setCacheObject(tokenKey, loginUser, expireTime, TimeUnit.MINUTES); } public void refreshToken1(LoginUserApplet dto) { @@ -223,4 +222,8 @@ private String getTokenKey(String token) { return ACCESS_TOKEN + token; } + + private String getUserKey(Long userid) { + return ACCESS_TOKEN + userid; + } } \ No newline at end of file diff --git a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java index ff02153..2a9d1a6 100644 --- a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java +++ b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java @@ -25,6 +25,7 @@ import io.jsonwebtoken.Claims; import reactor.core.publisher.Mono; +import java.time.LocalDateTime; import java.util.HashMap; import java.util.Map; @@ -109,6 +110,7 @@ return ServletUtils.webFluxResponseWriter(exchange.getResponse(), msg, HttpStatus.UNAUTHORIZED); } + /** * 获取缓存key */ diff --git a/ruoyi-gateway/src/main/resources/banner.txt b/ruoyi-gateway/src/main/resources/banner.txt deleted file mode 100644 index ceced29..0000000 --- a/ruoyi-gateway/src/main/resources/banner.txt +++ /dev/null @@ -1,10 +0,0 @@ -Spring Boot Version: ${spring-boot.version} -Spring Application Name: ${spring.application.name} - _ _ - (_) | | - _ __ _ _ ___ _ _ _ ______ __ _ __ _ | |_ ___ __ __ __ _ _ _ -| '__|| | | | / _ \ | | | || ||______| / _` | / _` || __| / _ \\ \ /\ / / / _` || | | | -| | | |_| || (_) || |_| || | | (_| || (_| || |_ | __/ \ V V / | (_| || |_| | -|_| \__,_| \___/ \__, ||_| \__, | \__,_| \__| \___| \_/\_/ \__,_| \__, | - __/ | __/ | __/ | - |___/ |___/ |___/ \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/RuoYiSystemApplication.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/RuoYiSystemApplication.java index 3fc922f..1edc201 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/RuoYiSystemApplication.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/RuoYiSystemApplication.java @@ -7,6 +7,7 @@ import com.ruoyi.common.security.annotation.EnableRyFeignClients; import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.transaction.annotation.EnableTransactionManagement; /** diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java index e14b510..acca8a1 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java @@ -130,6 +130,7 @@ user.setCreateBy(SecurityUtils.getUsername()); user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); user.setRoleType(1); + user.setPassWordUpdate(new Date()); userService.insertUser(user); SysUserRole sysUserRole = new SysUserRole(); sysUserRole.setRoleId(user.getRoleId()); @@ -503,7 +504,6 @@ sysUserVo.setSysUser(sysUser); sysUserVo.setRoles(roles); sysUserVo.setPermissions(permissions); - return R.ok(sysUserVo); } diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index 47651b2..f18227b 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -24,6 +24,7 @@ <result property="updateTime" column="update_time" /> <result property="forbiddenRemark" column="forbidden_remark"/> <result property="remark" column="remark" /> + <result property="passWordUpdate" column="passWordUpdate" /> <result property="roleType" column="roleType" /> <result property="objectId" column="objectId" /> <association property="dept" column="dept_id" javaType="com.ruoyi.system.api.domain.SysDept" resultMap="deptResult" /> @@ -49,7 +50,7 @@ </resultMap> <sql id="selectUserVo"> - select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, + select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.passWordUpdate, d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status, r.role_id, r.role_name, r.role_key, r.data_scope, r.status as role_status ,u.roleType as roleType,u.objectId AS objectId from sys_user u diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java index 66cbddc..a3279fb 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java @@ -15,6 +15,9 @@ import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; import com.ruoyi.chargingPile.api.model.TChargingGun; import com.ruoyi.chargingPile.api.model.TChargingPile; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.other.api.vo.CouponListVOVO; import com.ruoyi.account.api.vo.ExchangeRecordVO; import com.ruoyi.account.service.TAppCouponService; @@ -91,6 +94,7 @@ * @param dto * @return */ + @Log(title = "【扫一扫】添加车辆", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) @ApiOperation(value = "添加车辆", tags = {"小程序-扫一扫"}) @PostMapping(value = "/scan/addCar") public AjaxResult addCar(@RequestBody TAppUserCar dto) { @@ -207,7 +211,7 @@ public R<List<ExchangeRecordVO>> getExchangeRecordByCouponId(@RequestBody ExchangeRecordGoodsQuery couponId){ return R.ok(tAppCouponService.pagelist(couponId)); } - + @ApiOperation(value = "优惠卷可用数量", tags = {"小程序-站点管理-站点详情"}) @GetMapping(value = "/couponCount") public R<Long> couponCount() { diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserAddressController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserAddressController.java index 0ddf5fa..e2f680c 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserAddressController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserAddressController.java @@ -6,6 +6,9 @@ import com.ruoyi.account.service.TAppUserAddressService; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.common.security.service.TokenService; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -80,6 +83,7 @@ /** * 添加用户地址管理 */ + @Log(title = "【我的】添加用户地址", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) @ApiOperation(tags = {"小程序-用户地址"},value = "添加用户地址") @PostMapping(value = "/add") public AjaxResult<Boolean> add(@RequestBody TAppUserAddress dto) { @@ -93,6 +97,7 @@ /** * 修改用户地址 */ + @Log(title = "【我的】设置默认地址", businessType = BusinessType.UPDATE,operatorType = OperatorType.MOBILE) @ApiOperation(tags = {"小程序-用户地址"},value = "设置默认地址") @GetMapping(value = "/setDefaultAddress") public AjaxResult<String> setDefaultAddress(@RequestParam(value = "id") Long id) { @@ -111,6 +116,7 @@ /** * 修改用户地址 */ + @Log(title = "【我的】修改用户地址", businessType = BusinessType.UPDATE,operatorType = OperatorType.MOBILE) @ApiOperation(tags = {"小程序-用户地址"},value = "修改用户地址") @PostMapping(value = "/update") public AjaxResult<Boolean> update(@RequestBody TAppUserAddress dto) { @@ -146,6 +152,7 @@ /** * 删除用户地址 */ + @Log(title = "【我的】删除用户地址", businessType = BusinessType.DELETE,operatorType = OperatorType.MOBILE) @ApiOperation(tags = {"小程序-用户地址"},value = "删除用户地址") @DeleteMapping(value = "/deleteById") public AjaxResult<Boolean> deleteById(@RequestParam("id") Long id) { diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java index 67a4855..754743b 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java @@ -158,7 +158,7 @@ // 指定发送邮件的主机为 String host = "smtp.163.com"; Properties properties = new Properties(); - properties.put("mail.smtp.host", "smtp.163.com"); + properties.put("mail.smtp.host", host); properties.put("mail.smtp.socketFactory.port", "465"); properties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); properties.put("mail.smtp.auth", "true"); @@ -170,7 +170,7 @@ public javax.mail.PasswordAuthentication getPasswordAuthentication() { //发件人邮件用户名、授权码,换成自己的发件箱及授权码 - return new PasswordAuthentication("13281306557@163.com", "NUSdxDQqadYvVek2"); + return new PasswordAuthentication(from, "NUSdxDQqadYvVek2"); } }); @@ -180,7 +180,7 @@ // Set From,设置发件人 InternetAddress fromMail = new InternetAddress(from); //设置发件人名称,TODO 换成自己的发件箱 - fromMail.setPersonal(MimeUtility.encodeText("明星新能源科技有限公司<13281306557@163.com>")); + fromMail.setPersonal(MimeUtility.encodeText("明星新能源科技有限公司<" + from + ">")); message.setFrom(fromMail); // Set To: 设置收件人 InternetAddress toMail = new InternetAddress(to); @@ -261,7 +261,8 @@ appUserService.updateById(byId); return R.ok(); } - + + @ApiOperation(value = "查询当前用户是否为会员 0否1是", tags = {"小程序--查询当前用户是否为会员"}) @PostMapping(value = "/getUserInfo") public AjaxResult<Integer> getUserInfo() { @@ -672,7 +673,6 @@ } - @ApiOperation(value = "用户详情积分明细", tags = {"小程序-个人中心"}) @PostMapping(value = "/user/points/page1") public R<Page<TAppUserIntegralChange>> pointsDetail1(@RequestBody PointsQueryDto pointsQueryDto) { @@ -723,7 +723,6 @@ } - @ApiOperation(value = "积分详情", tags = {"小程序-个人中心"}) @GetMapping(value = "/user/points/detail") public R<TAppUserIntegralChange> pointsDetail(String id) { @@ -785,7 +784,8 @@ } @Resource private TAppUserVipDetailService appUserVipDetailService; - + + @ApiOperation(value = "个人中心信息", tags = {"小程序-个人中心"}) @GetMapping(value = "/user/info") public R<AppUserInfoDto> info() { @@ -826,8 +826,9 @@ appUserInfoDto.setPoints(byId.getPoints()==null?0:byId.getPoints()); return R.ok(appUserInfoDto); } - - + + + @Log(title = "【我的】设置头像", businessType = BusinessType.UPDATE,operatorType = OperatorType.MOBILE) @ApiOperation(value = "设置头像", tags = {"小程序-个人中心"}) @GetMapping(value = "/user/set/avatar") public R avatar(String url) { @@ -843,7 +844,7 @@ appUserService.updateById(byId); return R.ok(); } - + @ApiOperation(value = "优惠卷列表不分页(1可使用2不可用)", tags = {"小程序-个人中心"}) @GetMapping(value = "/user/coupon") public R<ListInfoCouponDto> userCoupon(@RequestParam("type") Integer type) { @@ -897,8 +898,8 @@ return R.ok(listInfoCouponDto); } - - + + @ApiOperation(value = "优惠卷详情(1可使用2不可用)", tags = {"小程序-个人中心"}) @PostMapping(value = "/user/coupon/getById") public R<TAppCoupon> couponGetById(@RequestParam("id")Long id) { @@ -980,7 +981,7 @@ return R.ok(); } - + @ApiOperation(value = "已赠送列表", tags = {"小程序-个人中心-邀请好友"}) @PostMapping(value = "/user/invite/page") public R<Page<TInviteUser>> invitePage(@RequestBody BasePage basePage) { @@ -993,7 +994,7 @@ } return R.ok(page); } - + @ApiOperation(value = "已赠送列表", tags = {"小程序-个人中心-邀请好友"}) @GetMapping(value = "/user/invite/info") public R<InviteInfoDto> inviteInfo() { @@ -1010,9 +1011,9 @@ return R.ok(inviteInfoDto); } - - - + + + @Log(title = "【我的】更换手机号", businessType = BusinessType.UPDATE,operatorType = OperatorType.MOBILE) @ApiOperation(value = "更换手机号", tags = {"小程序-用户管理-更换手机号"}) @PostMapping(value = "/user/updatePhone") public AjaxResult<String> updatePhone(@Validated @RequestBody UpdatePhoneDTO dto) { @@ -1034,7 +1035,9 @@ appUserService.updateById(appUser1); return AjaxResult.success(); } - + + + @Log(title = "【我的】注销接口", businessType = BusinessType.DELETE,operatorType = OperatorType.MOBILE) @ApiOperation(value = "注销接口", tags = {"小程序-用户管理-注销账号"}) @DeleteMapping("/logoff") public AjaxResult<?> logoff(HttpServletRequest request) { @@ -1110,7 +1113,8 @@ return R.ok(appUserService.list(Wrappers.lambdaQuery(TAppUser.class) .eq(TAppUser::getPhone,phone))); } - + + @Log(title = "【我的】签到", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) @ApiOperation(value = "签到", tags = {"小程序-个人中心-签到"}) @GetMapping(value = "/user/sign") public R sign() { @@ -1176,7 +1180,6 @@ } - //已签到日期 @ApiOperation(value = "本月已签到日期", tags = {"小程序-个人中心-签到"}) @GetMapping(value = "/user/has/sign") public R<List<TAppUserSign>> hasSign() { @@ -1196,11 +1199,9 @@ return R.ok(signRecords); } - - - - //已连续签到多少天 - + + + @ApiOperation(value = "本月已连续签到天数", tags = {"小程序-个人中心-签到"}) @GetMapping(value = "/user/continue/sign") public R continueSign() { @@ -1229,7 +1230,9 @@ appUserService.updateById(byId); return R.ok(); } - + + + @Log(title = "【我的】添加编辑车辆", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) @ApiOperation(value = "添加编辑车辆", tags = {"小程序-个人中心-车辆"}) @PostMapping(value = "/user/car/addOrUpdate") public R carAdd(@RequestBody TAppUserCar appUserCar) { @@ -1312,6 +1315,8 @@ return R.ok(); } + + @Log(title = "【我的】添加编辑车辆", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) @ApiOperation(value = "添加编辑车辆", tags = {"小程序-个人中心-车辆"}) @GetMapping(value = "/user/car/delete") public R carDelete(String id) { @@ -1323,6 +1328,8 @@ boolean b = appUserCarService.removeById(id); return R.ok(); } + + @ApiOperation(value = "车辆详情", tags = {"小程序-个人中心-车辆"}) @GetMapping(value = "/user/car/detail") public R<TAppUserCar> carDetail(String id) { @@ -1333,7 +1340,7 @@ } return R.ok(byId); } - + @ApiOperation(value = "获取车辆品牌", tags = {"小程序-个人中心-车辆"}) @GetMapping(value = "/user/car/getBrands") public R getBrands(String name) throws Exception { @@ -1354,7 +1361,8 @@ return R.ok(data); } - + + @ApiOperation(value = "根据品牌获取车系", tags = {"小程序-个人中心-车辆"}) @GetMapping(value = "/user/car/getModel") public R getModel(String id) throws Exception { @@ -1373,6 +1381,8 @@ } return R.ok(backList); } + + @ApiOperation(value = "根据车系获取车型", tags = {"小程序-个人中心-车辆"}) @GetMapping(value = "/user/car/getSeries") public R getSeries(String id) throws Exception { @@ -1390,7 +1400,8 @@ return R.ok(data); } - + + @ApiOperation(value = "根据车型获取详情", tags = {"小程序-个人中心-车辆"}) @GetMapping(value = "/user/car/getDetail") public R getDetail(String id) throws Exception { @@ -1403,6 +1414,7 @@ + @Log(title = "【我的】修改个人信息", businessType = BusinessType.UPDATE,operatorType = OperatorType.MOBILE) @PostMapping(value = "/user/editAppUserInfo") @ApiOperation(value = "修改个人信息", tags = {"小程序-个人中心"}) public AjaxResult editAppUserInfo(@RequestBody TAppUser appUser){ @@ -1439,6 +1451,9 @@ String result3 = HttpUtils.post(MsgConstants.SEND_URL, reqStr3); System.err.println(result3); } + + + @Log(title = "【我的】退出登录", businessType = BusinessType.STOP,operatorType = OperatorType.MOBILE) @PostMapping(value = "/user/logOut") @ApiOperation(value = "退出登录", tags = {"小程序-个人中心"}) public AjaxResult logOut(){ diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserVipDetailController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserVipDetailController.java index 40b7d6e..091a515 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserVipDetailController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserVipDetailController.java @@ -9,6 +9,9 @@ import com.ruoyi.account.service.TAppUserVipDetailService; import com.ruoyi.account.util.VipInfoDto; import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.other.api.domain.TCoupon; import com.ruoyi.other.api.dto.VipCouponDto; @@ -50,7 +53,7 @@ return R.ok(one); } - + @GetMapping("/getVipUseDetail") @ApiOperation(value = "生效会员列表", tags = {"小程序-个人中心"}) public R<List<TAppUserVipDetail>> getVipUseDetail(){ diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TInvoiceInformationController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TInvoiceInformationController.java index b5cfe15..9519658 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TInvoiceInformationController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TInvoiceInformationController.java @@ -6,6 +6,9 @@ import com.ruoyi.account.api.vo.InvoiceInformationVo; import com.ruoyi.account.service.TInvoiceInformationService; import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.common.security.service.TokenService; import io.swagger.annotations.ApiOperation; import org.springframework.beans.BeanUtils; @@ -53,6 +56,7 @@ + @Log(title = "【我的】添加开票抬头数据", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) @ResponseBody @PostMapping(value = "/addInvoiceInformation") @ApiOperation(value = "添加开票抬头数据", tags = {"小程序-充电发票"}) diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java index f06476c..4b52944 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java @@ -31,6 +31,7 @@ import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.common.security.annotation.Logical; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.common.security.service.TokenService; @@ -455,7 +456,6 @@ int isLogin = StringUtils.isEmpty(SecurityUtils.getToken(request)) ? 0 : 1; return AjaxResult.success(siteService.pageList(query,isLogin)); } - @ApiOperation(value = "获取站点列表", tags = {"小程序-站点管理-地图导航站点"}) @@ -464,6 +464,8 @@ int isLogin = StringUtils.isEmpty(SecurityUtils.getToken(request)) ? 0 : 1; return AjaxResult.success(siteService.getMapSiteList(query,isLogin)); } + + @ApiOperation(value = "获取站点详细信息", tags = {"小程序-站点管理-站点详情"}) @PostMapping("/getDetailById") public AjaxResult<SiteDetailVO> getDetailById(@Validated @RequestBody SiteDetailQuery query){ @@ -484,7 +486,8 @@ } return AjaxResult.success(siteDetailVO); } - + + @ApiOperation(value = "获取站点下充电桩及充电枪列表", tags = {"小程序-站点管理-站点详情"}) @GetMapping("/getChargingGunList") public AjaxResult<List<TChargingPileVO>> getChargingGunList(@RequestParam(value = "siteId")@ApiParam(value = "站点id", required = true)Integer siteId, @@ -498,6 +501,7 @@ return AjaxResult.success(chargingGunService.getChargingGunCount(siteId)); } + @ApiOperation(value = "获取站点下充电枪数量统计", tags = {"小程序-站点管理-站点详情"}) @GetMapping("/getChargingGunCount1") public AjaxResult<Map<String,ChargingGunCountVO>> getChargingGunCount1(@RequestParam(value = "siteId")@ApiParam(value = "站点id", required = true)Integer siteId){ diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyDetailController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyDetailController.java index cb640f7..c58af1d 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyDetailController.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyDetailController.java @@ -12,6 +12,9 @@ import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.DateUtils; import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.log.enums.OperatorType; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java index 4ac3c29..24e454b 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java @@ -9,10 +9,7 @@ import com.ruoyi.chargingPile.api.model.TChargingGun; import com.ruoyi.chargingPile.api.model.TChargingPile; import com.ruoyi.chargingPile.api.query.TChargingGunQuery; -import com.ruoyi.chargingPile.api.vo.GetChargingGunByCode; -import com.ruoyi.chargingPile.api.vo.GunStatusStatisticsVO; -import com.ruoyi.chargingPile.api.vo.SiteNameVO; -import com.ruoyi.chargingPile.api.vo.TChargingGunVO; +import com.ruoyi.chargingPile.api.vo.*; import com.ruoyi.chargingPile.config.FileUploadConfig; import com.ruoyi.chargingPile.service.ISiteService; import com.ruoyi.chargingPile.service.TChargingGunService; @@ -42,6 +39,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; /** * <p> @@ -348,5 +346,54 @@ TChargingGun chargingGun = chargingGunService.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getDelFlag, 0).eq(TChargingGun::getFullNumber, fullNumber)); return R.ok(chargingGun); } + + + + + + /** + * 根据枪唯一码查询信息 + * @return + */ + @ApiOperation(tags = {"大屏-对外开放区车位使用情况"},value = "对外开放区车位使用情况") + @GetMapping("/getLargeScreenGun") + public R<LargeScreenGunVo> getLargeScreenGun(){ + LargeScreenGunVo largeScreenGunVo = new LargeScreenGunVo(); + List<TChargingGun> tChargingGuns = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getDelFlag, 0).in(TChargingGun::getSiteId,25,26).in(TChargingGun::getChargeMode, 1,2,4)); + if(tChargingGuns.isEmpty()){ + return R.ok(largeScreenGunVo); + } + List<TChargingGun> supperFast = tChargingGuns.stream().filter(e -> e.getChargeMode() == 1).collect(Collectors.toList()); + largeScreenGunVo.setSuperFast(supperFast.size()); + int supperFastSize = supperFast.stream().filter(e -> e.getStatus() != 2).collect(Collectors.toList()).size(); + largeScreenGunVo.setUseSuperFast(supperFastSize); + List<TChargingGun> fast = tChargingGuns.stream().filter(e -> e.getChargeMode() == 2).collect(Collectors.toList()); + largeScreenGunVo.setFast(fast.size()); + int fastSize = fast.stream().filter(e -> e.getStatus() != 2).collect(Collectors.toList()).size(); + largeScreenGunVo.setUseFast(fastSize); + List<TChargingGun> v2g = tChargingGuns.stream().filter(e -> e.getChargeMode() == 4).collect(Collectors.toList()); + largeScreenGunVo.setV2g(v2g.size()); + int v2gSize = v2g.stream().filter(e -> e.getStatus() != 2).collect(Collectors.toList()).size(); + largeScreenGunVo.setUseV2g(v2gSize); + + return R.ok(largeScreenGunVo); + } + + + + + + + /** + * 大屏 根据站点ids和充电模式集合查询充电枪集合 没有过滤del_flag + */ + @GetMapping("/getGunIdsBySiteIdsAndChargeModels") + public R<List<Integer>> getGunIdsBySiteIdsAndChargeModels(@RequestParam("siteIds") List<Integer> siteIds ,@RequestParam("chargeModels") List<Integer> chargeModels){ + List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>() + .select(TChargingGun::getId).in(TChargingGun::getSiteId, siteIds) + .in(TChargingGun::getChargeMode, chargeModels)); + return R.ok(list.stream().map(TChargingGun::getId).collect(Collectors.toList())); + } + } 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 bdf4a07..52fb479 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 @@ -39,6 +39,7 @@ import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -66,9 +67,9 @@ private final TChargingPileService chargingPileService; private final TChargingGunService chargingGunService; - + @Resource - private RedisService redisService; + private RedisTemplate redisTemplate; @Resource private TFaultMessageService faultMessageService; @@ -246,16 +247,14 @@ String gun_code = vo.getGun_code(); //0:正常,1:故障,2=插枪 Integer status = vo.getStatus(); - Map<String, Object> charging_pile_online = redisService.getCacheMap("charging_gun_online"); - Long time = (Long) charging_pile_online.get(pile_code + gun_code); + Long time = (Long) redisTemplate.opsForHash().get("charging_gun_online", (pile_code + gun_code)); //小于1分钟才处理数据,防止频繁查询数据 if(null != time && (System.currentTimeMillis() - time) < 60000){ return; } TChargingGun tChargingGun = chargingGunService.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getFullNumber, (pile_code + gun_code)).eq(TChargingGun::getDelFlag, 0)); if(null != tChargingGun){ - charging_pile_online.put(tChargingGun.getFullNumber(), System.currentTimeMillis()); - redisService.setCacheMap("charging_gun_online", charging_pile_online); + redisTemplate.opsForHash().put("charging_gun_online", tChargingGun.getFullNumber(), System.currentTimeMillis()); TChargingPile chargingPile = chargingPileService.getById(tChargingGun.getChargingPileId()); //枪处于离线或者故障,返回状态为正常,则修改其状态 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 ac9279c..0d43f0f 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 @@ -42,6 +42,7 @@ import com.ruoyi.system.api.feignClient.SysUserClient; import com.ruoyi.system.api.feignClient.SysUserRoleClient; import com.ruoyi.system.api.model.SysUserRoleVo; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -104,7 +105,7 @@ private IotInterfaceClient iotInterfaceClient; @Resource - private RedisService redisService; + private RedisTemplate redisTemplate; @Resource private TFaultMessageService faultMessageService; @@ -701,14 +702,9 @@ */ @Override public void updateStatus() { - Map<String, Object> charging_gun_online = redisService.getCacheMap("charging_gun_online"); - Set<String> keySet = charging_gun_online.keySet(); - List<TChargingGun> list = new ArrayList<>(); - if(keySet.size() > 0){ - list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getDelFlag, 0).in(TChargingGun::getFullNumber, keySet)); - } + List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getDelFlag, 0)); for (TChargingGun chargingGun : list) { - Long time = (Long) charging_gun_online.get(chargingGun.getFullNumber()); + Long time = (Long) redisTemplate.opsForHash().get("charging_gun_online", chargingGun.getFullNumber()); //判断设备是否真的离线3分钟(2分钟+代码中的60秒间隔处理存储) if(null != time && System.currentTimeMillis() - time > 180000){ TChargingGun chargingGun1 = new TChargingGun(); diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java index e45fa9b..14214bf 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java @@ -4,7 +4,9 @@ import com.alibaba.fastjson.JSONObject; import com.ruoyi.chargingPile.api.dto.CheckChargingStrategyDTO; import com.ruoyi.chargingPile.api.feignClient.AccountingStrategyDetailClient; +import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; +import com.ruoyi.chargingPile.api.vo.UpdateChargingPileStatusVo; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.integration.api.model.*; @@ -21,6 +23,7 @@ import org.apache.rocketmq.client.producer.SendResult; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -30,6 +33,7 @@ import java.io.IOException; import java.math.BigDecimal; import java.util.*; +import java.util.concurrent.TimeUnit; /** * iotda消息监听 @@ -47,6 +51,12 @@ private IotMessageProduce iotMessageProduce; @Resource private AccountingStrategyDetailClient accountingStrategyDetailClient; + + @Resource + private RedisTemplate redisTemplate; + + @Resource + private ChargingPileClient chargingPileClient; @@ -99,7 +109,10 @@ break; case SendTagConstant.PING: PingMessage pingMessage = JSON.parseObject(content.toJSONString(),PingMessage.class); - sendResult = enhanceProduce.pingMessage(pingMessage); + //存储缓存中,5分钟有效 + redisTemplate.opsForValue().set("ping:" + pingMessage.getCharging_pile_code() + pingMessage.getCharging_gun_code(), pingMessage, 5, TimeUnit.MINUTES); + sendResult = null; +// sendResult = enhanceProduce.pingMessage(pingMessage); // chargingMessage.setPingMessage(pingMessage); // chargingMessageUtil.handleMessage(chargingMessage); // 响应硬件 @@ -108,6 +121,22 @@ pong.setCharging_gun_code(pingMessage.getCharging_gun_code()); pong.setCharging_gun_status(0); iotMessageProduce.sendMessage(pong.getCharging_pile_code(), ServiceIdMenu.PONG.getKey(), messageUtil.pong(pong)); + + UpdateChargingPileStatusVo vo1 = new UpdateChargingPileStatusVo(); + vo1.setGun_code(pingMessage.getCharging_gun_code()); + vo1.setPile_code(pingMessage.getCharging_pile_code()); + vo1.setStatus(pingMessage.getCharging_gun_status()); + chargingPileClient.updateChargingPileStatus(vo1); + // 监管平台推送充电设备状态 + String gunCode = pingMessage.getCharging_pile_code() + pingMessage.getCharging_gun_code(); + ChargingMessage chargingMessage1 = new ChargingMessage(); + chargingMessage1.setServiceId(SendTagConstant.GUN_STATUS); + GunStatusMessage gunStatusMessage = new GunStatusMessage(); + gunStatusMessage.setFullNumber(gunCode); + chargingMessage1.setGunStatusMessage(gunStatusMessage); + sendResult = enhanceProduce.gunStatusMessage(chargingMessage1); + + // sendResult = enhanceProduce.chargingMessage(chargingMessage); break; case SendTagConstant.END_CHARGE: diff --git a/ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/controller/LargeScreenController.java b/ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/controller/LargeScreenController.java new file mode 100644 index 0000000..2d7fb02 --- /dev/null +++ b/ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/controller/LargeScreenController.java @@ -0,0 +1,67 @@ +package com.ruoyi.jianguan.controller; + +import cn.hutool.core.date.DateUtil; +import com.ruoyi.chargingPile.api.vo.LargeScreenGunVo; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; +import com.ruoyi.jianguan.mongodb.service.UploadRealTimeMonitoringDataService; +import com.ruoyi.jianguan.vo.LargeChargingPowerVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.SneakyThrows; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +@Api(tags = "大屏") +@RestController +@RequestMapping("/large-screen") +public class LargeScreenController { + + private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + private final UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService; + + public LargeScreenController(UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService) { + this.uploadRealTimeMonitoringDataService = uploadRealTimeMonitoringDataService; + } + + + @SneakyThrows + @ApiOperation(tags = {"大屏-停车场充电功率曲线图"},value = "停车场充电功率曲线图") + @GetMapping("/getChargingPower") + public R<List<LargeChargingPowerVo>> getChargingPower(){ + String sevenDayAgo = LocalDate.now().minusDays(7) + " 00:00:00"; + String oneDayAgo = LocalDate.now().minusDays(1) + " 23:59:59"; + Date oneDayAgoTime = format.parse(oneDayAgo); + Date sevenDayAgoTime = format.parse(sevenDayAgo); + ArrayList<LargeChargingPowerVo> largeChargingPowerVos = new ArrayList<>(); + List<UploadRealTimeMonitoringData> rangeTimeData = uploadRealTimeMonitoringDataService.getRangeTimeData(oneDayAgoTime, sevenDayAgoTime); + for (int count = 7; count > 0; count--) { + LargeChargingPowerVo largeChargingPowerVo = new LargeChargingPowerVo(); + String time = LocalDate.now().minusDays(count).toString(); + List<UploadRealTimeMonitoringData> list = rangeTimeData.stream().filter(e -> e.getCreateTime().contains(time)).collect(Collectors.toList()); + if(!list.isEmpty()){ + BigDecimal powerAverage = list.stream().map(UploadRealTimeMonitoringData::getPower).reduce(BigDecimal.ZERO, BigDecimal::add).divide(BigDecimal.valueOf(list.size()), 0, RoundingMode.HALF_UP); + largeChargingPowerVo.setPower(powerAverage); + } + largeChargingPowerVo.setTime(time); + largeChargingPowerVos.add(largeChargingPowerVo); + } + + return R.ok(largeChargingPowerVos); + } + + + +} diff --git a/ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/vo/LargeChargingPowerVo.java b/ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/vo/LargeChargingPowerVo.java new file mode 100644 index 0000000..db1a794 --- /dev/null +++ b/ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/vo/LargeChargingPowerVo.java @@ -0,0 +1,17 @@ +package com.ruoyi.jianguan.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +@ApiModel("大屏 停车场充电功率曲线Vo") +public class LargeChargingPowerVo { + @ApiModelProperty("时间") + private String time; + + @ApiModelProperty("平均功率") + private BigDecimal power=BigDecimal.ONE; +} 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 f50bbf3..6db46cb 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 @@ -26,6 +26,7 @@ import com.ruoyi.order.api.vo.TOrderInvoiceVO; import com.ruoyi.order.export.*; import com.ruoyi.order.service.*; +import com.ruoyi.order.vo.StatisticsOfBatteryVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.poi.ss.usermodel.Workbook; diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/FinancialSettlementController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/FinancialSettlementController.java index 2c9e8c9..d6caee3 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/FinancialSettlementController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/FinancialSettlementController.java @@ -3,14 +3,11 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.entity.ExportParams; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.account.api.feignClient.AppUserCarClient; import com.ruoyi.account.api.feignClient.AppUserClient; import com.ruoyi.account.api.model.TAppUser; import com.ruoyi.account.api.model.TAppUserCar; import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; -import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; -import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; import com.ruoyi.chargingPile.api.feignClient.SiteClient; import com.ruoyi.chargingPile.api.model.Partner; import com.ruoyi.chargingPile.api.model.Site; @@ -20,37 +17,27 @@ import com.ruoyi.common.core.utils.WebUtils; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.page.PageInfo; -import com.ruoyi.common.log.annotation.Log; -import com.ruoyi.common.log.enums.BusinessType; -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.integration.api.feignClient.UploadRealTimeMonitoringDataClient; -import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; import com.ruoyi.order.api.dto.SettlementConfirmAdd; import com.ruoyi.order.api.model.*; import com.ruoyi.order.api.query.SettlementListQuery; -import com.ruoyi.order.api.query.TOrderInvoiceQuery; import com.ruoyi.order.api.vo.ChargingOrderListVO; -import com.ruoyi.order.api.vo.SettlementTotalVO; -import com.ruoyi.order.api.vo.TOrderInvoiceVO; -import com.ruoyi.order.export.OrderInvoiceExport; -import com.ruoyi.order.export.TChargingOrderExport; -import com.ruoyi.order.vo.ChargingOrderListInfoVO; import com.ruoyi.order.api.vo.ChargingOrderTimeVO; -import com.ruoyi.order.service.*; +import com.ruoyi.order.api.vo.SettlementTotalVO; +import com.ruoyi.order.export.TChargingOrderExport; +import com.ruoyi.order.service.AccountingStrategyOrderService; +import com.ruoyi.order.service.TChargingOrderAccountingStrategyService; +import com.ruoyi.order.service.TChargingOrderService; +import com.ruoyi.order.service.TSettlementConfirmService; +import com.ruoyi.order.vo.ChargingOrderListInfoVO; import com.ruoyi.other.api.domain.TVip; import com.ruoyi.other.api.feignClient.VipClient; -import com.ruoyi.payment.api.feignClient.AliPaymentClient; -import com.ruoyi.payment.api.feignClient.WxPaymentClient; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.apache.poi.ss.usermodel.Workbook; -import org.omg.CORBA.PRIVATE_MEMBER; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -60,12 +47,10 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.net.URLEncoder; -import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoUnit; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; 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 764dd6d..90f2041 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 @@ -1,5 +1,6 @@ package com.ruoyi.order.controller; import com.alibaba.fastjson2.JSON; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import java.math.BigDecimal; @@ -24,6 +25,9 @@ import com.ruoyi.common.core.dto.ChargingPercentProvinceDto; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.web.domain.BasePojo; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.common.redis.service.RedisService; import com.ruoyi.common.security.annotation.Logical; import com.ruoyi.common.security.annotation.RequiresPermissions; @@ -55,6 +59,7 @@ import com.ruoyi.order.service.*; import com.ruoyi.order.util.PreviousSixMonths; import com.ruoyi.order.vo.EndOfChargePageInfo; +import com.ruoyi.order.vo.StatisticsOfBatteryVO; import com.ruoyi.order.vo.WatchChargingOrderVo; import com.ruoyi.other.api.feignClient.RoleSiteClient; import com.ruoyi.other.api.feignClient.UserSiteClient; @@ -638,10 +643,11 @@ chargingOrderInfoVO.setList(list); return AjaxResult.success(chargingOrderInfoVO); } - + + @Log(title = "【扫一扫】添加评价", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) @ResponseBody @PostMapping(value = "/addEvaluate") @ApiOperation(value = "添加评价", tags = {"小程序-扫一扫"}) @@ -794,7 +800,7 @@ } - + @Log(title = "【扫一扫】支付充电充值费用", businessType = BusinessType.UPDATE,operatorType = OperatorType.MOBILE) @ResponseBody @PostMapping(value = "/paymentChargingOrder") @ApiOperation(value = "支付充电充值费用", tags = {"小程序-扫一扫"}) @@ -888,8 +894,7 @@ - - + @ResponseBody @GetMapping(value = "/preChargeCheck/{id}") @ApiOperation(value = "获取安全检测数据", tags = {"小程序-扫一扫"}) @@ -903,7 +908,6 @@ } - @ResponseBody @GetMapping(value = "/getChargingDetails/{id}") @ApiOperation(value = "获取充电中页面数据", tags = {"小程序-扫一扫"}) @@ -914,8 +918,8 @@ ChargingDetails chargingDetails = chargingOrderService.getChargingDetails(id); return AjaxResult.success(chargingDetails); } - - + + @Log(title = "【扫一扫】手动停止充电", businessType = BusinessType.STOP,operatorType = OperatorType.MOBILE) @ResponseBody @PutMapping(value = "/stopCharging/{id}") @ApiOperation(value = "手动停止充电", tags = {"小程序-扫一扫"}) @@ -1941,100 +1945,104 @@ @PostMapping(value = "/work/chargeDetail") @ApiOperation(value = "运营情况", tags = {"管理后台-工作台"}) public R workCharge(@RequestBody ChargingDetailQueryDto statisticsQueryDto) { - List<Integer> siteIds = new ArrayList<>(); - if (statisticsQueryDto.getSiteId() == null) { - Long userId = tokenService.getLoginUser().getUserid(); - //获取当前登录的siteIds - List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); - for (GetSiteListDTO datum : data) { - siteIds.add(datum.getId()); - } - } else { - siteIds.add(statisticsQueryDto.getSiteId()); - } - if (statisticsQueryDto.getDayType()==1) { - List<Map<String,Object>> charMap1 = chargingOrderService.getHourType(siteIds,statisticsQueryDto); - List<Map<String, Object>> charMap = new ArrayList<>(); - // 生成从 "00:00" 到 "23:00" 的时间数据 - for (int hour = 0; hour < 24; hour++) { - String time = String.format("%02d:00", hour); - Map<String, Object> mapWithTimeValue = findMapWithTimeValue(charMap1, time); - if (mapWithTimeValue!=null){ - charMap.add(mapWithTimeValue); - }else { - Map<String, Object> timeMap = new HashMap<>(); - timeMap.put("time", time); // 初始化值为 null - timeMap.put("electrovalence", 0); - timeMap.put("orderCount", 0); - timeMap.put("servicecharge", 0); - timeMap.put("electricity", 0); - charMap.add(timeMap); + try { + List<Integer> siteIds = new ArrayList<>(); + if (statisticsQueryDto.getSiteId() == null) { + Long userId = tokenService.getLoginUser().getUserid(); + //获取当前登录的siteIds + List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); + for (GetSiteListDTO datum : data) { + siteIds.add(datum.getId()); } + } else { + siteIds.add(statisticsQueryDto.getSiteId()); } - return R.ok(charMap); - }else if (statisticsQueryDto.getDayType()==2){ - // 假设 chargingOrderService.getDateType() 返回的是按天的数据 - List<Map<String, Object>> charMap1 = chargingOrderService.getDateType(siteIds, statisticsQueryDto); - - // 解析 startTime 和 endTime 为 LocalDate - LocalDate startDate = statisticsQueryDto.getStartTime(); - LocalDate endDate = statisticsQueryDto.getEndTime(); - - List<Map<String, Object>> dateRangeStatistics = new ArrayList<>(); - - // 遍历日期范围 - while (!startDate.isAfter(endDate)) { - String formattedDate = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); - Map<String, Object> dailyStats = findMapWithDateValue(charMap1, formattedDate); - - if (dailyStats != null) { - dateRangeStatistics.add(dailyStats); - } else { - Map<String, Object> dateMap = new HashMap<>(); - dateMap.put("time", formattedDate); - dateMap.put("electrovalence", 0); - dateMap.put("orderCount", 0); - dateMap.put("servicecharge", 0); - dateMap.put("electricity", 0); - dateRangeStatistics.add(dateMap); + if (statisticsQueryDto.getDayType()==1) { + List<Map<String,Object>> charMap1 = chargingOrderService.getHourType(siteIds,statisticsQueryDto); + List<Map<String, Object>> charMap = new ArrayList<>(); + // 生成从 "00:00" 到 "23:00" 的时间数据 + for (int hour = 0; hour < 24; hour++) { + String time = String.format("%02d:00", hour); + Map<String, Object> mapWithTimeValue = findMapWithTimeValue(charMap1, time); + if (mapWithTimeValue!=null){ + charMap.add(mapWithTimeValue); + }else { + Map<String, Object> timeMap = new HashMap<>(); + timeMap.put("time", time); // 初始化值为 null + timeMap.put("electrovalence", 0); + timeMap.put("orderCount", 0); + timeMap.put("servicecharge", 0); + timeMap.put("electricity", 0); + charMap.add(timeMap); + } } - - // 移动到下一天 - startDate = startDate.plusDays(1); - } + return R.ok(charMap); + }else if (statisticsQueryDto.getDayType()==2){ + // 假设 chargingOrderService.getDateType() 返回的是按天的数据 + List<Map<String, Object>> charMap1 = chargingOrderService.getDateType(siteIds, statisticsQueryDto); + + // 解析 startTime 和 endTime 为 LocalDate + LocalDate startDate = statisticsQueryDto.getStartTime(); + LocalDate endDate = statisticsQueryDto.getEndTime(); + + List<Map<String, Object>> dateRangeStatistics = new ArrayList<>(); + + // 遍历日期范围 + while (!startDate.isAfter(endDate)) { + String formattedDate = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); + Map<String, Object> dailyStats = findMapWithDateValue(charMap1, formattedDate); + + if (dailyStats != null) { + dateRangeStatistics.add(dailyStats); + } else { + Map<String, Object> dateMap = new HashMap<>(); + dateMap.put("time", formattedDate); + dateMap.put("electrovalence", 0); + dateMap.put("orderCount", 0); + dateMap.put("servicecharge", 0); + dateMap.put("electricity", 0); + dateRangeStatistics.add(dateMap); + } + + // 移动到下一天 + startDate = startDate.plusDays(1); + } // return dateRangeStatistics; - return R.ok(dateRangeStatistics); - }else if (statisticsQueryDto.getDayType()==3){ - List<Map<String,Object>> charMap1 = chargingOrderService.getMonthType(siteIds,statisticsQueryDto); - // 解析 startTime 和 endTime 为 LocalDate - LocalDate startDate = statisticsQueryDto.getStartTime(); - LocalDate endDate = statisticsQueryDto.getEndTime(); - - List<Map<String, Object>> dateRangeStatistics = new ArrayList<>(); - - // 遍历日期范围 - while (!startDate.isAfter(endDate)) { - String formattedDate = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM")); - Map<String, Object> dailyStats = findMapWithDateValue(charMap1, formattedDate); - - if (dailyStats != null) { - dateRangeStatistics.add(dailyStats); - } else { - Map<String, Object> dateMap = new HashMap<>(); - dateMap.put("time", formattedDate); - dateMap.put("electrovalence", 0); - dateMap.put("orderCount", 0); - dateMap.put("servicecharge", 0); - dateMap.put("electricity", 0); - dateRangeStatistics.add(dateMap); + return R.ok(dateRangeStatistics); + }else if (statisticsQueryDto.getDayType()==3){ + List<Map<String,Object>> charMap1 = chargingOrderService.getMonthType(siteIds,statisticsQueryDto); + // 解析 startTime 和 endTime 为 LocalDate + LocalDate startDate = statisticsQueryDto.getStartTime(); + LocalDate endDate = statisticsQueryDto.getEndTime(); + + List<Map<String, Object>> dateRangeStatistics = new ArrayList<>(); + + // 遍历日期范围 + while (!startDate.isAfter(endDate)) { + String formattedDate = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM")); + Map<String, Object> dailyStats = findMapWithDateValue(charMap1, formattedDate); + + if (dailyStats != null) { + dateRangeStatistics.add(dailyStats); + } else { + Map<String, Object> dateMap = new HashMap<>(); + dateMap.put("time", formattedDate); + dateMap.put("electrovalence", 0); + dateMap.put("orderCount", 0); + dateMap.put("servicecharge", 0); + dateMap.put("electricity", 0); + dateRangeStatistics.add(dateMap); + } + + // 移动到下一天 + startDate = startDate.plusMonths(1); } - - // 移动到下一天 - startDate = startDate.plusMonths(1); + return R.ok(dateRangeStatistics); + } - return R.ok(dateRangeStatistics); - + }catch (Exception e){ + e.printStackTrace(); } return R.ok(); @@ -2343,4 +2351,34 @@ return chargingOrderService.pushOrderInfo(code); } + + /** + * 添加汇总数据(临时) + * @return + */ + @ResponseBody + @GetMapping(value = "/addChargingOrderSummaryData") + public R addChargingOrderSummaryData(){ + return chargingOrderService.addChargingOrderSummaryData(); + } + + /** + * 充电桩数据大屏 新能源汽车电池安全检测次数统计 + */ + @ResponseBody + @GetMapping(value = "/getStatisticsOfBattery") + @ApiOperation(value = "新能源汽车电池安全检测次数统计", tags = {"充电桩数据大屏"}) + public R<StatisticsOfBatteryVO> getStatisticsOfBattery(){ + + return chargingOrderService.getStatisticsOfBattery(); + } + + /** + * 充电桩数据大屏 获取站点集合中总的充电量 + */ + @GetMapping("/getSumDegreeBySiteIds") + public R<BigDecimal> getSumDegreeBySiteIds(@RequestParam("siteIds") List<Integer> SiteIds){ + return R.ok(chargingOrderService.getSumDegreeBySiteIds(SiteIds)); + } + } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java index 354ef74..10b7aab 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java @@ -14,6 +14,9 @@ import com.ruoyi.common.core.dto.ExchangeBackDto; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.page.PageInfo; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.common.security.annotation.Logical; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.common.security.service.TokenService; diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderAppealController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderAppealController.java index ec9cff0..9c30d6d 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderAppealController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderAppealController.java @@ -13,6 +13,9 @@ import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.domain.BasePojo; import com.ruoyi.common.core.web.page.PageInfo; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.common.security.annotation.Logical; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.common.security.service.TokenService; @@ -233,6 +236,7 @@ + @Log(title = "【我的】申诉订单", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) @ResponseBody @PostMapping(value = "/addOrderAppeal") @ApiOperation(value = "申诉订单", tags = {"小程序-充电记录(个人中心)"}) diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderEvaluateController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderEvaluateController.java index 5723d6b..e33f0e5 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderEvaluateController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderEvaluateController.java @@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.page.PageInfo; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.common.security.annotation.Logical; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.common.security.service.TokenService; @@ -51,14 +54,14 @@ - - + @ApiOperation(tags = {"小程序-订单评价"},value = "充电订单评价标签及数量查询") @GetMapping(value = "/getTagCount") public AjaxResult<List<TEvaluationTagVO>> getTagCount(@ApiParam(value = "站点id")Integer siteId) { return AjaxResult.ok(orderEvaluateService.getTagCount(siteId)); } - + + @ApiOperation(tags = {"小程序-订单评价"},value = "充电订单评价分页列表查询") @PostMapping(value = "/pageList") public AjaxResult<PageInfo<TOrderEvaluateVO>> pageList(@RequestBody TOrderEvaluateQuery query) { @@ -121,7 +124,7 @@ return AjaxResult.success(); } - + @ApiOperation(tags = {"小程序-订单评价"},value = "电站详情中评价列表查询") @GetMapping(value = "/getSiteDetailEveList") public AjaxResult<SiteDetailEvaluateVO> getSiteDetailEveList(@RequestParam(value = "siteId")@ApiParam(value = "站点id")Integer siteId) { @@ -131,6 +134,7 @@ + @Log(title = "【我的】添加评价记录", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) @PostMapping(value = "/addOrderEvaluate") @ApiOperation(value = "添加评价记录", tags = {"小程序-充电记录"}) public AjaxResult addOrderEvaluate(@RequestBody OrderEvaluateVo query){ diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java index 2081255..9c4540d 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java @@ -17,6 +17,9 @@ import com.ruoyi.common.core.utils.OrderCodeUtil; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.page.PageInfo; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.common.security.annotation.Logical; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.common.security.service.TokenService; @@ -294,12 +297,16 @@ return AjaxResult.success(); } + + @GetMapping("/getMyShoppingOrderList") @ApiOperation(value = "获取购买订单列表", tags = {"小程序-商城购买订单"}) public AjaxResult<Map<String, Object>> getMyShoppingOrderList(GetMyShoppingOrderList query) { Map<String, Object> list = shoppingOrderService.getMyShoppingOrderList(query); return AjaxResult.success(list); } + + @GetMapping("/getMyShoppingOrderListNum") @ApiOperation(value = "获取购买订单列表数量", tags = {"小程序-商城购买订单"}) @@ -332,7 +339,6 @@ } - @GetMapping("/getMyShoppingOrderInfo1/{id}") @ApiOperation(value = "获取购买订单详情", tags = {"小程序-商城购买订单"}) public AjaxResult<MyShoppingOrderInfo> getMyShoppingOrderInfo1(@PathVariable String id) { @@ -345,7 +351,7 @@ return AjaxResult.success(info); } - + @Log(title = "【我的】确认收货操作", businessType = BusinessType.UPDATE,operatorType = OperatorType.MOBILE) @PutMapping("/confirmReceipt/{id}") @ApiOperation(value = "确认收货操作", tags = {"小程序-商城购买订单"}) public AjaxResult confirmReceipt(@PathVariable String id) { @@ -370,6 +376,7 @@ } + @Log(title = "【我的】取消订单操作", businessType = BusinessType.UPDATE,operatorType = OperatorType.MOBILE) @PutMapping("/cancelOrder/{id}") @ApiOperation(value = "取消订单操作", tags = {"小程序-商城购买订单"}) public AjaxResult cancelOrder(@PathVariable String id) { diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java index 0299e67..f4a307a 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java @@ -11,6 +11,7 @@ import com.ruoyi.order.api.vo.ChargingOrderListVO; import com.ruoyi.order.api.vo.ChargingOrderVO; import com.ruoyi.order.dto.*; +import com.ruoyi.order.vo.OrderCountByDate; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -55,7 +56,7 @@ @Param("pageCurr") Integer pageCurr, @Param("pageSize") Integer pageSize); List<ChargingOrderVO> chargingOrder(@Param("pageInfo") PageInfo<ChargingOrderVO> pageInfo, @Param("req") ChargingOrderQuery dto, @Param("startTime1")String startTime1, @Param("startTime2")String startTime2,@Param("endTime1") String endTime1,@Param("endTime2") String endTime11); - List<ChargingOrderVO> chargingOrderNolimit( @Param("req") ChargingOrderQuery dto, @Param("startTime1")String startTime1, @Param("startTime2")String startTime2,@Param("endTime1") String endTime1,@Param("endTime2") String endTime11); + Map<String, Object> chargingOrderNolimit( @Param("req") ChargingOrderQuery dto, @Param("startTime1")String startTime1, @Param("startTime2")String startTime2,@Param("endTime1") String endTime1,@Param("endTime2") String endTime11); List<PayOrderDto> payOrderQuery(@Param("pageInfo")PageInfo<PayOrderDto> pageInfo,@Param("data") PayOrderQueryDto payOrderQueryDto); @@ -142,4 +143,8 @@ Long countNoTag(); Long countCar(@Param("brands") List<String> brands); + + List<OrderCountByDate> countOrdersByDate(@Param("startTime")LocalDateTime startTime, @Param("endTime")LocalDateTime endTime,@Param("gunIds")List<Integer> gunIds); + + BigDecimal getSumDegreeBySiteIds(@Param("siteIds") List<Integer> siteIds); } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderSummaryDataMapper.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderSummaryDataMapper.java new file mode 100644 index 0000000..13defe6 --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderSummaryDataMapper.java @@ -0,0 +1,11 @@ +package com.ruoyi.order.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.order.api.model.TChargingOrderSummaryData; + +/** + * @author zhibing.pu + * @Date 2025/5/9 11:39 + */ +public interface TChargingOrderSummaryDataMapper extends BaseMapper<TChargingOrderSummaryData> { +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/ITChargingOrderSummaryDataService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/ITChargingOrderSummaryDataService.java new file mode 100644 index 0000000..dae6532 --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/ITChargingOrderSummaryDataService.java @@ -0,0 +1,11 @@ +package com.ruoyi.order.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.order.api.model.TChargingOrderSummaryData; + +/** + * @author zhibing.pu + * @Date 2025/5/9 11:39 + */ +public interface ITChargingOrderSummaryDataService extends IService<TChargingOrderSummaryData> { +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java index a1652ce..771d12c 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java @@ -15,6 +15,7 @@ import com.ruoyi.order.dto.*; import com.ruoyi.order.vo.ChargingOrderListInfoVO; import com.ruoyi.order.vo.EndOfChargePageInfo; +import com.ruoyi.order.vo.StatisticsOfBatteryVO; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; @@ -319,4 +320,14 @@ * @return */ R pushOrderInfo(String code); + + + R addChargingOrderSummaryData(); + + /** + * 大屏-新能源汽车电池安全检测次数统计 + */ + R<StatisticsOfBatteryVO> getStatisticsOfBattery(); + + BigDecimal getSumDegreeBySiteIds(List<Integer> siteIds); } 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 07f670a..4fd1554 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 @@ -17,6 +17,7 @@ import com.ruoyi.common.core.dto.ChargingOrderGroup; import com.ruoyi.common.core.dto.ChargingPercentProvinceDto; import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.web.domain.BasePojo; import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.common.redis.service.RedisService; import com.ruoyi.common.security.service.TokenService; @@ -51,6 +52,8 @@ import com.ruoyi.order.service.TOrderEvaluateService; import com.ruoyi.order.service.*; import com.ruoyi.order.vo.EndOfChargePageInfo; +import com.ruoyi.order.vo.OrderCountByDate; +import com.ruoyi.order.vo.StatisticsOfBatteryVO; import com.ruoyi.other.api.domain.*; import com.ruoyi.order.vo.ChargingOrderListInfoVO; import com.ruoyi.other.api.domain.TVip; @@ -210,6 +213,9 @@ @Resource private TransactionRecordClient transactionRecordClient; + + @Resource + private ITChargingOrderSummaryDataService chargingOrderSummaryDataService; @@ -1399,13 +1405,12 @@ if (siteIds.isEmpty())siteIds.add(-1); dto.setSiteIds(siteIds); List<ChargingOrderVO> list = this.baseMapper.chargingOrder(pageInfo,dto,startTime1,startTime2,endTime1,endTime2); - List<ChargingOrderVO> list1 = this.baseMapper.chargingOrderNolimit(dto,startTime1,startTime2,endTime1,endTime2); BigDecimal total = new BigDecimal("0"); long time = 0L; BigDecimal electronicMoney = new BigDecimal("0"); BigDecimal serviceMoney = new BigDecimal("0"); BigDecimal commissionMoney = new BigDecimal("0"); - BigDecimal refundMoney = new BigDecimal("0"); +// BigDecimal refundMoney = new BigDecimal("0"); BigDecimal paymentMoney = new BigDecimal("0"); List<TChargingOrderAccountingStrategy> list3 = chargingOrderAccountingStrategyService.list(); @@ -1473,50 +1478,54 @@ } } - List<TChargingOrderRefund> chargingOrderRefunds = chargingOrderRefundService.lambdaQuery() - .eq(TChargingOrderRefund::getRefundStatus,2).list(); - -// BigDecimal total = new BigDecimal("0"); -// long time = 0L; -// BigDecimal electronicMoney = new BigDecimal("0"); -// BigDecimal serviceMoney = new BigDecimal("0"); -// BigDecimal refundMoney = new BigDecimal("0"); -// BigDecimal paymentMoney = new BigDecimal("0"); - for (ChargingOrderVO chargingOrderVO : list1) { - if(null == chargingOrderVO.getStatus() || 5 != chargingOrderVO.getStatus()){ - continue; - } - List<TChargingOrderAccountingStrategy> list4 = list3.stream().filter(e -> e.getChargingOrderId().equals(chargingOrderVO.getId())).collect(Collectors.toList()); - BigDecimal electronic_reduce = list4.stream().map(TChargingOrderAccountingStrategy::getPeriodElectricPrice).reduce(BigDecimal.ZERO, BigDecimal::add); - BigDecimal service_reduce = list4.stream().map(TChargingOrderAccountingStrategy::getPeriodServicePrice).reduce(BigDecimal.ZERO, BigDecimal::add); - BigDecimal chargingCapacity = list4.stream().map(TChargingOrderAccountingStrategy::getChargingCapacity).reduce(BigDecimal.ZERO, BigDecimal::add); - electronicMoney = electronicMoney.add(electronic_reduce); - total = total.add(chargingCapacity); - if (!chargingOrderVO.getOrderSource().equals(2)) { - serviceMoney = serviceMoney.add(service_reduce); - paymentMoney = paymentMoney.add(electronic_reduce).add(service_reduce); - }else{ - serviceMoney = serviceMoney.add(service_reduce.multiply(new BigDecimal("0.8"))); - paymentMoney = paymentMoney.add(electronic_reduce).add(service_reduce.multiply(new BigDecimal("0.8"))); - } - if (chargingOrderVO.getStartTime()!=null && chargingOrderVO.getEndTime()!=null){ - LocalDateTime startTime = chargingOrderVO.getStartTime(); - LocalDateTime endTime = chargingOrderVO.getEndTime(); - // 计算时间差 单位秒 - long between = ChronoUnit.SECONDS.between(startTime, endTime); - time+=between; - } - List<TChargingOrderRefund> list2 = chargingOrderRefunds.stream().filter(e -> e.getChargingOrderId() != null && e.getChargingOrderId().equals(chargingOrderVO.getId())) - .collect(Collectors.toList()); - for (TChargingOrderRefund tChargingOrderRefund : list2) { - refundMoney = refundMoney.add(tChargingOrderRefund.getRefundTotalAmount()); - } +// List<TChargingOrderRefund> chargingOrderRefunds = chargingOrderRefundService.lambdaQuery() +// .eq(TChargingOrderRefund::getRefundStatus,2).list(); + + + Map<String, Object> map = this.baseMapper.chargingOrderNolimit(dto,startTime1,startTime2,endTime1,endTime2); +// for (ChargingOrderVO chargingOrderVO : list1) { +// if(null == chargingOrderVO.getStatus() || 5 != chargingOrderVO.getStatus()){ +// continue; +// } +// List<TChargingOrderAccountingStrategy> list4 = list3.stream().filter(e -> e.getChargingOrderId().equals(chargingOrderVO.getId())).collect(Collectors.toList()); +// BigDecimal electronic_reduce = list4.stream().map(TChargingOrderAccountingStrategy::getPeriodElectricPrice).reduce(BigDecimal.ZERO, BigDecimal::add); +// BigDecimal service_reduce = list4.stream().map(TChargingOrderAccountingStrategy::getPeriodServicePrice).reduce(BigDecimal.ZERO, BigDecimal::add); +// BigDecimal chargingCapacity = list4.stream().map(TChargingOrderAccountingStrategy::getChargingCapacity).reduce(BigDecimal.ZERO, BigDecimal::add); +// electronicMoney = electronicMoney.add(electronic_reduce); +// total = total.add(chargingCapacity); +// if (!chargingOrderVO.getOrderSource().equals(2)) { +// serviceMoney = serviceMoney.add(service_reduce); +// paymentMoney = paymentMoney.add(electronic_reduce).add(service_reduce); +// }else{ +// serviceMoney = serviceMoney.add(service_reduce.multiply(new BigDecimal("0.8"))); +// paymentMoney = paymentMoney.add(electronic_reduce).add(service_reduce.multiply(new BigDecimal("0.8"))); +// } +// if (chargingOrderVO.getStartTime()!=null && chargingOrderVO.getEndTime()!=null){ +// LocalDateTime startTime = chargingOrderVO.getStartTime(); +// LocalDateTime endTime = chargingOrderVO.getEndTime(); +// // 计算时间差 单位秒 +// long between = ChronoUnit.SECONDS.between(startTime, endTime); +// time+=between; +// } +//// List<TChargingOrderRefund> list2 = chargingOrderRefunds.stream().filter(e -> e.getChargingOrderId() != null && e.getChargingOrderId().equals(chargingOrderVO.getId())) +//// .collect(Collectors.toList()); +//// for (TChargingOrderRefund tChargingOrderRefund : list2) { +//// refundMoney = refundMoney.add(tChargingOrderRefund.getRefundTotalAmount()); +//// } +// } + if(null != map){ + tCharingOrderVO.setTotal(map.get("total")==null?BigDecimal.ZERO:(BigDecimal) map.get("total")); + tCharingOrderVO.setTime(map.get("time")==null?0L:(Long) map.get("time")); + tCharingOrderVO.setIncome((map.get("paymentMoney")==null?BigDecimal.ZERO:(BigDecimal) map.get("paymentMoney")).setScale(2, BigDecimal.ROUND_HALF_EVEN)); + tCharingOrderVO.setElectronicMoney((map.get("electronicMoney")==null?BigDecimal.ZERO:(BigDecimal) map.get("electronicMoney")).setScale(2, BigDecimal.ROUND_HALF_EVEN)); + tCharingOrderVO.setServiceMoney((map.get("serviceMoney")==null?BigDecimal.ZERO:(BigDecimal) map.get("serviceMoney")).setScale(2, BigDecimal.ROUND_HALF_EVEN)); + }else{ + tCharingOrderVO.setTotal(BigDecimal.ZERO); + tCharingOrderVO.setTime(0L); + tCharingOrderVO.setIncome(BigDecimal.ZERO); + tCharingOrderVO.setElectronicMoney(BigDecimal.ZERO); + tCharingOrderVO.setServiceMoney(BigDecimal.ZERO); } - tCharingOrderVO.setTotal(total); - tCharingOrderVO.setTime(time); - tCharingOrderVO.setIncome(paymentMoney.setScale(2, BigDecimal.ROUND_HALF_EVEN)); - tCharingOrderVO.setElectronicMoney(electronicMoney.setScale(2, BigDecimal.ROUND_HALF_EVEN)); - tCharingOrderVO.setServiceMoney(serviceMoney.setScale(2, BigDecimal.ROUND_HALF_EVEN)); pageInfo.setRecords(list); tCharingOrderVO.setList(pageInfo); return tCharingOrderVO; @@ -2619,6 +2628,36 @@ } } + + //添加汇总统计数据 + List<TChargingOrderAccountingStrategy> list4 = chargingOrderAccountingStrategyService.list(new QueryWrapper<TChargingOrderAccountingStrategy>().eq("charging_order_id", chargingOrder.getId())); + BigDecimal electronic_reduce = list4.stream().map(TChargingOrderAccountingStrategy::getPeriodElectricPrice).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal service_reduce = list4.stream().map(TChargingOrderAccountingStrategy::getPeriodServicePrice).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal chargingCapacity = list4.stream().map(TChargingOrderAccountingStrategy::getChargingCapacity).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal serviceMoney = BigDecimal.ZERO; + BigDecimal paymentMoney = BigDecimal.ZERO; + long time = 0; + if (!chargingOrder.getOrderSource().equals(2)) { + serviceMoney = serviceMoney.add(service_reduce); + paymentMoney = paymentMoney.add(electronic_reduce).add(service_reduce); + }else{ + serviceMoney = serviceMoney.add(service_reduce.multiply(new BigDecimal("0.8"))); + paymentMoney = paymentMoney.add(electronic_reduce).add(service_reduce.multiply(new BigDecimal("0.8"))); + } + if (chargingOrder.getStartTime()!=null && chargingOrder.getEndTime()!=null){ + LocalDateTime startTime = chargingOrder.getStartTime(); + LocalDateTime endTime = chargingOrder.getEndTime(); + // 计算时间差 单位秒 + time = ChronoUnit.SECONDS.between(startTime, endTime); + } + TChargingOrderSummaryData summaryData = new TChargingOrderSummaryData(); + summaryData.setChargingOrderId(chargingOrder.getId()); + summaryData.setChargingCapacity(chargingCapacity); + summaryData.setChargingDuration(time); + summaryData.setIncome(paymentMoney.setScale(2, BigDecimal.ROUND_HALF_EVEN)); + summaryData.setElectricPrice(electronic_reduce.setScale(2, BigDecimal.ROUND_HALF_EVEN)); + summaryData.setServicePrice(serviceMoney.setScale(2, BigDecimal.ROUND_HALF_EVEN)); + chargingOrderSummaryDataService.save(summaryData); return R.ok(); } @@ -3984,4 +4023,110 @@ tcecClient.notificationChargeOrderInfo(chargingOrder.getStartChargeSeq(), chargingOrder.getOperatorId()); return R.ok(); } + + + + + public R addChargingOrderSummaryData(){ + List<TChargingOrderAccountingStrategy> list3 = chargingOrderAccountingStrategyService.list(); + List<TChargingOrder> list1 = this.list(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getDelFlag, 0)); + for (TChargingOrder chargingOrderVO : list1) { + if(null == chargingOrderVO.getStatus() || 5 != chargingOrderVO.getStatus()){ + continue; + } + List<TChargingOrderAccountingStrategy> list4 = list3.stream().filter(e -> e.getChargingOrderId().equals(chargingOrderVO.getId())).collect(Collectors.toList()); + BigDecimal electronic_reduce = list4.stream().map(TChargingOrderAccountingStrategy::getPeriodElectricPrice).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal service_reduce = list4.stream().map(TChargingOrderAccountingStrategy::getPeriodServicePrice).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal chargingCapacity = list4.stream().map(TChargingOrderAccountingStrategy::getChargingCapacity).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal serviceMoney = new BigDecimal("0"); + BigDecimal paymentMoney = new BigDecimal("0"); + if (!chargingOrderVO.getOrderSource().equals(2)) { + serviceMoney = serviceMoney.add(service_reduce); + paymentMoney = paymentMoney.add(electronic_reduce).add(service_reduce); + }else{ + serviceMoney = serviceMoney.add(service_reduce.multiply(new BigDecimal("0.8"))); + paymentMoney = paymentMoney.add(electronic_reduce).add(service_reduce.multiply(new BigDecimal("0.8"))); + } + Long time = 0L; + if (chargingOrderVO.getStartTime()!=null && chargingOrderVO.getEndTime()!=null){ + LocalDateTime startTime = chargingOrderVO.getStartTime(); + LocalDateTime endTime = chargingOrderVO.getEndTime(); + // 计算时间差 单位秒 + long between = ChronoUnit.SECONDS.between(startTime, endTime); + time+=between; + } + + TChargingOrderSummaryData summaryData = new TChargingOrderSummaryData(); + summaryData.setChargingOrderId(chargingOrderVO.getId()); + summaryData.setChargingCapacity(chargingCapacity); + summaryData.setChargingDuration(time); + summaryData.setIncome(paymentMoney.setScale(2, BigDecimal.ROUND_HALF_EVEN)); + summaryData.setElectricPrice(electronic_reduce.setScale(2, BigDecimal.ROUND_HALF_EVEN)); + summaryData.setServicePrice(serviceMoney.setScale(2, BigDecimal.ROUND_HALF_EVEN)); + chargingOrderSummaryDataService.save(summaryData); + } + return R.ok(); + } + + /** + * 大屏-新能源汽车电池安全检测次数统计 + */ + @Override + public R<StatisticsOfBatteryVO> getStatisticsOfBattery() { + StatisticsOfBatteryVO vo = new StatisticsOfBatteryVO(); + //1.计算累计次数 + //查询该俩站点的快充和超充的充电枪id集合 site_id 25 26 charge_model 1 2 + R<List<Integer>> r = chargingGunClient.getGunIdsBySiteIdsAndChargeModels(Arrays.asList(25,26),Arrays.asList(1,2)); + if (r.getCode()!=200){ + return R.ok(vo); + } + List<Integer> gunIds=r.getData(); + //统计 + Long total= 0L; + if(gunIds!=null && !gunIds.isEmpty()) { + total = this.baseMapper.selectCount(new LambdaQueryWrapper<TChargingOrder>() + .eq(TChargingOrder::getDelFlag, 0)//未删除 + .in(TChargingOrder::getStatus, Arrays.asList(3, 5))//充电中、已结束 + .in(TChargingOrder::getChargingGunId, gunIds));//符合条件的充电枪 + } + vo.setTotal(total.intValue()); + //2.折线图 + /* // 计算日期范围:前七天(不含今日)直接查找数据量太大,内存报错 + LocalDate today = LocalDate.now(); + LocalDateTime startDate = today.minusDays(7).atStartOfDay(); + LocalDateTime endDate = today.minusDays(1).atTime(LocalTime.MAX); + // 查询数据库 + List<OrderCountByDate> orderCounts = this.baseMapper.countOrdersByDate(startDate, endDate, gunIds);*/ + // 转换结果 + List<LocalDate> dates = new ArrayList<>(); + List<Integer> counts = new ArrayList<>(); + LocalDate today = LocalDate.now(); + // 直接查找数据量太大,内存报错,分每天查找 + for (int i = 7; i >= 1; i--) {//升序 + LocalDate day = today.minusDays(i); + LocalDateTime startOfDay = day.atStartOfDay(); + LocalDateTime endOfDay = day.atTime(LocalTime.MAX); + //统计 + Long count=0L; + if(gunIds!=null && !gunIds.isEmpty()){ + count = this.baseMapper.selectCount(new LambdaQueryWrapper<TChargingOrder>() + .eq(TChargingOrder::getDelFlag,0)//未删除 + .in(TChargingOrder::getStatus,Arrays.asList(3,5))//充电中、已结束 + .in(TChargingOrder::getChargingGunId,gunIds)//符合条件的充电枪 站点 超充快充 + .between(BasePojo::getCreateTime,startOfDay,endOfDay));//每天 + } + dates.add(day); + counts.add(count.intValue()); + } + vo.setDates(dates); + vo.setCounts(counts); + return R.ok(vo); + } + + @Override + public BigDecimal getSumDegreeBySiteIds(List<Integer> siteIds) { + + return this.baseMapper.getSumDegreeBySiteIds(siteIds); + + } } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderSummaryDataServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderSummaryDataServiceImpl.java new file mode 100644 index 0000000..c4d03f7 --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderSummaryDataServiceImpl.java @@ -0,0 +1,15 @@ +package com.ruoyi.order.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.order.api.model.TChargingOrderSummaryData; +import com.ruoyi.order.mapper.TChargingOrderSummaryDataMapper; +import com.ruoyi.order.service.ITChargingOrderSummaryDataService; +import org.springframework.stereotype.Service; + +/** + * @author zhibing.pu + * @Date 2025/5/9 11:40 + */ +@Service +public class TChargingOrderSummaryDataServiceImpl extends ServiceImpl<TChargingOrderSummaryDataMapper, TChargingOrderSummaryData> implements ITChargingOrderSummaryDataService { +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderCountByDate.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderCountByDate.java new file mode 100644 index 0000000..ac8d817 --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderCountByDate.java @@ -0,0 +1,12 @@ +package com.ruoyi.order.vo; + +import lombok.Data; + +import java.time.LocalDate; + +@Data +public class OrderCountByDate { + + private LocalDate date; + private Long count; +} \ No newline at end of file diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/StatisticsOfBatteryVO.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/StatisticsOfBatteryVO.java new file mode 100644 index 0000000..54f6719 --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/StatisticsOfBatteryVO.java @@ -0,0 +1,19 @@ +package com.ruoyi.order.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +import java.time.LocalDate; +import java.util.Date; +import java.util.List; + +@Data +public class StatisticsOfBatteryVO { + @ApiModelProperty("累计检测") + private Integer total; + @ApiModelProperty("日期") + private List<LocalDate> dates; + @ApiModelProperty("次数") + private List<Integer> counts; +} diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml index d14c23d..1ab40bb 100644 --- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml +++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml @@ -240,68 +240,69 @@ </select> <select id="getRefundList" resultType="com.ruoyi.order.api.model.TChargingOrderRefund"> - - select * from (SELECT re.id, - re.`code`, - re.refund_code, - re.refund_title, - re.refund_reason, - re.refund_amount, - re.refund_total_amount, - re.refund_time, - re.pay_type, - re.pay_amount, - re.refund_remark, - co.recharge_serial_number as serail_number, - co.payment_amount, - co.create_time as pay_time, - co.id as order_id, - co.app_user_id as user_id, - 1 as type + select * from ( + SELECT + re.id, + re.`code`, + re.refund_code, + re.refund_title, + re.refund_reason, + re.refund_amount, + re.refund_total_amount, + re.refund_time, + re.pay_type, + re.pay_amount, + re.refund_remark, + co.recharge_serial_number as serail_number, + co.payment_amount, + co.create_time as pay_time, + co.id as order_id, + co.app_user_id as user_id, + 1 as type FROM t_charging_order_refund re LEFT JOIN t_charging_order co ON re.charging_order_id = co.id UNION ALL - SELECT re.id, - re.`code`, - re.refund_code, - re.refund_title, - re.refund_reason, - re.refund_amount, - re.refund_total_amount, - re.refund_time, - re.pay_type, - re.pay_amount, - re.refund_remark, - so.serial_number, - so.payment_amount, - so.create_time as pay_time, - so.id as order_id, - so.app_user_id as user_id, - 2 as type + SELECT + re.id, + re.`code`, + re.refund_code, + re.refund_title, + re.refund_reason, + re.refund_amount, + re.refund_total_amount, + re.refund_time, + re.pay_type, + re.pay_amount, + re.refund_remark, + so.serial_number, + so.payment_amount, + so.create_time as pay_time, + so.id as order_id, + so.app_user_id as user_id, + 2 as type FROM t_shopping_order_refund re LEFT JOIN t_shopping_order so on re.shopping_order_id = so.id UNION ALL - SELECT vr.id, - vr.`code`, - vr.refund_code, - vr.refund_title, - vr.refund_reason, - vr.refund_amount, - vr.refund_total_amount, - vr.refund_time, - vr.pay_type, - vr.pay_amount, - vr.refund_remark, - vo.serial_number, - vo.payment_amount, - vo.create_time as pay_time, - vo.id as order_id, - vo.app_user_id as user_id, - 3 as type + SELECT + vr.id, + vr.`code`, + vr.refund_code, + vr.refund_title, + vr.refund_reason, + vr.refund_amount, + vr.refund_total_amount, + vr.refund_time, + vr.pay_type, + vr.pay_amount, + vr.refund_remark, + vo.serial_number, + vo.payment_amount, + vo.create_time as pay_time, + vo.id as order_id, + vo.app_user_id as user_id, + 3 as type FROM t_vip_order_refund vr LEFT JOIN t_vip_order vo on vr.vip_order_id = vo.id - - ) o <where> <if test="data.code != null and data.code != ''"> @@ -1446,46 +1447,56 @@ </select> <select id="getHourType" resultType="java.util.Map"> + select + aa.time, + sum(aa.servicecharge) as servicecharge, + sum(aa.electrovalence) as electrovalence, + sum(aa.electricity) as electricity, + count(1) as orderCount + from ( SELECT - DATE_FORMAT( + DATE_FORMAT( <if test="statisticsQueryDto.type == 1"> a.start_time </if> <if test="statisticsQueryDto.type == 2"> a.end_time </if> - , '%H:00' ) as time, - SUM(CASE + , '%H:00') as time, + (CASE WHEN a.order_source = 0 THEN b.period_service_price WHEN a.order_source = 1 THEN b.period_service_price ELSE b.period_service_price * 0.8 END) as servicecharge, - SUM(b.period_electric_price) as electrovalence, - SUM(b.charging_capacity) as electricity, - count(1) as orderCount + (b.period_electric_price) as electrovalence, + (b.charging_capacity) as electricity FROM - t_charging_order a + t_charging_order a left join (select charging_order_id, sum(period_electric_price) as period_electric_price, sum(period_service_price) as period_service_price, sum(charging_capacity) as charging_capacity, sum(period_electric_price + period_service_price) as money from t_charging_order_accounting_strategy group by charging_order_id) b on (a.id = b.charging_order_id) - WHERE a.del_flag = 0 and a.status = 5 and a.recharge_payment_status = 2 and DATE( + WHERE a.del_flag = 0 and a.status = 5 and a.recharge_payment_status = 2 and DATE_FORMAT( <if test="statisticsQueryDto.type == 1"> a.create_time </if> <if test="statisticsQueryDto.type == 2"> a.end_time </if> - ) = #{statisticsQueryDto.hourDate} + , '%Y-%m-%d') = #{statisticsQueryDto.hourDate} <if test="siteIds != null and siteIds.size() > 0"> and a.site_id IN <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> #{siteId} </foreach> </if> - GROUP BY - time - ORDER BY - time + ) as aa GROUP BY aa.time ORDER BY aa.time </select> <select id="getDateType" resultType="java.util.Map"> + select + aa.time, + sum(aa.servicecharge) as servicecharge, + sum(aa.electrovalence) as electrovalence, + sum(aa.electricity) as electricity, + count(1) as orderCount + from ( SELECT DATE_FORMAT( <if test="statisticsQueryDto.type == 1"> @@ -1494,38 +1505,41 @@ <if test="statisticsQueryDto.type == 2"> a.end_time </if> - , '%Y-%m-%d' ) as time, - SUM(CASE + , '%Y-%m-%d') as time, + (CASE WHEN a.order_source = 0 THEN b.period_service_price WHEN a.order_source = 1 THEN b.period_service_price ELSE b.period_service_price * 0.8 END) as servicecharge, - SUM(b.period_electric_price) as electrovalence, - SUM(b.charging_capacity) as electricity, - count(1) as orderCount + (b.period_electric_price) as electrovalence, + (b.charging_capacity) as electricity FROM t_charging_order a left join (select charging_order_id, sum(period_electric_price) as period_electric_price, sum(period_service_price) as period_service_price, sum(charging_capacity) as charging_capacity, sum(period_electric_price + period_service_price) as money from t_charging_order_accounting_strategy group by charging_order_id) b on (a.id = b.charging_order_id) - WHERE a.del_flag = 0 and a.status = 5 and a.recharge_payment_status = 2 and DATE( + WHERE a.del_flag = 0 and a.status = 5 and a.recharge_payment_status = 2 and DATE_FORMAT( <if test="statisticsQueryDto.type == 1"> a.start_time </if> <if test="statisticsQueryDto.type == 2"> a.end_time </if> - ) between #{statisticsQueryDto.startTime} and #{statisticsQueryDto.endTime} + , '%Y-%m-%d') between #{statisticsQueryDto.startTime} and #{statisticsQueryDto.endTime} <if test="siteIds != null and siteIds.size() > 0"> and a.site_id IN <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> #{siteId} </foreach> </if> - GROUP BY - time - ORDER BY - time + ) as aa GROUP BY aa.time ORDER BY aa.time </select> <select id="getMonthType" resultType="java.util.Map"> + select + aa.time, + sum(aa.servicecharge) as servicecharge, + sum(aa.electrovalence) as electrovalence, + sum(aa.electricity) as electricity, + count(1) as orderCount + from ( SELECT DATE_FORMAT( <if test="statisticsQueryDto.type == 1"> @@ -1534,38 +1548,32 @@ <if test="statisticsQueryDto.type == 2"> a.end_time </if> - , '%Y-%m' ) as time, - SUM(CASE + , '%Y-%m') as time, + (CASE WHEN a.order_source = 0 THEN b.period_service_price WHEN a.order_source = 1 THEN b.period_service_price ELSE b.period_service_price * 0.8 END) as servicecharge, - SUM(b.period_electric_price) as electrovalence, - SUM(b.charging_capacity) as electricity, - count(1) as orderCount + (b.period_electric_price) as electrovalence, + (b.charging_capacity) as electricity FROM t_charging_order a left join (select charging_order_id, sum(period_electric_price) as period_electric_price, sum(period_service_price) as period_service_price, sum(charging_capacity) as charging_capacity, sum(period_electric_price + period_service_price) as money from t_charging_order_accounting_strategy group by charging_order_id) b on (a.id = b.charging_order_id) - WHERE a.del_flag = 0 and a.status = 5 and a.recharge_payment_status = 2 and DATE( + WHERE a.del_flag = 0 and a.status = 5 and a.recharge_payment_status = 2 and DATE_FORMAT( <if test="statisticsQueryDto.type == 1"> a.start_time </if> <if test="statisticsQueryDto.type == 2"> a.end_time </if> - ) between #{statisticsQueryDto.startTime} and #{statisticsQueryDto.endTime} + , '%Y-%m-%d') between #{statisticsQueryDto.startTime} and #{statisticsQueryDto.endTime} <if test="siteIds != null and siteIds.size() > 0"> and a.site_id IN <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> #{siteId} </foreach> </if> - GROUP BY - time - ORDER BY - time - - + ) as aa GROUP BY aa.time ORDER BY aa.time </select> <select id="getchargingCapacity" resultType="java.util.Map"> SELECT @@ -1619,7 +1627,7 @@ tc.name as name, cp.name AS siteName FROM - `charging_pile_order`.`t_charging_order` co + (select site_id,create_time,charging_gun_id, charging_pile_id, current, (CASE WHEN need_elec = 0 THEN `current` ELSE need_elec END) as need_elec from `charging_pile_order`.`t_charging_order`) co LEFT JOIN `charging_pile_service`.`t_charging_gun` tc ON co.charging_gun_id = tc.id LEFT JOIN `charging_pile_service`.`t_charging_pile` cp ON tc.charging_pile_id = cp.id <where> @@ -1680,8 +1688,16 @@ </foreach> </if> </select> - <select id="chargingOrderNolimit" resultType="com.ruoyi.order.api.vo.ChargingOrderVO"> - select t1.* + <select id="chargingOrderNolimit" resultType="map"> + select + sum(charging_capacity) as total, + sum(charging_duration) as `time`, + sum(electric_price) as electronicMoney, + sum(income) as paymentMoney, + sum(service_price) as serviceMoney + from t_charging_order_summary_data + where charging_order_id in ( + select t1.id from t_charging_order t1 where 1=1 <if test="null != req.code and req.code!=''"> @@ -1730,6 +1746,31 @@ and (t1.end_time between #{endTime1} and #{endTime2}) </if> and t1.del_flag = 0 - order by t1.create_time desc + ) + </select> + <select id="countOrdersByDate" resultType="com.ruoyi.order.vo.OrderCountByDate"> + SELECT DATE_FORMAT(create_time, '%m/%d') AS `date`, COUNT(*) AS `count` + FROM t_charging_order + WHERE + del_flag = 0 + and + status in (3,5) + + and charging_gun_id in + <foreach item="item" index="index" collection="gunIds" open="(" separator="," close=")"> + #{item} + </foreach> + and create_time BETWEEN #{startTime} AND #{endTime} + GROUP BY DATE(create_time, '%m/%d') + ORDER BY DATE(create_time, '%m/%d') ASC + </select> + + <select id="getSumDegreeBySiteIds" resultType="java.math.BigDecimal"> + select sum(charging_capacity) from t_charging_order where del_flag=0 + and site_id in + <foreach item="item" index="index" collection="siteIds" open="(" separator="," close=")"> + #{item} + </foreach> + </select> </mapper> diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderSummaryDataMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderSummaryDataMapper.xml new file mode 100644 index 0000000..189f0a7 --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderSummaryDataMapper.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.ruoyi.order.mapper.TChargingOrderSummaryDataMapper"> + +</mapper> \ No newline at end of file diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderInvoiceMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderInvoiceMapper.xml index f9050e6..88cea85 100644 --- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderInvoiceMapper.xml +++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderInvoiceMapper.xml @@ -65,7 +65,7 @@ AND toi.create_time BETWEEN #{query.startTime} AND #{query.endTime} </if> <if test="query.userIds != null and query.userIds.size()>0"> - AND toi.billing_user_id IN + AND toi.app_user_id IN <foreach collection="query.userIds" close=")" open="(" item="userId" separator=","> #{userId} </foreach> @@ -102,7 +102,7 @@ AND toi.billing_time BETWEEN #{query.startTime} AND #{query.endTime} </if> <if test="query.userIds != null and query.userIds.size()>0"> - AND toi.billing_user_id IN + AND toi.app_user_id IN <foreach collection="query.userIds" close=")" open="(" item="userId" separator=","> #{userId} </foreach> @@ -138,7 +138,7 @@ AND toi.billing_time BETWEEN #{query.startTime} AND #{query.endTime} </if> <if test="query.userIds != null and query.userIds.size()>0"> - AND toi.billing_user_id IN + AND toi.app_user_id IN <foreach collection="query.userIds" close=")" open="(" item="userId" separator=","> #{userId} </foreach> diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TAdvertisingController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TAdvertisingController.java index 22ecb7f..3a284fa 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TAdvertisingController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TAdvertisingController.java @@ -109,7 +109,8 @@ public AjaxResult<PageInfo<TAdvertising>> pageList(@RequestBody AdvertisingDTO dto) { return AjaxResult.ok(advertisingService.pageList(dto)); } - + + @ApiOperation(tags = {"小程序-广告管理"},value = "广告列表查询") @GetMapping(value = "/list") public AjaxResult<List<TAdvertising>> list(@RequestParam("position") Integer position) { diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java index 4d800c2..7cd9edf 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java @@ -9,6 +9,7 @@ import com.ruoyi.common.core.web.domain.BasePojo; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.common.security.annotation.Logical; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.common.security.service.TokenService; @@ -51,7 +52,7 @@ /** * 添加计费策略管理 */ - @Log(title = "添加集团用户申请", businessType = BusinessType.INSERT) + @Log(title = "【我的】添加集团用户申请", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) @ApiOperation(tags = {"小程序-集团用户"},value = "添加集团用户申请") @PostMapping(value = "/add") public AjaxResult<Boolean> add(@Validated @RequestBody TEnterpriseUserApplication dto) { diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEvaluationTagController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEvaluationTagController.java index dd476f4..f2289c5 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEvaluationTagController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEvaluationTagController.java @@ -8,6 +8,7 @@ import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.common.security.annotation.Logical; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.other.api.domain.TEvaluationTag; @@ -117,7 +118,6 @@ List<TEvaluationTag> tEvaluationTags = evaluationTagService.listByIds(tagIds); return R.ok(tEvaluationTags); } - @ResponseBody diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java index 0ef3d4a..93a1dd2 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java @@ -19,6 +19,7 @@ import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.common.redis.service.RedisService; import com.ruoyi.common.security.annotation.Logical; import com.ruoyi.common.security.annotation.RequiresPermissions; @@ -139,8 +140,9 @@ TGoods byId = goodsService.getById(id); return AjaxResult.ok(byId); } - - + + + @GetMapping("/getInfoByType") @ApiOperation(tags = {"小程序-兑换商城"},value = "商品查看详情") public R getInfoByType(Integer goodType,Integer id,Integer type) { @@ -177,16 +179,15 @@ public AjaxResult<PageInfo<TGoods>> pageList(@RequestBody GoodsDTO dto) { return AjaxResult.ok(goodsService.pageList(dto)); } - - + + @ApiOperation(tags = {"小程序-兑换商城"},value = "商品列表分页查询") @PostMapping(value = "/app/pageList") public AjaxResult<PageInfo<TGoods>> apppageList(@RequestBody AppGoodQuery appGoodQuery) { return AjaxResult.ok(goodsService.pageList1(appGoodQuery)); } - - - + + @ApiOperation(tags = {"小程序-兑换商城"},value = "积分兑换商品检查数量") @PostMapping(value = "/app/shop/check") public R check(@RequestBody ExchangeDto exchangeDto) { @@ -220,7 +221,7 @@ } - + @Log(title = "【我的】积分兑换商品", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) @ApiOperation(tags = {"小程序-兑换商城"},value = "积分兑换商品") @PostMapping(value = "/app/shop") public AjaxResult<PageInfo<TGoods>> shop(@RequestBody ExchangeDto exchangeDto) { @@ -310,7 +311,8 @@ @Resource private AliPaymentClient aliPaymentClient; - + + @Log(title = "【我的】支付商品", businessType = BusinessType.UPDATE,operatorType = OperatorType.MOBILE) @ApiOperation(tags = {"小程序-现金商城"},value = "支付商品") @PostMapping(value = "/app/pay") public Object pay(@RequestBody ExchangeDto exchangeDto) { diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralRuleController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralRuleController.java index a029e65..f9cf3f2 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralRuleController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralRuleController.java @@ -12,6 +12,7 @@ import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.common.security.annotation.Logical; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.common.security.service.TokenService; diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TInvoiceTypeController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TInvoiceTypeController.java index 85af561..1268b60 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TInvoiceTypeController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TInvoiceTypeController.java @@ -7,6 +7,7 @@ import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.common.security.annotation.Logical; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.other.api.domain.TInvoiceType; diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TNoticeController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TNoticeController.java index a88c9a0..9000e6e 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TNoticeController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TNoticeController.java @@ -6,6 +6,7 @@ import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.common.security.annotation.Logical; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.other.api.domain.TNotice; @@ -94,7 +95,8 @@ } - + + @ApiOperation(tags = {"小程序-首页-公告管理"},value = "查询") @GetMapping(value = "/list") public AjaxResult<List<TNotice>> list() { diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TScreenContentController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TScreenContentController.java new file mode 100644 index 0000000..bd3274f --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TScreenContentController.java @@ -0,0 +1,142 @@ +package com.ruoyi.other.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.security.annotation.Logical; +import com.ruoyi.common.security.annotation.RequiresPermissions; +import com.ruoyi.other.api.domain.TNotice; +import com.ruoyi.other.api.domain.TScreenContent; +import com.ruoyi.other.api.dto.NoticeQueryDto; +import com.ruoyi.other.service.TNoticeService; +import com.ruoyi.other.service.TScreenContentService; +import com.ruoyi.other.util.EnergyRefreshService; +import com.ruoyi.other.vo.*; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.BeanUtils; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * <p> + * 前端控制器 + * </p> + * + * @author huliguo + * @since 2025/5/23 + */ +@RestController +@RequestMapping("/t_screen_content") +public class TScreenContentController { + + @Resource + private TScreenContentService screenContentService; + @Resource + private EnergyRefreshService energyRefreshService; + + /** + * 顶部-累计电量 + */ + @ApiOperation(tags = {"顶部-累计电量"},value = "充电桩数据大屏") + @GetMapping(value = "/top") + public AjaxResult<ScreenTopVO> top(@RequestParam("siteIds") List<Integer> siteIds) { + return AjaxResult.success(screenContentService.top(siteIds)); + } + + /** + * 光伏发电和消纳 这里的绿电是调后台大屏内容管理的 + */ + @ApiOperation(tags = {"光伏发电和消纳"},value = "充电桩数据大屏") + @GetMapping(value = "/photovoltaicAndConsumption") + public AjaxResult<PhotovoltaicAndConsumptionVO> photovoltaicAndConsumption() { + //需调用接口 获取光伏发电量 + + return AjaxResult.success(new PhotovoltaicAndConsumptionVO()); + } + + + /** + * 累计减排数据 + */ + @ApiOperation(tags = {"减排数据"},value = "充电桩数据大屏") + @GetMapping(value = "/emissionReduction") + public AjaxResult<EmissionReductionVO> emissionReduction (@RequestParam("siteIds") List<Integer> siteIds) { + return AjaxResult.success( screenContentService.emissionReduction(siteIds)); + } + /** + * 光伏发电实时情况 + */ + @ApiOperation(tags = {"光伏发电实时情况"},value = "充电桩数据大屏") + @GetMapping(value = "/photovoltaicPowerGeneration") + public AjaxResult<PhotovoltaicPowerGenerationVO> photovoltaicPowerGeneration (@RequestParam("siteIds") List<Integer> siteIds) { + return AjaxResult.success( screenContentService.photovoltaicPowerGeneration(siteIds)); + } + + /** + * 储能放电情况 + */ + @ApiOperation(tags = {"储能放电情况"},value = "充电桩数据大屏") + @GetMapping(value = "/energyStorageDischarge") + public AjaxResult<EnergyStorageDischargeVO> energyStorageDischarge() { + //需调用接口 获取光伏发电量 + EnergyStorageDischargeVO vo = new EnergyStorageDischargeVO(); + vo.setTodayDischarge(energyRefreshService.getCurrentValue()); + return AjaxResult.success(vo); + } + + + + /** + * 停车场共享情况及相关数据 + */ + @ApiOperation(tags = {"停车场共享情况及相关数据"},value = "充电桩数据大屏") + @GetMapping(value = "/screen") + public AjaxResult<TScreenContent> screen(@RequestParam("siteIds") List<Integer> siteIds) { + List<TScreenContent> list = screenContentService.list(new LambdaQueryWrapper<TScreenContent>().in(TScreenContent::getSiteId, siteIds)); + TScreenContent tScreenContent = new TScreenContent(); + if(list==null|| list.isEmpty()){ + return AjaxResult.success(tScreenContent); + } + BeanUtils.copyProperties( list.get(0),tScreenContent); + list.remove(0); + list.forEach(x->{ + tScreenContent.setCarDischarge(tScreenContent.getCarDischarge().add(x.getCarDischarge())); + tScreenContent.setGreenElectricity(tScreenContent.getGreenElectricity().add(x.getGreenElectricity())); + tScreenContent.setGreenElectricityToday(tScreenContent.getGreenElectricityToday().add(x.getGreenElectricityToday())); + tScreenContent.setValueOne(tScreenContent.getValueOne().add(x.getValueOne())); + tScreenContent.setValueTwo(tScreenContent.getValueTwo().add(x.getValueTwo())); + tScreenContent.setValueThree(tScreenContent.getValueThree().add(x.getValueThree())); + if(tScreenContent.getStatisticalDeadline().isBefore(x.getStatisticalDeadline())) tScreenContent.setStatisticalDeadline(x.getStatisticalDeadline()); + }); + return AjaxResult.success(tScreenContent); + } + + /** + * 数据回显 站点id + */ + //todo 鉴权 + @RequiresPermissions(value = {"/publicAnnouncementManagement"}, logical = Logical.OR) + @ApiOperation(tags = {"后台-大屏内容设置-基础信息"},value = "查询") + @GetMapping(value = "/{siteId}") + public AjaxResult<TScreenContent> detail(@PathVariable("siteId") Integer siteId) { + TScreenContent one = screenContentService.getOne(new LambdaQueryWrapper<TScreenContent>().eq(TScreenContent::getSiteId, siteId)); + return AjaxResult.success(one); + } + + /** + * 新增修改 + */ + //todo 鉴权 + @RequiresPermissions(value = {"",""}, logical = Logical.OR) + @ApiOperation(tags = {"后台-大屏内容设置-基础信息"},value = "新增修改") + @PostMapping(value = "/saveOrUpdate") + @Log(title = "【大屏管理】新增修改内容", businessType = BusinessType.INSERT) + public AjaxResult saveOrUpdate(@RequestBody TScreenContent screenContent) { + screenContentService.saveOrUpdate(screenContent); + return AjaxResult.success(); + } +} diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TSystemConfigurationController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TSystemConfigurationController.java index 0836321..548092f 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TSystemConfigurationController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TSystemConfigurationController.java @@ -8,6 +8,7 @@ import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.common.security.annotation.Logical; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.other.api.domain.TSystemConfiguration; diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java index bcd53a4..3a319a7 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java @@ -17,6 +17,7 @@ import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.common.security.annotation.Logical; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.common.security.service.TokenService; @@ -184,8 +185,8 @@ .last("LIMIT 1"))); } } - - + + @ApiOperation(value = "会员信息", tags = {"小程序-个人中心"}) @GetMapping("/vipInfo") public R<List<VipInfoDto>> vipInfo() { @@ -254,7 +255,8 @@ @Resource private AppUserVipDetailClient vipDetailClient; - + + @ApiOperation(value = "当前生效会员信息", tags = {"小程序-个人中心"}) @GetMapping("/recent/vipInfo") public R<List<VipInfoDto>> recentVipInfo() { @@ -338,9 +340,10 @@ } return R.ok(); } - - - + + + + @Log(title = "【会员】购买会员", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) @ApiOperation(value = "购买会员", tags = {"小程序-个人中心"}) @GetMapping("/vipInfo/pay") public Object vipInfoPay(@RequestParam("vipId")Integer vipId,@RequestParam("buyType") Integer buyType, diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TScreenContentMapper.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TScreenContentMapper.java new file mode 100644 index 0000000..2f87f68 --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TScreenContentMapper.java @@ -0,0 +1,26 @@ +package com.ruoyi.other.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.other.api.domain.TNotice; +import com.ruoyi.other.api.domain.TScreenContent; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.List; + +/** + * <p> + * 服务实现类 + * </p> + * + * @author huliguo + * @since 2025/5/23 + */ +@Mapper +public interface TScreenContentMapper extends BaseMapper<TScreenContent> { + + BigDecimal getCarDisCharge(@Param("siteIds") List<Integer> siteIds); + + BigDecimal getGreenElectricity(@Param("siteIds") List<Integer> siteIds); +} diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TScreenContentService.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TScreenContentService.java new file mode 100644 index 0000000..c1ce779 --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TScreenContentService.java @@ -0,0 +1,27 @@ +package com.ruoyi.other.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.other.api.domain.TNotice; +import com.ruoyi.other.api.domain.TScreenContent; +import com.ruoyi.other.vo.EmissionReductionVO; +import com.ruoyi.other.vo.PhotovoltaicPowerGenerationVO; +import com.ruoyi.other.vo.ScreenTopVO; + +import java.util.List; + +/** + * <p> + * 服务实现类 + * </p> + * + * @author huliguo + * @since 2025/5/23 + */ +public interface TScreenContentService extends IService<TScreenContent> { + + EmissionReductionVO emissionReduction(List<Integer> siteIds); + + PhotovoltaicPowerGenerationVO photovoltaicPowerGeneration(List<Integer> siteIds); + + ScreenTopVO top(List<Integer> siteIds); +} diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TScreenContentServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TScreenContentServiceImpl.java new file mode 100644 index 0000000..52dc72a --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TScreenContentServiceImpl.java @@ -0,0 +1,166 @@ +package com.ruoyi.other.service.impl; + +import com.alibaba.fastjson2.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.web.domain.BasePojo; +import com.ruoyi.order.api.feignClient.ChargingOrderClient; +import com.ruoyi.order.api.model.TChargingOrder; +import com.ruoyi.other.api.domain.TScreenContent; +import com.ruoyi.other.api.domain.TSystemConfiguration; +import com.ruoyi.other.mapper.TScreenContentMapper; +import com.ruoyi.other.mapper.TSystemConfigurationMapper; +import com.ruoyi.other.service.TScreenContentService; +import com.ruoyi.other.service.TSystemConfigurationService; +import com.ruoyi.other.vo.EmissionReductionVO; +import com.ruoyi.other.vo.PhotovoltaicPowerGenerationVO; +import com.ruoyi.other.vo.ScreenStorageConfigVO; +import com.ruoyi.other.vo.ScreenTopVO; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import javax.json.Json; +import javax.json.JsonObject; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Random; +import java.util.concurrent.ThreadLocalRandom; + +/** + * <p> + * 服务实现类 + * </p> + * + * @author huliguo + * @since 2025/5/23 + */ +@Service +public class TScreenContentServiceImpl extends ServiceImpl<TScreenContentMapper, TScreenContent> implements TScreenContentService { + + @Resource + private ChargingOrderClient chargingOrderClient; + @Resource + private TSystemConfigurationMapper systemConfigurationMapper; + + @Override + public EmissionReductionVO emissionReduction(List<Integer> siteIds) { + //需调用接口 计算光伏减排 + EmissionReductionVO vo = new EmissionReductionVO(); + //获取总电量 计算电量 + BigDecimal charge=new BigDecimal("0.00"); + if (siteIds!=null && !siteIds.isEmpty()){ + R<BigDecimal> r = chargingOrderClient.getSumDegreeBySiteIds(siteIds); + if (r.getCode()==200){ + charge=r.getData(); + } + } + //计算电量占比率 + if (charge.compareTo(BigDecimal.ZERO) != 0) { + // 定义乘数和除数 + BigDecimal multiplier = new BigDecimal("0.1404"); // 0.1404 + BigDecimal divisor = new BigDecimal("1000"); // 1000 + // 计算:charge × 0.1404 ÷ 1000 + charge = charge + .multiply(multiplier) // 乘以 0.1404 + .divide(divisor, 2, RoundingMode.HALF_UP); // 除以 1000,保留6位小数,四舍五入 + } + vo.setCharge(charge); + return vo; + } + + @Override + public PhotovoltaicPowerGenerationVO photovoltaicPowerGeneration(List<Integer> siteIds) { + //需调用接口 + + //假数据 + PhotovoltaicPowerGenerationVO vo = new PhotovoltaicPowerGenerationVO(); + List<LocalDate> dates = new ArrayList<>(); + List<Integer> values = new ArrayList<>(); + LocalDate today = LocalDate.now(); + // 生成每天数据 + for (int i = 7; i >= 1; i--) {//升序 + LocalDate day = today.minusDays(i); + //统计 + dates.add(day); + int value = new Random().nextInt(151) + 100; // 100-250 + values.add(value); + } + vo.setDates(dates); + vo.setValues(values); + return vo; + } + + @Override + public ScreenTopVO top(List<Integer> siteIds) { + ScreenTopVO vo = new ScreenTopVO(); + + BigDecimal charge=new BigDecimal("0.00"); + BigDecimal carCharge=new BigDecimal("0.00"); + BigDecimal greenElectricity=new BigDecimal("0.00"); + if (siteIds!=null && !siteIds.isEmpty()){ + //获取充电量 + R<BigDecimal> r = chargingOrderClient.getSumDegreeBySiteIds(siteIds); + if (r.getCode()==200){ + charge=r.getData(); + } + //汽车放电量 + carCharge = this.baseMapper.getCarDisCharge(siteIds); + + //累计绿电消纳电量 + greenElectricity = this.baseMapper.getGreenElectricity(siteIds); + } + vo.setCarCharge(charge); + vo.setCarDisCharge(carCharge); + vo.setGreenElectricity(greenElectricity); + + //获取系统建设日期和累计储能放电量 + TSystemConfiguration sysConfig = systemConfigurationMapper.selectOne(new LambdaQueryWrapper<TSystemConfiguration>() + .eq(TSystemConfiguration::getType,3)); + //解析 + ScreenStorageConfigVO configVO = JSON.parseObject(sysConfig.getContent(), ScreenStorageConfigVO.class); + //计算储能充电量 + LocalDate systemCreateTime = configVO.getSystemCreateTime(); + LocalDate today = LocalDate.now(); + int days = (int) ChronoUnit.DAYS.between(systemCreateTime, today) +1;//包括今天 + + BigDecimal dailyRate = new BigDecimal("100"); + BigDecimal totalCharge = dailyRate.multiply(BigDecimal.valueOf(days)) + .divide(BigDecimal.valueOf(10000), 2, RoundingMode.HALF_UP); + vo.setStorageCharge(totalCharge); + //获取储能放电量 + + // 判断是否等于今天 + if (configVO.getLastUpdated().equals(today)) { + vo.setStorageDisCharge(configVO.getStorageDisCharge()); + return vo; + } + //判断离今天还有几天 + int count = (int) ChronoUnit.DAYS.between(configVO.getLastUpdated(), today) +1;//包括今天 + BigDecimal storageDisCharge = configVO.getStorageDisCharge(); + // 每天生成一个随机值(不超过100)并累加 + for (int i = 0; i < count; i++) { + int dailyCharge = ThreadLocalRandom.current().nextInt(0, 101); // 0-100的随机数 + storageDisCharge = storageDisCharge.add(new BigDecimal(dailyCharge)); + } + + // 更新回对象 + configVO.setStorageDisCharge(storageDisCharge); + configVO.setLastUpdated(today); + String json = JSON.toJSONString(configVO); + sysConfig.setContent(json); + + systemConfigurationMapper.updateById(sysConfig); + vo.setStorageDisCharge(storageDisCharge); + return vo; + } +} diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/EnergyRefreshService.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/EnergyRefreshService.java new file mode 100644 index 0000000..fa1937a --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/EnergyRefreshService.java @@ -0,0 +1,110 @@ +package com.ruoyi.other.util; + +import com.alibaba.fastjson2.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.other.api.domain.TSystemConfiguration; +import com.ruoyi.other.mapper.TSystemConfigurationMapper; +import com.ruoyi.other.vo.ScreenStorageConfigVO; +import lombok.Getter; +import lombok.Setter; +import lombok.Value; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalTime; +import java.util.Random; + +@Service +public class EnergyRefreshService { + private final Random random = new Random(); + @Resource + private TSystemConfigurationMapper systemConfigurationMapper; + + private final BigDecimal targetLow = new BigDecimal("85"); + + private final BigDecimal targetHigh = new BigDecimal("87"); + + + private final int maxIncrement = 10; + + private boolean isRunning = true; // 控制任务是否继续执行 + + // 定时任务方法 + @Scheduled(cron = "0 */15 * * * ?")//15分钟执行一次 + public synchronized void refreshValue() { + // 检查当前时间是否在允许的时间段内 + LocalTime now = LocalTime.now(); + boolean isInMorning = now.isAfter(LocalTime.of(10, 0)) && now.isBefore(LocalTime.of(12, 0)); + boolean isInAfternoon = now.isAfter(LocalTime.of(15, 0)) && now.isBefore(LocalTime.of(21, 0)); + + if (!isInMorning && !isInAfternoon) { + return; + } + + + //获取当前值 + BigDecimal currentValue = getCurrentValue(); + // 检查是否已停止或达到目标范围 + if (!isRunning || isWithinTargetRange(currentValue)) { + isRunning = false; + return; + } + + + // 生成随机增量并更新值 + int increment = random.nextInt(maxIncrement + 1); + currentValue = currentValue.add(BigDecimal.valueOf(increment)) + .setScale(2, RoundingMode.HALF_UP); + //更新值 + updateCurrentValue(currentValue); + System.out.printf("定时刷新:当前时间 %s,当前值:%.2f%n", now, currentValue); + } + + private boolean isWithinTargetRange(BigDecimal value) { + return value.compareTo(targetLow) >= 0 && value.compareTo(targetHigh) <= 0; + } + + /** + * 获取当前值 + */ + public BigDecimal getCurrentValue() { + //获取系统建设日期和累计储能放电量 + TSystemConfiguration sysConfig = systemConfigurationMapper.selectOne(new LambdaQueryWrapper<TSystemConfiguration>() + .eq(TSystemConfiguration::getType,3)); + //解析 + ScreenStorageConfigVO configVO = JSON.parseObject(sysConfig.getContent(), ScreenStorageConfigVO.class); + return configVO.getCurrentValue(); + } + + /** + * 更新当前值 + */ + private void updateCurrentValue(BigDecimal currentValue) { + //获取系统建设日期和累计储能放电量 + TSystemConfiguration sysConfig = systemConfigurationMapper.selectOne(new LambdaQueryWrapper<TSystemConfiguration>() + .eq(TSystemConfiguration::getType,3)); + //解析 + ScreenStorageConfigVO configVO = JSON.parseObject(sysConfig.getContent(), ScreenStorageConfigVO.class); + //更新 + configVO.setCurrentValue(currentValue); + String json = JSON.toJSONString(configVO); + sysConfig.setContent(json); + systemConfigurationMapper.updateById(sysConfig); + } + + + + // 重置任务 + @Scheduled(cron = "0 0 0 * * ?") // 每天凌晨0点执行 + public void reset() { + BigDecimal currentValue = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP); + updateCurrentValue(currentValue); + //更新 + this.isRunning = true; + } + + +} \ No newline at end of file diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/EmissionReductionVO.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/EmissionReductionVO.java new file mode 100644 index 0000000..adb7c77 --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/EmissionReductionVO.java @@ -0,0 +1,27 @@ +package com.ruoyi.other.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class EmissionReductionVO { + @ApiModelProperty("累计光伏发电二氧化碳减排量(吨)") + private BigDecimal photovoltaic = new BigDecimal("63.00"); + @ApiModelProperty("累计光伏发电二氧化碳减排量(占比率)") + private BigDecimal photovoltaicRate = new BigDecimal("48.8"); + + @ApiModelProperty("累计储能二氧化碳减排量(吨)") + private BigDecimal energyStorage = new BigDecimal("20.00"); + @ApiModelProperty("累计储能二氧化碳减排量(占比率)") + private BigDecimal energyStorageRate = new BigDecimal("48.8"); + + @ApiModelProperty("累计充电二氧化碳减排量(吨)") + private BigDecimal charge; + @ApiModelProperty("累计充电二氧化碳减排量(占比率)") + private BigDecimal chargeRate = new BigDecimal("4.8"); + + @ApiModelProperty("总计二氧化碳减排量(吨)") + private BigDecimal total = new BigDecimal("48000"); +} diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/EnergyStorageDischargeVO.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/EnergyStorageDischargeVO.java new file mode 100644 index 0000000..d8086c5 --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/EnergyStorageDischargeVO.java @@ -0,0 +1,18 @@ +package com.ruoyi.other.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class EnergyStorageDischargeVO { + @ApiModelProperty("储能配置") + private Integer config=100; + @ApiModelProperty("今日储能") + private Integer todayStorage=100; + @ApiModelProperty("今日放能") + private BigDecimal todayDischarge; + + +} diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/PhotovoltaicAndConsumptionVO.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/PhotovoltaicAndConsumptionVO.java new file mode 100644 index 0000000..cb2148a --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/PhotovoltaicAndConsumptionVO.java @@ -0,0 +1,18 @@ +package com.ruoyi.other.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class PhotovoltaicAndConsumptionVO { + @ApiModelProperty("光伏面积") + private Integer area = 3593; + @ApiModelProperty("装机容量") + private BigDecimal capacity = new BigDecimal("759.52"); + @ApiModelProperty("今日已发电") + private BigDecimal todayGenerateElectricity=new BigDecimal("71.29"); + +} diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/PhotovoltaicPowerGenerationVO.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/PhotovoltaicPowerGenerationVO.java new file mode 100644 index 0000000..578eac3 --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/PhotovoltaicPowerGenerationVO.java @@ -0,0 +1,15 @@ +package com.ruoyi.other.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDate; +import java.util.List; + +@Data +public class PhotovoltaicPowerGenerationVO { + @ApiModelProperty("日期") + private List<LocalDate> dates; + @ApiModelProperty("数据") + private List<Integer> values; +} diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ScreenStorageConfigVO.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ScreenStorageConfigVO.java new file mode 100644 index 0000000..5d3c27f --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ScreenStorageConfigVO.java @@ -0,0 +1,33 @@ +package com.ruoyi.other.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +@Data +public class ScreenStorageConfigVO { + /** + * 系统建设日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate systemCreateTime; + + /** + * 储能放电量 随机增长,每日不超过100度 + */ + private BigDecimal storageDisCharge; + + /** + * 最后一次更改时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate lastUpdated; + + /** + * 储能放电情况 今日放能 规定时间内 随机增长 凌晨数值重置 + */ + private BigDecimal currentValue; +} diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ScreenTopVO.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ScreenTopVO.java new file mode 100644 index 0000000..fd9d887 --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ScreenTopVO.java @@ -0,0 +1,24 @@ +package com.ruoyi.other.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class ScreenTopVO { + @ApiModelProperty("汽车充电量") + private BigDecimal carCharge; + @ApiModelProperty("汽车放电量") + private BigDecimal carDisCharge; + @ApiModelProperty("光伏发电量") + private BigDecimal photovoltaic=new BigDecimal("0.00"); + @ApiModelProperty("光伏用电量") + private BigDecimal greenElectricity; + @ApiModelProperty("储能充电量") + private BigDecimal storageCharge; + @ApiModelProperty("储能放电量") + private BigDecimal storageDisCharge; + + +} diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TScreenContentMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TScreenContentMapper.xml new file mode 100644 index 0000000..fed5aea --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TScreenContentMapper.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.ruoyi.other.mapper.TScreenContentMapper"> + + <select id="getCarDisCharge" resultType="java.math.BigDecimal"> + select + sum(car_discharge) + FROM t_screen_content + WHERE + site_id in + <foreach item="item" index="index" collection="siteIds" open="(" separator="," close=")"> + #{item} + </foreach> + </select> + <select id="getGreenElectricity" resultType="java.math.BigDecimal"> + select + sum(green_electricity) + FROM t_screen_content + WHERE + site_id in + <foreach item="item" index="index" collection="siteIds" open="(" separator="," close=")"> + #{item} + </foreach> + </select> +</mapper> -- Gitblit v1.7.1