Merge remote-tracking branch 'origin/master'
This commit is contained in:
+19
@@ -16,6 +16,7 @@ import com.jero.modules.dummy.entity.DummyInventoryBaseEO;
|
||||
import com.jero.modules.dummy.service.IDummyInventoryBaseEOService;
|
||||
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
|
||||
import com.jero.modules.project.service.IProjectLawsInventoryEOService;
|
||||
import com.jero.modules.system.entity.SysRole;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -436,4 +437,22 @@ public class ProjectLawsInventoryEOController extends JeroController<ProjectLaws
|
||||
return this.projectLawsInventoryEOService.expediting(json);
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前登录用户角色
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "当前登录用户角色")
|
||||
@RequestMapping(value = "/getRoleByUserId", method = RequestMethod.GET)
|
||||
public Result<List<SysRole>> getRoleByUserId(String projectLibraryId) {
|
||||
Result<List<SysRole>> result = new Result<>();
|
||||
List<SysRole> list = projectLawsInventoryEOService.getRoleByUserId(projectLibraryId);
|
||||
if(list==null||list.size()<=0) {
|
||||
result.error500("未找到角色信息");
|
||||
}else {
|
||||
result.setResult(list);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
@@ -6,6 +6,7 @@ import com.itextpdf.text.DocumentException;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
|
||||
import com.jero.modules.system.entity.SysRole;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -144,4 +145,6 @@ public interface IProjectLawsInventoryEOService extends IService<ProjectLawsInve
|
||||
* @return
|
||||
*/
|
||||
Result<?> expediting(JSONObject json);
|
||||
|
||||
List<SysRole> getRoleByUserId(String projectLibraryId);
|
||||
}
|
||||
|
||||
+59
@@ -50,9 +50,11 @@ import com.jero.modules.split.common.FileUnZip;
|
||||
import com.jero.modules.system.entity.SysAnnouncement;
|
||||
import com.jero.modules.system.entity.SysCategory;
|
||||
import com.jero.modules.system.entity.SysDictItem;
|
||||
import com.jero.modules.system.entity.SysRole;
|
||||
import com.jero.modules.system.entity.SysUser;
|
||||
import com.jero.modules.system.mapper.SysCategoryMapper;
|
||||
import com.jero.modules.system.mapper.SysDictItemMapper;
|
||||
import com.jero.modules.system.mapper.SysRoleMapper;
|
||||
import com.jero.modules.system.mapper.SysUserMapper;
|
||||
import com.jero.modules.system.service.ISysAnnouncementService;
|
||||
import com.jero.modules.system.service.ISysUserService;
|
||||
@@ -204,6 +206,13 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
@Autowired
|
||||
private TaskFeignClientImpl taskFeignClient;
|
||||
|
||||
@Autowired
|
||||
SysRoleMapper sysRoleMapper;
|
||||
@Autowired
|
||||
ProjectLibraryBaseServiceImpl projectLibraryBaseService;
|
||||
@Autowired
|
||||
ProjectRelatedPersonnelServiceImpl projectRelatedPersonnelService;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
@@ -5829,4 +5838,54 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<SysRole> getRoleByUserId(String projectLibraryId) {
|
||||
List<SysRole> sysRoles = new LinkedList<>();
|
||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
//项目详情中取R&H Studio和认证工程师
|
||||
List<ProjectLibraryBase> projectLibraryBases = projectLibraryBaseService.queryById(projectLibraryId);
|
||||
String certificationEngineerName = "";
|
||||
if(projectLibraryBases.size() != 0){
|
||||
certificationEngineerName = projectLibraryBases.get(0).getCertificationEngineerName();
|
||||
String studioEngineerName = projectLibraryBases.get(0).getStudioEngineerName();
|
||||
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());
|
||||
sysRoles.add(sysRole);
|
||||
}
|
||||
}
|
||||
//相关人员名单中取法规工程师
|
||||
List<ProjectRelatedPersonnel> projectRelatedPersonnels = projectRelatedPersonnelService.queryPageList(projectLibraryId);
|
||||
List<String> lawEngineerNameList = new ArrayList<>();
|
||||
if(projectRelatedPersonnels.size() != 0){
|
||||
lawEngineerNameList = projectRelatedPersonnels.stream().map(ProjectRelatedPersonnel::getLawEngineerName).collect(Collectors.toList());
|
||||
}
|
||||
if(StringUtils.isNotBlank(certificationEngineerName) && certificationEngineerName.equals(loginUser.getUsername())
|
||||
&& 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());
|
||||
sysRoles.add(sysRole);
|
||||
|
||||
}
|
||||
|
||||
List<SysRole> roleList = sysRoleMapper.getRoleByUserId(loginUser.getId());
|
||||
//studio角色,法规工程师/认证工程师,领导角色,管理员角色
|
||||
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);
|
||||
}
|
||||
}
|
||||
return sysRoles;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,9 @@
|
||||
<a-icon type="plus"/>
|
||||
{{ $t('add') }}
|
||||
</div>
|
||||
<div class="operator-text" @click="roleSwitchingClick">
|
||||
<div class="operator-text"
|
||||
v-if="roleSwitchingList.length > 1"
|
||||
@click="roleSwitchingClick">
|
||||
<a-icon type="select"/>
|
||||
{{ $t('roleSwitching') }}
|
||||
</div>
|
||||
@@ -136,6 +138,7 @@
|
||||
{{ $t('batSetting') }}
|
||||
</div>
|
||||
<div class="operator-text"
|
||||
v-if="roleSwitchingList.length > 1"
|
||||
@click="roleSwitchingClick">
|
||||
<a-icon type="select"/>
|
||||
{{ $t('roleSwitching') }}
|
||||
@@ -888,7 +891,7 @@
|
||||
return current && current < moment().subtract(1, 'day')
|
||||
},
|
||||
getRoleByUserId() {
|
||||
getAction('/sys/role/getRoleByUserId', { projectLibraryId: this.$route.query.id }).then((res) => {
|
||||
getAction('/project/projectLawsInventoryEO/getRoleByUserId', { projectLibraryId: this.$route.query.id }).then((res) => {
|
||||
if (res.success) {
|
||||
this.roleSwitchingList = res.result || []
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user