换成增加租户进行分组

This commit is contained in:
yuyang 2022-03-17 13:57:24 +08:00
parent 350ea92e71
commit 96c7535ddc
6 changed files with 37 additions and 20 deletions

View File

@ -581,9 +581,11 @@
tcm.timing_charging_model_id as timingChargingModelId, tcm.timing_charging_model_id as timingChargingModelId,
tcm.reason as reason, tcm.reason as reason,
cs.name as chargingStationName, cs.name as chargingStationName,
cs.charging_station_id as chargingStationId,
tcm.timing_time as timingTime, tcm.timing_time as timingTime,
tcm.status as status, tcm.status as status,
tcm.create_time as createTime tcm.create_time as createTime,
tcm.phone as phone
from xhpc_timing_charging_model as tcm from xhpc_timing_charging_model as tcm
left join xhpc_charging_station as cs on cs.charging_station_id = tcm.charging_station_id left join xhpc_charging_station as cs on cs.charging_station_id = tcm.charging_station_id
where tcm.timing_charging_model_id =#{timingChargingModelId} where tcm.timing_charging_model_id =#{timingChargingModelId}

View File

@ -3,13 +3,17 @@ package com.xhpc.general.controller;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.log.annotation.Log; import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType; import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.general.service.IXhpcServiceDataUpdateService; import com.xhpc.general.service.IXhpcServiceDataUpdateService;
import com.xhpc.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/** /**
* program: ruoyi * program: ruoyi
* User: HongYun * User: HongYun
@ -21,6 +25,8 @@ public class XhpcServiceDataUpdateController {
@Autowired @Autowired
IXhpcServiceDataUpdateService xhpcServiceDataUpdateService; IXhpcServiceDataUpdateService xhpcServiceDataUpdateService;
@Resource
TokenService tokenService;
@GetMapping("/list") @GetMapping("/list")
public AjaxResult list(){ public AjaxResult list(){
@ -31,7 +37,8 @@ public class XhpcServiceDataUpdateController {
@Log(title = "小程序设置-修改", businessType = BusinessType.UPDATE) @Log(title = "小程序设置-修改", businessType = BusinessType.UPDATE)
@GetMapping("/update") @GetMapping("/update")
public AjaxResult update(@RequestParam(required = false) String SOC, @RequestParam(required = false) String version, @RequestParam(required = false) String phone, @RequestParam(required = false) String aliyunMessageCount) { public AjaxResult update(@RequestParam(required = false) String SOC, @RequestParam(required = false) String version, @RequestParam(required = false) String phone, @RequestParam(required = false) String aliyunMessageCount) {
LoginUser loginUser = tokenService.getLoginUser();
return xhpcServiceDataUpdateService.update(SOC, version, phone, aliyunMessageCount); String tenantId = loginUser.getTenantId();
return xhpcServiceDataUpdateService.update(SOC, version, phone, aliyunMessageCount,tenantId);
} }
} }

View File

@ -29,7 +29,7 @@ public interface IXhpcServiceDataUpdateService {
* @date 2021/11/30 14:44 * @date 2021/11/30 14:44
* @since version-1.0 * @since version-1.0
*/ */
AjaxResult update(String SOC, String version, String phone, String aliyunMessageCount); AjaxResult update(String SOC, String version, String phone, String aliyunMessageCount,String tenantId);
} }

View File

@ -2,6 +2,8 @@ package com.xhpc.general.service;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.redis.service.RedisService; import com.xhpc.common.redis.service.RedisService;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -18,14 +20,18 @@ public class XhpcServiceDataUpdateServiceImpl implements IXhpcServiceDataUpdateS
@Autowired @Autowired
private RedisService redisService; private RedisService redisService;
@Autowired
private TokenService tokenService;
@Override @Override
public Map<String, Object> list() { public Map<String, Object> list() {
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
Map<String,Object> list=new HashMap<>(); Map<String,Object> list=new HashMap<>();
String cacheSOC = redisService.getCacheObject("global:SOC"); String cacheSOC = redisService.getCacheObject("global:"+tenantId+":SOC");
String cacheVersion = redisService.getCacheObject("global:version"); String cacheVersion = redisService.getCacheObject("global:"+tenantId+":version");
String cachePhone = redisService.getCacheObject("global:phone"); String cachePhone = redisService.getCacheObject("global:"+tenantId+":phone");
String cacheAliyunMessageCount = redisService.getCacheObject("global:AliyunMessageCount"); //String cacheAliyunMessageCount = redisService.getCacheObject("global:AliyunMessageCount");
list.put("SOC",cacheSOC); list.put("SOC",cacheSOC);
list.put("version",cacheVersion); list.put("version",cacheVersion);
list.put("phone", cachePhone); list.put("phone", cachePhone);
@ -35,7 +41,7 @@ public class XhpcServiceDataUpdateServiceImpl implements IXhpcServiceDataUpdateS
@Override @Override
public AjaxResult update(String SOC, String version, String phone, String aliyunMessageCount) { public AjaxResult update(String SOC, String version, String phone, String aliyunMessageCount,String tenantId) {
if (SOC != null) { if (SOC != null) {
int soc = Integer.parseInt(SOC); int soc = Integer.parseInt(SOC);
@ -52,9 +58,9 @@ public class XhpcServiceDataUpdateServiceImpl implements IXhpcServiceDataUpdateS
// return AjaxResult.error("短信条数为空"); // return AjaxResult.error("短信条数为空");
// } // }
redisService.setCacheObject("global:SOC", SOC); redisService.setCacheObject("global:"+tenantId+":SOC", SOC);
redisService.setCacheObject("global:version", version); redisService.setCacheObject("global:"+tenantId+":version", version);
redisService.setCacheObject("global:phone", phone); redisService.setCacheObject("global:"+tenantId+":phone", phone);
// redisService.setCacheObject("global:AliyunMessageCount", aliyunMessageCount); // redisService.setCacheObject("global:AliyunMessageCount", aliyunMessageCount);

View File

@ -234,7 +234,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
number =Integer.parseInt(userMessage.get("socUser").toString()); number =Integer.parseInt(userMessage.get("socUser").toString());
} }
//平台 //平台
String soc = redisService.getCacheObject("global:SOC"); String soc = redisService.getCacheObject("global:"+tenantId+":SOC");
if(!"".equals(soc) && soc!=null){ if(!"".equals(soc) && soc!=null){
if(number!=0){ if(number!=0){
if(Integer.parseInt(soc)-number<0){ if(Integer.parseInt(soc)-number<0){
@ -544,7 +544,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
int number =0; int number =0;
//平台 //平台
String soc = redisService.getCacheObject("global:SOC"); String soc = redisService.getCacheObject("global:"+xhpcTerminal.getTenantId()+":SOC");
if(!"".equals(soc) && soc!=null){ if(!"".equals(soc) && soc!=null){
if(number!=0){ if(number!=0){
if(Integer.parseInt(soc)-number<0){ if(Integer.parseInt(soc)-number<0){
@ -785,7 +785,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
number =Integer.parseInt(userMessage.get("socUser").toString()); number =Integer.parseInt(userMessage.get("socUser").toString());
} }
//平台 //平台
String soc = redisService.getCacheObject("global:SOC"); String soc = redisService.getCacheObject("global:"+xhpcTerminal.getTenantId()+":SOC");
if(!"".equals(soc) && soc!=null){ if(!"".equals(soc) && soc!=null){
if(number!=0){ if(number!=0){
if(Integer.parseInt(soc)-number<0){ if(Integer.parseInt(soc)-number<0){

View File

@ -437,12 +437,14 @@ public class XhpcAppUserServiceImpl extends BaseService implements IXhpcAppUserU
public AjaxResult appInfo(HttpServletRequest request) { public AjaxResult appInfo(HttpServletRequest request) {
try{ try{
LoginUser loginUser = logUserUtils.getLogUser(request); LoginUser loginUser = logUserUtils.getLogUser(request);
Object version = redisService.getCacheObject("global:version"); String tenantId = loginUser.getTenantId();
Object servicePhone = redisService.getCacheObject("global:phone"); Object version = redisService.getCacheObject("global:"+tenantId+":version");
Object servicePhone = redisService.getCacheObject("global:"+tenantId+":phone");
//根据不同的用户类型查询不同的信息 //根据不同的用户类型查询不同的信息
Long userid = loginUser.getUserid(); Long userid = loginUser.getUserid();
Integer userType = loginUser.getUserType(); Integer userType = loginUser.getUserType();
R user = userTypeService.getUser(null, loginUser.getUserid(), loginUser.getUserType(), null,loginUser.getTenantId());
R user = userTypeService.getUser(null, loginUser.getUserid(), loginUser.getUserType(), null,tenantId);
if(user !=null && user.getData() !=null){ if(user !=null && user.getData() !=null){
Map<String, Object> map = (Map<String, Object>)user.getData(); Map<String, Object> map = (Map<String, Object>)user.getData();
//发票留言板版本客服电话 //发票留言板版本客服电话
@ -481,7 +483,7 @@ public class XhpcAppUserServiceImpl extends BaseService implements IXhpcAppUserU
map.put("activity",0); map.put("activity",0);
map.put("activitySize",1); map.put("activitySize",1);
map.put("activityImg","https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/bunengshanchu/1.png"); map.put("activityImg","https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/bunengshanchu/1.png");
map.put("socSize",redisService.getCacheObject("global:SOC")); map.put("socSize",redisService.getCacheObject("global:"+tenantId+":SOC"));
return AjaxResult.success(map); return AjaxResult.success(map);
}else{ }else{
return AjaxResult.error("请重新登录",HttpStatus.USER_LOGIN); return AjaxResult.error("请重新登录",HttpStatus.USER_LOGIN);