换成增加租户进行分组

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.reason as reason,
cs.name as chargingStationName,
cs.charging_station_id as chargingStationId,
tcm.timing_time as timingTime,
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
left join xhpc_charging_station as cs on cs.charging_station_id = tcm.charging_station_id
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.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.general.service.IXhpcServiceDataUpdateService;
import com.xhpc.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* program: ruoyi
* User: HongYun
@ -21,6 +25,8 @@ public class XhpcServiceDataUpdateController {
@Autowired
IXhpcServiceDataUpdateService xhpcServiceDataUpdateService;
@Resource
TokenService tokenService;
@GetMapping("/list")
public AjaxResult list(){
@ -31,7 +37,8 @@ public class XhpcServiceDataUpdateController {
@Log(title = "小程序设置-修改", businessType = BusinessType.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) {
return xhpcServiceDataUpdateService.update(SOC, version, phone, aliyunMessageCount);
LoginUser loginUser = tokenService.getLoginUser();
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
* @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.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.stereotype.Service;
@ -18,14 +20,18 @@ public class XhpcServiceDataUpdateServiceImpl implements IXhpcServiceDataUpdateS
@Autowired
private RedisService redisService;
@Autowired
private TokenService tokenService;
@Override
public Map<String, Object> list() {
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
Map<String,Object> list=new HashMap<>();
String cacheSOC = redisService.getCacheObject("global:SOC");
String cacheVersion = redisService.getCacheObject("global:version");
String cachePhone = redisService.getCacheObject("global:phone");
String cacheAliyunMessageCount = redisService.getCacheObject("global:AliyunMessageCount");
String cacheSOC = redisService.getCacheObject("global:"+tenantId+":SOC");
String cacheVersion = redisService.getCacheObject("global:"+tenantId+":version");
String cachePhone = redisService.getCacheObject("global:"+tenantId+":phone");
//String cacheAliyunMessageCount = redisService.getCacheObject("global:AliyunMessageCount");
list.put("SOC",cacheSOC);
list.put("version",cacheVersion);
list.put("phone", cachePhone);
@ -35,7 +41,7 @@ public class XhpcServiceDataUpdateServiceImpl implements IXhpcServiceDataUpdateS
@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) {
int soc = Integer.parseInt(SOC);
@ -52,9 +58,9 @@ public class XhpcServiceDataUpdateServiceImpl implements IXhpcServiceDataUpdateS
// return AjaxResult.error("短信条数为空");
// }
redisService.setCacheObject("global:SOC", SOC);
redisService.setCacheObject("global:version", version);
redisService.setCacheObject("global:phone", phone);
redisService.setCacheObject("global:"+tenantId+":SOC", SOC);
redisService.setCacheObject("global:"+tenantId+":version", version);
redisService.setCacheObject("global:"+tenantId+":phone", phone);
// 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());
}
//平台
String soc = redisService.getCacheObject("global:SOC");
String soc = redisService.getCacheObject("global:"+tenantId+":SOC");
if(!"".equals(soc) && soc!=null){
if(number!=0){
if(Integer.parseInt(soc)-number<0){
@ -544,7 +544,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
int number =0;
//平台
String soc = redisService.getCacheObject("global:SOC");
String soc = redisService.getCacheObject("global:"+xhpcTerminal.getTenantId()+":SOC");
if(!"".equals(soc) && soc!=null){
if(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());
}
//平台
String soc = redisService.getCacheObject("global:SOC");
String soc = redisService.getCacheObject("global:"+xhpcTerminal.getTenantId()+":SOC");
if(!"".equals(soc) && soc!=null){
if(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) {
try{
LoginUser loginUser = logUserUtils.getLogUser(request);
Object version = redisService.getCacheObject("global:version");
Object servicePhone = redisService.getCacheObject("global:phone");
String tenantId = loginUser.getTenantId();
Object version = redisService.getCacheObject("global:"+tenantId+":version");
Object servicePhone = redisService.getCacheObject("global:"+tenantId+":phone");
//根据不同的用户类型查询不同的信息
Long userid = loginUser.getUserid();
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){
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("activitySize",1);
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);
}else{
return AjaxResult.error("请重新登录",HttpStatus.USER_LOGIN);