Compare commits

..

No commits in common. "80c7da422f67ab81bb722ae54da878e4055aa4c8" and "22777ab15948a8741de1c4a88c4396c23987daad" have entirely different histories.

11 changed files with 23 additions and 41 deletions

View File

@ -44,7 +44,7 @@ public class ModuleController {
* @return 子模块列表
*/
@GetMapping("/module/get/min")
public BaseResponse moduleGetBySysId(@RequestParam Long sysId, HttpServletRequest request) {
public BaseResponse moduleGetBySysId(@RequestParam Integer sysId, HttpServletRequest 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<ProjectModuleDO> getBySysId(Long sysId, Long userId, int is);
List<ProjectModuleDO> getBySysId(Integer sysId, Long userId, int is);
@Select("select principal_id from organize_oa.oa_project where id=#{projectId}")
Long getPidByProjectid(Integer projectId);

View File

@ -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,cycle) "
+ " work_load, description, status, dead_line) "
+ "value (#{projectChildId},#{name},#{principalId},#{workLoad},"
+ "#{description},#{status},#{deadLine},#{cycle})")
+ "#{description},#{status},#{deadLine})")
void projectModuleAdd(ProjectModuleAddVO projectModuleAddVO);
void projectEdit(ProjectDO projectEdit);

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,5 @@
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;
@ -23,8 +21,6 @@ import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import static java.lang.System.*;
@Slf4j
@Service
@RequiredArgsConstructor
@ -33,7 +29,6 @@ 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) {
@ -53,28 +48,21 @@ public class ModuleServiceImpl implements ModuleService {
for (ProjectChildDO projectWorkDO : projectWorkDOList) {
ProjectChildGetVO projectWorkAndNameVO = new ProjectChildGetVO();
Processing.copyProperties(projectWorkDO, projectWorkAndNameVO);
//描述转换,负责人名字转换
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());
}
projectWorkAndNameVO.setPrincipalName(userDAO.getUserById(projectWorkDO.getPrincipalId()).getUsername());
projectWorkAndNameVOS.add(projectWorkAndNameVO);
}
return ResultUtil.success(projectWorkAndNameVOS);
}
@SuppressWarnings("checkstyle:Regexp")
@Override
public BaseResponse getBySysId(Long sysId, HttpServletRequest request) {
public BaseResponse getBySysId(Integer sysId, HttpServletRequest request) {
log.info("SysService");
//获取用户id
Long userId = Processing.getAuthHeaderToUserId(request);
//获取子系统负责人id
Long pid = moduleMapper.getPidBySysid(sysId.intValue());
Long pid = moduleMapper.getPidBySysid(sysId);
//获取项目负责人id
Long prid = moduleMapper.getPridBySysyid(sysId.intValue());
Long prid = moduleMapper.getPridBySysyid(sysId);
//判断是否是子系统/项目负责人
int is = 1;
if (!pid.equals(userId) && !prid.equals(userId)) {
@ -82,20 +70,18 @@ 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);
//描述转换负责人名字转换
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());
}
// 添加负责人和子系统名称
projectWorkAndNameVO.
setChildSystemName(projectDAO.getProjectWorkerById(projectWorkDO.getProjectChildId()).getName())
.setPrincipalUser(userDAO.getUserById(projectWorkDO.getPrincipalId()).getUsername());
projectWorkAndNameVOS.add(projectWorkAndNameVO);
}
return ResultUtil.success(projectWorkAndNameVOS);
}

View File

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

View File

@ -6,15 +6,13 @@ create table oa_project_child
name varchar(100) not null comment '项目名称',
principal_id bigint unsigned not 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 '工作量(人天)',
files json null comment '子项目文件',
complete_time date 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_child_oa_user_id_fk
foreign key (principal_id) references oa_user (id)
on update cascade

View File

@ -6,17 +6,14 @@ 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 not null comment '模块周期',
cycle int unsigned 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 '模块表';
comment '模块表';