diff --git a/ant-design-vue-jeecg/src/views/functionx/modules/FunctionxForm1.vue b/ant-design-vue-jeecg/src/views/functionx/modules/FunctionxForm1.vue new file mode 100644 index 0000000..8121904 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/functionx/modules/FunctionxForm1.vue @@ -0,0 +1,296 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/functionx/modules/FunctionxModal1.vue b/ant-design-vue-jeecg/src/views/functionx/modules/FunctionxModal1.vue new file mode 100644 index 0000000..a965bd0 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/functionx/modules/FunctionxModal1.vue @@ -0,0 +1,60 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/modulex/modules/ModulexForm1.vue b/ant-design-vue-jeecg/src/views/modulex/modules/ModulexForm1.vue new file mode 100644 index 0000000..6fca9f4 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/modulex/modules/ModulexForm1.vue @@ -0,0 +1,274 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/modulex/modules/ModulexModal1.vue b/ant-design-vue-jeecg/src/views/modulex/modules/ModulexModal1.vue new file mode 100644 index 0000000..63d0ecf --- /dev/null +++ b/ant-design-vue-jeecg/src/views/modulex/modules/ModulexModal1.vue @@ -0,0 +1,60 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/requirementitem/RequirementItemList.vue b/ant-design-vue-jeecg/src/views/requirementitem/RequirementItemList.vue index 83eb3de..1e94e75 100644 --- a/ant-design-vue-jeecg/src/views/requirementitem/RequirementItemList.vue +++ b/ant-design-vue-jeecg/src/views/requirementitem/RequirementItemList.vue @@ -77,6 +77,15 @@ :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" class="j-table-force-nowrap" @change="handleTableChange"> + + 模块 + + + 功能 + + 规则 + + 无操作权限 @@ -128,12 +140,15 @@ import RequirementItemModal from './modules/RequirementItemModal' import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' import { httpAction, getAction } from '@/api/manage' + import ModulexModal1 from "../modulex/modules/ModulexModal1"; + import FunctionxModal1 from "../functionx/modules/FunctionxModal1"; + import RulexModal1 from "../rulex/modules/RulexModal1"; export default { name: 'RequirementItemList', mixins:[JeecgListMixin, mixinDevice], components: { - RequirementItemModal + RequirementItemModal,ModulexModal1,FunctionxModal1,RulexModal1 }, data () { return { @@ -211,6 +226,12 @@ align:"center", dataIndex: 'updateBy_dictText' }, + { + title: '转化', + dataIndex: 'zh', + align: "center", + scopedSlots: {customRender: 'zh'} + }, { title: '操作', dataIndex: 'action', @@ -229,6 +250,7 @@ qrxq:"/requirementitem/requirementItem/qrxq", checkqx:"/requirementtype/requirementType/checkqx", wdxqlist:"/requirementitem/requirementItem/wdxqlist", + checkzh:"/modulex/modulex/checkzh", }, dictOptions:{}, @@ -244,6 +266,39 @@ }, }, methods: { + zhmk(record){ + getAction(this.url.checkzh,{requirementid:record.id,funlevel:2}).then((res)=>{ + if (res.success) { + this.$refs.modulex.add(record); + this.$refs.modulex.title = "新增"; + this.$refs.modulex.disableSubmit = false; + }else{ + this.$message.warning(res.message); + } + }); + }, + zhgn(record){ + getAction(this.url.checkzh,{requirementid:record.id,funlevel:3}).then((res)=>{ + if (res.success) { + this.$refs.functionxm.add(record); + this.$refs.functionxm.title = "新增"; + this.$refs.functionxm.disableSubmit = false; + }else{ + this.$message.warning(res.message); + } + }); + }, + zhgz(record){ + getAction(this.url.checkzh,{requirementid:record.id,funlevel:4}).then((res)=>{ + if (res.success) { + this.$refs.rulexmd.add(record); + this.$refs.rulexmd.title = "新增"; + this.$refs.rulexmd.disableSubmit = false; + }else{ + this.$message.warning(res.message); + } + }); + }, checkqx(record){ getAction(this.url.checkqx,{createBy:record.createBy}).then((res)=>{ if (res.success) { diff --git a/ant-design-vue-jeecg/src/views/rulex/modules/RulexForm1.vue b/ant-design-vue-jeecg/src/views/rulex/modules/RulexForm1.vue new file mode 100644 index 0000000..195e794 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/rulex/modules/RulexForm1.vue @@ -0,0 +1,245 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/rulex/modules/RulexModal1.vue b/ant-design-vue-jeecg/src/views/rulex/modules/RulexModal1.vue new file mode 100644 index 0000000..10458cb --- /dev/null +++ b/ant-design-vue-jeecg/src/views/rulex/modules/RulexModal1.vue @@ -0,0 +1,60 @@ + + + \ No newline at end of file diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/controller/FunctionxController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/controller/FunctionxController.java index 2edec78..ab5d776 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/controller/FunctionxController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/controller/FunctionxController.java @@ -24,6 +24,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; +import org.jeecg.modules.demo.requirementfun.entity.RequirementFun; +import org.jeecg.modules.demo.requirementfun.service.IRequirementFunService; +import org.jeecg.modules.demo.requirementitem.entity.RequirementItem; +import org.jeecg.modules.demo.requirementitem.service.IRequirementItemService; import org.jeecg.modules.modulex.entity.Modulex; import org.jeecg.modules.modulex.service.IModulexService; import org.jeecgframework.poi.excel.ExcelImportUtil; @@ -57,6 +61,11 @@ public class FunctionxController extends JeecgController zhgn(@RequestBody Functionx functionx) { + QueryWrapper queryWrapper=new QueryWrapper<>(); + queryWrapper.eq("id",functionx.getModuleId()); + Modulex one = modulexService.getOne(queryWrapper); + if(one.getRelatedBean()==null){ + return Result.error("请先为对应模块关联实体!!!"); + } + //感觉不符合逻辑,上级模块如果是已发布,然后新增也是已发布状态,那样发布按钮还有什么用?? +// functionx.setWorkStatus(one.getWorkStatus()); + functionxService.save(functionx); + RequirementItem requirementItem = requirementItemService.getById(functionx.getModuleId()); + requirementItem.setRequirementStatus(2); + requirementItemService.updateById(requirementItem); + RequirementFun requirementFun1 = new RequirementFun(); + requirementFun1.setRequirementId(functionx.getModuleId()); + requirementFun1.setFunId(functionx.getId()); + requirementFun1.setFunLevel(3); + requirementFunService.save(requirementFun1); + return Result.OK("添加成功!"); + } + /** * 编辑 * diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementfun/controller/RequirementFunController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementfun/controller/RequirementFunController.java new file mode 100644 index 0000000..5a5bed1 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementfun/controller/RequirementFunController.java @@ -0,0 +1,171 @@ +package org.jeecg.modules.demo.requirementfun.controller; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.demo.requirementfun.entity.RequirementFun; +import org.jeecg.modules.demo.requirementfun.service.IRequirementFunService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; + + /** + * @Description: 需求功能关联管理 + * @Author: jeecg-boot + * @Date: 2023-07-04 + * @Version: V1.0 + */ +@Api(tags="需求功能关联管理") +@RestController +@RequestMapping("/requirementfun/requirementFun") +@Slf4j +public class RequirementFunController extends JeecgController { + @Autowired + private IRequirementFunService requirementFunService; + + /** + * 分页列表查询 + * + * @param requirementFun + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "需求功能关联管理-分页列表查询") + @ApiOperation(value="需求功能关联管理-分页列表查询", notes="需求功能关联管理-分页列表查询") + @GetMapping(value = "/list") + public Result queryPageList(RequirementFun requirementFun, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(requirementFun, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = requirementFunService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param requirementFun + * @return + */ + @AutoLog(value = "需求功能关联管理-添加") + @ApiOperation(value="需求功能关联管理-添加", notes="需求功能关联管理-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody RequirementFun requirementFun) { + requirementFunService.save(requirementFun); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param requirementFun + * @return + */ + @AutoLog(value = "需求功能关联管理-编辑") + @ApiOperation(value="需求功能关联管理-编辑", notes="需求功能关联管理-编辑") + @PutMapping(value = "/edit") + public Result edit(@RequestBody RequirementFun requirementFun) { + requirementFunService.updateById(requirementFun); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "需求功能关联管理-通过id删除") + @ApiOperation(value="需求功能关联管理-通过id删除", notes="需求功能关联管理-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + requirementFunService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "需求功能关联管理-批量删除") + @ApiOperation(value="需求功能关联管理-批量删除", notes="需求功能关联管理-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.requirementFunService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @AutoLog(value = "需求功能关联管理-通过id查询") + @ApiOperation(value="需求功能关联管理-通过id查询", notes="需求功能关联管理-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + RequirementFun requirementFun = requirementFunService.getById(id); + if(requirementFun==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(requirementFun); + } + + /** + * 导出excel + * + * @param request + * @param requirementFun + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, RequirementFun requirementFun) { + return super.exportXls(request, requirementFun, RequirementFun.class, "需求功能关联管理"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, RequirementFun.class); + } + +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementfun/entity/RequirementFun.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementfun/entity/RequirementFun.java new file mode 100644 index 0000000..ae828a1 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementfun/entity/RequirementFun.java @@ -0,0 +1,69 @@ +package org.jeecg.modules.demo.requirementfun.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 需求功能关联管理 + * @Author: jeecg-boot + * @Date: 2023-07-04 + * @Version: V1.0 + */ +@Data +@TableName("requirement_fun") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="requirement_fun对象", description="需求功能关联管理") +public class RequirementFun implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private java.lang.String id; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private java.lang.String createBy; + /**创建日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建日期") + private java.util.Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private java.lang.String updateBy; + /**更新日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新日期") + private java.util.Date updateTime; + /**所属部门*/ + @ApiModelProperty(value = "所属部门") + private java.lang.String sysOrgCode; + /**需求id*/ + @Excel(name = "需求id", width = 15) + @ApiModelProperty(value = "需求id") + private java.lang.String requirementId; + /**功能层级*/ + @Excel(name = "功能层级", width = 15) + @ApiModelProperty(value = "功能层级") + private java.lang.Integer funLevel; + /**功能id*/ + @Excel(name = "功能id", width = 15) + @ApiModelProperty(value = "功能id") + private java.lang.String funId; +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementfun/mapper/RequirementFunMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementfun/mapper/RequirementFunMapper.java new file mode 100644 index 0000000..197d395 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementfun/mapper/RequirementFunMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.demo.requirementfun.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.demo.requirementfun.entity.RequirementFun; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 需求功能关联管理 + * @Author: jeecg-boot + * @Date: 2023-07-04 + * @Version: V1.0 + */ +public interface RequirementFunMapper extends BaseMapper { + +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementfun/mapper/xml/RequirementFunMapper.xml b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementfun/mapper/xml/RequirementFunMapper.xml new file mode 100644 index 0000000..7bb1fec --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementfun/mapper/xml/RequirementFunMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementfun/service/IRequirementFunService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementfun/service/IRequirementFunService.java new file mode 100644 index 0000000..a47887a --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementfun/service/IRequirementFunService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.demo.requirementfun.service; + +import org.jeecg.modules.demo.requirementfun.entity.RequirementFun; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 需求功能关联管理 + * @Author: jeecg-boot + * @Date: 2023-07-04 + * @Version: V1.0 + */ +public interface IRequirementFunService extends IService { + +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementfun/service/impl/RequirementFunServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementfun/service/impl/RequirementFunServiceImpl.java new file mode 100644 index 0000000..f63a625 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementfun/service/impl/RequirementFunServiceImpl.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.demo.requirementfun.service.impl; + +import org.jeecg.modules.demo.requirementfun.entity.RequirementFun; +import org.jeecg.modules.demo.requirementfun.mapper.RequirementFunMapper; +import org.jeecg.modules.demo.requirementfun.service.IRequirementFunService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 需求功能关联管理 + * @Author: jeecg-boot + * @Date: 2023-07-04 + * @Version: V1.0 + */ +@Service +public class RequirementFunServiceImpl extends ServiceImpl implements IRequirementFunService { + +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/controller/RulexController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/controller/RulexController.java index 25b8fd0..3e73466 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/controller/RulexController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/controller/RulexController.java @@ -14,6 +14,10 @@ import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.demo.functionx.entity.Functionx; import org.jeecg.modules.demo.functionx.mapper.FunctionxMapper; +import org.jeecg.modules.demo.requirementfun.entity.RequirementFun; +import org.jeecg.modules.demo.requirementfun.service.IRequirementFunService; +import org.jeecg.modules.demo.requirementitem.entity.RequirementItem; +import org.jeecg.modules.demo.requirementitem.service.IRequirementItemService; import org.jeecg.modules.demo.rulex.entity.Rulex; import org.jeecg.modules.demo.rulex.service.IRulexService; @@ -53,6 +57,10 @@ public class RulexController extends JeecgController { private IRulexService rulexService; @Autowired FunctionxMapper functionxMapper; + @Autowired + private IRequirementFunService requirementFunService; + @Autowired + private IRequirementItemService requirementItemService; /** @@ -118,6 +126,43 @@ public class RulexController extends JeecgController { return Result.OK("添加成功!"); } + /** + * 转化规则 + * + * @param rulex + * @return + */ + @AutoLog(value = "转化规则") + @ApiOperation(value="转化规则", notes="转化规则") + @PostMapping(value = "/zhgz") + public Result zhgz(@RequestBody Rulex rulex) { + if(rulex.getFunctionId()==null){ + return Result.error("功能点错误!!!"); + } + Functionx functionx = functionxMapper.selectById(rulex.getFunctionId()); + if(functionx.getStartTime()!=null){ + rulex.setStartTime(functionx.getStartTime()); + } + if(functionx.getSubmitTime()!=null){ + rulex.setSubmitTime(functionx.getSubmitTime()); + } + if(functionx.getRealDuration()!=null){ + rulex.setRealDuration(functionx.getRealDuration()); + } + rulex.setManagerUsers(functionx.getManagerUsers()); + rulex.setWorkStatus(functionx.getWorkStatus()); + rulexService.save(rulex); + RequirementItem requirementItem = requirementItemService.getById(rulex.getModuleId()); + requirementItem.setRequirementStatus(2); + requirementItemService.updateById(requirementItem); + RequirementFun requirementFun1 = new RequirementFun(); + requirementFun1.setRequirementId(rulex.getModuleId()); + requirementFun1.setFunId(rulex.getId()); + requirementFun1.setFunLevel(4); + requirementFunService.save(requirementFun1); + return Result.OK("添加成功!"); + } + /** * 编辑 * diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/controller/ModulexController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/controller/ModulexController.java index b9d15a2..c084704 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/controller/ModulexController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/controller/ModulexController.java @@ -12,6 +12,10 @@ import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.modules.demo.requirementfun.entity.RequirementFun; +import org.jeecg.modules.demo.requirementfun.service.IRequirementFunService; +import org.jeecg.modules.demo.requirementitem.entity.RequirementItem; +import org.jeecg.modules.demo.requirementitem.service.IRequirementItemService; import org.jeecg.modules.modulex.entity.Modulex; import org.jeecg.modules.modulex.mapper.ModulexMapper; import org.jeecg.modules.modulex.service.IModulexService; @@ -41,6 +45,10 @@ public class ModulexController extends JeecgController private IModulexService modulexService; @Resource private ModulexMapper modulexMapper; + @Autowired + private IRequirementFunService requirementFunService; + @Autowired + private IRequirementItemService requirementItemService; /** * 分页列表查询 @@ -137,6 +145,42 @@ public class ModulexController extends JeecgController return Result.OK("添加成功!"); } + /** + * 转化模块 + * moduleName 中文名称 + * 相同上级的模块不能重名 + */ + @AutoLog(value = "转化模块") + @ApiOperation(value = "转化模块", notes = "转化模块") + @PostMapping(value = "/zhmk") + public Result zhmk(@RequestBody Modulex modulex) { + //版本号 顺序累加;初始值1 + if (StringUtils.hasText(modulex.getPid())) { + List collect = modulexService.list( + new LambdaQueryWrapper() + .eq(StringUtils.hasText(modulex.getPid()), Modulex::getPid, modulex.getPid())) + .stream().map(Modulex::getModuleName).collect(Collectors.toList()); + collect.add(modulex.getModuleName()); + HashSet setList = new HashSet<>(collect); + if (collect.size() != setList.size()){ + return Result.error("相同上级的模块不能重名"); + } + } + Integer newVersion = modulexService.getMaxVersion(modulex.getVerison()); + modulex.setVerison(newVersion + 1); + modulexService.save(modulex); + RequirementItem requirementItem = requirementItemService.getById(modulex.getRequirementid()); + requirementItem.setRequirementStatus(2); + requirementItemService.updateById(requirementItem); + RequirementFun requirementFun1 = new RequirementFun(); + requirementFun1.setRequirementId(modulex.getRequirementid()); + requirementFun1.setFunId(modulex.getId()); + requirementFun1.setFunLevel(2); + requirementFunService.save(requirementFun1); + + return Result.OK("成功!"); + } + /** * 编辑 * @@ -219,4 +263,84 @@ public class ModulexController extends JeecgController return super.importExcel(request, response, Modulex.class); } + /** + * 检查是否转化 + * + * @param + * @return + */ + @AutoLog(value = "检查是否转化") + @ApiOperation(value = "检查是否转化", notes = "检查是否转化") + @GetMapping(value = "/checkzh") + public Result checkzh(@RequestParam(name = "requirementid", required = true) String requirementid,@RequestParam(name = "funlevel", required = true) Integer funlevel,HttpServletRequest req) { + + RequirementFun requirementFun = new RequirementFun(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(requirementFun, req.getParameterMap()); + queryWrapper.eq("requirement_id",requirementid); + queryWrapper.eq("fun_level",funlevel); + List listrf = requirementFunService.list(queryWrapper); + if(listrf.size()>0){ + return Result.error("已转化,不可再次转化"); + }else{ + if(funlevel!=2){ + RequirementFun requirementFunzh = new RequirementFun(); + QueryWrapper queryWrapperzh = QueryGenerator.initQueryWrapper(requirementFunzh, req.getParameterMap()); + queryWrapperzh.eq("requirement_id",requirementid); + queryWrapperzh.eq("fun_level",funlevel-1); + List listzh = requirementFunService.list(queryWrapperzh); + if(listzh.size()>0){ + return Result.OK(""); + }else{ + if(funlevel==3){ + return Result.error("该需求无转化模块,不能转化功能"); + } + if(funlevel==4){ + return Result.error("该需求无转化功能,不能转化规则"); + } + return Result.OK(""); + } + }else{ + return Result.OK(""); + } + } + } + + /** + * 查询模块id + * + * @param + * @return + */ + @AutoLog(value = "查询模块id") + @ApiOperation(value = "查询模块id", notes = "查询模块id") + @GetMapping(value = "/getmoduleid") + public Result getmoduleid(@RequestParam(name = "requirementid", required = true) String requirementid,HttpServletRequest req) { + + RequirementFun requirementFun = new RequirementFun(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(requirementFun, req.getParameterMap()); + queryWrapper.eq("requirement_id",requirementid); + queryWrapper.eq("fun_level",2); + List listrf = requirementFunService.list(queryWrapper); + return Result.OK(listrf.get(0).getFunId()); + } + + /** + * 查询功能id + * + * @param + * @return + */ + @AutoLog(value = "查询功能id") + @ApiOperation(value = "查询功能id", notes = "查询功能id") + @GetMapping(value = "/getfunctionid") + public Result getfunctionid(@RequestParam(name = "requirementid", required = true) String requirementid,HttpServletRequest req) { + + RequirementFun requirementFun = new RequirementFun(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(requirementFun, req.getParameterMap()); + queryWrapper.eq("requirement_id",requirementid); + queryWrapper.eq("fun_level",3); + List listrf = requirementFunService.list(queryWrapper); + return Result.OK(listrf.get(0).getFunId()); + } + } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/entity/Modulex.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/entity/Modulex.java index c725616..ec49f7e 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/entity/Modulex.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/entity/Modulex.java @@ -197,4 +197,7 @@ public class Modulex implements Serializable { @Excel(name = "版本号", width = 15) @ApiModelProperty(value = "版本号") private Integer verison; + + @TableField(exist = false) + private String requirementid; }