diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/service/IFunctionxService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/service/IFunctionxService.java index 75e572a..5934a73 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/service/IFunctionxService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/service/IFunctionxService.java @@ -3,6 +3,7 @@ package org.jeecg.modules.demo.functionx.service; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.common.api.vo.Result; import org.jeecg.modules.demo.functionx.entity.Functionx; +import org.jeecg.modules.demo.newlayout.dto.FunctionDto; import org.jeecg.modules.modulex.entity.Modulex; import java.util.List; @@ -39,4 +40,5 @@ public interface IFunctionxService extends IService { */ List queryFunctionListByModuleId(Modulex modulex); + List queryFunctionDtoListByModuleId(Modulex modulex); } 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 052a8a5..c070cda 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 @@ -8,11 +8,16 @@ 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.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.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -29,6 +34,8 @@ public class FunctionxServiceImpl extends ServiceImpl queryFunctionDtoListByModuleId(Modulex modulex) { + LambdaQueryWrapper functionWrapper = new LambdaQueryWrapper<>(); + functionWrapper.eq(Functionx::getModuleId, modulex.getId()); + List functionxList = this.list(functionWrapper); + List functionDtoList = new ArrayList<>(); + functionxList.forEach(functionx -> { + FunctionDto functionDto = new FunctionDto(); + BeanUtils.copyProperties(functionx, functionDto); + // 查询该功能下所有的规则 + List ruleDtoList = + rulexService.queryRuleDtoListByFunctionId(functionx); + functionDto.setRuleDtoList(ruleDtoList); + functionDtoList.add(functionDto); + }); + return functionDtoList; + } } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/controller/NewProjectController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/controller/NewProjectController.java new file mode 100644 index 0000000..676048a --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/controller/NewProjectController.java @@ -0,0 +1,86 @@ +package org.jeecg.modules.demo.newlayout.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.modules.demo.newlayout.dto.ProjectDto; +import org.jeecg.modules.projectx.entity.Projectx; +import org.jeecg.modules.projectx.service.IProjectxService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 新项目控制器. + * + * @author wish + * @version 1.0.0 + * @date 2023/07/10 + */ +@Slf4j +@RestController +@RequestMapping("/newprojectx/newprojectx") +public class NewProjectController { + @Autowired + private IProjectxService projectService; + + /** + * 列表查询. + * + * @param projectx projectx + * @param request 请求 + * @return {@link Result}<{@link ?}> + */ + @GetMapping("/list") + public Result list(Projectx projectx, HttpServletRequest request) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper( + projectx, request.getParameterMap()); + List list = projectService.listDto(queryWrapper); + return Result.OK(list); + } + + /** + * 分页查询. + * + * @param page 页面 + * @param pageSize 页面大小 + * @param projectx projectx + * @param request 请求 + * @return {@link Result}<{@link Page}<{@link ?}>> + */ + @GetMapping("/page") + public Result> page(@RequestParam(value = "page", defaultValue = "1") + Integer page, + @RequestParam(value = "pageSize", defaultValue = "5") + Integer pageSize, + Projectx projectx, HttpServletRequest request) { + if (page <= 0 || pageSize <= 0) { + page = 1; + pageSize = 5; + } + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper( + projectx, request.getParameterMap()); + Page projectPage = new Page<>(page, pageSize); + Page projectDtoPage = projectService.pageDto(projectPage, queryWrapper); + return Result.OK(projectDtoPage); + } + + /** + * 通过id获取项目dto. + * + * @param projectx projectx + * @return {@link Result}<{@link ProjectDto}> + */ + @GetMapping("/queryById") + public Result getProjectDtoById(Projectx projectx) { + ProjectDto projectDto = projectService.queryDtoById(projectx); + return Result.OK(projectDto); + } +} 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 new file mode 100644 index 0000000..8c2c2dc --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/FunctionDto.java @@ -0,0 +1,21 @@ +package org.jeecg.modules.demo.newlayout.dto; + +import lombok.Data; +import org.jeecg.modules.demo.functionx.entity.Functionx; + +import java.util.List; + +/** + * 功能dto + * + * @author wish + * @version 1.0.0 + * @date 2023/07/10 + */ +@Data +public class FunctionDto extends Functionx { + /** + * 规则dto列表 + */ + List ruleDtoList; +} 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 new file mode 100644 index 0000000..20f3df2 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/ModuleDto.java @@ -0,0 +1,21 @@ +package org.jeecg.modules.demo.newlayout.dto; + +import lombok.Data; +import org.jeecg.modules.modulex.entity.Modulex; + +import java.util.List; + +/** + * 模块dto + * + * @author wish + * @version 1.0.0 + * @date 2023/07/10 + */ +@Data +public class ModuleDto extends Modulex { + /** + * 功能dto列表 + */ + List functionDtoList; +} 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 new file mode 100644 index 0000000..43125c3 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/ProjectDto.java @@ -0,0 +1,21 @@ +package org.jeecg.modules.demo.newlayout.dto; + +import lombok.Data; +import org.jeecg.modules.projectx.entity.Projectx; + +import java.util.List; + +/** + * 项目dto. + * + * @author wish + * @version 1.0.0 + * @date 2023/07/10 + */ +@Data +public class ProjectDto extends Projectx { + /** + * 模块dto列表. + */ + List moduleDtoList; +} 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 new file mode 100644 index 0000000..d5cf34d --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/RuleDto.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.demo.newlayout.dto; + +import lombok.Data; +import org.jeecg.modules.demo.rulex.entity.Rulex; + +@Data +public class RuleDto extends Rulex { +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/service/IRulexService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/service/IRulexService.java index 7049105..b978ab7 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/service/IRulexService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/service/IRulexService.java @@ -2,6 +2,7 @@ package org.jeecg.modules.demo.rulex.service; import org.jeecg.common.api.vo.Result; import org.jeecg.modules.demo.functionx.entity.Functionx; +import org.jeecg.modules.demo.newlayout.dto.RuleDto; import org.jeecg.modules.demo.rulex.entity.Rulex; import com.baomidou.mybatisplus.extension.service.IService; @@ -18,4 +19,6 @@ public interface IRulexService extends IService { Result sort(String id); List queryRuleListByFunctionId(Functionx functionx); + + List queryRuleDtoListByFunctionId(Functionx functionx); } 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 8b3babc..a55688d 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 @@ -3,14 +3,17 @@ package org.jeecg.modules.demo.rulex.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.jeecg.common.api.vo.Result; import org.jeecg.modules.demo.functionx.entity.Functionx; +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.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import java.util.ArrayList; import java.util.List; /** @@ -54,4 +57,19 @@ public class RulexServiceImpl extends ServiceImpl implements ruleWrapper.eq(Rulex::getFunctionId, functionx.getId()); return this.list(ruleWrapper); } + + @Override + public List queryRuleDtoListByFunctionId(Functionx functionx) { + LambdaQueryWrapper ruleWrapper = new LambdaQueryWrapper<>(); + ruleWrapper.eq(Rulex::getFunctionId, functionx.getId()); + List rulexList = this.list(ruleWrapper); + // 将rule封装为ruleDto + List ruleDtoList = new ArrayList<>(); + for (Rulex rulex : rulexList) { + RuleDto ruleDto = new RuleDto(); + BeanUtils.copyProperties(rulex, ruleDto); + ruleDtoList.add(ruleDto); + } + return ruleDtoList; + } } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/IModulexService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/IModulexService.java index d6a8ad2..ce407b7 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/IModulexService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/IModulexService.java @@ -3,32 +3,38 @@ package org.jeecg.modules.modulex.service; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.demo.newlayout.dto.ModuleDto; import org.jeecg.modules.modulex.entity.Modulex; +import org.jeecg.modules.projectx.entity.Projectx; + +import java.util.List; /** * @Description: 模块管理 * @Author: jeecg-boot - * @Date: 2023-04-10 + * @Date: 2023-04-10 * @Version: V1.0 */ public interface IModulexService extends IService { - /** - * 得到最大的版本号 - */ - Integer getMaxVersion(Integer verison); + /** + * 得到最大的版本号 + */ + Integer getMaxVersion(Integer verison); + + Result fabu(String id); - Result fabu(String id); + Result kaishi(String id); - Result kaishi(String id); + Result tijiao(String id); - Result tijiao(String id); + Result chehui(String id); - Result chehui(String id); + Result shenhe(String id); - Result shenhe(String id); + void setmodule(String id, String moduleId); - void setmodule(String id, String moduleId); + void copy(Modulex modulex); - void copy(Modulex modulex); + List queryDtoListByProId(Projectx project); } 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 3ba1d7d..73857d6 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 @@ -6,6 +6,8 @@ import org.jeecg.common.api.vo.Result; 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.FunctionDto; +import org.jeecg.modules.demo.newlayout.dto.ModuleDto; import org.jeecg.modules.demo.rulex.entity.Rulex; import org.jeecg.modules.demo.rulex.service.IRulexService; import org.jeecg.modules.fieldx.entity.Fieldx; @@ -13,6 +15,7 @@ import org.jeecg.modules.fieldx.service.IFieldxService; 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.tablex.entity.Tablex; import org.jeecg.modules.tablex.service.ITablexService; import org.springframework.beans.BeanUtils; @@ -22,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.ObjectUtils; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.Date; import java.util.LinkedList; import java.util.List; @@ -35,226 +39,245 @@ import java.util.List; @Service public class ModulexServiceImpl extends ServiceImpl implements IModulexService { - @Resource - private FunctionxMapper functionxMapper; + @Resource + private FunctionxMapper functionxMapper; - @Resource - private ModulexMapper modulexMapper; + @Resource + private ModulexMapper modulexMapper; - @Autowired - private IFunctionxService iFunctionxService; + @Autowired + private IFunctionxService iFunctionxService; - @Autowired - private IRulexService iRulexService; + @Autowired + private IRulexService iRulexService; - @Autowired - private ITablexService iTablexService; + @Autowired + private ITablexService iTablexService; - @Autowired - private IFieldxService iFieldxService; + @Autowired + private IFieldxService iFieldxService; - /** - * 得到最大的版本号 - */ - @Override - public Integer getMaxVersion(Integer verison) { - return this.list().size(); - } + /** + * 得到最大的版本号 + */ + @Override + public Integer getMaxVersion(Integer verison) { + return this.list().size(); + } - /** - * 发布:点击发布按钮,状态变成已发布, - * 任务责任人(即开发者)可以操作开始、提交等功能; - * 模块管理下属所有功能状态变为已发布。 - * - * @param id modulex表的主键id - */ - @Override - public Result fabu(String id) { - Modulex byId = this.getById(id); - if (byId.getWorkStatus() == 1) { - return Result.error("当前功能已发布!!!"); - } else { - byId.setWorkStatus(1); - this.updateById(byId); - //模块管理下属所有功能状态变为已发布 - this.handleStatus(id, 1); - return Result.OK("发布成功!!"); - } + /** + * 发布:点击发布按钮,状态变成已发布, + * 任务责任人(即开发者)可以操作开始、提交等功能; + * 模块管理下属所有功能状态变为已发布。 + * + * @param id modulex表的主键id + */ + @Override + public Result fabu(String id) { + Modulex byId = this.getById(id); + if (byId.getWorkStatus() == 1) { + return Result.error("当前功能已发布!!!"); + } else { + byId.setWorkStatus(1); + this.updateById(byId); + //模块管理下属所有功能状态变为已发布 + this.handleStatus(id, 1); + return Result.OK("发布成功!!"); } + } - /** - * 开始:任务责任人(即开发者)使用的功能,点击开始按钮,状态变为开发中, - * 表示任务开始,开始时间设置为当前时间。 - * - * @param id modulex表的主键id - */ - @Override - public Result kaishi(String id) { - Modulex byId = this.getById(id); - if (byId.getWorkStatus() != 1) { - return Result.error("当前不处于已发布阶段,无法开始,请先发布"); - } else { - byId.setWorkStatus(2); - byId.setStartTime(new Date()); - this.updateById(byId); + /** + * 开始:任务责任人(即开发者)使用的功能,点击开始按钮,状态变为开发中, + * 表示任务开始,开始时间设置为当前时间。 + * + * @param id modulex表的主键id + */ + @Override + public Result kaishi(String id) { + Modulex byId = this.getById(id); + if (byId.getWorkStatus() != 1) { + return Result.error("当前不处于已发布阶段,无法开始,请先发布"); + } else { + byId.setWorkStatus(2); + byId.setStartTime(new Date()); + this.updateById(byId); - return Result.OK("任务开始成功"); - } + return Result.OK("任务开始成功"); } + } - /** - * 提交:任务责任人(即开发者)使用的功能,点击提交按钮,表示任务完成,状态变为已提交, - * 提交时间设置为当前时间,并自动计算实际时长。 - * 模块管理下属所有功能状态变成已完成才能点击提交按钮。 - * - * @param id modulex表的主键id - */ - @Override - public Result tijiao(String id) { - Modulex byId = this.getById(id); - if (byId.getWorkStatus() != 2) { - return Result.error("当前不处于开发中阶段,无法提交"); - } else { - byId.setWorkStatus(3); - byId.setSubmitTime(new Date()); - this.updateById(byId); - - this.handleStatus(id, 3); - return Result.OK("提交成功!!"); - } + /** + * 提交:任务责任人(即开发者)使用的功能,点击提交按钮,表示任务完成,状态变为已提交, + * 提交时间设置为当前时间,并自动计算实际时长。 + * 模块管理下属所有功能状态变成已完成才能点击提交按钮。 + * + * @param id modulex表的主键id + */ + @Override + public Result tijiao(String id) { + Modulex byId = this.getById(id); + if (byId.getWorkStatus() != 2) { + return Result.error("当前不处于开发中阶段,无法提交"); + } else { + byId.setWorkStatus(3); + byId.setSubmitTime(new Date()); + this.updateById(byId); + this.handleStatus(id, 3); + return Result.OK("提交成功!!"); } - /** - * 撤回:项目负责人(管理员)使用,点击撤回,状态变为开发中。 - * - * @param id modulex表的主键id - *

- * 问题:模块管理中撤回后,该模块的”功能“对应的所有任务状也做撤回操作,肯该功能所对应的“开发规则”的任务状态也做撤回操作 - */ - @Override - @Transactional(readOnly = false, rollbackFor = Exception.class) - public Result chehui(String id) { - Modulex byId = this.getById(id); - if (byId.getWorkStatus() == 2) { - return Result.error("正处于开发中"); - } - byId.setWorkStatus(2); - this.updateById(byId); + } - //add by zhc 7.5 - this.doWorkStatusRollBack(id); - return Result.OK("撤回成功"); + /** + * 撤回:项目负责人(管理员)使用,点击撤回,状态变为开发中。 + * + * @param id modulex表的主键id + *

+ * 问题:模块管理中撤回后,该模块的”功能“对应的所有任务状也做撤回操作,肯该功能所对应的“开发规则”的任务状态也做撤回操作 + */ + @Override + @Transactional(readOnly = false, rollbackFor = Exception.class) + public Result chehui(String id) { + Modulex byId = this.getById(id); + if (byId.getWorkStatus() == 2) { + return Result.error("正处于开发中"); } + byId.setWorkStatus(2); + this.updateById(byId); - @Transactional(readOnly = false, rollbackFor = Exception.class) - public void doWorkStatusRollBack(final String moduleId) { - /** - * work_status值:未发布0、已发布1、开发中2、已完成3、已撤回4、已取消9;默认0 - */ - iFunctionxService.lambdaUpdate().set(Functionx::getWorkStatus, 4).set(Functionx::getUpdateTime, new Date()).eq(Functionx::getModuleId, moduleId).update(); - iRulexService.lambdaUpdate().set(Rulex::getWorkStatus, 4).set(Rulex::getUpdateTime, new Date()).eq(Rulex::getModuleId, moduleId).update(); - } + //add by zhc 7.5 + this.doWorkStatusRollBack(id); + return Result.OK("撤回成功"); + } + @Transactional(readOnly = false, rollbackFor = Exception.class) + public void doWorkStatusRollBack(final String moduleId) { /** - * BUG反馈:项目负责人(管理员)使用,点击BUG反馈,状态变为DEBUG,下属功能状态不变,BUG管理增加一条记录,记录BUG内容。 - * 审核:项目负责人(管理员)使用,点击完成,状态变为已审核。 - * - * @param id modulex表的主键id + * work_status值:未发布0、已发布1、开发中2、已完成3、已撤回4、已取消9;默认0 */ - @Override - public Result shenhe(String id) { - Modulex byId = this.getById(id); - if (byId.getWorkStatus() == 4) { - return Result.error("已审核"); - } - byId.setWorkStatus(4); - this.updateById(byId); - return Result.OK("审核通过"); - } + iFunctionxService.lambdaUpdate().set(Functionx::getWorkStatus, 4).set(Functionx::getUpdateTime, new Date()).eq(Functionx::getModuleId, moduleId).update(); + iRulexService.lambdaUpdate().set(Rulex::getWorkStatus, 4).set(Rulex::getUpdateTime, new Date()).eq(Rulex::getModuleId, moduleId).update(); + } - @Override - public void setmodule(String id, String moduleId) { - modulexMapper.setmodule(id, moduleId); + /** + * BUG反馈:项目负责人(管理员)使用,点击BUG反馈,状态变为DEBUG,下属功能状态不变,BUG管理增加一条记录,记录BUG内容。 + * 审核:项目负责人(管理员)使用,点击完成,状态变为已审核。 + * + * @param id modulex表的主键id + */ + @Override + public Result shenhe(String id) { + Modulex byId = this.getById(id); + if (byId.getWorkStatus() == 4) { + return Result.error("已审核"); } + byId.setWorkStatus(4); + this.updateById(byId); + return Result.OK("审核通过"); + } - /** - * 模块管理中复制功能:新增模块对应的实体和字段、功能和规则 - * - * @param modulex - */ - @Transactional(readOnly = false, rollbackFor = Exception.class) - @Override - public void copy(Modulex modulex) { - Integer newVersion = this.getMaxVersion(modulex.getVerison()); - modulex.setVerison(newVersion + 1); - modulex.setRelatedBean(null); - //复制模块 - this.save(modulex); + @Override + public void setmodule(String id, String moduleId) { + modulexMapper.setmodule(id, moduleId); + } - String id = modulex.getId(); - //复制实体&字段 - Tablex tablex = iTablexService.getOne(new LambdaQueryWrapper().eq(Tablex::getModuleId, modulex.getCopyId())); - if (!ObjectUtils.isEmpty(tablex)) { - Tablex tablex1 = new Tablex(); - BeanUtils.copyProperties(tablex, tablex1); - tablex1.setId(null); - tablex1.setModuleId(modulex.getId()); - tablex1.setTableName(modulex.getModuleName()); - tablex1.setTableEnName(modulex.getModuleEnName()); - tablex1.setCreateTime(new Date()); - iTablexService.save(tablex1); - List fieldxList = iFieldxService.list(new LambdaQueryWrapper().eq(Fieldx::getTableId, tablex.getId())); - if (!ObjectUtils.isEmpty(fieldxList)) { - List addList = new LinkedList<>(); - fieldxList.forEach(e -> { - Fieldx fieldx1 = new Fieldx(); - BeanUtils.copyProperties(e, fieldx1); - fieldx1.setId(null); - fieldx1.setTableId(tablex1.getId()); - fieldx1.setCreateTime(new Date()); + /** + * 模块管理中复制功能:新增模块对应的实体和字段、功能和规则 + * + * @param modulex + */ + @Transactional(readOnly = false, rollbackFor = Exception.class) + @Override + public void copy(Modulex modulex) { + Integer newVersion = this.getMaxVersion(modulex.getVerison()); + modulex.setVerison(newVersion + 1); + modulex.setRelatedBean(null); + //复制模块 + this.save(modulex); - addList.add(fieldx1); - }); - iFieldxService.saveBatch(addList); - } - this.lambdaUpdate().set(Modulex::getRelatedBean, tablex1.getId()).eq(Modulex::getId, id).update(); - } + String id = modulex.getId(); + //复制实体&字段 + Tablex tablex = iTablexService.getOne(new LambdaQueryWrapper().eq(Tablex::getModuleId, modulex.getCopyId())); + if (!ObjectUtils.isEmpty(tablex)) { + Tablex tablex1 = new Tablex(); + BeanUtils.copyProperties(tablex, tablex1); + tablex1.setId(null); + tablex1.setModuleId(modulex.getId()); + tablex1.setTableName(modulex.getModuleName()); + tablex1.setTableEnName(modulex.getModuleEnName()); + tablex1.setCreateTime(new Date()); + iTablexService.save(tablex1); + List fieldxList = iFieldxService.list(new LambdaQueryWrapper().eq(Fieldx::getTableId, tablex.getId())); + if (!ObjectUtils.isEmpty(fieldxList)) { + List addList = new LinkedList<>(); + fieldxList.forEach(e -> { + Fieldx fieldx1 = new Fieldx(); + BeanUtils.copyProperties(e, fieldx1); + fieldx1.setId(null); + fieldx1.setTableId(tablex1.getId()); + fieldx1.setCreateTime(new Date()); - //复制功能 - List functionxList = iFunctionxService.list(new LambdaQueryWrapper().eq(Functionx::getModuleId, modulex.getCopyId())); - if (!ObjectUtils.isEmpty(functionxList)) { - List addList = new LinkedList<>(); - functionxList.forEach(e -> { - Functionx functionx = new Functionx(); - BeanUtils.copyProperties(e, functionx); - functionx.setId(null); - functionx.setModuleId(modulex.getId()); - functionx.setCreateTime(new Date()); - addList.add(functionx); - }); - iFunctionxService.saveBatch(addList); - } + addList.add(fieldx1); + }); + iFieldxService.saveBatch(addList); + } + this.lambdaUpdate().set(Modulex::getRelatedBean, tablex1.getId()).eq(Modulex::getId, id).update(); + } + //复制功能 + List functionxList = iFunctionxService.list(new LambdaQueryWrapper().eq(Functionx::getModuleId, modulex.getCopyId())); + if (!ObjectUtils.isEmpty(functionxList)) { + List addList = new LinkedList<>(); + functionxList.forEach(e -> { + Functionx functionx = new Functionx(); + BeanUtils.copyProperties(e, functionx); + functionx.setId(null); + functionx.setModuleId(modulex.getId()); + functionx.setCreateTime(new Date()); + addList.add(functionx); + }); + iFunctionxService.saveBatch(addList); } + } + + @Override + public List queryDtoListByProId(Projectx projectx) { + LambdaQueryWrapper moduleWrapper = new LambdaQueryWrapper<>(); + moduleWrapper.eq(Modulex::getProjectId, projectx.getId()); + List modulexList = this.list(moduleWrapper); + // 将模块转为dto + List moduleDtoList = new ArrayList<>(); + for (Modulex modulex : modulexList) { + ModuleDto moduleDto = new ModuleDto(); + BeanUtils.copyProperties(modulex, moduleDto); + // 查询当前模块下所有的功能dto + List functionDtoList = + iFunctionxService.queryFunctionDtoListByModuleId(modulex); + moduleDto.setFunctionDtoList(functionDtoList); + moduleDtoList.add(moduleDto); + } + return moduleDtoList; + } - private void handleStatus(String id, Integer a) { - //先查字模块 先查询父id 等于 这个 id 的数据 - List modulexs = this.list(new LambdaQueryWrapper().eq(Modulex::getPid, id)); - if (modulexs.size() > 0) { - modulexs.forEach(modulex -> { - modulex.setWorkStatus(a); - this.updateById(modulex); - }); - } - //再查下属功能 - List functionxs = functionxMapper.selectList(new LambdaQueryWrapper().eq(Functionx::getModuleId, id)); - if (functionxs.size() > 0) { - functionxs.forEach(funcx -> { - funcx.setWorkStatus(a); - functionxMapper.updateById(funcx); - }); - } + + private void handleStatus(String id, Integer a) { + //先查字模块 先查询父id 等于 这个 id 的数据 + List modulexs = this.list(new LambdaQueryWrapper().eq(Modulex::getPid, id)); + if (modulexs.size() > 0) { + modulexs.forEach(modulex -> { + modulex.setWorkStatus(a); + this.updateById(modulex); + }); + } + //再查下属功能 + List functionxs = functionxMapper.selectList(new LambdaQueryWrapper().eq(Functionx::getModuleId, id)); + if (functionxs.size() > 0) { + functionxs.forEach(funcx -> { + funcx.setWorkStatus(a); + functionxMapper.updateById(funcx); + }); } + } } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/projectx/service/IProjectxService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/projectx/service/IProjectxService.java index 9644080..be325d0 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/projectx/service/IProjectxService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/projectx/service/IProjectxService.java @@ -1,16 +1,25 @@ package org.jeecg.modules.projectx.service; - +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.demo.newlayout.dto.ProjectDto; import org.jeecg.modules.projectx.entity.Projectx; +import java.util.List; + /** * @Description: 项目管理 管理项目基本信息 * @Author: jeecg-boot - * @Date: 2023-04-10 + * @Date: 2023-04-10 * @Version: V1.0 */ public interface IProjectxService extends IService { + List listDto(QueryWrapper queryWrapper); + + ProjectDto queryDtoById(Projectx projectx); + + Page pageDto(Page projectPage, QueryWrapper queryWrapper); } 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 5c7c114..c739c84 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 @@ -1,18 +1,75 @@ 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.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.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import java.util.ArrayList; +import java.util.List; /** * @Description: 项目管理 管理项目基本信息 * @Author: jeecg-boot - * @Date: 2023-04-10 + * @Date: 2023-04-10 * @Version: V1.0 */ @Service -public class ProjectxServiceImpl extends ServiceImpl implements IProjectxService { +public class ProjectxServiceImpl extends ServiceImpl + implements IProjectxService { + + @Autowired + private IModulexService modulexService; + + @Override + public List listDto(QueryWrapper queryWrapper) { + List list = this.list(queryWrapper); + List projectDtoList = new ArrayList<>(); + for (Projectx projectx : list) { + projectDtoList.add(this.queryDtoById(projectx)); + } + return projectDtoList; + } + + @Override + public ProjectDto queryDtoById(Projectx projectx) { + if (StringUtils.isEmpty(projectx.getId())) { + return new ProjectDto(); + } + // 查询当前项目信息 + Projectx project = this.getById(projectx.getId()); + // 将当前项目封装为dto + ProjectDto projectDto = new ProjectDto(); + BeanUtils.copyProperties(project, projectDto); + // 查询当前项目的模块 + List moduleDtoList = modulexService.queryDtoListByProId(project); + projectDto.setModuleDtoList(moduleDtoList); + return projectDto; + } + + @Override + public Page pageDto(Page projectPage, + QueryWrapper queryWrapper) { + Page projectDtoPage = new Page<>(); + this.page(projectPage, queryWrapper); + List projectDtoList = new ArrayList<>(); + List projectxList = projectPage.getRecords(); + for (Projectx projectx : projectxList) { + projectDtoList.add(this.queryDtoById(projectx)); + } + BeanUtils.copyProperties(projectPage, projectDtoPage); + projectDtoPage.setRecords(projectDtoList); + return projectDtoPage; + } + }