From 26cd0115150771d66a6cfca9c03820a734b69c9f Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期三, 11 十二月 2024 19:19:38 +0800
Subject: [PATCH] 合作商权限

---
 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TRepairServiceImpl.java |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TRepairServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TRepairServiceImpl.java
index c1f07c9..3eaf1ed 100644
--- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TRepairServiceImpl.java
+++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TRepairServiceImpl.java
@@ -1,6 +1,8 @@
 package com.ruoyi.chargingPile.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.account.api.dto.SendMessageDTO;
+import com.ruoyi.account.api.feignClient.AppUserClient;
 import com.ruoyi.chargingPile.api.feignClient.SiteClient;
 import com.ruoyi.chargingPile.api.model.Site;
 import com.ruoyi.chargingPile.api.model.TChargingPile;
@@ -14,6 +16,7 @@
 import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.web.page.BasePage;
 import com.ruoyi.common.core.web.page.PageInfo;
+import com.ruoyi.common.security.service.TokenService;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.other.api.feignClient.RoleSiteClient;
 import com.ruoyi.other.api.feignClient.UserSiteClient;
@@ -21,6 +24,7 @@
 import com.ruoyi.system.api.feignClient.SysUserClient;
 import com.ruoyi.system.api.feignClient.SysUserRoleClient;
 import com.ruoyi.system.api.model.SysUserRoleVo;
+import jdk.nashorn.internal.parser.Token;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -64,9 +68,12 @@
 	
 	@Resource
 	private SysUserRoleClient sysUserRoleClient;
+	@Resource
+	private AppUserClient appUserClient;
+
 	
-	
-	
+	@Autowired
+	private TokenService tokenService;
 	
 	/**
 	 * 获取报修记录列表
@@ -79,7 +86,8 @@
 		//校验合作商权限
 		List<Integer> siteIds = new ArrayList<>();
 		if(null == siteId || 0 == siteId){
-			SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData();
+			
+			SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData();
 			Integer roleType = sysUser.getRoleType();
 			Integer objectId = sysUser.getObjectId();
 			//合作商
@@ -88,7 +96,7 @@
 				siteIds = new ArrayList<>(data);
 			}else{
 				//非管理员需要根据角色和用户配置查询允许的站点数据
-				if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){
+				if(!SecurityUtils.isAdmin(tokenService.getLoginUser().getUserid())){
 					List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData();
 					List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData();
 					List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData();
@@ -108,8 +116,14 @@
 		Site site = siteService.getById(dto.getSiteId());
 		TChargingPile chargingPile = chargingPileService.getById(dto.getChargingPileId());
 		String siteName = site.getName();
-		String reqStr = MsgUtil.faultMsg(site.getPhone(), site.getName(), chargingPile.getNumber() + "");
-		String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr);
+//		String reqStr = MsgUtil.faultMsg(site.getPhone(), site.getName(), chargingPile.getNumber() + "");
+//		String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr);
+		SendMessageDTO sendMessageDTO = new SendMessageDTO();
+		sendMessageDTO.setPhone(site.getPhone());
+		sendMessageDTO.setCode(site.getName());
+		sendMessageDTO.setChargeGun(chargingPile.getNumber() + "");
+		sendMessageDTO.setType(3);
+		String result = appUserClient.sendMessage(sendMessageDTO).getData();
 		log.info("故障短信提醒:{}",result);
 		if(siteName.length()>10){
 			siteName = siteName.substring(0,10);

--
Gitblit v1.7.1