Compare commits

..

6 Commits

Author SHA1 Message Date
80c7da422f Merge pull request 'bug:子模块子系统查询,添加bug修复' (#30) from feature-jie into develop
Reviewed-on: #30
Reviewed-by: 筱锋xiao_lfeng <gm@x-lf.cn>
2024-04-19 19:15:34 +08:00
75d9435911
fix(业务): 权限修改
All checks were successful
代码检查 / 代码检查 (pull_request) Successful in 16s
对于误修改部分进行补丁
2024-04-19 19:12:26 +08:00
176yunxuan
a4aa3bd939 bug:子模块子系统查询和添加bug修复
All checks were successful
代码检查 / 代码检查 (pull_request) Successful in 19s
2024-04-19 19:10:01 +08:00
176yunxuan
50050f820f bug:子模块子系统查询和添加bug修复
All checks were successful
代码检查 / 代码检查 (pull_request) Successful in 3m47s
2024-04-19 18:41:36 +08:00
176yunxuan
00938a07f9 Merge branch 'develop' into feature-jie 2024-04-19 18:36:15 +08:00
176yunxuan
1e46fe8476 fix:子模块返回 2024-04-19 13:18:39 +08:00
11 changed files with 41 additions and 23 deletions

View File

@ -44,7 +44,7 @@ public class ModuleController {
* @return 子模块列表 * @return 子模块列表
*/ */
@GetMapping("/module/get/min") @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); return moduleService.getBySysId(sysId, request);
} }

View File

@ -15,7 +15,7 @@ public interface ModuleMapper {
List<ProjectChildDO> getByProjectId(Integer projectId, Long userId, int is); 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}") @Select("select principal_id from organize_oa.oa_project where id=#{projectId}")
Long getPidByProjectid(Integer projectId); Long getPidByProjectid(Integer projectId);

View File

@ -31,9 +31,9 @@ public interface ProjectMapper {
void projectWorkAdd(ProjectChildAddVO projectChildAddVO); void projectWorkAdd(ProjectChildAddVO projectChildAddVO);
@Insert("insert into organize_oa.oa_project_modules (project_child_id, name, principal_id," @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}," + "value (#{projectChildId},#{name},#{principalId},#{workLoad},"
+ "#{description},#{status},#{deadLine})") + "#{description},#{status},#{deadLine},#{cycle})")
void projectModuleAdd(ProjectModuleAddVO projectModuleAddVO); void projectModuleAdd(ProjectModuleAddVO projectModuleAddVO);
void projectEdit(ProjectDO projectEdit); void projectEdit(ProjectDO projectEdit);

View File

@ -13,6 +13,7 @@ public class ProjectModuleDO {
private Long id; private Long id;
private Long projectChildId; private Long projectChildId;
private Long principalId; private Long principalId;
private Integer cycle;
private Integer workLoad; private Integer workLoad;
private String description; private String description;
private String name; private String name;

View File

@ -16,6 +16,8 @@ public class ProjectModuleAddVO {
private Long principalId; private Long principalId;
@NotNull(message = "工作量不能为空") @NotNull(message = "工作量不能为空")
private Integer workLoad; private Integer workLoad;
@NotNull(message = "周期不能为空")
private Integer cycle;
@NotNull(message = "名字不能为空") @NotNull(message = "名字不能为空")
private String name; private String name;
private String description; private String description;

View File

@ -15,7 +15,6 @@ import java.sql.Timestamp;
public class ProjectWorkAndNameVO { public class ProjectWorkAndNameVO {
private Long id; private Long id;
private String childSystemName;
private Long projectChildId; private Long projectChildId;
private Long principalId; private Long principalId;
private String principalUser; private String principalUser;
@ -23,11 +22,8 @@ public class ProjectWorkAndNameVO {
private Integer workLoad; private Integer workLoad;
private String name; private String name;
private String description; private String description;
private Integer isDelete;
private String status; private String status;
private Timestamp deadLine; private Timestamp deadLine;
private Timestamp beginTime;
private Timestamp completeTime;
} }

View File

@ -8,7 +8,7 @@ import javax.servlet.http.HttpServletRequest;
public interface ModuleService { public interface ModuleService {
BaseResponse getByProjectId(Integer projectId, HttpServletRequest request); BaseResponse getByProjectId(Integer projectId, HttpServletRequest request);
BaseResponse getBySysId(Integer sysId, HttpServletRequest request); BaseResponse getBySysId(Long sysId, HttpServletRequest request);
BaseResponse deleteById(HttpServletRequest request, Long id); BaseResponse deleteById(HttpServletRequest request, Long id);
} }

View File

@ -1,5 +1,7 @@
package com.jsl.oa.services.impl; 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.ProjectDAO;
import com.jsl.oa.dao.RoleDAO; import com.jsl.oa.dao.RoleDAO;
import com.jsl.oa.dao.UserDAO; import com.jsl.oa.dao.UserDAO;
@ -21,6 +23,8 @@ import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import static java.lang.System.*;
@Slf4j @Slf4j
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@ -29,6 +33,7 @@ public class ModuleServiceImpl implements ModuleService {
private final ModuleMapper moduleMapper; private final ModuleMapper moduleMapper;
private final UserDAO userDAO; private final UserDAO userDAO;
private final RoleDAO roleDAO; private final RoleDAO roleDAO;
private final Gson gson;
@Override @Override
public BaseResponse getByProjectId(Integer projectId, HttpServletRequest request) { public BaseResponse getByProjectId(Integer projectId, HttpServletRequest request) {
@ -48,21 +53,28 @@ public class ModuleServiceImpl implements ModuleService {
for (ProjectChildDO projectWorkDO : projectWorkDOList) { for (ProjectChildDO projectWorkDO : projectWorkDOList) {
ProjectChildGetVO projectWorkAndNameVO = new ProjectChildGetVO(); ProjectChildGetVO projectWorkAndNameVO = new ProjectChildGetVO();
Processing.copyProperties(projectWorkDO, projectWorkAndNameVO); 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); projectWorkAndNameVOS.add(projectWorkAndNameVO);
} }
return ResultUtil.success(projectWorkAndNameVOS); return ResultUtil.success(projectWorkAndNameVOS);
} }
@SuppressWarnings("checkstyle:Regexp")
@Override @Override
public BaseResponse getBySysId(Integer sysId, HttpServletRequest request) { public BaseResponse getBySysId(Long sysId, HttpServletRequest request) {
log.info("SysService"); log.info("SysService");
//获取用户id //获取用户id
Long userId = Processing.getAuthHeaderToUserId(request); Long userId = Processing.getAuthHeaderToUserId(request);
//获取子系统负责人id //获取子系统负责人id
Long pid = moduleMapper.getPidBySysid(sysId); Long pid = moduleMapper.getPidBySysid(sysId.intValue());
//获取项目负责人id //获取项目负责人id
Long prid = moduleMapper.getPridBySysyid(sysId); Long prid = moduleMapper.getPridBySysyid(sysId.intValue());
//判断是否是子系统/项目负责人 //判断是否是子系统/项目负责人
int is = 1; int is = 1;
if (!pid.equals(userId) && !prid.equals(userId)) { if (!pid.equals(userId) && !prid.equals(userId)) {
@ -70,18 +82,20 @@ public class ModuleServiceImpl implements ModuleService {
} }
List<ProjectModuleDO> projectWorkDOList = moduleMapper.getBySysId(sysId, userId, is); List<ProjectModuleDO> projectWorkDOList = moduleMapper.getBySysId(sysId, userId, is);
out.println(projectWorkDOList.size());
// 封装VO类 // 封装VO类
List<ProjectWorkAndNameVO> projectWorkAndNameVOS = new ArrayList<>(); List<ProjectWorkAndNameVO> projectWorkAndNameVOS = new ArrayList<>();
for (ProjectModuleDO projectWorkDO : projectWorkDOList) { for (ProjectModuleDO projectWorkDO : projectWorkDOList) {
ProjectWorkAndNameVO projectWorkAndNameVO = new ProjectWorkAndNameVO(); ProjectWorkAndNameVO projectWorkAndNameVO = new ProjectWorkAndNameVO();
Processing.copyProperties(projectWorkDO, projectWorkAndNameVO); Processing.copyProperties(projectWorkDO, projectWorkAndNameVO);
// 添加负责人和子系统名称 //描述转换负责人名字转换
projectWorkAndNameVO. JsonObject jsonObject = gson.fromJson(projectWorkDO.getDescription(), JsonObject.class);
setChildSystemName(projectDAO.getProjectWorkerById(projectWorkDO.getProjectChildId()).getName()) projectWorkAndNameVO.setDescription(jsonObject.get("description").getAsString());
.setPrincipalUser(userDAO.getUserById(projectWorkDO.getPrincipalId()).getUsername()); if (projectWorkDO.getPrincipalId() != null) {
projectWorkAndNameVO
.setPrincipalUser(userDAO.getUserById(projectWorkDO.getPrincipalId()).getUsername());
}
projectWorkAndNameVOS.add(projectWorkAndNameVO); projectWorkAndNameVOS.add(projectWorkAndNameVO);
} }
return ResultUtil.success(projectWorkAndNameVOS); return ResultUtil.success(projectWorkAndNameVOS);
} }

View File

@ -2,7 +2,7 @@ create table oa_project
( (
id bigint unsigned auto_increment comment '项目id' id bigint unsigned auto_increment comment '项目id'
primary key, primary key,
name varchar(255) not null comment '项目名称', name varchar(255) not null unique comment '项目名称',
principal_id bigint unsigned not null comment '项目负责人', principal_id bigint unsigned not null comment '项目负责人',
description json null comment '项目描述(技术选择,描述)', description json null comment '项目描述(技术选择,描述)',
tags json null comment '项目标签项目类型web大数据等', tags json null comment '项目标签项目类型web大数据等',

View File

@ -6,13 +6,15 @@ create table oa_project_child
name varchar(100) not null comment '项目名称', name varchar(100) not null comment '项目名称',
principal_id bigint unsigned not null comment '项目负责人', principal_id bigint unsigned not null comment '项目负责人',
description json null comment '项目描述(技术选择,描述)', description json null comment '项目描述(技术选择,描述)',
cycle int unsigned not null comment '项目周期', cycle int unsigned not null comment '系统周期',
work_load int unsigned default '1' not null comment '工作量(人天)', work_load int unsigned default '1' not null comment '工作量(人天)',
files json null comment '子项目文件', files json null comment '子项目文件',
complete_time date null comment '完成时间', complete_time date null comment '完成时间',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间', created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '更新时间', updated_at timestamp null comment '更新时间',
is_delete tinyint(1) default 0 not 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 constraint oa_project_child_oa_user_id_fk
foreign key (principal_id) references oa_user (id) foreign key (principal_id) references oa_user (id)
on update cascade on update cascade

View File

@ -6,14 +6,17 @@ create table oa_project_modules
name varchar(100) not null comment '模块名称', name varchar(100) not null comment '模块名称',
principal_id bigint unsigned not null comment '模块负责人', principal_id bigint unsigned not null comment '模块负责人',
description json 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 '工作量(人天)', work_load int unsigned default '1' not null comment '工作量(人天)',
complete_time datetime null comment '完成时间', complete_time datetime null comment '完成时间',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间', created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '更新时间', updated_at timestamp null comment '更新时间',
is_delete tinyint(1) default 0 not 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 constraint oa_project_modules_oa_user_id_fk
foreign key (principal_id) references oa_user (id) foreign key (principal_id) references oa_user (id)
on update cascade on update cascade
) )
comment '模块表'; comment '模块表';