From 22ec3d921ecf700fed6643e24faef4eb963f5784 Mon Sep 17 00:00:00 2001 From: yuyang Date: Thu, 24 Mar 2022 16:09:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=BA=E6=9E=84=E6=8A=98?= =?UTF-8?q?=E6=89=A3=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=95=B0=E6=8D=AE=E5=A4=A7?= =?UTF-8?q?=E5=B1=8F=E6=9E=AA=E4=BD=BF=E7=94=A8=E7=8E=87=E5=92=8C=E5=B7=A5?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xhpc/common/api/UserTypeService.java | 3 +- .../api/factory/UserTypeFallbackFactory.java | 3 +- .../XhpcDataBigScreenController.java | 38 +++- .../mapper/XhpcChargingStationMapper.java | 11 ++ .../service/XhpcDataBigScreenService.java | 8 + .../impl/XhpcDataBigScreenServiceImpl.java | 174 +++++++++++++++++- .../mapper/XhpcChargingStationMapper.xml | 39 ++++ .../impl/XhpcRealTimeOrderServiceImpl.java | 39 +--- .../user/controller/XhpcCommonController.java | 5 +- .../xhpc/user/mapper/XhpcCommunityMapper.java | 2 +- .../xhpc/user/mapper/XhpcCustomersMapper.java | 2 +- .../xhpc/user/service/IXhpcCommonService.java | 3 +- .../user/service/IXhpcCommunityService.java | 2 +- .../user/service/IXhpcCustomersService.java | 2 +- .../service/impl/XhpcCommonServiceImpl.java | 6 +- .../impl/XhpcCommunityServiceImpl.java | 4 +- .../impl/XhpcCustomersServiceImpl.java | 4 +- .../resources/mapper/XhpcCommunityMapper.xml | 10 +- .../resources/mapper/XhpcCustomersMapper.xml | 10 +- 19 files changed, 288 insertions(+), 77 deletions(-) diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/UserTypeService.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/UserTypeService.java index 18541b7b..774c9895 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/UserTypeService.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/UserTypeService.java @@ -3,6 +3,7 @@ package com.xhpc.common.api; import com.xhpc.common.api.factory.UserTypeFallbackFactory; import com.xhpc.common.core.constant.ServiceNameConstants; import com.xhpc.common.core.domain.R; +import org.apache.ibatis.annotations.Param; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -47,7 +48,7 @@ public interface UserTypeService { * 获取该机构的折扣比例 */ @GetMapping("/common/getMechanismDiscount") - R getMechanismDiscount(@RequestParam(value = "userId")Long userId, @RequestParam(value = "userType")Integer userType, @RequestParam(value = "tenantId")String tenantId); + R getMechanismDiscount(@RequestParam(value = "userId")Long userId, @RequestParam(value = "userType")Integer userType, @RequestParam(value = "tenantId")String tenantId, @Param("chargingStationId")Long chargingStationId); } diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/UserTypeFallbackFactory.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/UserTypeFallbackFactory.java index e97b938c..825c6f98 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/UserTypeFallbackFactory.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/UserTypeFallbackFactory.java @@ -2,6 +2,7 @@ package com.xhpc.common.api.factory; import com.xhpc.common.api.UserTypeService; import com.xhpc.common.core.domain.R; +import org.apache.ibatis.annotations.Param; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.cloud.openfeign.FallbackFactory; @@ -32,7 +33,7 @@ public class UserTypeFallbackFactory implements FallbackFactory } @Override - public R getMechanismDiscount(Long userId, Integer userType, String tenantId) { + public R getMechanismDiscount(Long userId, Integer userType, String tenantId, @Param("chargingStationId")Long chargingStationId) { return R.fail("机构信息获取失败:" + cause.getMessage()); } }; diff --git a/xhpc-modules/xhpc-data-big-screen/src/main/java/com/xhpc/databigscreen/controller/XhpcDataBigScreenController.java b/xhpc-modules/xhpc-data-big-screen/src/main/java/com/xhpc/databigscreen/controller/XhpcDataBigScreenController.java index ac8e1e4e..efca915f 100644 --- a/xhpc-modules/xhpc-data-big-screen/src/main/java/com/xhpc/databigscreen/controller/XhpcDataBigScreenController.java +++ b/xhpc-modules/xhpc-data-big-screen/src/main/java/com/xhpc/databigscreen/controller/XhpcDataBigScreenController.java @@ -29,15 +29,19 @@ public class XhpcDataBigScreenController extends BaseController { @Resource XhpcDataBigScreenService xhpcDataBigScreenService; + /** + * 订单趋势 + * @param coreParam + * @return + */ @GetMapping("/orders-trend") public R queryOrdersTrend(CoreParam coreParam) { - return xhpcDataBigScreenService.queryOrderTrend(coreParam); } /** * query realtime orders by coreParam - * + * 实时订单 * @author WH * @date 2022/3/16 10:56 * @since version-1.0 @@ -50,7 +54,7 @@ public class XhpcDataBigScreenController extends BaseController { /** * Return order ratio - * + * 订单来源比例 * @author WH * @date 2022/3/9 15:49 * @since version-1.0 @@ -61,9 +65,20 @@ public class XhpcDataBigScreenController extends BaseController { return xhpcDataBigScreenService.queryOrderRatio(coreParam); } + /** + * 枪使用率 + */ + @GetMapping("/terminal-gun") + public R queryTerminalGun(CoreParam coreParam) { + + return xhpcDataBigScreenService.queryTerminalGun(coreParam); + } + + + /** * Return total electric quantity - * + * 总电量 * @author WH * @date 2022/3/9 15:49 * @since version-1.0 @@ -76,7 +91,7 @@ public class XhpcDataBigScreenController extends BaseController { /** * Return user activation - * + * 用户活跃度 * @author WH * @date 2022/3/9 13:53 * @since version-1.0 @@ -89,7 +104,7 @@ public class XhpcDataBigScreenController extends BaseController { /** * Return a count of user total - * + * 用户总数 * @author WH * @date 2022/3/9 10:43 * @since version-1.0 @@ -103,7 +118,7 @@ public class XhpcDataBigScreenController extends BaseController { /** * Core interface * Return special info of charging station - * + * 用于地球返回位置信息 电站信息 * @author WH * @date 2022/3/9 10:42 * @since version-1.0 @@ -114,4 +129,13 @@ public class XhpcDataBigScreenController extends BaseController { return xhpcDataBigScreenService.returnCoreLocation(coreParam); } + + /** + * 工单 + */ + @GetMapping("/work-order") + public R queryWorkOrder(CoreParam coreParam) { + + return xhpcDataBigScreenService.queryWorkOrder(coreParam); + } } diff --git a/xhpc-modules/xhpc-data-big-screen/src/main/java/com/xhpc/databigscreen/mapper/XhpcChargingStationMapper.java b/xhpc-modules/xhpc-data-big-screen/src/main/java/com/xhpc/databigscreen/mapper/XhpcChargingStationMapper.java index 50fe740f..1d5c9b00 100644 --- a/xhpc-modules/xhpc-data-big-screen/src/main/java/com/xhpc/databigscreen/mapper/XhpcChargingStationMapper.java +++ b/xhpc-modules/xhpc-data-big-screen/src/main/java/com/xhpc/databigscreen/mapper/XhpcChargingStationMapper.java @@ -43,4 +43,15 @@ public interface XhpcChargingStationMapper { */ List selectChargingStationIds(@Param("tenantIdList") List tenantIdList); + + /** + * 查询枪的使用率 + */ + List getTerminal(@Param("chargingStationIds")List chargingStationIds,@Param("tenantIds")List tenantIds); + + /** + * 查询枪的使用率 + */ + List> getWorkOrderTerminal(@Param("chargingStationIds")List chargingStationIds,@Param("tenantIds")List tenantIds); + } \ No newline at end of file diff --git a/xhpc-modules/xhpc-data-big-screen/src/main/java/com/xhpc/databigscreen/service/XhpcDataBigScreenService.java b/xhpc-modules/xhpc-data-big-screen/src/main/java/com/xhpc/databigscreen/service/XhpcDataBigScreenService.java index 07917ae3..abd0344d 100644 --- a/xhpc-modules/xhpc-data-big-screen/src/main/java/com/xhpc/databigscreen/service/XhpcDataBigScreenService.java +++ b/xhpc-modules/xhpc-data-big-screen/src/main/java/com/xhpc/databigscreen/service/XhpcDataBigScreenService.java @@ -5,6 +5,7 @@ import com.xhpc.databigscreen.domain.CoreParam; import com.xhpc.databigscreen.domain.OrderRatio; import com.xhpc.databigscreen.domain.OrderTrend; import com.xhpc.databigscreen.domain.RealtimeOrders; +import org.graalvm.compiler.hotspot.replacements.ObjectCloneNode; import java.util.List; import java.util.Map; @@ -61,6 +62,12 @@ public interface XhpcDataBigScreenService { */ R queryOrderRatio(CoreParam coreParam); + /** + * 枪使用率 + * @param coreParam + * @return + */ + R queryTerminalGun(CoreParam coreParam); /** * query realtime by coreParam * @@ -71,4 +78,5 @@ public interface XhpcDataBigScreenService { R queryOrderTrend(CoreParam coreParam); + R queryWorkOrder(CoreParam coreParam); } diff --git a/xhpc-modules/xhpc-data-big-screen/src/main/java/com/xhpc/databigscreen/service/impl/XhpcDataBigScreenServiceImpl.java b/xhpc-modules/xhpc-data-big-screen/src/main/java/com/xhpc/databigscreen/service/impl/XhpcDataBigScreenServiceImpl.java index 44cc5a99..cbd12503 100644 --- a/xhpc-modules/xhpc-data-big-screen/src/main/java/com/xhpc/databigscreen/service/impl/XhpcDataBigScreenServiceImpl.java +++ b/xhpc-modules/xhpc-data-big-screen/src/main/java/com/xhpc/databigscreen/service/impl/XhpcDataBigScreenServiceImpl.java @@ -2,6 +2,7 @@ package com.xhpc.databigscreen.service.impl; import com.xhpc.common.constant.ConstantClass; import com.xhpc.common.core.domain.R; +import com.xhpc.common.redis.service.RedisService; import com.xhpc.common.util.MyDateUtil; import com.xhpc.common.util.UserTypeUtil; import com.xhpc.databigscreen.domain.CoreParam; @@ -13,13 +14,11 @@ import com.xhpc.databigscreen.mapper.XhpcChargingStationMapper; import com.xhpc.databigscreen.mapper.XhpcHistoryOrderMapper; import com.xhpc.databigscreen.mapper.XhpcRateTimeMapper; import com.xhpc.databigscreen.service.XhpcDataBigScreenService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -38,6 +37,8 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService { XhpcHistoryOrderMapper xhpcHistoryOrderMapper; @Resource XhpcRateTimeMapper xhpcRateTimeMapper; + @Resource + private RedisService redisService; @Override public R>> returnCoreLocation(CoreParam coreParam) { @@ -402,6 +403,108 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService { return null; } + /** + * 枪使用率 + * + * @param coreParam + * @return + */ + @Override + public R queryTerminalGun(CoreParam coreParam) { + String tenantIdsStr = null; + List> xhpcChargingStationList = null; + List tenantIdList = null; + String[] tenantIdArray = null; + Map map =new HashMap<>(); + ArrayList chargingStationIdList = new ArrayList<>(); + //judge care param function + switch (coreParam.getParamType()) { + case 0://全国 + tenantIdsStr = coreParam.getTenantIds(); + if (!"".equals(tenantIdsStr) && tenantIdsStr != null) { + tenantIdArray = tenantIdsStr.split(","); + tenantIdList = Arrays.stream(tenantIdArray).collect(Collectors.toList()); + } + return getMapR(chargingStationIdList,tenantIdList, map); + //query charging station infos of whole area + case 1://省市区 + Integer areaCode = coreParam.getAreaCode(); + tenantIdsStr = coreParam.getTenantIds(); + + if (!"".equals(tenantIdsStr) && tenantIdsStr != null) { + tenantIdArray = tenantIdsStr.split(","); + tenantIdList = Arrays.stream(tenantIdArray).collect(Collectors.toList()); + xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndAreaCode(tenantIdList, areaCode); + for (Map chargingStation : xhpcChargingStationList) { + chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID)); + } + } else { + xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndAreaCode(tenantIdList, areaCode); + for (Map chargingStation : xhpcChargingStationList) { + chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID)); + } + } + return getMapR(chargingStationIdList,tenantIdList, map); + case 2://场站 + //query location info of special charging station of special tenant + tenantIdsStr = coreParam.getTenantIds(); + if (!"".equals(tenantIdsStr) && tenantIdsStr != null) { + tenantIdArray = tenantIdsStr.split(","); + tenantIdList = Arrays.stream(tenantIdArray).collect(Collectors.toList()); + String chargingStationIdStr = coreParam.getChargingStationIds(); + long chargingStationId = Long.parseLong(chargingStationIdStr); + xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndChargingStationId(tenantIdList, chargingStationId); + for (Map chargingStation : xhpcChargingStationList) { + chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID)); + } + return getMapR(chargingStationIdList,tenantIdList, map); + } else { + return R.fail("传入的参数有误"); + } + default: + R.fail("param type is invalid"); + break; + } + return R.ok(); + } + + private R> getMapR(List chargingStationIdList,List tenantIdList, Map map) { + List terminal = xhpcChargingStationMapper.getTerminal(chargingStationIdList, tenantIdList); + + int offLine =0;//离线 + int fault =0;//故障 + int freeTime =0;//空闲 + int charge =0;//充电 + int unknown =0;//未知 + if(terminal !=null && terminal.size()>0){ + for (String st:terminal) { + Map cacheMap = redisService.getCacheMap("gun:" + st); + if(!cacheMap.isEmpty()){ + if (cacheMap.containsKey("status") && + "离线".equals(cacheMap.get("status").toString())){ + offLine++; + }else if(cacheMap.containsKey("status") && + "故障".equals(cacheMap.get("status").toString())){ + fault++; + }else if(cacheMap.containsKey("status") && + "空闲".equals(cacheMap.get("status").toString())){ + freeTime++; + }else{ + charge++; + } + }else{ + unknown++; + } + } + } + map.put("offLine",offLine); + map.put("fault",fault); + map.put("freeTime",freeTime); + map.put("charge",charge); + map.put("unknown",unknown); + return R.ok(map); + } + @Override public R queryRealtimeOrders(CoreParam coreParam) { @@ -482,11 +585,8 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService { if (!"".equals(tenantIdsStr) && tenantIdsStr != null) { tenantIdArray = tenantIdsStr.split(","); tenantIdList = Arrays.stream(tenantIdArray).collect(Collectors.toList()); - return getOrderTrend(tenantIdList, null); - } else { - return getOrderTrend(tenantIdList, null); } - //query charging station infos of whole area + return getOrderTrend(tenantIdList, null); case 1: Integer areaCode = coreParam.getAreaCode(); tenantIdsStr = coreParam.getTenantIds(); @@ -529,6 +629,64 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService { } } + @Override + public R queryWorkOrder(CoreParam coreParam) { + String tenantIdsStr = null; + List> xhpcChargingStationList = null; + List tenantIdList = null; + String[] tenantIdArray = null; + //judge care param function + switch (coreParam.getParamType()) { + case 0: + tenantIdsStr = coreParam.getTenantIds(); + if (!"".equals(tenantIdsStr) && tenantIdsStr != null) { + tenantIdArray = tenantIdsStr.split(","); + tenantIdList = Arrays.stream(tenantIdArray).collect(Collectors.toList()); + } + return R.ok(xhpcChargingStationMapper.getWorkOrderTerminal(null,tenantIdList)); + //query charging station infos of whole area + case 1: + Integer areaCode = coreParam.getAreaCode(); + tenantIdsStr = coreParam.getTenantIds(); + if (!"".equals(tenantIdsStr) && tenantIdsStr != null) { + tenantIdArray = tenantIdsStr.split(","); + tenantIdList = Arrays.stream(tenantIdArray).collect(Collectors.toList()); + xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndAreaCode(tenantIdList, areaCode); + ArrayList chargingStationIdList = new ArrayList<>(); + for (Map chargingStation : xhpcChargingStationList) { + chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID)); + } + return R.ok(xhpcChargingStationMapper.getWorkOrderTerminal(chargingStationIdList,tenantIdList)); + } else { + xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndAreaCode(tenantIdList, areaCode); + ArrayList chargingStationIdList = new ArrayList<>(); + for (Map chargingStation : xhpcChargingStationList) { + chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID)); + } + return R.ok(xhpcChargingStationMapper.getWorkOrderTerminal(chargingStationIdList,tenantIdList)); + } + case 2: + //query location info of special charging station of special tenant + tenantIdsStr = coreParam.getTenantIds(); + if (!"".equals(tenantIdsStr) && tenantIdsStr != null) { + tenantIdArray = tenantIdsStr.split(","); + tenantIdList = Arrays.stream(tenantIdArray).collect(Collectors.toList()); + String chargingStationIdStr = coreParam.getChargingStationIds(); + long chargingStationId = Long.parseLong(chargingStationIdStr); + xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndChargingStationId(tenantIdList, chargingStationId); + ArrayList chargingStationIdList = new ArrayList<>(); + for (Map chargingStation : xhpcChargingStationList) { + chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID)); + } + return R.ok(xhpcChargingStationMapper.getWorkOrderTerminal(chargingStationIdList,tenantIdList)); + } else { + return R.fail("传入的参数有误"); + } + default: + return R.fail("param type is invalid"); + } + } + private R getOrderTrend(List tenantIdList, ArrayList chargingStationIdList) { List> orderTrendList = xhpcHistoryOrderMapper.selectOrderTrendByTenantIdsAndChargingStationIds(tenantIdList, chargingStationIdList); diff --git a/xhpc-modules/xhpc-data-big-screen/src/main/resources/mapper/XhpcChargingStationMapper.xml b/xhpc-modules/xhpc-data-big-screen/src/main/resources/mapper/XhpcChargingStationMapper.xml index 600e5acb..cd13be3f 100644 --- a/xhpc-modules/xhpc-data-big-screen/src/main/resources/mapper/XhpcChargingStationMapper.xml +++ b/xhpc-modules/xhpc-data-big-screen/src/main/resources/mapper/XhpcChargingStationMapper.xml @@ -470,4 +470,43 @@ tenant_id = #{tenantId,jdbcType=VARCHAR} where charging_station_id = #{chargingStationId,jdbcType=BIGINT} + + + + + \ No newline at end of file diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java index b27e427b..fa3da4dc 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java @@ -445,46 +445,9 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe } // if ( !UserTypeUtil.INTERNET_TYPE.equals(source)) { - //用户第几次充电 -// int count = xhpcChargeOrderService.getCount(userId,null,source,xhpcChargeOrder.getTenantId()); -// if (count == 0) { -// //活动折扣 -// Map promotion = xhpcChargeOrderService.getPromotion(); -// if (promotion != null && promotion.get("state") != null && promotion.get("discount") != null) { -// //state 1.总金额 2.电费 3.服务费 discount 折扣率 -// String state = promotion.get("state").toString(); -// BigDecimal discount =new BigDecimal(promotion.get("discount").toString()).divide(new BigDecimal(100)); -// -// if(discount.compareTo(new BigDecimal(0))==1){ -// if("1".equals(state) || "2".equals(state) || "3".equals(state)){ -// //折扣的钱 -// promotionDiscount=money.multiply(discount).setScale(2,BigDecimal.ROUND_HALF_UP); -// //剩余的总金额 -// actPrice = money.subtract(promotionDiscount); -// -// BigDecimal decimal1 = surplusPowerPrice.multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP); -// BigDecimal decimal2 = surplusServicePrice.multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP); -// if("1".equals(state)){ -// //总金额 -// actPrice =actPrice.subtract(decimal1.add(decimal2)); -// //折扣的钱 -// promotionDiscount = decimal1.add(decimal2); -// surplusPowerPrice = surplusPowerPrice.subtract(decimal1); -// surplusServicePrice= surplusServicePrice.subtract(decimal2); -// }else if("2".equals(state)){ -// //电费 -// surplusPowerPrice=surplusPowerPrice.subtract(decimal1); -// }else{ -// //服务费 -// surplusServicePrice =surplusServicePrice.subtract(decimal2); -// } -// } -// } -// } -// } if(UserTypeUtil.COMMUNIT_TYPE.equals(source) || UserTypeUtil.CUSTOMERS_TYPE.equals(source)){ //折扣(机构用户),没有活动时计算 - R mechanismDiscount = userTypeService.getMechanismDiscount(userId, source, xhpcChargeOrder.getTenantId()); + R mechanismDiscount = userTypeService.getMechanismDiscount(userId, source, xhpcChargeOrder.getTenantId(),xhpcChargeOrder.getChargingStationId()); if(mechanismDiscount !=null && mechanismDiscount.getData() !=null) { Map userDiscount = (Map) mechanismDiscount.getData(); if (userDiscount != null && userDiscount.get("commissionType") != null && userDiscount.get("servicePreferential") != null) { diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcCommonController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcCommonController.java index e94f11e6..2ac4221d 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcCommonController.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcCommonController.java @@ -4,6 +4,7 @@ import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.util.UserTypeUtil; import com.xhpc.user.service.IXhpcCommonService; +import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -76,9 +77,9 @@ public class XhpcCommonController extends BaseController { * @return */ @GetMapping(value = "/getMechanismDiscount") - public AjaxResult getMechanismDiscount(Long userId, Integer userType, String tenantId) { + public AjaxResult getMechanismDiscount(Long userId, Integer userType, String tenantId, Long chargingStationId) { - return xhpcCommonService.getMechanismDiscount(userId,userType,tenantId); + return xhpcCommonService.getMechanismDiscount(userId,userType,tenantId,chargingStationId); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcCommunityMapper.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcCommunityMapper.java index 2896cc89..c6bcbf21 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcCommunityMapper.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcCommunityMapper.java @@ -108,5 +108,5 @@ public interface XhpcCommunityMapper { /** * 根据用户id获取社区组 */ - Map getCommunityPersonnelUserId(@Param("userId")Long userId,@Param("tenantId")String tenantId); + Map getCommunityPersonnelUserId(@Param("userId")Long userId,@Param("tenantId")String tenantId,@Param("chargingStationId")Long chargingStationId); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcCustomersMapper.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcCustomersMapper.java index bcb8b9e2..7331d9de 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcCustomersMapper.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcCustomersMapper.java @@ -106,5 +106,5 @@ public interface XhpcCustomersMapper { /** * 根据用户id获取大客户组 */ - Map getCustomersPersonnelUserId(@Param("userId")Long userId,@Param("tenantId")String tenantId); + Map getCustomersPersonnelUserId(@Param("userId")Long userId,@Param("tenantId")String tenantId,@Param("chargingStationId") Long chargingStationId); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcCommonService.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcCommonService.java index e2b13b73..f833186e 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcCommonService.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcCommonService.java @@ -34,8 +34,9 @@ public interface IXhpcCommonService { * @param userId 充值用户 * @param userType 用户类型 * @param tenantId 租户id + * @param chargingStationId 场站id * @return */ - AjaxResult getMechanismDiscount(Long userId, Integer userType, String tenantId); + AjaxResult getMechanismDiscount(Long userId, Integer userType, String tenantId, Long chargingStationId); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcCommunityService.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcCommunityService.java index 0bc49beb..463fb34d 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcCommunityService.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcCommunityService.java @@ -107,5 +107,5 @@ public interface IXhpcCommunityService { /** * 根据用户id获取社区组 */ - Map getCommunityPersonnelUserId(Long userId,String tenantId); + Map getCommunityPersonnelUserId(Long userId,String tenantId,Long chargingStationId); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcCustomersService.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcCustomersService.java index f586d397..0078bc29 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcCustomersService.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcCustomersService.java @@ -100,5 +100,5 @@ public interface IXhpcCustomersService { /** * 根据用户id获取大客户组 */ - Map getCustomersPersonnelUserId(Long userId,String tenantId); + Map getCustomersPersonnelUserId(Long userId,String tenantId, Long chargingStationId); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCommonServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCommonServiceImpl.java index 5e70ab44..3043388c 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCommonServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCommonServiceImpl.java @@ -89,11 +89,11 @@ public class XhpcCommonServiceImpl implements IXhpcCommonService { * @return */ @Override - public AjaxResult getMechanismDiscount(Long userId, Integer userType, String tenantId) { + public AjaxResult getMechanismDiscount(Long userId, Integer userType, String tenantId, Long chargingStationId) { if(UserTypeUtil.COMMUNIT_TYPE.equals(userType)){ - return AjaxResult.success(xhpcCommunityService.getCommunityPersonnelUserId(userId, tenantId)); + return AjaxResult.success(xhpcCommunityService.getCommunityPersonnelUserId(userId, tenantId,chargingStationId)); }else if(UserTypeUtil.CUSTOMERS_TYPE.equals(userType)){ - return AjaxResult.success(xhpcCustomersService.getCustomersPersonnelUserId(userId, tenantId)); + return AjaxResult.success(xhpcCustomersService.getCustomersPersonnelUserId(userId, tenantId,chargingStationId)); }else{ return AjaxResult.error(); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCommunityServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCommunityServiceImpl.java index 9e9f98dc..a597d37d 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCommunityServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCommunityServiceImpl.java @@ -314,8 +314,8 @@ public class XhpcCommunityServiceImpl extends BaseService implements IXhpcCommun * @param tenantId */ @Override - public Map getCommunityPersonnelUserId(Long userId, String tenantId) { - return xhpcCommunityMapper.getCommunityPersonnelUserId(userId, tenantId); + public Map getCommunityPersonnelUserId(Long userId, String tenantId,Long chargingStationId) { + return xhpcCommunityMapper.getCommunityPersonnelUserId(userId, tenantId,chargingStationId); } public R judgeXhpcCommunity(XhpcCommunity xhpcCommunity){ diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCustomersServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCustomersServiceImpl.java index 87abb2ab..918406a7 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCustomersServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCustomersServiceImpl.java @@ -296,8 +296,8 @@ public class XhpcCustomersServiceImpl extends BaseService implements IXhpcCustom * @param tenantId */ @Override - public Map getCustomersPersonnelUserId(Long userId, String tenantId) { - return xhpcCustomersMapper.getCustomersPersonnelUserId(userId, tenantId); + public Map getCustomersPersonnelUserId(Long userId, String tenantId, Long chargingStationId) { + return xhpcCustomersMapper.getCustomersPersonnelUserId(userId, tenantId,chargingStationId); } public R judgeXhpcCustomers(XhpcCustomers xhpcCustomers){ diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommunityMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommunityMapper.xml index 73426a92..3cf1a3ba 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommunityMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommunityMapper.xml @@ -457,9 +457,11 @@ diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCustomersMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCustomersMapper.xml index 6f02a563..5eb4d35f 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCustomersMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCustomersMapper.xml @@ -454,9 +454,11 @@