bug:子模块子系统查询,添加bug修复 #30
|
@ -23,22 +23,22 @@ public class PermissionList {
|
|||
permissionList.add(new PermissionVO("info:get_header_image", "获取头部图片"));
|
||||
permissionList.add(new PermissionVO("info:edit_header_image", "编辑头部图片"));
|
||||
permissionList.add(new PermissionVO("info:delete_header_image", "删除头部图片"));
|
||||
permissionList.add(new PermissionVO("project:child_add", "增加子系统"));
|
||||
permissionList.add(new PermissionVO("project:module_add", "增加子模块"));
|
||||
permissionPrincipal.add(new PermissionVO("project:child:add", "增加子系统"));
|
||||
permissionPrincipal.add(new PermissionVO("project:module:add", "增加子模块"));
|
||||
|
||||
permissionPrincipal.add(new PermissionVO("auth:change_password", "修改密码"));
|
||||
permissionPrincipal.add(new PermissionVO("info:get_header_image", "获取头部图片"));
|
||||
permissionPrincipal.add(new PermissionVO("info:edit_header_image", "编辑头部图片"));
|
||||
permissionPrincipal.add(new PermissionVO("info:delete_header_image", "删除头部图片"));
|
||||
permissionPrincipal.add(new PermissionVO("project:add", "增加项目"));
|
||||
permissionPrincipal.add(new PermissionVO("project:child_add", "增加子系统"));
|
||||
permissionPrincipal.add(new PermissionVO("project:module_add", "增加子模块"));
|
||||
permissionPrincipal.add(new PermissionVO("project:child:add", "增加子系统"));
|
||||
permissionPrincipal.add(new PermissionVO("project:module:add", "增加子模块"));
|
||||
|
||||
permissionDeveloper.add(new PermissionVO("auth:change_password", "修改密码"));
|
||||
permissionDeveloper.add(new PermissionVO("info:get_header_image", "获取头部图片"));
|
||||
permissionDeveloper.add(new PermissionVO("info:edit_header_image", "编辑头部图片"));
|
||||
permissionDeveloper.add(new PermissionVO("info:delete_header_image", "删除头部图片"));
|
||||
permissionDeveloper.add(new PermissionVO("project:child_add", "增加子系统"));
|
||||
permissionDeveloper.add(new PermissionVO("project:module_add", "增加子模块"));
|
||||
permissionPrincipal.add(new PermissionVO("project:child:add", "增加子系统"));
|
||||
permissionPrincipal.add(new PermissionVO("project:module:add", "增加子模块"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ModuleController {
|
|||
* @return 子模块列表
|
||||
*/
|
||||
@GetMapping("/module/get/min")
|
||||
public BaseResponse moduleGetBySysId(@RequestParam Integer sysId, HttpServletRequest request) {
|
||||
public BaseResponse moduleGetBySysId(@RequestParam Long sysId, HttpServletRequest request) {
|
||||
return moduleService.getBySysId(sysId, request);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ public interface ModuleMapper {
|
|||
|
||||
List<ProjectChildDO> getByProjectId(Integer projectId, Long userId, int is);
|
||||
|
||||
List<ProjectModuleDO> getBySysId(Integer sysId, Long userId, int is);
|
||||
List<ProjectModuleDO> getBySysId(Long sysId, Long userId, int is);
|
||||
|
||||
@Select("select principal_id from organize_oa.oa_project where id=#{projectId}")
|
||||
Long getPidByProjectid(Integer projectId);
|
||||
|
|
|
@ -31,9 +31,9 @@ public interface ProjectMapper {
|
|||
void projectWorkAdd(ProjectChildAddVO projectChildAddVO);
|
||||
|
||||
@Insert("insert into organize_oa.oa_project_modules (project_child_id, name, principal_id,"
|
||||
+ " work_load, description, status, dead_line) "
|
||||
+ " work_load, description, status, dead_line,cycle) "
|
||||
+ "value (#{projectChildId},#{name},#{principalId},#{workLoad},"
|
||||
+ "#{description},#{status},#{deadLine})")
|
||||
+ "#{description},#{status},#{deadLine},#{cycle})")
|
||||
void projectModuleAdd(ProjectModuleAddVO projectModuleAddVO);
|
||||
|
||||
void projectEdit(ProjectDO projectEdit);
|
||||
|
|
|
@ -13,6 +13,7 @@ public class ProjectModuleDO {
|
|||
private Long id;
|
||||
private Long projectChildId;
|
||||
private Long principalId;
|
||||
private Integer cycle;
|
||||
private Integer workLoad;
|
||||
private String description;
|
||||
private String name;
|
||||
|
|
|
@ -16,6 +16,8 @@ public class ProjectModuleAddVO {
|
|||
private Long principalId;
|
||||
@NotNull(message = "工作量不能为空")
|
||||
private Integer workLoad;
|
||||
@NotNull(message = "周期不能为空")
|
||||
private Integer cycle;
|
||||
@NotNull(message = "名字不能为空")
|
||||
private String name;
|
||||
private String description;
|
||||
|
|
|
@ -18,14 +18,12 @@ public class ProjectWorkAndNameVO {
|
|||
private Long projectChildId;
|
||||
private Long principalId;
|
||||
private String principalUser;
|
||||
private Integer cycle;
|
||||
private Integer workLoad;
|
||||
private String name;
|
||||
private String description;
|
||||
private Integer isDelete;
|
||||
private String status;
|
||||
private Timestamp deadLine;
|
||||
private Timestamp beginTime;
|
||||
private Timestamp completeTime;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||
public interface ModuleService {
|
||||
BaseResponse getByProjectId(Integer projectId, HttpServletRequest request);
|
||||
|
||||
BaseResponse getBySysId(Integer sysId, HttpServletRequest request);
|
||||
BaseResponse getBySysId(Long sysId, HttpServletRequest request);
|
||||
|
||||
BaseResponse deleteById(HttpServletRequest request, Long id);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.jsl.oa.services.impl;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.jsl.oa.dao.ProjectDAO;
|
||||
import com.jsl.oa.dao.RoleDAO;
|
||||
import com.jsl.oa.dao.UserDAO;
|
||||
|
@ -21,6 +23,8 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static java.lang.System.*;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
|
@ -29,6 +33,7 @@ public class ModuleServiceImpl implements ModuleService {
|
|||
private final ModuleMapper moduleMapper;
|
||||
private final UserDAO userDAO;
|
||||
private final RoleDAO roleDAO;
|
||||
private final Gson gson;
|
||||
|
||||
@Override
|
||||
public BaseResponse getByProjectId(Integer projectId, HttpServletRequest request) {
|
||||
|
@ -48,21 +53,28 @@ public class ModuleServiceImpl implements ModuleService {
|
|||
for (ProjectChildDO projectWorkDO : projectWorkDOList) {
|
||||
ProjectChildGetVO projectWorkAndNameVO = new ProjectChildGetVO();
|
||||
Processing.copyProperties(projectWorkDO, projectWorkAndNameVO);
|
||||
projectWorkAndNameVO.setPrincipalName(userDAO.getUserById(projectWorkDO.getPrincipalId()).getUsername());
|
||||
//描述转换,负责人名字转换
|
||||
JsonObject jsonObject = gson.fromJson(projectWorkDO.getDescription(), JsonObject.class);
|
||||
projectWorkAndNameVO.setDescription(jsonObject.get("description").getAsString());
|
||||
if (projectWorkDO.getPrincipalId() != null) {
|
||||
projectWorkAndNameVO
|
||||
.setPrincipalName(userDAO.getUserById(projectWorkDO.getPrincipalId()).getUsername());
|
||||
}
|
||||
projectWorkAndNameVOS.add(projectWorkAndNameVO);
|
||||
}
|
||||
return ResultUtil.success(projectWorkAndNameVOS);
|
||||
}
|
||||
|
||||
@SuppressWarnings("checkstyle:Regexp")
|
||||
@Override
|
||||
public BaseResponse getBySysId(Integer sysId, HttpServletRequest request) {
|
||||
public BaseResponse getBySysId(Long sysId, HttpServletRequest request) {
|
||||
log.info("SysService");
|
||||
//获取用户id
|
||||
Long userId = Processing.getAuthHeaderToUserId(request);
|
||||
//获取子系统负责人id
|
||||
Long pid = moduleMapper.getPidBySysid(sysId);
|
||||
Long pid = moduleMapper.getPidBySysid(sysId.intValue());
|
||||
//获取项目负责人id
|
||||
Long prid = moduleMapper.getPridBySysyid(sysId);
|
||||
Long prid = moduleMapper.getPridBySysyid(sysId.intValue());
|
||||
//判断是否是子系统/项目负责人
|
||||
int is = 1;
|
||||
if (!pid.equals(userId) && !prid.equals(userId)) {
|
||||
|
@ -70,13 +82,19 @@ public class ModuleServiceImpl implements ModuleService {
|
|||
}
|
||||
|
||||
List<ProjectModuleDO> projectWorkDOList = moduleMapper.getBySysId(sysId, userId, is);
|
||||
out.println(projectWorkDOList.size());
|
||||
// 封装VO类
|
||||
List<ProjectWorkAndNameVO> projectWorkAndNameVOS = new ArrayList<>();
|
||||
for (ProjectModuleDO projectWorkDO : projectWorkDOList) {
|
||||
ProjectWorkAndNameVO projectWorkAndNameVO = new ProjectWorkAndNameVO();
|
||||
Processing.copyProperties(projectWorkDO, projectWorkAndNameVO);
|
||||
// 添加负责人和子系统名称
|
||||
projectWorkAndNameVO.setPrincipalUser(userDAO.getUserById(projectWorkDO.getPrincipalId()).getUsername());
|
||||
//描述转换,负责人名字转换
|
||||
JsonObject jsonObject = gson.fromJson(projectWorkDO.getDescription(), JsonObject.class);
|
||||
projectWorkAndNameVO.setDescription(jsonObject.get("description").getAsString());
|
||||
if (projectWorkDO.getPrincipalId() != null) {
|
||||
projectWorkAndNameVO
|
||||
.setPrincipalUser(userDAO.getUserById(projectWorkDO.getPrincipalId()).getUsername());
|
||||
}
|
||||
projectWorkAndNameVOS.add(projectWorkAndNameVO);
|
||||
}
|
||||
return ResultUtil.success(projectWorkAndNameVOS);
|
||||
|
|
|
@ -2,7 +2,7 @@ create table oa_project
|
|||
(
|
||||
id bigint unsigned auto_increment comment '项目id'
|
||||
primary key,
|
||||
name varchar(255) not null comment '项目名称',
|
||||
name varchar(255) not null unique comment '项目名称',
|
||||
principal_id bigint unsigned not null comment '项目负责人',
|
||||
description json null comment '项目描述(技术选择,描述)',
|
||||
tags json null comment '项目标签(项目类型:web,大数据等)',
|
||||
|
|
|
@ -13,6 +13,8 @@ create table oa_project_child
|
|||
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
updated_at timestamp null comment '更新时间',
|
||||
is_delete tinyint(1) default 0 not null comment '项目是否删除',
|
||||
dead_line timestamp not null comment '子模块的截止时间',
|
||||
status varchar(8) default 'progress' not null comment '模块状态(draft: 草稿,progress: 进行,pause: 暂停,abnormal: 异常,complete: 完成)',
|
||||
constraint oa_project_child_oa_user_id_fk
|
||||
foreign key (principal_id) references oa_user (id)
|
||||
on update cascade
|
||||
|
|
|
@ -6,14 +6,17 @@ create table oa_project_modules
|
|||
name varchar(100) not null comment '模块名称',
|
||||
principal_id bigint unsigned not null comment '模块负责人',
|
||||
description json null comment '项目描述(技术选择,描述)',
|
||||
cycle int unsigned null comment '模块周期',
|
||||
cycle int unsigned not null comment '项目周期',
|
||||
work_load int unsigned default '1' not null comment '工作量(人天)',
|
||||
complete_time datetime null comment '完成时间',
|
||||
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
updated_at timestamp null comment '更新时间',
|
||||
is_delete tinyint(1) default 0 not null comment '项目是否删除',
|
||||
dead_line timestamp not null comment '子模块的截止时间',
|
||||
status varchar(8) default 'progress' not null comment '模块状态(draft: 草稿,progress: 进行,pause: 暂停,abnormal: 异常,complete: 完成)',
|
||||
constraint oa_project_modules_oa_user_id_fk
|
||||
foreign key (principal_id) references oa_user (id)
|
||||
on update cascade
|
||||
)
|
||||
comment '模块表';
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user