Commit 84b5c6cf authored by chenzhao's avatar chenzhao

增加判断当前用户是否场站

parent 73f95aa7
......@@ -22,8 +22,8 @@ public class MaintenanceUtil {
public static final String NO="否";
// 是否签订安全协议
public static final Integer QD = 1 ;
public static final Integer WQD = 0 ;
public static final Integer QD = 0 ;
public static final Integer WQD = 1 ;
......
......@@ -2,8 +2,11 @@ package com.yeejoin.amos.boot.module.jxiop.api.service;
import java.util.List;
import java.util.Map;
public interface IPermissionService {
List<String> getCurrentUserPermissions();
List<String> getCurrentUserProjectOrgCodes();
Map<String, String> judgeUserIsStation();
}
......@@ -8,6 +8,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.jxiop.api.service.IPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.ObjectUtils;
......@@ -51,6 +52,8 @@ public class PrivilegeController extends BaseController {
private RedisUtils redisUtils;
@Autowired
private UserEmpowerMapper userEmpowerMapper;
@Autowired
IPermissionService iPermissionService;
@Value("${yth.qg.id}")
private Long qgCompanyId;
......@@ -238,4 +241,12 @@ public class PrivilegeController extends BaseController {
return ResponseHelper.buildResponse(list);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/judgeUserIsStation")
@ApiOperation(httpMethod = "GET", value = "查询当前人是否为场站层级", notes = "查询当前人是否为场站层级")
public ResponseModel<Map<String,String>> judgeUserIsStation() {
return ResponseHelper.buildResponse(iPermissionService.judgeUserIsStation());
}
}
......@@ -16,6 +16,7 @@ import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -61,6 +62,32 @@ public class IPermissionServiceImpl implements IPermissionService {
return result;
}
public Map<String, String> judgeUserIsStation() {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String userId = reginParams.getUserModel().getUserId();
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId));
Map<String, String> map = new HashMap<>();
if (ObjectUtils.isEmpty(stdUserEmpower)) {
map.put("isStation","false");
} else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.get("level");
if (companyLevel.equals("categroy_leve2")) {
map.put("isStation","false");
}
if (companyLevel.equals("area")) {
map.put("isStation","false");
}
if (companyLevel.equals("station")) {
map.put("isStation","false");
}
}
return map;
}
@Override
public List<String> getCurrentUserProjectOrgCodes() {
List<String> result = new ArrayList<>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment