增加接口:查询当前用户的价格屏蔽

This commit is contained in:
季圣华
2022-10-23 18:48:58 +08:00
parent b5a2fab979
commit 6c8427bd89
3 changed files with 27 additions and 3 deletions

View File

@@ -2,11 +2,8 @@ package com.jsh.erp.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.Role;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.role.RoleService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.service.userBusiness.UserBusinessService;
import com.jsh.erp.utils.ErpInfo;
import io.swagger.annotations.Api;

View File

@@ -13,6 +13,7 @@ import com.jsh.erp.datasource.vo.TreeNodeEx;
import com.jsh.erp.exception.BusinessParamCheckingException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.redis.RedisService;
import com.jsh.erp.service.role.RoleService;
import com.jsh.erp.service.tenant.TenantService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.*;
@@ -51,6 +52,9 @@ public class UserController {
@Resource
private UserService userService;
@Resource
private RoleService roleService;
@Resource
private TenantService tenantService;
@@ -382,6 +386,24 @@ public class UserController {
return arr;
}
@GetMapping(value = "/getCurrentPriceLimit")
@ApiOperation(value = "查询当前用户的价格屏蔽")
public BaseResponseInfo getCurrentPriceLimit(HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
Map<String, Object> data = new HashMap<>();
String priceLimit = roleService.getCurrentPriceLimit(request);
data.put("priceLimit", priceLimit);
res.code = 200;
res.data = data;
} catch(Exception e){
e.printStackTrace();
res.code = 500;
res.data = "获取session失败";
}
return res;
}
/**
* 获取当前用户的角色类型
* @param request

View File

@@ -240,4 +240,9 @@ public class RoleService {
}
return price;
}
public String getCurrentPriceLimit(HttpServletRequest request) throws Exception {
Long userId = userService.getUserId(request);
return userService.getRoleTypeByUserId(userId).getPriceLimit();
}
}