|
@@ -83,9 +83,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
project.setProjectNo(Constant.PROJECT_PREFIX + seq);
|
|
|
projectMapper.insert(project);
|
|
|
//给项目经理添加一条上传权限
|
|
|
- if(null != project.getManagerId()){
|
|
|
+ if (null != project.getManagerId()) {
|
|
|
Integer cot = powerMapper.selectCount(new QueryWrapper<Power>().eq("user_id", project.getManagerId()).eq("project_id", project.getId()).eq("power_type", 0));
|
|
|
- if(cot==0){
|
|
|
+ if (cot == 0) {
|
|
|
Power power = new Power();
|
|
|
power.setUserId(project.getManagerId());
|
|
|
power.setProjectId(project.getId());
|
|
@@ -132,9 +132,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//删除之前的项目经理上传权限
|
|
|
powerMapper.delete(new QueryWrapper<Power>().eq("user_id", pro.getManagerId()).eq("project_id", pro.getId()).eq("power_type", 0));
|
|
|
//重新添加项目经理上传权限
|
|
|
- if(null != project.getManagerId()){
|
|
|
+ if (null != project.getManagerId()) {
|
|
|
Integer cot = powerMapper.selectCount(new QueryWrapper<Power>().eq("user_id", project.getManagerId()).eq("project_id", project.getId()).eq("power_type", 0));
|
|
|
- if(cot==0){
|
|
|
+ if (cot == 0) {
|
|
|
Power power = new Power();
|
|
|
power.setUserId(project.getManagerId());
|
|
|
power.setProjectId(project.getId());
|
|
@@ -291,9 +291,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
List<Integer> uIds = new ArrayList<>();
|
|
|
List<ProjectVO> projects = new ArrayList<>();
|
|
|
List<Integer> projectIds = new ArrayList<>();
|
|
|
- if (Constant.SYS_PARENT_ID == user.getParentId()) {
|
|
|
+ if (Constant.SYS_PARENT_ID.equals(user.getParentId())) {
|
|
|
projects = projectMapper.getProjectListByUid(keyName, user);
|
|
|
- } else if (Constant.SYS_ID == user.getParentId()) {
|
|
|
+ } else if (Constant.SYS_ID.equals(user.getParentId())) {
|
|
|
if (user.getSubordinateType() == 0) {
|
|
|
QueryWrapper<Project> qwr = new QueryWrapper<>();
|
|
|
//资产方管理员,看到自己创建的项目
|
|
@@ -363,9 +363,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
if (user != null) {
|
|
|
List<Integer> uIds = new ArrayList<>();
|
|
|
List<Integer> projectIds = new ArrayList<>();
|
|
|
- if (Constant.SYS_PARENT_ID == user.getParentId()) {
|
|
|
+ if (Constant.SYS_PARENT_ID.equals(user.getParentId())) {
|
|
|
projects = projectMapper.getProjectListByUid(keyName, user);
|
|
|
- } else if (Constant.SYS_ID == user.getParentId()) {
|
|
|
+ } else if (Constant.SYS_ID.equals(user.getParentId())) {
|
|
|
if (user.getSubordinateType() == 0) {
|
|
|
QueryWrapper<Project> qwr = new QueryWrapper<>();
|
|
|
//资产方管理员,看到自己创建的项目
|
|
@@ -401,31 +401,31 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
msg.setError("用户不存在或者未登录");
|
|
|
}
|
|
|
List<Integer> pIds = projects.stream().map(Project::getId).collect(Collectors.toList());
|
|
|
- if(!pIds.contains(project.getId())){
|
|
|
+ if (!pIds.contains(project.getId())) {
|
|
|
msg.setError("您没有该权限!");
|
|
|
return msg;
|
|
|
}
|
|
|
ProjectVO vo = projectMapper.getProjectById(project.getId());
|
|
|
- if (Constant.SYS_PARENT_ID == user.getParentId()) {
|
|
|
+ if (Constant.SYS_PARENT_ID.equals(user.getParentId())) {
|
|
|
//当前人超级管理员 ,对项目只可以浏览
|
|
|
map.put("update", 0);
|
|
|
map.put("download", 0);
|
|
|
map.put("view", 1);
|
|
|
map.put("approve", 0);
|
|
|
- } else if (Constant.SYS_ID == user.getParentId()) {
|
|
|
+ } else if (Constant.SYS_ID.equals(user.getParentId())) {
|
|
|
//当前为系统管理员
|
|
|
- if (Constant.ASSETS_COMPANY == user.getSubordinateType()) {
|
|
|
+ if (Constant.ASSETS_COMPANY.equals(user.getSubordinateType())) {
|
|
|
map.put("update", 1);
|
|
|
map.put("download", 1);
|
|
|
map.put("view", 1);
|
|
|
map.put("approve", 0);
|
|
|
- } else if (Constant.PRODUCER_COMPANY == user.getSubordinateType()) {
|
|
|
+ } else if (Constant.PRODUCER_COMPANY.equals(user.getSubordinateType())) {
|
|
|
map.put("update", 0);
|
|
|
map.put("download", 1);
|
|
|
map.put("view", 1);
|
|
|
map.put("approve", 0);
|
|
|
}
|
|
|
- } else if (vo.getManagerId() == user.getId()) {
|
|
|
+ } else if (vo.getManagerId().equals(user.getId())) {
|
|
|
//当前人是该项目的项目经理
|
|
|
Integer approve = 0;
|
|
|
if (projectApproveMapper.selectCount(new QueryWrapper<ProjectApprove>().eq("approver_id", user.getId())) > 0) {
|
|
@@ -489,7 +489,6 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
List<User> users = projectMapper.getProjectUserById(project.getId());
|
|
|
vo.setParticipateUsers(users);
|
|
|
//处理users按照客户呼和供应商分组
|
|
|
- System.out.println("users===>" + users);
|
|
|
// for (User user : users) {
|
|
|
// if (user.getSubordinateType() == 0) {
|
|
|
// //资产方
|
|
@@ -516,25 +515,25 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
List<Integer> uids = new ArrayList<>();
|
|
|
uids.add(-1);
|
|
|
- if(Constant.SYS_ID == user.getParentId()){
|
|
|
+ if (Constant.SYS_ID.equals(user.getParentId())) {
|
|
|
//资产方管理员
|
|
|
- uids = userCompanyMapper.selectList(new QueryWrapper<UserCompany>().eq("cooperation_company_id", user.getCompanyId()).in("belong_company_id",ids)).stream().map(UserCompany::getUserId).collect(Collectors.toList());
|
|
|
- List<Integer> userIds = userMapper.selectList(new QueryWrapper<User>().eq("company_id", user.getCompanyId()).ne("parent_id",1)).stream().map(User::getId).collect(Collectors.toList());
|
|
|
+ uids = userCompanyMapper.selectList(new QueryWrapper<UserCompany>().eq("cooperation_company_id", user.getCompanyId()).in("belong_company_id", ids)).stream().map(UserCompany::getUserId).collect(Collectors.toList());
|
|
|
+ List<Integer> userIds = userMapper.selectList(new QueryWrapper<User>().eq("company_id", user.getCompanyId()).ne("parent_id", 1)).stream().map(User::getId).collect(Collectors.toList());
|
|
|
uids.addAll(userIds);
|
|
|
uids.add(-1);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
//项目经理
|
|
|
- if(null != projectId){
|
|
|
+ if (null != projectId) {
|
|
|
Project pro = projectMapper.selectById(projectId);
|
|
|
user = userMapper.selectById(pro.getCreatorId());
|
|
|
- uids = userCompanyMapper.selectList(new QueryWrapper<UserCompany>().eq("cooperation_company_id", user.getCompanyId()).in("belong_company_id",ids)).stream().map(UserCompany::getUserId).collect(Collectors.toList());
|
|
|
- List<Integer> userIds = userMapper.selectList(new QueryWrapper<User>().eq("company_id", user.getCompanyId()).ne("parent_id",1)).stream().map(User::getId).collect(Collectors.toList());
|
|
|
+ uids = userCompanyMapper.selectList(new QueryWrapper<UserCompany>().eq("cooperation_company_id", user.getCompanyId()).in("belong_company_id", ids)).stream().map(UserCompany::getUserId).collect(Collectors.toList());
|
|
|
+ List<Integer> userIds = userMapper.selectList(new QueryWrapper<User>().eq("company_id", user.getCompanyId()).ne("parent_id", 1)).stream().map(User::getId).collect(Collectors.toList());
|
|
|
uids.addAll(userIds);
|
|
|
uids.add(-1);
|
|
|
id = user.getId();//不能是管理员本人
|
|
|
}
|
|
|
}
|
|
|
- List<UserVO> userVOS = userMapper.selsctUsersByUids(uids,id);
|
|
|
+ List<UserVO> userVOS = userMapper.selsctUsersByUids(uids, id);
|
|
|
msg.data = userVOS;
|
|
|
return msg;
|
|
|
}
|
|
@@ -544,12 +543,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
QueryWrapper<Mould> qw = new QueryWrapper<>();
|
|
|
Integer companyId = -1;
|
|
|
- if (Constant.SYS_ID == user.getParentId()) {
|
|
|
+ if (Constant.SYS_ID.equals(user.getParentId())) {
|
|
|
//此时是admin
|
|
|
User admin = userMapper.selectOne(new QueryWrapper<User>().eq("id", user.getId()));
|
|
|
companyId = admin.getCompanyId();
|
|
|
// qw.eq("company_id", admin.getCompanyId());
|
|
|
- } else if (Constant.SYS_PARENT_ID == user.getParentId()) {
|
|
|
+ } else if (Constant.SYS_PARENT_ID.equals(user.getParentId())) {
|
|
|
//系统管理员
|
|
|
// qw.eq("company_type",Constant.ASSETS_COMPANY);
|
|
|
} else {
|
|
@@ -559,7 +558,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
// qw.eq("company_id", admin.getCompanyId());
|
|
|
}
|
|
|
// List<Mould> moulds = mouldMapper.selectList(new QueryWrapper<Mould>().eq("company_id", companyId).isNull("project_id"));
|
|
|
- msg.data = mouldMapper.selectListByCompanyId(companyId,null);
|
|
|
+ msg.data = mouldMapper.selectListByCompanyId(companyId, null);
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
@@ -572,14 +571,14 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
if (userVO.getId() != null) {
|
|
|
//资产方管理员,获取他公司下的所有模具
|
|
|
PageHelper.startPage(page.getPageNum(), page.getPageSize());
|
|
|
- if (Constant.SYS_PARENT_ID == userVO.getParentId()) {
|
|
|
+ if (Constant.SYS_PARENT_ID.equals(userVO.getParentId())) {
|
|
|
//超级管理员,获取平台所有模具
|
|
|
moulds = mouldMapper.selectListByCondition(userVO);
|
|
|
- } else if (Constant.SYS_ID == userVO.getParentId()) {
|
|
|
- if (Constant.ASSETS_COMPANY == userVO.getSubordinateType()) {
|
|
|
+ } else if (Constant.SYS_ID.equals(userVO.getParentId())) {
|
|
|
+ if (Constant.ASSETS_COMPANY.equals(userVO.getSubordinateType())) {
|
|
|
//资产方管理员
|
|
|
moulds = mouldMapper.selectListByCondition(userVO);
|
|
|
- } else if (Constant.PRODUCER_COMPANY == userVO.getSubordinateType()) {
|
|
|
+ } else if (Constant.PRODUCER_COMPANY.equals(userVO.getSubordinateType())) {
|
|
|
set = customCompanyMapper.selectList(new QueryWrapper<CustomCompany>().eq("company_id", userVO.getCompanyId())).stream().map(CustomCompany::getProjectId).collect(Collectors.toList());
|
|
|
set.add(-1);
|
|
|
moulds = mouldMapper.selectListByConditionByProject(userVO, set);
|
|
@@ -636,10 +635,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
if (user != null) {
|
|
|
QueryWrapper<Project> qw = new QueryWrapper<>();
|
|
|
qw.select("id", "project_name");
|
|
|
- if (Constant.SYS_PARENT_ID == user.getParentId()) {
|
|
|
+ if (Constant.SYS_PARENT_ID.equals(user.getParentId())) {
|
|
|
//系统超级管理员,可获得所有项目
|
|
|
projects = projectMapper.selectList(qw);
|
|
|
- } else if (Constant.SYS_ID == user.getParentId()) {
|
|
|
+ } else if (Constant.SYS_ID.equals(user.getParentId())) {
|
|
|
//资产方管理员
|
|
|
qw.eq("owner_company", user.getCompanyId());
|
|
|
projects = projectMapper.selectList(qw);
|
|
@@ -679,7 +678,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
msg.setError("用户不存在或者未登录");
|
|
|
return msg;
|
|
|
} else {
|
|
|
- if (Constant.SYS_ID == user.getParentId()) {
|
|
|
+ if (Constant.SYS_ID.equals(user.getParentId())) {
|
|
|
//admin创建人员,获取该公司下的所有项目
|
|
|
list = projectMapper.selectList(new QueryWrapper<Project>().eq("owner_company", user.getCompanyId()));
|
|
|
} else {
|
|
@@ -701,15 +700,15 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
List<MouldVO> moulds = new ArrayList<>();
|
|
|
if (userVO.getId() != null) {
|
|
|
//资产方管理员,获取他公司下的所有模具
|
|
|
- if (Constant.SYS_PARENT_ID == userVO.getParentId()) {
|
|
|
+ if (Constant.SYS_PARENT_ID.equals(userVO.getParentId())) {
|
|
|
//超级管理员,获取平台所有模具
|
|
|
moulds = mouldMapper.selectListByCondition(userVO);
|
|
|
- } else if (Constant.SYS_ID == userVO.getParentId()) {
|
|
|
+ } else if (Constant.SYS_ID.equals(userVO.getParentId())) {
|
|
|
|
|
|
- if (Constant.ASSETS_COMPANY == userVO.getSubordinateType()) {
|
|
|
+ if (Constant.ASSETS_COMPANY.equals(userVO.getSubordinateType())) {
|
|
|
//资产方管理员
|
|
|
moulds = mouldMapper.selectListByCondition(userVO);
|
|
|
- } else if (Constant.PRODUCER_COMPANY == userVO.getSubordinateType()) {
|
|
|
+ } else if (Constant.PRODUCER_COMPANY.equals(userVO.getSubordinateType())) {
|
|
|
set = customCompanyMapper.selectList(new QueryWrapper<CustomCompany>().eq("company_id", userVO.getCompanyId())).stream().map(CustomCompany::getProjectId).collect(Collectors.toList());
|
|
|
set.add(-1);
|
|
|
moulds = mouldMapper.selectListByConditionByProject(userVO, set);
|
|
@@ -776,7 +775,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
// qw.eq("company_id", admin.getCompanyId());
|
|
|
}
|
|
|
// List<Mould> moulds = mouldMapper.selectList(new QueryWrapper<Mould>().eq("company_id", companyId).isNull("project_id"));
|
|
|
- msg.data = mouldMapper.selectListByCompanyId(companyId,userVO.getProjectId());
|
|
|
+ msg.data = mouldMapper.selectListByCompanyId(companyId, userVO.getProjectId());
|
|
|
return msg;
|
|
|
}
|
|
|
}
|