法规清单-选择角色中英文切换。
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@ public enum ProjectRoleEnum {
|
||||
STUDIO_ENGINEER("studio工程师","0","R&H Studio"),
|
||||
REGULATI_ENGINEER("法规工程师","1","studio"),
|
||||
HOMOLOGATION_ENGINEER("认证工程师","2","homo"),
|
||||
REGULATI_AND_HOMOLOGATION_ENGINEER("法规工程师/认证工程师","4",""),
|
||||
REGULATI_AND_HOMOLOGATION_ENGINEER("法规工程师/认证工程师","4","Regulatory Engineer/Certification Engineer"),
|
||||
MANAGER("领导角色","11","R&H Manager"),
|
||||
ADMIN("系统管理员","12","admin"),
|
||||
;
|
||||
|
||||
+2
-2
@@ -443,9 +443,9 @@ public class ProjectLawsInventoryEOController extends JeroController<ProjectLaws
|
||||
*/
|
||||
@ApiOperation(value = "当前登录用户角色")
|
||||
@RequestMapping(value = "/getRoleByUserId", method = RequestMethod.GET)
|
||||
public Result<List<SysRole>> getRoleByUserId(String projectLibraryId) {
|
||||
public Result<List<SysRole>> getRoleByUserId(String projectLibraryId,String cut) {
|
||||
Result<List<SysRole>> result = new Result<>();
|
||||
List<SysRole> list = projectLawsInventoryEOService.getRoleByUserId(projectLibraryId);
|
||||
List<SysRole> list = projectLawsInventoryEOService.getRoleByUserId(projectLibraryId,cut);
|
||||
if(list==null||list.size()<=0) {
|
||||
result.error500("未找到角色信息");
|
||||
}else {
|
||||
|
||||
+33
-16
@@ -1,30 +1,35 @@
|
||||
package com.jero.modules.project.enums;
|
||||
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.modules.system.util.StringUtils;
|
||||
|
||||
/**
|
||||
* 项目角色枚举类
|
||||
*/
|
||||
public enum ProjectRoleEnum {
|
||||
STUDIO_ENGINEER("studio工程师","0"),
|
||||
REGULATI_ENGINEER("法规工程师","1"),
|
||||
HOMOLOGATION_ENGINEER("认证工程师","2"),
|
||||
ENGINEERING_INTERFACE_PERSON("工程接口人","3"),
|
||||
REGULATI_AND_HOMOLOGATION_ENGINEER("法规与认证工程师","4"),
|
||||
DESIGNINITIATOR("设计符合性确认-发起人","5"),
|
||||
DESIGNDUTY("设计符合性确认-责任人","6"),
|
||||
PREHOMOINITIATOR("prehomo确认-发起人","7"),
|
||||
PREHOMODUTY("prehomo确认-责任人","8"),
|
||||
VERIFYINITIATOR("验证符合性确认-发起人","9"),
|
||||
VERIFYDUTY("验证符合性确认-责任人","10"),
|
||||
MANAGER("验证符合性确认-责任人","11"),
|
||||
ADMIN("系统管理员","12"),
|
||||
STUDIO_ENGINEER("studio工程师","0","R&H Studio"),
|
||||
REGULATI_ENGINEER("法规工程师","1","Regulatory Engineer"),
|
||||
HOMOLOGATION_ENGINEER("认证工程师","2","Certification Engineer"),
|
||||
ENGINEERING_INTERFACE_PERSON("工程接口人","3","Engineering interface person"),
|
||||
REGULATI_AND_HOMOLOGATION_ENGINEER("法规与认证工程师","4","Regulatory and certification engineer"),
|
||||
DESIGNINITIATOR("设计符合性确认-发起人","5",""),
|
||||
DESIGNDUTY("设计符合性确认-责任人","6",""),
|
||||
PREHOMOINITIATOR("prehomo确认-发起人","7",""),
|
||||
PREHOMODUTY("prehomo确认-责任人","8",""),
|
||||
VERIFYINITIATOR("验证符合性确认-发起人","9",""),
|
||||
VERIFYDUTY("验证符合性确认-责任人","10",""),
|
||||
MANAGER("验证符合性确认-责任人","11",""),
|
||||
ADMIN("系统管理员","12",""),
|
||||
;
|
||||
|
||||
String name;
|
||||
String value;
|
||||
String enName;
|
||||
|
||||
private ProjectRoleEnum(String name, String value) {
|
||||
private ProjectRoleEnum(String name, String value,String enName) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.enName = enName;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@@ -43,11 +48,23 @@ public enum ProjectRoleEnum {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static String getTextByValue(String value) {
|
||||
public String getEnName() {
|
||||
return enName;
|
||||
}
|
||||
|
||||
public void setEnName(String enName) {
|
||||
this.enName = enName;
|
||||
}
|
||||
|
||||
public static String getTextByValue(String value,String cut) {
|
||||
ProjectRoleEnum[] values = values();
|
||||
for (ProjectRoleEnum projectRoleEnum : values) {
|
||||
if (projectRoleEnum.value.equals(value)) {
|
||||
return projectRoleEnum.name;
|
||||
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
|
||||
return projectRoleEnum.name;
|
||||
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
|
||||
return projectRoleEnum.enName;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
+1
-1
@@ -148,5 +148,5 @@ public interface IProjectLawsInventoryEOService extends IService<ProjectLawsInve
|
||||
*/
|
||||
Result<?> expediting(JSONObject json);
|
||||
|
||||
List<SysRole> getRoleByUserId(String projectLibraryId);
|
||||
List<SysRole> getRoleByUserId(String projectLibraryId,String cut);
|
||||
}
|
||||
|
||||
+32
-10
@@ -6293,7 +6293,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
|
||||
|
||||
@Override
|
||||
public List<SysRole> getRoleByUserId(String projectLibraryId) {
|
||||
public List<SysRole> getRoleByUserId(String projectLibraryId,String cut) {
|
||||
List<SysRole> sysRoles = new LinkedList<>();
|
||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
//项目详情中取R&H Studio和认证工程师
|
||||
@@ -6305,7 +6305,12 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
if(StringUtils.isNotBlank(studioEngineerName) && studioEngineerName.equals(loginUser.getUsername())){
|
||||
SysRole sysRole = new SysRole();
|
||||
sysRole.setRoleCode(com.jero.modules.system.enums.ProjectRoleEnum.STUDIO_ENGINEER.getValue());
|
||||
sysRole.setRoleName(com.jero.modules.system.enums.ProjectRoleEnum.STUDIO_ENGINEER.getName());
|
||||
if(StringUtils.equals(cut,CutEnum.CN.getValue())){
|
||||
sysRole.setRoleName(com.jero.modules.system.enums.ProjectRoleEnum.STUDIO_ENGINEER.getName());
|
||||
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
|
||||
sysRole.setRoleName(com.jero.modules.system.enums.ProjectRoleEnum.STUDIO_ENGINEER.getCode());
|
||||
}
|
||||
|
||||
sysRoles.add(sysRole);
|
||||
}
|
||||
}
|
||||
@@ -6325,7 +6330,11 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
|| lawEngineerNameList.contains(loginUser.getUsername())){
|
||||
SysRole sysRole = new SysRole();
|
||||
sysRole.setRoleCode(com.jero.modules.system.enums.ProjectRoleEnum.REGULATI_AND_HOMOLOGATION_ENGINEER.getValue());
|
||||
sysRole.setRoleName(com.jero.modules.system.enums.ProjectRoleEnum.REGULATI_AND_HOMOLOGATION_ENGINEER.getName());
|
||||
if(StringUtils.equals(cut,CutEnum.CN.getValue())){
|
||||
sysRole.setRoleName(com.jero.modules.system.enums.ProjectRoleEnum.REGULATI_AND_HOMOLOGATION_ENGINEER.getName());
|
||||
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
|
||||
sysRole.setRoleName(com.jero.modules.system.enums.ProjectRoleEnum.REGULATI_AND_HOMOLOGATION_ENGINEER.getCode());
|
||||
}
|
||||
sysRoles.add(sysRole);
|
||||
|
||||
}
|
||||
@@ -6335,14 +6344,27 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
if (roleList.size() != 0) {
|
||||
List<SysRole> manager = roleList.stream().filter(e -> com.jero.modules.system.enums.ProjectRoleEnum.MANAGER.getCode().equals(e.getRoleCode())).collect(Collectors.toList());
|
||||
List<SysRole> admin = roleList.stream().filter(e -> com.jero.modules.system.enums.ProjectRoleEnum.ADMIN.getCode().equals(e.getRoleCode())).collect(Collectors.toList());
|
||||
if (manager.size() != 0) {
|
||||
manager.get(0).setRoleCode(com.jero.modules.system.enums.ProjectRoleEnum.MANAGER.getValue());
|
||||
sysRoles.addAll(manager);
|
||||
}
|
||||
if (admin.size() != 0) {
|
||||
admin.get(0).setRoleCode(com.jero.modules.system.enums.ProjectRoleEnum.ADMIN.getValue());
|
||||
sysRoles.addAll(admin);
|
||||
if(StringUtils.equals(cut,CutEnum.CN.getValue())){
|
||||
if (manager.size() != 0) {
|
||||
manager.get(0).setRoleCode(com.jero.modules.system.enums.ProjectRoleEnum.MANAGER.getValue());
|
||||
sysRoles.addAll(manager);
|
||||
}
|
||||
if (admin.size() != 0) {
|
||||
admin.get(0).setRoleCode(com.jero.modules.system.enums.ProjectRoleEnum.ADMIN.getValue());
|
||||
sysRoles.addAll(admin);
|
||||
}
|
||||
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
|
||||
if (manager.size() != 0) {
|
||||
manager.get(0).setRoleCode(com.jero.modules.system.enums.ProjectRoleEnum.MANAGER.getCode());
|
||||
sysRoles.addAll(manager);
|
||||
}
|
||||
if (admin.size() != 0) {
|
||||
admin.get(0).setRoleCode(com.jero.modules.system.enums.ProjectRoleEnum.ADMIN.getCode());
|
||||
admin.get(0).setRoleName(com.jero.modules.system.enums.ProjectRoleEnum.ADMIN.getCode());
|
||||
sysRoles.addAll(admin);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return sysRoles;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user