From ab1732c5cfe515482d5543a6285fd18858dc1cfb Mon Sep 17 00:00:00 2001 From: wish Date: Sat, 15 Jul 2023 11:54:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E9=A1=B9=E7=9B=AE=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E7=95=8C=E9=9D=A2-=E6=B7=BB=E5=8A=A0=E6=9F=A5=E8=AF=A2bug?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=EF=BC=8C=E5=B0=81=E8=A3=85dto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo/bugx/service/IBugxService.java | 19 +- .../bugx/service/impl/BugxServiceImpl.java | 204 +++++++++++++++--- .../service/impl/FunctionxServiceImpl.java | 94 +++++++- .../modules/demo/newlayout/dto/BugDto.java | 41 ++++ .../demo/newlayout/dto/FunctionDto.java | 44 +++- .../modules/demo/newlayout/dto/ModuleDto.java | 36 ++++ .../demo/newlayout/dto/ProjectDto.java | 10 + .../modules/demo/newlayout/dto/RuleDto.java | 43 ++++ .../rulex/service/impl/RulexServiceImpl.java | 90 +++++++- .../service/impl/ModulexServiceImpl.java | 90 +++++++- .../service/impl/ProjectxServiceImpl.java | 26 +++ 11 files changed, 647 insertions(+), 50 deletions(-) create mode 100644 jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/BugDto.java diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/service/IBugxService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/service/IBugxService.java index 2a173c9..87e082a 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/service/IBugxService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/service/IBugxService.java @@ -1,20 +1,29 @@ package org.jeecg.modules.demo.bugx.service; +import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.common.api.vo.Result; import org.jeecg.modules.demo.bugx.entity.Bugx; -import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.demo.functionx.entity.Functionx; +import org.jeecg.modules.demo.newlayout.dto.BugDto; +import org.jeecg.modules.demo.rulex.entity.Rulex; + +import java.util.List; /** * @Description: BUG管理 * @Author: jeecg-boot - * @Date: 2023-04-11 + * @Date: 2023-04-11 * @Version: V1.0 */ public interface IBugxService extends IService { - String sort(String code); + String sort(String code); + + Result shenhe(String id); + + Result bohui(String id); - Result shenhe(String id); + List queryBugDtoListByFunctionId(Functionx functionx); - Result bohui(String id); + List queryBugDtoListByRuleId(Rulex rulex); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/service/impl/BugxServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/service/impl/BugxServiceImpl.java index 52c2106..74a28e9 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/service/impl/BugxServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/service/impl/BugxServiceImpl.java @@ -1,57 +1,197 @@ package org.jeecg.modules.demo.bugx.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.vo.DictModel; import org.jeecg.modules.demo.bugx.entity.Bugx; import org.jeecg.modules.demo.bugx.mapper.BugxMapper; import org.jeecg.modules.demo.bugx.service.IBugxService; +import org.jeecg.modules.demo.functionx.entity.Functionx; +import org.jeecg.modules.demo.functionx.service.IFunctionxService; +import org.jeecg.modules.demo.newlayout.dto.BugDto; +import org.jeecg.modules.demo.rulex.entity.Rulex; +import org.jeecg.modules.demo.rulex.service.IRulexService; +import org.jeecg.modules.modulex.entity.Modulex; +import org.jeecg.modules.modulex.service.IModulexService; +import org.jeecg.modules.projectx.entity.Projectx; +import org.jeecg.modules.projectx.service.IProjectxService; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.system.service.ISysDictService; +import org.jeecg.modules.system.service.ISysUserService; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; - -import java.util.Date; +import java.util.*; /** * @Description: BUG管理 * @Author: jeecg-boot - * @Date: 2023-04-11 + * @Date: 2023-04-11 * @Version: V1.0 */ @Service public class BugxServiceImpl extends ServiceImpl implements IBugxService { - @Autowired - BugxMapper bugxMapper; - @Override - public String sort(String code) { - return bugxMapper.sort(code); + @Autowired + BugxMapper bugxMapper; + + @Autowired + private ISysDictService dictService; + + @Autowired + private IProjectxService projectxService; + + @Autowired + private IModulexService modulexService; + + @Autowired + private IFunctionxService functionxService; + + @Autowired + private IRulexService rulexService; + + @Autowired + private ISysUserService sysUserService; + private static final String BUG_TYPE_DICT_CODE = "bug_type"; + private static final String BUG_LEVEL_DICT_CODE = "work_level"; + private static final String BUG_STATUS_DICT_CODE = "bug_status"; + + + @Override + public String sort(String code) { + return bugxMapper.sort(code); + } + + @Override + public Result shenhe(String id) { + Bugx bugx = bugxMapper.selectById(id); + if (bugx.getBugStatus() == 4) { + if (bugx.getRuleId() != null) { + bugxMapper.upRstatus(bugx.getRuleId()); + } else if (bugx.getFunctionId() != null) { + baseMapper.upFstatus(bugx.getFunctionId()); + } else { + baseMapper.upMstatus(bugx.getModuleId()); + } + bugxMapper.shenhe(id, new Date()); + return Result.OK("审核通过!!"); + } else if (bugx.getBugStatus() == 2) { + return Result.error("已审核过!!!"); + } else { + return Result.error("请先提交!!"); } - @Override - public Result shenhe(String id) { - Bugx bugx = bugxMapper.selectById(id); - if(bugx.getBugStatus()==4){ - if(bugx.getRuleId()!=null){ - bugxMapper.upRstatus(bugx.getRuleId()); - }else if(bugx.getFunctionId()!=null){ - baseMapper.upFstatus(bugx.getFunctionId()); - }else { - baseMapper.upMstatus(bugx.getModuleId()); - } - bugxMapper.shenhe(id,new Date()); - return Result.OK("审核通过!!"); - }else if(bugx.getBugStatus()==2){ - return Result.error("已审核过!!!"); - } - else{ - return Result.error("请先提交!!"); - } + } + + @Override + public Result bohui(String id) { + bugxMapper.bohui(id, new Date()); + return Result.OK("驳回!!"); + } + @Override + public List queryBugDtoListByFunctionId(Functionx functionx) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(Bugx::getFunctionId, functionx.getId()); + List bugxList = this.list(wrapper); + List bugDtoList = new ArrayList<>(); + // 将bug转为bugDto + for (Bugx bugx : bugxList) { + BugDto bugDto = new BugDto(); + BeanUtils.copyProperties(bugx, bugDto); + // 设置功能 + bugDto.setFunctionId_dictText(functionx.getFunctionName()); + // 设置规则 + if (!StringUtils.isEmpty(bugDto.getRuleId())) { + Rulex rulex = rulexService.getById(bugDto.getRuleId()); + Optional.ofNullable(rulex).ifPresent(consumer -> { + bugDto.setRuleId_dictText(rulex.getRuleCode()); + }); + } + this.createBugDto(bugDto); + bugDtoList.add(bugDto); } + return bugDtoList; + } - @Override - public Result bohui(String id) { - bugxMapper.bohui(id,new Date()); - return Result.OK("驳回!!"); + @Override + public List queryBugDtoListByRuleId(Rulex rulex) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(Bugx::getRuleId, rulex.getId()); + List bugxList = this.list(wrapper); + List bugDtoList = new ArrayList<>(); + for (Bugx bugx : bugxList) { + BugDto bugDto = new BugDto(); + BeanUtils.copyProperties(bugx, bugDto); + // 设置规则 + bugDto.setRuleId_dictText(rulex.getRuleCode()); + this.createBugDto(bugDto); + //设置功能 + if (!StringUtils.isEmpty(bugDto.getFunctionId())) { + Functionx functionx = functionxService.getById(bugDto.getFunctionId()); + Optional.ofNullable(functionx).ifPresent(consumer -> { + bugDto.setFunctionId_dictText(functionx.getFunctionName()); + }); + } + bugDtoList.add(bugDto); + } + return bugDtoList; + } + + private void createBugDto(BugDto bugDto) { + // 设置bug类型 + List bugTypeList = + dictService.getDictItems(BUG_TYPE_DICT_CODE); + bugTypeList.forEach(type -> { + if (type.getValue().equals(bugDto.getType().toString())) { + bugDto.setType_dictText(type.getText()); + } + }); + // 设置项目 + if (!StringUtils.isEmpty(bugDto.getProjectId())) { + Projectx projectx = projectxService.getById(bugDto.getId()); + Optional.ofNullable(projectx).ifPresent(consumer -> { + bugDto.setProjectId_dictText(projectx.getProjectName()); + }); + } + // 设置责任人 + if (!StringUtils.isEmpty(bugDto.getManagerUsers())) { + String[] users = bugDto.getManagerUsers().split(","); + if (users.length > 0) { + List sysUsers = + sysUserService.listByIds(Arrays.asList(users)); + StringBuilder sb = new StringBuilder(); + sysUsers.forEach(user -> sb.append(user.getRealname()).append(",")); + if (sb.length() > 0) { + bugDto.setManagerUsers_dictText(sb.substring(0, sb.length() - 1)); + } + } + } + // 设置模块 + if (!StringUtils.isEmpty(bugDto.getModuleId())) { + Modulex modulex = modulexService.getById(bugDto.getModuleId()); + Optional.ofNullable(modulex).ifPresent(consumer -> { + bugDto.setModuleId_dictText(modulex.getModuleName()); + }); } + //设置错误级别 + List bugLevelList = + dictService.getDictItems(BUG_LEVEL_DICT_CODE); + bugLevelList.forEach(level -> { + if (level.getValue().equals(bugDto.getBugLevel().toString())) { + bugDto.setBugLevel_dictText(level.getText()); + } + }); + // 设置bug状态 + List bugStatusList = + dictService.getDictItems(BUG_STATUS_DICT_CODE); + bugStatusList.forEach(status -> { + if (status.getValue().equals(bugDto.getBugStatus().toString())) { + bugDto.setBugStatus_dictText(status.getText()); + } + }); + } } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/service/impl/FunctionxServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/service/impl/FunctionxServiceImpl.java index c070cda..a3f5b44 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/service/impl/FunctionxServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/service/impl/FunctionxServiceImpl.java @@ -3,23 +3,32 @@ package org.jeecg.modules.demo.functionx.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.vo.DictModel; +import org.jeecg.modules.demo.bugx.service.IBugxService; import org.jeecg.modules.demo.functiontemplate.entity.FunctionTemplate; import org.jeecg.modules.demo.functiontemplate.mapper.FunctionTemplateMapper; import org.jeecg.modules.demo.functionx.entity.Functionx; import org.jeecg.modules.demo.functionx.mapper.FunctionxMapper; import org.jeecg.modules.demo.functionx.service.IFunctionxService; +import org.jeecg.modules.demo.newlayout.dto.BugDto; import org.jeecg.modules.demo.newlayout.dto.FunctionDto; import org.jeecg.modules.demo.newlayout.dto.RuleDto; import org.jeecg.modules.demo.rulex.service.IRulexService; import org.jeecg.modules.modulex.entity.Modulex; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.system.service.ISysDictService; +import org.jeecg.modules.system.service.ISysUserService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Arrays; import java.util.Date; import java.util.List; +import java.util.stream.Collectors; /** * @Description: 功能管理 @@ -37,6 +46,24 @@ public class FunctionxServiceImpl extends ServiceImpl queryFunctionDtoListByModuleId(Modulex modulex) { - LambdaQueryWrapper functionWrapper = new LambdaQueryWrapper<>(); - functionWrapper.eq(Functionx::getModuleId, modulex.getId()); - List functionxList = this.list(functionWrapper); + List functionxList = this.queryFunctionListByModuleId(modulex); List functionDtoList = new ArrayList<>(); functionxList.forEach(functionx -> { FunctionDto functionDto = new FunctionDto(); BeanUtils.copyProperties(functionx, functionDto); + // 查询对应模块 + functionDto.setModuleId_dictText(modulex.getModuleName()); + // 设置功能类型 + List funTypeList = + dictService.getDictItems(FUNCTION_TYPE_DICT_CODE); + funTypeList.forEach(type -> { + if (type.getValue().equals(functionDto.getFunctionType().toString())) { + functionDto.setFunctionType_dictText(type.getText()); + } + }); + // 设置责任人 + if (!StringUtils.isEmpty(functionDto.getManagerUsers())) { + String[] users = functionDto.getManagerUsers().split(","); + if (users.length > 0) { + List sysUsers = + sysUserService.listByIds(Arrays.asList(users)); + StringBuilder sb = new StringBuilder(); + sysUsers.forEach(user -> sb.append(user.getRealname()).append(",")); + if (sb.length() > 0) { + functionDto.setManagerUsers_dictText(sb.substring(0, sb.length() - 1)); + } + } + } + // 设置任务等级 + List worlLevelList = + dictService.getDictItems(WORK_LEVEL_DICT_CODE); + worlLevelList.forEach(level -> { + if (level.getValue().equals(functionDto.getWorkLevel().toString())) { + functionDto.setWorkLevel_dictText(level.getText()); + } + }); + // 设置任务状态 + List workStatusList = + dictService.getDictItems(WORK_STATUS_DICT_CODE); + workStatusList.forEach(status -> { + if (status.getValue().equals(functionDto.getWorkStatus().toString())) { + functionDto.setWorkStatus_dictText(status.getText()); + } + }); + // 设置功能状态 + List statusList = + dictService.getDictItems(STATUS_DICT_CODE); + statusList.forEach(status -> { + if (status.getValue().equals(functionDto.getStatus().toString())) { + functionDto.setStatus_dictText(status.getText()); + } + }); + // 设置版本状态 + List versionStatusList = + dictService.getDictItems(VERSION_STATUS_CODE); + versionStatusList.forEach(versionStatus -> { + if (versionStatus.getValue().equals(functionDto.getVerisonStatus().toString())) { + functionDto.setVersionStatus_dictText(versionStatus.getText()); + } + }); // 查询该功能下所有的规则 List ruleDtoList = rulexService.queryRuleDtoListByFunctionId(functionx); functionDto.setRuleDtoList(ruleDtoList); + // 查询该功能下所有的bug + List bugDtoList = + bugxService.queryBugDtoListByFunctionId(functionDto); + // 功能对应的bug_type为2 + bugDtoList = bugDtoList.stream().filter(bugDto -> + bugDto.getType().equals(2)).collect(Collectors.toList()); + functionDto.setBugDtoList(bugDtoList); + functionDtoList.add(functionDto); }); return functionDtoList; diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/BugDto.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/BugDto.java new file mode 100644 index 0000000..0794e3a --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/BugDto.java @@ -0,0 +1,41 @@ +package org.jeecg.modules.demo.newlayout.dto; + +import lombok.Data; +import org.jeecg.modules.demo.bugx.entity.Bugx; + +@Data +public class BugDto extends Bugx { + /** + * bug类型 + */ + private String type_dictText; + /** + * 项目 + */ + private String projectId_dictText; + /** + * 模块 + */ + private String moduleId_dictText; + /** + * 功能 + */ + private String functionId_dictText; + /** + * 规则 + */ + private String ruleId_dictText; + /** + * 错误级别 + */ + private String bugLevel_dictText; + /** + * bug状态 + */ + private String bugStatus_dictText; + + /** + * 责任人 + */ + private String managerUsers_dictText; +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/FunctionDto.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/FunctionDto.java index 8c2c2dc..48247e1 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/FunctionDto.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/FunctionDto.java @@ -17,5 +17,47 @@ public class FunctionDto extends Functionx { /** * 规则dto列表 */ - List ruleDtoList; + private List ruleDtoList; + + + /** + * 对应模块 + */ + private String moduleId_dictText; + + /** + * 功能类型 + */ + private String functionType_dictText; + + /** + * 责任人 + */ + private String managerUsers_dictText; + + + /** + * 任务等级 + */ + private String workLevel_dictText; + + /** + * 任务状态 + */ + private String workStatus_dictText; + + /** + * 功能状态 + */ + private String status_dictText; + + /** + * 版本状态 + */ + private String versionStatus_dictText; + + /** + * bug列表 + */ + private List bugDtoList; } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/ModuleDto.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/ModuleDto.java index 20f3df2..eac6347 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/ModuleDto.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/ModuleDto.java @@ -18,4 +18,40 @@ public class ModuleDto extends Modulex { * 功能dto列表 */ List functionDtoList; + + /** + * 上级模块 + */ + private String pid_dictText; + + /** + * 项目名称 + */ + private String projectId_dictText; + + /** + * 任务等级 + */ + private String workLevel_dictText; + + /** + * 任务状态 + */ + private String workStatus_dictText; + + /** + * 关联实体 + */ + private String relatedBean_dictText; + + + /** + * 模块状态 + */ + private String status_dictText; + + /** + * 版本状态 + */ + private String versionStatus_dictText; } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/ProjectDto.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/ProjectDto.java index 43125c3..ec98dcf 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/ProjectDto.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/ProjectDto.java @@ -18,4 +18,14 @@ public class ProjectDto extends Projectx { * 模块dto列表. */ List moduleDtoList; + + /** + * 项目状态 + */ + private String status_dictText; + + /** + * 项目复制来源 + */ + private String sourceProject_dictText; } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/RuleDto.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/RuleDto.java index d5cf34d..a8b5c23 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/RuleDto.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/RuleDto.java @@ -3,6 +3,49 @@ package org.jeecg.modules.demo.newlayout.dto; import lombok.Data; import org.jeecg.modules.demo.rulex.entity.Rulex; +import java.util.List; + @Data public class RuleDto extends Rulex { + + /** + * 对应模块 + */ + private String moduleId_dictText; + + + /** + * 对应功能 + */ + private String functionId_dictText; + + /** + * 对应字段 + */ + private String tableId_dictText; + + /** + * 任务等级 + */ + private String workLevel_dictText; + + /** + * 任务状态 + */ + private String workStatus_dictText; + + /** + * 规则状态 + */ + private String status_dictText; + + /** + * 版本状态 + */ + private String versionStatus_dictText; + + /** + * bug列表 + */ + private List bugDtoList; } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/service/impl/RulexServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/service/impl/RulexServiceImpl.java index a55688d..2f282e8 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/service/impl/RulexServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/service/impl/RulexServiceImpl.java @@ -1,20 +1,30 @@ package org.jeecg.modules.demo.rulex.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.vo.DictModel; +import org.jeecg.modules.demo.bugx.service.IBugxService; import org.jeecg.modules.demo.functionx.entity.Functionx; +import org.jeecg.modules.demo.newlayout.dto.BugDto; import org.jeecg.modules.demo.newlayout.dto.RuleDto; import org.jeecg.modules.demo.rulex.entity.Rulex; import org.jeecg.modules.demo.rulex.mapper.RulexMapper; import org.jeecg.modules.demo.rulex.service.IRulexService; +import org.jeecg.modules.modulex.entity.Modulex; +import org.jeecg.modules.modulex.service.IModulexService; +import org.jeecg.modules.system.service.ISysDictService; +import org.jeecg.modules.tablex.entity.Tablex; +import org.jeecg.modules.tablex.service.ITablexService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.util.StringUtils; import java.util.ArrayList; import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; /** * @Description: 规则管理 @@ -28,6 +38,23 @@ public class RulexServiceImpl extends ServiceImpl implements @Autowired RulexMapper rulexMapper; + @Autowired + private IModulexService modulexService; + + @Autowired + private ITablexService tablexService; + + @Autowired + private ISysDictService dictService; + + @Autowired + private IBugxService bugxService; + + private static final String WORK_STATUS_DICT_CODE = "work_status"; + private static final String WORK_LEVEL_DICT_CODE = "work_level"; + private static final String VERSION_STATUS_CODE = "verison_status"; + private static final String STATUS_DICT_CODE = "status"; + @Override public Result sort(String id) { String sort = rulexMapper.sort(id); @@ -60,14 +87,67 @@ public class RulexServiceImpl extends ServiceImpl implements @Override public List queryRuleDtoListByFunctionId(Functionx functionx) { - LambdaQueryWrapper ruleWrapper = new LambdaQueryWrapper<>(); - ruleWrapper.eq(Rulex::getFunctionId, functionx.getId()); - List rulexList = this.list(ruleWrapper); + List rulexList = this.queryRuleListByFunctionId(functionx); // 将rule封装为ruleDto List ruleDtoList = new ArrayList<>(); for (Rulex rulex : rulexList) { RuleDto ruleDto = new RuleDto(); BeanUtils.copyProperties(rulex, ruleDto); + // 设置对应模块 + if (!StringUtils.isEmpty(ruleDto.getModuleId())) { + Modulex modulex = modulexService.getById(ruleDto.getModuleId()); + Optional.ofNullable(modulex).ifPresent(consumer -> { + ruleDto.setModuleId_dictText(modulex.getModuleName()); + }); + } + // 设置对应功能 + ruleDto.setFunctionId_dictText(functionx.getFunctionName()); + // 设置对应字段 + if (!StringUtils.isEmpty(ruleDto.getTableId())) { + Tablex tablex = tablexService.getById(ruleDto.getTableId()); + Optional.ofNullable(tablex).ifPresent(consumer -> { + ruleDto.setTableId_dictText(tablex.getTableName()); + }); + } + // 设置任务等级 + List worlLevelList = + dictService.getDictItems(WORK_LEVEL_DICT_CODE); + worlLevelList.forEach(level -> { + if (level.getValue().equals(ruleDto.getWorkLevel().toString())) { + ruleDto.setWorkLevel_dictText(level.getText()); + } + }); + // 设置任务状态 + List workStatusList = + dictService.getDictItems(WORK_STATUS_DICT_CODE); + workStatusList.forEach(status -> { + if (status.getValue().equals(ruleDto.getWorkStatus().toString())) { + ruleDto.setWorkStatus_dictText(status.getText()); + } + }); + // 设置功能状态 + List statusList = + dictService.getDictItems(STATUS_DICT_CODE); + statusList.forEach(status -> { + if (status.getValue().equals(ruleDto.getStatus().toString())) { + ruleDto.setStatus_dictText(status.getText()); + } + }); + // 设置版本状态 + List versionStatusList = + dictService.getDictItems(VERSION_STATUS_CODE); + versionStatusList.forEach(versionStatus -> { + if (versionStatus.getValue().equals(ruleDto.getVerisonStatus().toString())) { + ruleDto.setVersionStatus_dictText(versionStatus.getText()); + } + }); + // 设置该规则下所有bug + List bugDtoList = + bugxService.queryBugDtoListByRuleId(ruleDto); + // 规则对应的bug_type为3 + bugDtoList = bugDtoList.stream().filter(bugDto -> + bugDto.getType().equals(3)).collect(Collectors.toList()); + ruleDto.setBugDtoList(bugDtoList); ruleDtoList.add(ruleDto); } return ruleDtoList; diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java index 73857d6..5ffe71d 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java @@ -3,6 +3,7 @@ package org.jeecg.modules.modulex.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.vo.DictModel; import org.jeecg.modules.demo.functionx.entity.Functionx; import org.jeecg.modules.demo.functionx.mapper.FunctionxMapper; import org.jeecg.modules.demo.functionx.service.IFunctionxService; @@ -16,6 +17,9 @@ import org.jeecg.modules.modulex.entity.Modulex; import org.jeecg.modules.modulex.mapper.ModulexMapper; import org.jeecg.modules.modulex.service.IModulexService; import org.jeecg.modules.projectx.entity.Projectx; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.system.service.ISysDictService; +import org.jeecg.modules.system.service.ISysUserService; import org.jeecg.modules.tablex.entity.Tablex; import org.jeecg.modules.tablex.service.ITablexService; import org.springframework.beans.BeanUtils; @@ -23,12 +27,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.ObjectUtils; +import org.springframework.util.StringUtils; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Date; -import java.util.LinkedList; -import java.util.List; +import java.util.*; /** * @Description: 模块管理 @@ -57,6 +59,22 @@ public class ModulexServiceImpl extends ServiceImpl impl @Autowired private IFieldxService iFieldxService; + @Autowired + private ISysDictService dictService; + + @Autowired + private ITablexService tablexService; + + @Autowired + private ISysUserService sysUserService; + + private static final String WORK_STATUS_DICT_CODE = "work_status"; + private static final String WORK_LEVEL_DICT_CODE = "work_level"; + + private static final String STATUS_DICT_CODE = "a_status"; + + private static final String VERSION_STATUS_CODE = "verison_status"; + /** * 得到最大的版本号 */ @@ -249,6 +267,7 @@ public class ModulexServiceImpl extends ServiceImpl impl List modulexList = this.list(moduleWrapper); // 将模块转为dto List moduleDtoList = new ArrayList<>(); + // 开始封装dto中的信息 for (Modulex modulex : modulexList) { ModuleDto moduleDto = new ModuleDto(); BeanUtils.copyProperties(modulex, moduleDto); @@ -256,6 +275,69 @@ public class ModulexServiceImpl extends ServiceImpl impl List functionDtoList = iFunctionxService.queryFunctionDtoListByModuleId(modulex); moduleDto.setFunctionDtoList(functionDtoList); + // 设置上级模块 + if (!StringUtils.isEmpty(moduleDto.getPid())) { + Modulex pid = this.getById(moduleDto.getPid()); + Optional.ofNullable(pid).ifPresent(consumer -> { + moduleDto.setPid_dictText(pid.getModuleName()); + }); + } + // 设置项目名称 + moduleDto.setProjectId_dictText(projectx.getProjectName()); + // 设置任务等级 + List worlLevelList = + dictService.getDictItems(WORK_LEVEL_DICT_CODE); + worlLevelList.forEach(level -> { + if (level.getValue().equals(moduleDto.getWorkLevel().toString())) { + moduleDto.setWorkLevel_dictText(level.getText()); + } + }); + // 设置任务状态 + List workStatusList = + dictService.getDictItems(WORK_STATUS_DICT_CODE); + workStatusList.forEach(status -> { + if (status.getValue().equals(moduleDto.getWorkStatus().toString())) { + moduleDto.setWorkStatus_dictText(status.getText()); + } + }); + // 设置关联实体 + if (!StringUtils.isEmpty(moduleDto.getRelatedBean())) { + Tablex tablex = tablexService.getById(moduleDto.getRelatedBean()); + Optional.ofNullable(tablex).ifPresent(consumer -> { + moduleDto.setRelatedBean_dictText(consumer.getTableName()); + }); + } + // 设置模块状态 + List statusList = + dictService.getDictItems(STATUS_DICT_CODE); + statusList.forEach(status -> { + if (status.getValue().equals(moduleDto.getStatus().toString())) { + moduleDto.setStatus_dictText(status.getText()); + } + }); + // 设置版本状态 + List versionStatusList = + dictService.getDictItems(VERSION_STATUS_CODE); + versionStatusList.forEach(versionStatus -> { + if (versionStatus.getValue().equals(moduleDto.getVerisonStatus().toString())) { + moduleDto.setVersionStatus_dictText(versionStatus.getText()); + } + }); + // 设置责任人 + if (!StringUtils.isEmpty(moduleDto.getManagerUsers())) { + String[] users = moduleDto.getManagerUsers().split(","); + if (users.length > 0) { + List sysUsers = + sysUserService.listByIds(Arrays.asList(users)); + StringBuilder sb = new StringBuilder(); + sysUsers.forEach(user -> { + sb.append(user.getRealname()).append(","); + }); + if (sb.length() > 0) { + moduleDto.setManagerUsers_dictText(sb.substring(0, sb.length() - 1)); + } + } + } moduleDtoList.add(moduleDto); } return moduleDtoList; diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/projectx/service/impl/ProjectxServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/projectx/service/impl/ProjectxServiceImpl.java index c739c84..b88e4fd 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/projectx/service/impl/ProjectxServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/projectx/service/impl/ProjectxServiceImpl.java @@ -3,12 +3,14 @@ package org.jeecg.modules.projectx.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.common.system.vo.DictModel; import org.jeecg.modules.demo.newlayout.dto.ModuleDto; import org.jeecg.modules.demo.newlayout.dto.ProjectDto; import org.jeecg.modules.modulex.service.IModulexService; import org.jeecg.modules.projectx.entity.Projectx; import org.jeecg.modules.projectx.mapper.ProjectxMapper; import org.jeecg.modules.projectx.service.IProjectxService; +import org.jeecg.modules.system.service.ISysDictService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -16,6 +18,7 @@ import org.springframework.util.StringUtils; import java.util.ArrayList; import java.util.List; +import java.util.Optional; /** * @Description: 项目管理 管理项目基本信息 @@ -30,6 +33,11 @@ public class ProjectxServiceImpl extends ServiceImpl @Autowired private IModulexService modulexService; + @Autowired + private ISysDictService dictService; + + private static final String PROJECT_STATUS_DICT_CODE = "project_status"; + @Override public List listDto(QueryWrapper queryWrapper) { List list = this.list(queryWrapper); @@ -49,10 +57,28 @@ public class ProjectxServiceImpl extends ServiceImpl Projectx project = this.getById(projectx.getId()); // 将当前项目封装为dto ProjectDto projectDto = new ProjectDto(); + // 开始封装dto中的信息 BeanUtils.copyProperties(project, projectDto); // 查询当前项目的模块 List moduleDtoList = modulexService.queryDtoListByProId(project); projectDto.setModuleDtoList(moduleDtoList); + // 获取字典内容列表--项目状态 + List projectStatusList = + dictService.getDictItems(PROJECT_STATUS_DICT_CODE); + // 设置项目状态 + projectStatusList.forEach(status -> { + if (status.getValue().equals(projectDto.getProjectStatus().toString())) { + projectDto.setStatus_dictText(status.getText()); + } + }); + // 设置复制来源 + if (!StringUtils.isEmpty(projectDto.getSourceProjectId())) { + Projectx sourceProject = this.getById(projectDto.getSourceProjectId()); + Optional.ofNullable(sourceProject).ifPresent(consumer -> { + projectDto.setSourceProject_dictText(consumer.getProjectName()); + }); + + } return projectDto; }