任务管理 -复制功能 7.5

master
zhc077 1 year ago
parent ccf9f5f3c6
commit 334efe6b0a
  1. 2
      ant-design-vue-jeecg/src/views/modulex/modules/ModulexForm.vue
  2. 19
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/controller/ModulexController.java
  3. 151
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/entity/Modulex.java
  4. 1
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/IModulexService.java
  5. 77
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java

@ -233,6 +233,8 @@
this.model.moduleEnName = this.model.moduleEnName + '+1';
this.model.moduleCode = this.model.moduleCode + '+1';
this.model.createTime = null;
//id
this.model.copyId = record.id;
}
this.visible = true;
},

@ -62,10 +62,10 @@ public class ModulexController extends JeecgController<Modulex, IModulexService>
Page<Modulex> page = new Page<Modulex>(pageNo, pageSize);
IPage<Modulex> pageList = modulexService.page(page, queryWrapper);
List<Modulex> modulexList = pageList.getRecords();
for (Modulex modu :modulexList) {
if (!StringUtils.hasText(modu.getManagerUsers())){
for (Modulex modu : modulexList) {
if (!StringUtils.hasText(modu.getManagerUsers())) {
break;
}else {
} else {
String[] split = modu.getManagerUsers().split(",");
List<String> stringList = Arrays.asList(split);
List<String> strings = new ArrayList<>();
@ -121,19 +121,18 @@ public class ModulexController extends JeecgController<Modulex, IModulexService>
public Result<?> add(@RequestBody Modulex modulex) {
//版本号 顺序累加;初始值1
if (StringUtils.hasText(modulex.getPid())) {
List<String> collect = modulexService.list(
new LambdaQueryWrapper<Modulex>()
.eq(StringUtils.hasText(modulex.getPid()), Modulex::getPid, modulex.getPid()))
List<String> collect = modulexService.list(new LambdaQueryWrapper<Modulex>().eq(StringUtils.hasText(modulex.getPid()), Modulex::getPid, modulex.getPid()))
.stream().map(Modulex::getModuleName).collect(Collectors.toList());
collect.add(modulex.getModuleName());
HashSet<String> setList = new HashSet<>(collect);
if (collect.size() != setList.size()){
if (collect.size() != setList.size()) {
return Result.error("相同上级的模块不能重名");
}
}
Integer newVersion = modulexService.getMaxVersion(modulex.getVerison());
modulex.setVerison(newVersion + 1);
modulexService.save(modulex);
// Integer newVersion = modulexService.getMaxVersion(modulex.getVerison());
// modulex.setVerison(newVersion + 1);
// modulexService.save(modulex);
modulexService.copy(modulex);
return Result.OK("添加成功!");
}

@ -21,35 +21,45 @@ import java.util.Date;
/**
* @Description: 模块管理
* @Author: jeecg-boot
* @Date: 2023-04-10
* @Date: 2023-04-10
* @Version: V1.0
*/
@Data
@TableName("modulex")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="modulex对象", description="模块管理")
@ApiModel(value = "modulex对象", description = "模块管理")
public class Modulex implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**创建人*/
/**
* 创建人
*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
/**
* 创建日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private Date createTime;
/**更新人*/
/**
* 更新人
*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
/**
* 更新日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private Date updateTime;
/**
@ -57,36 +67,42 @@ public class Modulex implements Serializable {
* 关联表字段 modulex.id
* 显示上级名称
*/
@Excel(name = "上级模块id", width = 15)
@Excel(name = "上级模块id", width = 15)
@ApiModelProperty(value = "上级模块id")
@Dict(dictTable = "modulex",dicText = "module_name",dicCode = "id")
@Dict(dictTable = "modulex", dicText = "module_name", dicCode = "id")
private String pid;
/**
* 项目id
* 关联表字段 modulex.id
* 显示项目名称
*/
@Excel(name = "项目id", width = 15)
@Excel(name = "项目id", width = 15)
@ApiModelProperty(value = "项目id")
@Dict(dictTable = "projectx",dicText = "project_name",dicCode = "id")
@Dict(dictTable = "projectx", dicText = "project_name", dicCode = "id")
private String projectId;
/**
/**
* 中文名称
* 相同上级的模块不能重名
*/
@Excel(name = "中文名称", width = 15)
@Excel(name = "中文名称", width = 15)
@ApiModelProperty(value = "中文名称")
private String moduleName;
/**英文名称*/
@Excel(name = "英文名称", width = 15)
/**
* 英文名称
*/
@Excel(name = "英文名称", width = 15)
@ApiModelProperty(value = "英文名称")
private String moduleEnName;
/**模块编码*/
@Excel(name = "模块编码", width = 15)
/**
* 模块编码
*/
@Excel(name = "模块编码", width = 15)
@ApiModelProperty(value = "模块编码")
private String moduleCode;
/**内容描述*/
@Excel(name = "内容描述", width = 15)
/**
* 内容描述
*/
@Excel(name = "内容描述", width = 15)
@ApiModelProperty(value = "内容描述")
private String pmDescribe;
/**
@ -94,7 +110,7 @@ public class Modulex implements Serializable {
* 关联表字段 用户表.id(s)
* 用户id列表模块的开发任务可以分配给多个人员显示用户名称列表
*/
@Excel(name = "责任人", width = 15)
@Excel(name = "责任人", width = 15)
@ApiModelProperty(value = "责任人")
private String managerUsers;
@ -102,51 +118,62 @@ public class Modulex implements Serializable {
* 上面的字段 本身的数据字典无法翻译 也不能直接把原来的字段替换掉
* 用这个字段代表 翻译后的值 不改变原先的
*/
@TableField(exist = false)
private String managerUsers_dictText;
/**
@TableField(exist = false)
private String managerUsers_dictText;
@TableField(exist = false)
private String copyId;
/**
* 任务等级
* 12345默认2
*/
@Excel(name = "任务等级", width = 15)
@Excel(name = "任务等级", width = 15)
@ApiModelProperty(value = "任务等级")
@Dict(dicCode = "work_level")
private Integer workLevel;
/**
/**
* 任务状态
* 未发布0已发布1开发中2已完成3已审核4DEBUG 9默认 0
*/
@Excel(name = "任务状态", width = 15)
@Excel(name = "任务状态", width = 15)
@ApiModelProperty(value = "任务状态")
@Dict(dicCode = "work_status")
private Integer workStatus;
/**发布时间*/
@Excel(name = "发布时间", width = 15, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
/**
* 发布时间
*/
@Excel(name = "发布时间", width = 15, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "发布时间")
private Date publishTime;
/**
/**
* 任务时长
* 单位小时等于下级模块时长的和默认1小时
*/
@Excel(name = "任务时长", width = 15)
@Excel(name = "任务时长", width = 15)
@ApiModelProperty(value = "任务时长")
private Double duration;
/**开始时间*/
@Excel(name = "开始时间", width = 15, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
/**
* 开始时间
*/
@Excel(name = "开始时间", width = 15, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "开始时间")
private Date startTime;
/**提交时间*/
@Excel(name = "提交时间", width = 15, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
/**
* 提交时间
*/
@Excel(name = "提交时间", width = 15, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "提交时间")
private Date submitTime;
/**实际时长*/
@Excel(name = "实际时长", width = 15)
/**
* 实际时长
*/
@Excel(name = "实际时长", width = 15)
@ApiModelProperty(value = "实际时长")
private Double realDuration;
/**
@ -154,7 +181,7 @@ public class Modulex implements Serializable {
* 关联表字段 project_user_role.id(s)
* 规则 角色列表哪些用户可以使用该模块即未来系统的权限分配显示角色名列表
*/
@Excel(name = "用户角色", width = 15)
@Excel(name = "用户角色", width = 15)
@ApiModelProperty(value = "用户角色")
private String userRole;
/**
@ -162,39 +189,43 @@ public class Modulex implements Serializable {
* 关联表字段 tablex.id
* 规则 关联实体表关联的是该模块管理的实体最下级模块有显示表名
*/
@Excel(name = "关联实体", width = 15)
@Excel(name = "关联实体", width = 15)
@ApiModelProperty(value = "关联实体")
@Dict(dictTable = "tablex",dicText = "table_name",dicCode = "id")
@Dict(dictTable = "tablex", dicText = "table_name", dicCode = "id")
private String relatedBean;
/**原型图*/
@Excel(name = "原型图", width = 15)
/**
* 原型图
*/
@Excel(name = "原型图", width = 15)
@ApiModelProperty(value = "原型图")
private String prototypes;
/**分析图*/
@Excel(name = "分析图", width = 15)
/**
* 分析图
*/
@Excel(name = "分析图", width = 15)
@ApiModelProperty(value = "分析图")
private String diagrams;
/**
/**
* 模块状态
* 正常1停用0废弃9默认1
*/
@Excel(name = "模块状态", width = 15)
@Excel(name = "模块状态", width = 15)
@ApiModelProperty(value = "模块状态")
@Dict(dicCode = "a_status")
private Integer status;
/**
/**
* 版本状态
* "值:当前1、历史0;默认1"
*/
@Excel(name = "版本状态", width = 15)
@Excel(name = "版本状态", width = 15)
@ApiModelProperty(value = "版本状态")
@Dict(dicCode = "verison_status")
private Integer verisonStatus;
/**
/**
* 版本号
* 顺序累加初始值1
*/
@Excel(name = "版本号", width = 15)
@Excel(name = "版本号", width = 15)
@ApiModelProperty(value = "版本号")
private Integer verison;
}

@ -30,4 +30,5 @@ public interface IModulexService extends IService<Modulex> {
void setmodule(String id, String moduleId);
void copy(Modulex modulex);
}

@ -1,27 +1,30 @@
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.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.rulex.entity.Rulex;
import org.jeecg.modules.demo.rulex.service.IRulexService;
import org.jeecg.modules.fieldx.entity.Fieldx;
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.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.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @Description: 模块管理
@ -44,6 +47,12 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
@Autowired
private IRulexService iRulexService;
@Autowired
private ITablexService iTablexService;
@Autowired
private IFieldxService iFieldxService;
/**
* 得到最大的版本号
*/
@ -169,6 +178,66 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
modulexMapper.setmodule(id, moduleId);
}
/**
* 模块管理中复制功能新增模块对应的实体和字段功能和规则
*
* @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);
String id = modulex.getId();
//复制实体&字段
Tablex tablex = iTablexService.getOne(new LambdaQueryWrapper<Tablex>().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<Fieldx> fieldxList = iFieldxService.list(new LambdaQueryWrapper<Fieldx>().eq(Fieldx::getTableId, tablex.getId()));
if (!ObjectUtils.isEmpty(fieldxList)) {
List<Fieldx> 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());
addList.add(fieldx1);
});
iFieldxService.saveBatch(addList);
}
this.lambdaUpdate().set(Modulex::getRelatedBean, tablex1.getId()).eq(Modulex::getId, id).update();
}
//复制功能
List<Functionx> functionxList = iFunctionxService.list(new LambdaQueryWrapper<Functionx>().eq(Functionx::getModuleId, modulex.getCopyId()));
if (!ObjectUtils.isEmpty(functionxList)) {
List<Functionx> 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);
}
}
private void handleStatus(String id, Integer a) {
//先查字模块 先查询父id 等于 这个 id 的数据

Loading…
Cancel
Save