From 913dce9225b620df0b3e1a87ef170b7d6580aaef Mon Sep 17 00:00:00 2001 From: yuyang Date: Mon, 20 Dec 2021 09:28:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E8=B4=A6=E5=8F=B7=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=9C=BA=E7=AB=99=E5=B9=B6=E8=B5=8B=E4=BA=88=E8=AF=A5?= =?UTF-8?q?=E7=AB=99=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../XhpcChargingStationController.java | 2 +- .../mapper/XhpcChargingStationMapper.java | 6 ++++-- .../service/XhpcChargingStationServiceImpl.java | 15 +++++++++++++++ .../mapper/XhpcChargingStationMapper.xml | 17 +++++++++++++++++ 4 files changed, 37 insertions(+), 3 deletions(-) diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingStationController.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingStationController.java index 41486912..a728d7d5 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingStationController.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingStationController.java @@ -167,7 +167,7 @@ public class XhpcChargingStationController extends BaseController { /** - * 添加场点 + * 添加场站 * * @param xhpcChargingStationDto * @return diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingStationMapper.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingStationMapper.java index be34d5cc..372e92d5 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingStationMapper.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingStationMapper.java @@ -261,7 +261,9 @@ public interface XhpcChargingStationMapper { */ Map getLandUser(@Param("userId") Long userId); - - + /** + * 添加场站数据权限 + */ + void addXhpcUserPrivilege(@Param("userId") Long userId,@Param("chargingStationId") Long chargingStationId); } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java index 7377a4b3..a8c8909a 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java @@ -595,6 +595,21 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi //修改桩和终端的模板id xhpcChargingStationMapper.updateXhpcChargingPile(chargingStationId,rateModelId); xhpcChargingStationMapper.updateXhpcTerminal(chargingStationId,rateModelId); + try{ + //获取登陆用户 + Long logUserId = SecurityUtils.getUserId(); + if(logUserId !=1){ + Map landUser = xhpcChargingStationMapper.getLandUser(logUserId); + if(landUser !=null){ + if(landUser.get("userType") !=null && "02".equals(landUser.get("userType").toString())){ + xhpcChargingStationMapper.addXhpcUserPrivilege(logUserId,chargingStationId); + } + } + } + }catch (Exception e){ + logger.info("添加场站权限失败"); + } + return AjaxResult.success(); } diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml index 54634a6b..6b82386c 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml @@ -890,4 +890,21 @@ select user_id as userId,user_type as userType,operator_id as operatorId from sys_user where user_id =#{userId} + + insert into xhpc_user_privilege( + + user_id, + + + charging_station_id + + )values( + + #{userId}, + + + #{chargingStationId} + + ) +