给客户和仓库增加权限控制
This commit is contained in:
@@ -10,6 +10,7 @@ import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.depot.DepotService;
|
||||
import com.jsh.erp.service.material.MaterialService;
|
||||
import com.jsh.erp.service.systemConfig.SystemConfigService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
||||
import com.jsh.erp.utils.*;
|
||||
import org.slf4j.Logger;
|
||||
@@ -36,6 +37,9 @@ public class DepotController {
|
||||
@Resource
|
||||
private DepotService depotService;
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Resource
|
||||
private UserBusinessService userBusinessService;
|
||||
|
||||
@@ -113,18 +117,18 @@ public class DepotController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户拥有权限的仓库列表
|
||||
* @param type
|
||||
* @param keyId
|
||||
* 获取当前用户拥有权限的仓库列表
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@GetMapping(value = "/findDepotByUserId")
|
||||
public JSONArray findDepotByUserId(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
|
||||
HttpServletRequest request) throws Exception{
|
||||
JSONArray arr = new JSONArray();
|
||||
@GetMapping(value = "/findDepotByCurrentUser")
|
||||
public BaseResponseInfo findDepotByCurrentUser(HttpServletRequest request) throws Exception{
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
try {
|
||||
JSONArray arr = new JSONArray();
|
||||
String type = "UserDepot";
|
||||
Long userId = userService.getUserId(request);
|
||||
List<Depot> dataList = depotService.findUserDepot();
|
||||
//开始拼接json数据
|
||||
if (null != dataList) {
|
||||
@@ -134,9 +138,9 @@ public class DepotController {
|
||||
//勾选判断1
|
||||
Boolean flag = false;
|
||||
try {
|
||||
flag = userBusinessService.checkIsUserBusinessExist(type, keyId, "[" + depot.getId().toString() + "]");
|
||||
flag = userBusinessService.checkIsUserBusinessExist(type, userId.toString(), "[" + depot.getId().toString() + "]");
|
||||
} catch (DataAccessException e) {
|
||||
logger.error(">>>>>>>>>>>>>>>>>查询用户对应的仓库:类型" + type + " KeyId为: " + keyId + " 存在异常!");
|
||||
logger.error(">>>>>>>>>>>>>>>>>查询用户对应的仓库:类型" + type + " KeyId为: " + userId + " 存在异常!");
|
||||
}
|
||||
if (!depotFlag || flag) {
|
||||
item.put("id", depot.getId());
|
||||
@@ -145,10 +149,14 @@ public class DepotController {
|
||||
}
|
||||
}
|
||||
}
|
||||
res.code = 200;
|
||||
res.data = arr;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
res.code = 500;
|
||||
res.data = "获取数据失败";
|
||||
}
|
||||
return arr;
|
||||
return res;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/updateIsDefault")
|
||||
|
||||
@@ -78,11 +78,11 @@ public class SupplierController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/findBySelect_cus")
|
||||
public JSONArray findBySelectCus(@RequestParam(value = "UBType", required = false) String ubType,
|
||||
@RequestParam(value = "UBKeyId", required = false) String ubKeyId,
|
||||
HttpServletRequest request) {
|
||||
public JSONArray findBySelectCus(HttpServletRequest request) {
|
||||
JSONArray arr = new JSONArray();
|
||||
try {
|
||||
String type = "UserCustomer";
|
||||
Long userId = userService.getUserId(request);
|
||||
List<Supplier> supplierList = supplierService.findBySelectCus();
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if (null != supplierList) {
|
||||
@@ -92,7 +92,7 @@ public class SupplierController {
|
||||
//勾选判断1
|
||||
Boolean flag = false;
|
||||
try {
|
||||
flag = userBusinessService.checkIsUserBusinessExist(ubType, ubKeyId, "[" + supplier.getId().toString() + "]");
|
||||
flag = userBusinessService.checkIsUserBusinessExist(type, userId.toString(), "[" + supplier.getId().toString() + "]");
|
||||
} catch (DataAccessException e) {
|
||||
logger.error(">>>>>>>>>>>>>>>>>查询用户对应的客户:存在异常!");
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.Depot;
|
||||
import com.jsh.erp.datasource.entities.SystemConfig;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.depot.DepotService;
|
||||
import com.jsh.erp.service.systemConfig.SystemConfigService;
|
||||
@@ -84,4 +85,26 @@ public class SystemConfigController {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前租户的配置信息
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getCurrentInfo")
|
||||
public BaseResponseInfo getCurrentInfo(HttpServletRequest request) throws Exception {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
try{
|
||||
List<SystemConfig> list = systemConfigService.getSystemConfig();
|
||||
if(list.size()>0) {
|
||||
res.code = 200;
|
||||
res.data = list.get(0);
|
||||
}
|
||||
} catch(Exception e){
|
||||
e.printStackTrace();
|
||||
res.code = 500;
|
||||
res.data = "获取数据失败";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user