Browse Source

复制项目接口

tall3
ma 4 years ago
parent
commit
2cbcd62b61
  1. 11
      common/src/main/java/com/ccsens/common/api/ProjectController.java
  2. 10
      common/src/main/java/com/ccsens/common/bean/dto/ProjectDto.java
  3. 6
      common/src/main/java/com/ccsens/common/bean/po/ProTaskFlow.java
  4. 20
      common/src/main/java/com/ccsens/common/bean/po/ProTaskFlowExample.java
  5. 46
      common/src/main/java/com/ccsens/common/bean/vo/ProjectVo.java
  6. 19
      common/src/main/java/com/ccsens/common/bean/vo/TaskVo.java
  7. 28
      common/src/main/java/com/ccsens/common/persist/dao/LabelBusinessDao.java
  8. 27
      common/src/main/java/com/ccsens/common/persist/dao/ProParentTaskDao.java
  9. 14
      common/src/main/java/com/ccsens/common/persist/dao/ProRoleDao.java
  10. 15
      common/src/main/java/com/ccsens/common/persist/dao/ProRoleRepulsionDao.java
  11. 28
      common/src/main/java/com/ccsens/common/persist/dao/ProRoleTaskDao.java
  12. 7
      common/src/main/java/com/ccsens/common/persist/dao/ProTaskDetailDao.java
  13. 28
      common/src/main/java/com/ccsens/common/persist/dao/ProTaskFlowDao.java
  14. 28
      common/src/main/java/com/ccsens/common/persist/dao/ProTaskNotifyDao.java
  15. 28
      common/src/main/java/com/ccsens/common/persist/dao/ProTaskPanelInfoDao.java
  16. 14
      common/src/main/java/com/ccsens/common/persist/dao/ProTaskPluginDao.java
  17. 27
      common/src/main/java/com/ccsens/common/persist/dao/ProTaskProcessDao.java
  18. 28
      common/src/main/java/com/ccsens/common/persist/dao/ProTaskSubDao.java
  19. 22
      common/src/main/java/com/ccsens/common/persist/dao/ProTaskVersionDao.java
  20. 8
      common/src/main/java/com/ccsens/common/service/IProjectService.java
  21. 341
      common/src/main/java/com/ccsens/common/service/ProjectService.java
  22. 12
      common/src/main/java/com/ccsens/common/service/TaskService.java
  23. 1
      common/src/main/java/com/ccsens/common/util/CommonCodeError.java
  24. 104
      common/src/main/resources/application-dev.yml
  25. 8
      common/src/main/resources/application.yml
  26. 37
      common/src/main/resources/mapper_dao/LabelBusinessDao.xml
  27. 33
      common/src/main/resources/mapper_dao/ProParentTaskDao.xml
  28. 37
      common/src/main/resources/mapper_dao/ProRoleDao.xml
  29. 28
      common/src/main/resources/mapper_dao/ProRoleRepulsionDao.xml
  30. 34
      common/src/main/resources/mapper_dao/ProRoleTaskDao.xml
  31. 17
      common/src/main/resources/mapper_dao/ProTaskDetailDao.xml
  32. 34
      common/src/main/resources/mapper_dao/ProTaskFlowDao.xml
  33. 38
      common/src/main/resources/mapper_dao/ProTaskNotifyDao.xml
  34. 47
      common/src/main/resources/mapper_dao/ProTaskPanelInfoDao.xml
  35. 37
      common/src/main/resources/mapper_dao/ProTaskPluginDao.xml
  36. 36
      common/src/main/resources/mapper_dao/ProTaskProcessDao.xml
  37. 32
      common/src/main/resources/mapper_dao/ProTaskSubDao.xml
  38. 23
      common/src/main/resources/mapper_dao/ProTaskVersionDao.xml
  39. 14
      common/src/main/resources/mapper_raw/ProTaskFlowMapper.xml

11
common/src/main/java/com/ccsens/common/api/ProjectController.java

@ -1,5 +1,6 @@
//package com.ccsens.common.api;
//
//import com.ccsens.cloudutil.annotation.MustLogin;
//import com.ccsens.common.bean.dto.ProjectDto;
//import com.ccsens.common.bean.vo.ProjectVo;
//import com.ccsens.common.service.IProjectService;
@ -29,6 +30,7 @@
// @Resource
// private IProjectService projectService;
//
//
// @ApiOperation(value = "根据id查询项目信息", notes = "根据id查询项目信息")
// @RequestMapping(value = "/findProjectById", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
// public JsonResponse<ProjectVo.ProjectInfo> findProjectById(@ApiParam @Validated @RequestBody QueryDto<ProjectDto.ProjectById> params) throws Exception{
@ -38,4 +40,13 @@
// return JsonResponse.newInstance().ok(projectInfo);
// }
//
// @MustLogin
// @ApiOperation(value = "根据模板复制项目", notes = "")
// @RequestMapping(value = "/copyProject", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
// public JsonResponse<ProjectVo.CopyProjectInfo> copyProject(@ApiParam @Validated @RequestBody QueryDto<ProjectDto.CopyProject> params) throws Exception{
// log.info("根据模板复制项目新:{}",params);
// ProjectVo.CopyProjectInfo newProject = projectService.copyProject(params.getParam(), params.getUserId());
// log.info("根据模板复制项目新结束{}",newProject);
// return JsonResponse.newInstance().ok(newProject);
// }
//}

10
common/src/main/java/com/ccsens/common/bean/dto/ProjectDto.java

@ -16,4 +16,14 @@ public class ProjectDto {
@ApiModelProperty("项目id")
private Long projectId;
}
@Data
@ApiModel("根据模板复制项目")
public static class CopyProject{
@NotNull(message = "请选择要复制得项目")
@ApiModelProperty("项目id")
private Long projectId;
@ApiModelProperty("新项目名字")
private String projectName;
}
}

6
common/src/main/java/com/ccsens/common/bean/po/ProTaskFlow.java

@ -10,7 +10,7 @@ public class ProTaskFlow implements Serializable {
private Long flowType;
private Integer jumpTaskDetailId;
private Long jumpTaskDetailId;
private Date createdAt;
@ -44,11 +44,11 @@ public class ProTaskFlow implements Serializable {
this.flowType = flowType;
}
public Integer getJumpTaskDetailId() {
public Long getJumpTaskDetailId() {
return jumpTaskDetailId;
}
public void setJumpTaskDetailId(Integer jumpTaskDetailId) {
public void setJumpTaskDetailId(Long jumpTaskDetailId) {
this.jumpTaskDetailId = jumpTaskDetailId;
}

20
common/src/main/java/com/ccsens/common/bean/po/ProTaskFlowExample.java

@ -295,52 +295,52 @@ public class ProTaskFlowExample {
return (Criteria) this;
}
public Criteria andJumpTaskDetailIdEqualTo(Integer value) {
public Criteria andJumpTaskDetailIdEqualTo(Long value) {
addCriterion("jump_task_detail_id =", value, "jumpTaskDetailId");
return (Criteria) this;
}
public Criteria andJumpTaskDetailIdNotEqualTo(Integer value) {
public Criteria andJumpTaskDetailIdNotEqualTo(Long value) {
addCriterion("jump_task_detail_id <>", value, "jumpTaskDetailId");
return (Criteria) this;
}
public Criteria andJumpTaskDetailIdGreaterThan(Integer value) {
public Criteria andJumpTaskDetailIdGreaterThan(Long value) {
addCriterion("jump_task_detail_id >", value, "jumpTaskDetailId");
return (Criteria) this;
}
public Criteria andJumpTaskDetailIdGreaterThanOrEqualTo(Integer value) {
public Criteria andJumpTaskDetailIdGreaterThanOrEqualTo(Long value) {
addCriterion("jump_task_detail_id >=", value, "jumpTaskDetailId");
return (Criteria) this;
}
public Criteria andJumpTaskDetailIdLessThan(Integer value) {
public Criteria andJumpTaskDetailIdLessThan(Long value) {
addCriterion("jump_task_detail_id <", value, "jumpTaskDetailId");
return (Criteria) this;
}
public Criteria andJumpTaskDetailIdLessThanOrEqualTo(Integer value) {
public Criteria andJumpTaskDetailIdLessThanOrEqualTo(Long value) {
addCriterion("jump_task_detail_id <=", value, "jumpTaskDetailId");
return (Criteria) this;
}
public Criteria andJumpTaskDetailIdIn(List<Integer> values) {
public Criteria andJumpTaskDetailIdIn(List<Long> values) {
addCriterion("jump_task_detail_id in", values, "jumpTaskDetailId");
return (Criteria) this;
}
public Criteria andJumpTaskDetailIdNotIn(List<Integer> values) {
public Criteria andJumpTaskDetailIdNotIn(List<Long> values) {
addCriterion("jump_task_detail_id not in", values, "jumpTaskDetailId");
return (Criteria) this;
}
public Criteria andJumpTaskDetailIdBetween(Integer value1, Integer value2) {
public Criteria andJumpTaskDetailIdBetween(Long value1, Long value2) {
addCriterion("jump_task_detail_id between", value1, value2, "jumpTaskDetailId");
return (Criteria) this;
}
public Criteria andJumpTaskDetailIdNotBetween(Integer value1, Integer value2) {
public Criteria andJumpTaskDetailIdNotBetween(Long value1, Long value2) {
addCriterion("jump_task_detail_id not between", value1, value2, "jumpTaskDetailId");
return (Criteria) this;
}

46
common/src/main/java/com/ccsens/common/bean/vo/ProjectVo.java

@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author AUSU
*/
@ -22,17 +24,17 @@ public class ProjectVo {
@ApiModelProperty("重复频率")
private String cycle;
@ApiModelProperty("计划开始时间")
private String planStartTime;
private Long planStartTime;
@ApiModelProperty("计划时长")
private String planDuration;
private Long planDuration;
@ApiModelProperty("计划结束时间")
private String planEndTime;
private Long planEndTime;
@ApiModelProperty("真实开始时间")
private String realStartTime;
private Long realStartTime;
@ApiModelProperty("真实时长")
private String realDuration;
private Long realDuration;
@ApiModelProperty("真实结束时间")
private String realEndTime;
private Long realEndTime;
}
@ -47,4 +49,36 @@ public class ProjectVo {
@ApiModelProperty("结束时间")
private Long endTime;
}
@Data
@ApiModel("复制的项目信息")
public static class CopyProjectInfo{
@ApiModelProperty("项目id")
private Long id;
// @ApiModelProperty("任务详情")
// private List<ProjectVo.TaskDetail> taskDetails;
}
@Data
@ApiModel("任务详情")
public static class TaskDetail{
@ApiModelProperty("任务详情id")
private Long taskDetailId;
@ApiModelProperty("任务详情名称")
private String taskDetailName;
@ApiModelProperty("任务等级")
private Byte taskDetailLevel;
@ApiModelProperty("任务详情下的分解任务")
private List<ProjectVo.TaskSub> taskSubList;
}
@Data
@ApiModel("分解任务")
public static class TaskSub{
@ApiModelProperty("分解任务id")
private Long taskSubId;
@ApiModelProperty("分解任务开始时间")
private Long startTime;
@ApiModelProperty("分解任务结束时间")
private Long endTime;
}
}

19
common/src/main/java/com/ccsens/common/bean/vo/TaskVo.java

@ -79,4 +79,23 @@ public class TaskVo {
@ApiModelProperty("跨列")
private int colspan;
}
@Data
@ApiModel("任务详情")
public static class TaskDetail{
@ApiModelProperty("任务详情id")
private Long detailId;
@ApiModelProperty("任务名称")
private String name;
@ApiModelProperty("任务描述")
private String description;
@ApiModelProperty("重复频率")
private String cycle;
//以下是任务关系表
@ApiModelProperty("任务关系表id")
private Long parentTaskId;
@ApiModelProperty("父级任务id")
private Long parentTaskDetailId;
}
}

28
common/src/main/java/com/ccsens/common/persist/dao/LabelBusinessDao.java

@ -0,0 +1,28 @@
package com.ccsens.common.persist.dao;
import com.ccsens.common.bean.po.LabelBusiness;
import com.ccsens.common.persist.mapper.LabelBusinessMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author AUSU
*/
@Repository
public interface LabelBusinessDao extends LabelBusinessMapper {
/**
* 根据业务id集合查询任务标签表
* @param businessIdList 业务id集合
* @return 任务标签集合
*/
List<LabelBusiness> findBusinessLabelByBid(@Param("businessIdList") List<Long> businessIdList);
/**
* 保存全部任务标签关系
* @param businessLabelList 任务标签关系列表
*/
void insertAllBusinessLabel(@Param("businessLabelList") List<LabelBusiness> businessLabelList);
}

27
common/src/main/java/com/ccsens/common/persist/dao/ProParentTaskDao.java

@ -0,0 +1,27 @@
package com.ccsens.common.persist.dao;
import com.ccsens.common.bean.po.ProParentTask;
import com.ccsens.common.bean.vo.TaskVo;
import com.ccsens.common.persist.mapper.ProParentTaskMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author AUSU
*/
public interface ProParentTaskDao extends ProParentTaskMapper {
/**
* 根据项目id查找一级任务列表
* @param oldProjectId 项目id
* @return 一级任务列表
*/
List<TaskVo.TaskDetail> findTaskByParentId(@Param("oldProjectId") Long oldProjectId);
/**
* 保存所有任务关系
* @param newParentTaskList 任务关系列表
*/
void insertAllParentTask(@Param("newParentTaskList") List<ProParentTask> newParentTaskList);
}

14
common/src/main/java/com/ccsens/common/persist/dao/ProRoleDao.java

@ -1,6 +1,7 @@
package com.ccsens.common.persist.dao;
import com.ccsens.common.bean.po.ProRole;
import com.ccsens.common.bean.po.ProTaskSub;
import com.ccsens.common.persist.mapper.ProRoleMapper;
import org.apache.ibatis.annotations.Param;
@ -34,4 +35,17 @@ public interface ProRoleDao extends ProRoleMapper {
* 根据任务分解id查找任务负责人下所有成员的userId
*/
List<String> queryExecutorUserIdBySubTaskId(@Param("subTaskId")Long subTaskId);
/**
* 根据项目id查询角色列表
* @param oldProjectId 项目id
* @return 角色列表
*/
List<ProRole> findRoleByProjectId(@Param("projectId") Long oldProjectId);
/**
* 添加角色信息
* @param newRoleList 角色列表
*/
void insertRoleList(@Param("newRoleList") List<ProRole> newRoleList);
}

15
common/src/main/java/com/ccsens/common/persist/dao/ProRoleRepulsionDao.java

@ -1,5 +1,7 @@
package com.ccsens.common.persist.dao;
import com.ccsens.common.bean.po.ProRole;
import com.ccsens.common.bean.po.ProRoleRepulsion;
import com.ccsens.common.persist.mapper.ProRoleRepulsionMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@ -18,4 +20,17 @@ public interface ProRoleRepulsionDao extends ProRoleRepulsionMapper {
* @return 排斥的角色id
*/
List<Long> findRepulsionByRoleId(@Param("roleId") Long roleId);
/**
* 查询角色的不可见列表
* @param oldRoleList 角色列表
* @return 不可见列表
*/
List<ProRoleRepulsion> findRepulsionByRoleIdList(@Param("oldRoleList") List<ProRole> oldRoleList);
/**
* 批量插入角色的不可见列表
* @param newRoleRepulsionList 不可见列表
*/
void insertRoleRepulsionList(@Param("newRoleRepulsionList") List<ProRoleRepulsion> newRoleRepulsionList);
}

28
common/src/main/java/com/ccsens/common/persist/dao/ProRoleTaskDao.java

@ -0,0 +1,28 @@
package com.ccsens.common.persist.dao;
import com.ccsens.common.bean.po.ProRoleTask;
import com.ccsens.common.persist.mapper.ProRoleTaskMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author AUSU
*/
@Repository
public interface ProRoleTaskDao extends ProRoleTaskMapper {
/**
* 根据角色id查找所有角色任务关系
* @param oldRoleIdList 角色id集合
* @return 角色任务关系列表
*/
List<ProRoleTask> findRoleTaskByRoleId(@Param("roleIds") List<Long> oldRoleIdList);
/**
* 保存所有的角色任务关系
* @param newRoleTaskList 角色任务关系列表
*/
void insertAllRoleTask(@Param("roleTaskList") List<ProRoleTask> newRoleTaskList);
}

7
common/src/main/java/com/ccsens/common/persist/dao/ProTaskDetailDao.java

@ -1,5 +1,6 @@
package com.ccsens.common.persist.dao;
import com.ccsens.common.bean.po.ProTaskDetail;
import com.ccsens.common.bean.po.ProTaskStatusRecord;
import com.ccsens.common.bean.vo.TaskVo;
import com.ccsens.common.persist.mapper.ProTaskDetailMapper;
@ -64,4 +65,10 @@ public interface ProTaskDetailDao extends ProTaskDetailMapper {
* 查询最后一次开始之后的记录
*/
List<ProTaskStatusRecord> calculateDuration(@Param("taskDetailId")Long subTaskId);
/**
* 保存所有的任务详情
* @param newTaskDetailList 任务详情列表
*/
void insertAllTaskDetail(@Param("newTaskDetailList") List<ProTaskDetail> newTaskDetailList);
}

28
common/src/main/java/com/ccsens/common/persist/dao/ProTaskFlowDao.java

@ -0,0 +1,28 @@
package com.ccsens.common.persist.dao;
import com.ccsens.common.bean.po.ProTaskFlow;
import com.ccsens.common.persist.mapper.ProTaskFlowMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author AUSU
*/
@Repository
public interface ProTaskFlowDao extends ProTaskFlowMapper {
/**
* 根据任务id集合查询所有的任务流转
* @param taskIdList 任务id集合
* @return 任务流转列表
*/
List<ProTaskFlow> findTaskFlowByTaskIdList(@Param("taskIdList") List<Long> taskIdList);
/**
* 保存所有的任务流转
* @param taskFlowList 任务流转列表
*/
void insertAllTaskFlow(@Param("taskFlowList") List<ProTaskFlow> taskFlowList);
}

28
common/src/main/java/com/ccsens/common/persist/dao/ProTaskNotifyDao.java

@ -0,0 +1,28 @@
package com.ccsens.common.persist.dao;
import com.ccsens.common.bean.po.ProTaskNotify;
import com.ccsens.common.persist.mapper.ProTaskNotifyMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author AUSU
*/
@Repository
public interface ProTaskNotifyDao extends ProTaskNotifyMapper {
/**
* 根据任务id列表查询所有的任务通知
* @param oldTaskIdList 任务id列表
* @return 任务通知列表
*/
List<ProTaskNotify> findTaskNotifyByTaskIdList(@Param("taskIdList") List<Long> oldTaskIdList);
/**
* 保存所有的任务通知
* @param newTaskNotifyList 任务通知列表
*/
void insertAllTaskNotify(List<ProTaskNotify> newTaskNotifyList);
}

28
common/src/main/java/com/ccsens/common/persist/dao/ProTaskPanelInfoDao.java

@ -0,0 +1,28 @@
package com.ccsens.common.persist.dao;
import com.ccsens.common.bean.po.ProTaskPanelInfo;
import com.ccsens.common.persist.mapper.ProTaskPanelInfoMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author AUSU
*/
@Repository
public interface ProTaskPanelInfoDao extends ProTaskPanelInfoMapper {
/**
* 根据任务id集合查找任务面板
* @param taskIdList 任务id集合
* @return 任务面板列表
*/
List<ProTaskPanelInfo> findPanelByTaskIdList(@Param("taskIdList") List<Long> taskIdList);
/**
* 将所有任务任务面板保存
* @param taskPanelInfoList 任务面板列表
*/
void insertAllTaskPanel(@Param("taskPanelInfoList") List<ProTaskPanelInfo> taskPanelInfoList);
}

14
common/src/main/java/com/ccsens/common/persist/dao/ProTaskPluginDao.java

@ -1,5 +1,6 @@
package com.ccsens.common.persist.dao;
import com.ccsens.common.bean.po.ProTaskPlugin;
import com.ccsens.common.bean.vo.TaskVo;
import com.ccsens.common.persist.mapper.ProTaskPluginMapper;
import org.apache.ibatis.annotations.Param;
@ -18,4 +19,17 @@ public interface ProTaskPluginDao extends ProTaskPluginMapper {
* @return 插件列表
*/
List<TaskVo.TaskPluginInfo> queryTaskOfPlugin(@Param("detailTaskId") Long detailTaskId);
/**
* 根据任务id列表查询任务插件
* @param oldTaskIdList 任务id列表
* @return 任务插件列表
*/
List<ProTaskPlugin> findPluginByTaskIdList(@Param("oldTaskIdList") List<Long> oldTaskIdList);
/**
* 添加所有的任务插件列表
* @param taskPluginList 任务插件列表
*/
void insertAllTaskPlugin(List<ProTaskPlugin> taskPluginList);
}

27
common/src/main/java/com/ccsens/common/persist/dao/ProTaskProcessDao.java

@ -0,0 +1,27 @@
package com.ccsens.common.persist.dao;
import com.ccsens.common.bean.po.ProTaskProcess;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author AUSU
*/
@Repository
public interface ProTaskProcessDao {
/**
* 根据任务id列表查询所有上下道工序
* @param oldTaskIdList 任务id列表
* @return 上下道工序列表
*/
List<ProTaskProcess> findTaskProcessByTaskIdList(@Param("taskIdList") List<Long> oldTaskIdList);
/**
* 保存所有的上下道工序
* @param newTaskProcessList 任务上下道工序列表
*/
void insertAllTaskProcess(@Param("taskProcessList") List<ProTaskProcess> newTaskProcessList);
}

28
common/src/main/java/com/ccsens/common/persist/dao/ProTaskSubDao.java

@ -0,0 +1,28 @@
package com.ccsens.common.persist.dao;
import com.ccsens.common.bean.po.ProTaskSub;
import com.ccsens.common.persist.mapper.ProTaskSubMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author AUSU
*/
@Repository
public interface ProTaskSubDao extends ProTaskSubMapper {
/**
* 查询任务详情的分解任务
* @param taskDetailId 任务详情id
* @return 分解任务列表
*/
List<ProTaskSub> findSubTaskByDetail(@Param("id") Long taskDetailId);
/**
* 保存所有的分解任务
* @param newTaskSubList 分解任务列表
*/
void insertAllTaskSub(@Param("newTaskSubList") List<ProTaskSub> newTaskSubList);
}

22
common/src/main/java/com/ccsens/common/persist/dao/ProTaskVersionDao.java

@ -0,0 +1,22 @@
package com.ccsens.common.persist.dao;
import com.ccsens.common.bean.po.ProTaskVersion;
import com.ccsens.common.persist.mapper.ProTaskVersionMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author AUSU
*/
@Repository
public interface ProTaskVersionDao extends ProTaskVersionMapper {
/**
* 根据项目id查询版本信息
* @param id 项目id
* @return 版本信息
*/
ProTaskVersion findVersionByProjectId(@Param("projectId") Long id);
}

8
common/src/main/java/com/ccsens/common/service/IProjectService.java

@ -14,4 +14,12 @@ public interface IProjectService {
* @return 返回项目信息
*/
ProjectVo.ProjectInfo findProjectById(ProjectDto.ProjectById param, Long userId);
/**
* 复制项目
* @param param 项目id,项目名称
* @param userId 用户id
* @return 新项目
*/
ProjectVo.CopyProjectInfo copyProject(ProjectDto.CopyProject param, Long userId);
}

341
common/src/main/java/com/ccsens/common/service/ProjectService.java

@ -1,11 +1,16 @@
package com.ccsens.common.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.ccsens.common.bean.dto.ProjectDto;
import com.ccsens.common.bean.po.ProTaskDetail;
import com.ccsens.common.bean.po.*;
import com.ccsens.common.bean.vo.ProjectVo;
import com.ccsens.common.persist.dao.ProProjectDao;
import com.ccsens.common.persist.mapper.ProTaskDetailMapper;
import com.ccsens.common.bean.vo.TaskVo;
import com.ccsens.common.persist.dao.*;
import com.ccsens.common.util.CommonCodeError;
import com.ccsens.util.exception.BaseException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -13,6 +18,8 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
/**
* @author ma
@ -22,15 +29,341 @@ import javax.annotation.Resource;
@Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
public class ProjectService implements IProjectService{
@Resource
private Snowflake snowflake;
@Resource
private ProProjectDao projectDao;
@Resource
private ProTaskDetailDao taskDetailDao;
@Resource
private ProTaskSubDao taskSubDao;
@Resource
private ProRoleDao roleDao;
@Resource
private ProRoleTaskDao roleTaskDao;
@Resource
private ProRoleRepulsionDao roleRepulsionDao;
@Resource
private ProParentTaskDao parentTaskDao;
@Resource
private ProTaskPanelInfoDao taskPanelInfoDao;
@Resource
private ProTaskPluginDao taskPluginDao;
@Resource
private ProTaskFlowDao taskFlowDao;
@Resource
private ProTaskProcessDao taskProcessDao;
@Resource
private ProTaskNotifyDao taskNotifyDao;
@Resource
private LabelBusinessDao labelBusinessDao;
@Resource
private ProTaskVersionDao taskVersionDao;
@Override
public ProjectVo.ProjectInfo findProjectById(ProjectDto.ProjectById param, Long userId) {
ProjectVo.ProjectInfo projectById = projectDao.findProjectById(param.getProjectId());
if (ObjectUtil.isNull(projectById)){
throw new BaseException("项目不存在,请检查后再试");
throw new BaseException(CommonCodeError.PROJECT_NOT_FOUND);
}
return projectById;
}
@Override
public ProjectVo.CopyProjectInfo copyProject(ProjectDto.CopyProject param, Long userId) {
ProjectVo.ProjectInfo oldProject = projectDao.findProjectById(param.getProjectId());
if (ObjectUtil.isNull(oldProject)){
throw new BaseException(CommonCodeError.PROJECT_NOT_FOUND);
}
ProjectVo.CopyProjectInfo copyProject = new ProjectVo.CopyProjectInfo();
long currentTime = System.currentTimeMillis();
//复制项目到任务详情表
ProTaskDetail newProjectDetail = new ProTaskDetail();
newProjectDetail.setId(snowflake.nextId());
if (StrUtil.isNotBlank(param.getProjectName())){
newProjectDetail.setName(param.getProjectName());
}else{
newProjectDetail.setName(oldProject.getName()+"-副本");
}
newProjectDetail.setDescription(oldProject.getDescription());
newProjectDetail.setCycle(oldProject.getCycle());
taskDetailDao.insertSelective(newProjectDetail);
//复制项目到任务分解表
ProTaskSub newProjectSub = new ProTaskSub();
newProjectSub.setId(snowflake.nextId());
newProjectSub.setPlanStartTime(currentTime);
newProjectSub.setPlanDuration(oldProject.getPlanDuration());
newProjectSub.setPlanEndTime(currentTime+oldProject.getPlanDuration());
newProjectSub.setTaskDetailId(newProjectDetail.getId());
taskSubDao.insertSelective(newProjectSub);
//处理项目版本表
ProTaskVersion oldProjectVersion = taskVersionDao.findVersionByProjectId(oldProject.getId());
if (ObjectUtil.isNotNull(oldProjectVersion)){
ProTaskVersion newProjectVersion = new ProTaskVersion();
BeanUtil.copyProperties(oldProjectVersion,newProjectVersion);
newProjectVersion.setId(snowflake.nextId());
newProjectVersion.setProjectType((byte)0);
newProjectVersion.setTaskDetailId(newProjectDetail.getId());
newProjectVersion.setCreatedAt(null);
newProjectVersion.setUpdatedAt(null);
taskVersionDao.insertSelective(newProjectVersion);
}
//处理项目标签
List<Long> businessId = new ArrayList<>();
businessId.add(oldProject.getId());
List<LabelBusiness> oldBusinessLabelList = labelBusinessDao.findBusinessLabelByBid(businessId);
if (CollectionUtil.isNotEmpty(oldBusinessLabelList)){
List<LabelBusiness> newLabelList = new ArrayList<>();
for (LabelBusiness oldBusinessLabel : oldBusinessLabelList) {
LabelBusiness newLabelBusiness = new LabelBusiness();
BeanUtil.copyProperties(oldBusinessLabel,newLabelBusiness);
newLabelBusiness.setId(snowflake.nextId());
newLabelBusiness.setBusinessId(newProjectDetail.getId());
newLabelBusiness.setUserId(userId);
newLabelList.add(newLabelBusiness);
}
labelBusinessDao.insertAllBusinessLabel(newLabelList);
}
//复制角色相关
copyRole(oldProject.getId(),newProjectDetail.getId(),userId);
//复制任务相关
copyProject.setId(newProjectDetail.getId());
return copyProject;
}
/**
* 复制角色相关
* @param oldProjectId 旧项目id
* @param newProjectId 新项目id
* @param userId 用户id
*/
private void copyRole(Long oldProjectId, Long newProjectId, Long userId) {
List<ProRole> oldRoleList = roleDao.findRoleByProjectId(oldProjectId);
Map<Long,Long> oldAndNewRoleId = new HashMap<>();
if (CollectionUtil.isNotEmpty(oldRoleList)){
List<ProRole> newRoleList = new ArrayList<>();
for (ProRole oldRole : oldRoleList) {
ProRole newRole = new ProRole();
newRole.setId(snowflake.nextId());
newRole.setName(oldRole.getName());
newRole.setLabelId(oldRole.getLabelId());
newRole.setProjectId(newProjectId);
newRole.setOperator(userId);
oldAndNewRoleId.put(oldRole.getId(),newRole.getId());
newRoleList.add(newRole);
}
roleDao.insertRoleList(newRoleList);
List<ProRoleRepulsion> oldRoleRepulsions = roleRepulsionDao.findRepulsionByRoleIdList(oldRoleList);
if (CollectionUtil.isNotEmpty(oldRoleRepulsions)){
List<ProRoleRepulsion> newRoleRepulsionList = new ArrayList<>();
for (ProRoleRepulsion oldRoleRepulsion : oldRoleRepulsions) {
ProRoleRepulsion newRoleRepulsion = new ProRoleRepulsion();
newRoleRepulsion.setId(snowflake.nextId());
newRoleRepulsion.setRoleId(oldAndNewRoleId.get(oldRoleRepulsion.getRoleId()));
newRoleRepulsion.setRepulsionRoleId(oldAndNewRoleId.get(oldRoleRepulsion.getRepulsionRoleId()));
newRoleRepulsion.setOperator(userId);
newRoleRepulsionList.add(newRoleRepulsion);
}
roleRepulsionDao.insertRoleRepulsionList(newRoleRepulsionList);
}
//复制角色标签关系
List<Long> roleIdList = new ArrayList<>();
oldAndNewRoleId.forEach((key,val)->roleIdList.add(key));
List<LabelBusiness> oldRoleLabelList = labelBusinessDao.findBusinessLabelByBid(roleIdList);
if (CollectionUtil.isNotEmpty(oldRoleLabelList)){
List<LabelBusiness> newRoleLabelList = new ArrayList<>();
for (LabelBusiness oldRoleLabel : oldRoleLabelList) {
LabelBusiness newRoleLabel = new LabelBusiness();
BeanUtil.copyProperties(oldRoleLabel,newRoleLabel);
newRoleLabel.setId(snowflake.nextId());
newRoleLabel.setBusinessId(oldAndNewRoleId.get(oldRoleLabel.getBusinessId()));
newRoleLabel.setUserId(userId);
newRoleLabelList.add(newRoleLabel);
}
labelBusinessDao.insertAllBusinessLabel(newRoleLabelList);
}
//复制任务相关
copyTask(oldProjectId, newProjectId, userId,oldAndNewRoleId);
}
}
/**
* @param oldProjectId 旧项目id
* @param newProjectId 新项目id
* @param userId 用户id
* @param oldAndNewRoleId 旧角色id与新角色id
*/
private void copyTask(Long oldProjectId, Long newProjectId, Long userId, Map<Long, Long> oldAndNewRoleId) {
List<ProParentTask> newParentTaskList = new ArrayList<>();
//查找项目下的一级任务
List<TaskVo.TaskDetail> oldFirstTaskDetailList = parentTaskDao.findTaskByParentId(oldProjectId);
Map<Long,Long> oldAndNewTaskDetailId = new HashMap<>();
//1.把项目id放到任务id的map中,后续要删除
oldAndNewTaskDetailId.put(oldProjectId,newProjectId);
if (CollectionUtil.isNotEmpty(oldFirstTaskDetailList)) {
List<ProTaskDetail> newTaskDetailList = new ArrayList<>();
List<ProTaskSub> newTaskSubList = new ArrayList<>();
for (TaskVo.TaskDetail oldFirstTaskDetail : oldFirstTaskDetailList) {
//循环处理一级任务及一级任务的分解任务
taskLoop(newTaskDetailList,newTaskSubList,oldAndNewTaskDetailId,oldFirstTaskDetail,oldProjectId,newParentTaskList);
//查询二级任务
List<TaskVo.TaskDetail> oldSecondTaskDetailList = parentTaskDao.findTaskByParentId(oldFirstTaskDetail.getDetailId());
if (CollectionUtil.isNotEmpty(oldSecondTaskDetailList)) {
for (TaskVo.TaskDetail oldSecondTaskDetail : oldSecondTaskDetailList) {
//循环处理二级任务及二级任务的分级任务
taskLoop(newTaskDetailList,newTaskSubList,oldAndNewTaskDetailId,oldSecondTaskDetail,oldSecondTaskDetail.getParentTaskDetailId(),newParentTaskList);
}
}
}
//2.删除任务id的map中的项目id
oldAndNewTaskDetailId.remove(oldProjectId);
//将任务详情和分解任务,任务关系保存到数据库
taskDetailDao.insertAllTaskDetail(newTaskDetailList);
taskSubDao.insertAllTaskSub(newTaskSubList);
parentTaskDao.insertAllParentTask(newParentTaskList);
//处理角色任务关联表
List<Long> oldRoleIdList = new ArrayList<>();
oldAndNewRoleId.forEach((key,val) -> oldRoleIdList.add(key));
List<ProRoleTask> oldRoleTaskList = roleTaskDao.findRoleTaskByRoleId(oldRoleIdList);
if (CollectionUtil.isNotEmpty(oldRoleTaskList)){
List<ProRoleTask> newRoleTaskList = new ArrayList<>();
for (ProRoleTask oldRoleTask : oldRoleTaskList) {
ProRoleTask newRoleTask = new ProRoleTask();
newRoleTask.setId(snowflake.nextId());
newRoleTask.setTaskId(oldAndNewTaskDetailId.get(oldRoleTask.getTaskId()));
newRoleTask.setRoleId(oldAndNewRoleId.get(oldRoleTask.getRoleId()));
newRoleTask.setOperator(userId);
newRoleTaskList.add(newRoleTask);
}
roleTaskDao.insertAllRoleTask(newRoleTaskList);
}
//处理任务面板信息表
List<Long> oldTaskIdList = new ArrayList<>();
oldAndNewTaskDetailId.forEach((key,val) -> oldTaskIdList.add(key));
List<ProTaskPanelInfo> oldTaskPanelInfoList = taskPanelInfoDao.findPanelByTaskIdList(oldTaskIdList);
if (CollectionUtil.isNotEmpty(oldTaskPanelInfoList)) {
List<ProTaskPanelInfo> newTaskPanelInfoList = new ArrayList<>();
for (ProTaskPanelInfo oldTaskPanelInfo : oldTaskPanelInfoList) {
ProTaskPanelInfo newTaskPanelInfo = new ProTaskPanelInfo();
newTaskPanelInfo.setId(snowflake.nextId());
newTaskPanelInfo.setTaskDetailId(oldAndNewTaskDetailId.get(oldTaskPanelInfo.getTaskDetailId()));
newTaskPanelInfo.setBackColor(oldTaskPanelInfo.getBackColor());
newTaskPanelInfo.setRoundCorner(oldTaskPanelInfo.getRoundCorner());
newTaskPanelInfo.setBorder(oldTaskPanelInfo.getBorder());
newTaskPanelInfo.setShadow(oldTaskPanelInfo.getShadow());
newTaskPanelInfo.setWidth(oldTaskPanelInfo.getWidth());
newTaskPanelInfo.setHeight(oldTaskPanelInfo.getHeight());
newTaskPanelInfo.setRow(oldTaskPanelInfo.getRow());
newTaskPanelInfo.setCol(oldTaskPanelInfo.getCol());
newTaskPanelInfoList.add(newTaskPanelInfo);
}
taskPanelInfoDao.insertAllTaskPanel(newTaskPanelInfoList);
}
//处理任务插件表
List<ProTaskPlugin> oldTaskPluginList = taskPluginDao.findPluginByTaskIdList(oldTaskIdList);
if (CollectionUtil.isNotEmpty(oldTaskPluginList)){
List<ProTaskPlugin> newTaskPluginList = new ArrayList<>();
for (ProTaskPlugin oldTaskPlugin : oldTaskPluginList) {
ProTaskPlugin newTaskPlugin = new ProTaskPlugin();
BeanUtil.copyProperties(oldTaskPlugin,newTaskPlugin);
newTaskPlugin.setId(snowflake.nextId());
newTaskPlugin.setTaskDetailId(oldAndNewTaskDetailId.get(oldTaskPlugin.getTaskDetailId()));
newTaskPluginList.add(newTaskPlugin);
}
taskPluginDao.insertAllTaskPlugin(newTaskPluginList);
}
//处理任务流转表
List<ProTaskFlow> oldTaskFlowList = taskFlowDao.findTaskFlowByTaskIdList(oldTaskIdList);
if (CollectionUtil.isNotEmpty(oldTaskFlowList)){
List<ProTaskFlow> newTaskFlowList = new ArrayList<>();
for (ProTaskFlow oldTaskFlow : oldTaskFlowList) {
ProTaskFlow newTaskFlow = new ProTaskFlow();
newTaskFlow.setId(snowflake.nextId());
newTaskFlow.setTaskDetailId(oldAndNewTaskDetailId.get(oldTaskFlow.getTaskDetailId()));
newTaskFlow.setFlowType(oldTaskFlow.getFlowType());
newTaskFlow.setJumpTaskDetailId(oldAndNewTaskDetailId.get(oldTaskFlow.getJumpTaskDetailId()));
newTaskFlowList.add(newTaskFlow);
}
taskFlowDao.insertAllTaskFlow(newTaskFlowList);
}
//处理任务上下道工序
List<ProTaskProcess> oldTaskProcessList = taskProcessDao.findTaskProcessByTaskIdList(oldTaskIdList);
if (CollectionUtil.isNotEmpty(oldTaskProcessList)){
List<ProTaskProcess> newTaskProcessList = new ArrayList<>();
for (ProTaskProcess oldTaskProcess : oldTaskProcessList) {
ProTaskProcess newTaskProcess = new ProTaskProcess();
BeanUtil.copyProperties(oldTaskProcess,newTaskProcess);
newTaskProcess.setId(snowflake.nextId());
newTaskProcess.setTaskDetailId(oldAndNewTaskDetailId.get(oldTaskProcess.getTaskDetailId()));
newTaskProcess.setNextTaskDetailId(oldAndNewTaskDetailId.get(oldTaskProcess.getNextTaskDetailId()));
newTaskProcessList.add(newTaskProcess);
}
taskProcessDao.insertAllTaskProcess(newTaskProcessList);
}
//处理任务通知表
List<ProTaskNotify> oldTaskNotifyList = taskNotifyDao.findTaskNotifyByTaskIdList(oldTaskIdList);
if (CollectionUtil.isNotEmpty(oldTaskNotifyList)){
List<ProTaskNotify> newTaskNotifyList = new ArrayList<>();
for (ProTaskNotify oldTaskNotify : oldTaskNotifyList) {
ProTaskNotify newTaskNotify = new ProTaskNotify();
BeanUtil.copyProperties(oldTaskNotify,newTaskNotify);
newTaskNotify.setId(snowflake.nextId());
newTaskNotify.setTaskDetailId(oldAndNewTaskDetailId.get(oldTaskNotify.getTaskDetailId()));
newTaskNotifyList.add(newTaskNotify);
}
taskNotifyDao.insertAllTaskNotify(newTaskNotifyList);
}
//处理任务标签关系表
List<LabelBusiness> oldTaskLabelList = labelBusinessDao.findBusinessLabelByBid(oldTaskIdList);
if (CollectionUtil.isNotEmpty(oldTaskLabelList)){
List<LabelBusiness> newTaskLabelList = new ArrayList<>();
for (LabelBusiness oldTaskLabel : oldTaskLabelList) {
LabelBusiness newTaskLabel = new LabelBusiness();
BeanUtil.copyProperties(oldTaskLabel,newTaskLabel);
newTaskLabel.setId(snowflake.nextId());
newTaskLabel.setUserId(userId);
newTaskLabel.setBusinessId(oldAndNewTaskDetailId.get(oldTaskLabel.getBusinessId()));
newTaskLabelList.add(newTaskLabel);
}
labelBusinessDao.insertAllBusinessLabel(newTaskLabelList);
}
}
}
private void taskLoop(List<ProTaskDetail> newTaskDetailList,List<ProTaskSub> newTaskSubList,Map<Long,Long> oldAndNewTaskDetailId
,TaskVo.TaskDetail oldTaskDetail,Long parentTaskId,List<ProParentTask> newParentTaskList) {
ProTaskDetail newTaskDetail = new ProTaskDetail();
newTaskDetail.setId(snowflake.nextId());
newTaskDetail.setName(oldTaskDetail.getName());
newTaskDetail.setDescription(oldTaskDetail.getDescription());
newTaskDetail.setCycle(oldTaskDetail.getCycle());
//将任务详情添加到newTaskDetailList集合中
newTaskDetailList.add(newTaskDetail);
oldAndNewTaskDetailId.put(oldTaskDetail.getDetailId(),newTaskDetail.getId());
//处理任务关系表
ProParentTask newParentTask = new ProParentTask();
newParentTask.setId(snowflake.nextId());
newParentTask.setTaskDetailId(newTaskDetail.getId());
newParentTask.setParentTaskDetailId(oldAndNewTaskDetailId.get(parentTaskId));
newParentTaskList.add(newParentTask);
List<ProTaskSub> oldTaskSubList = taskSubDao.findSubTaskByDetail(oldTaskDetail.getDetailId());
if (CollectionUtil.isNotEmpty(oldTaskSubList)){
for (ProTaskSub oldTaskSub : oldTaskSubList) {
ProTaskSub newTaskSub = new ProTaskSub();
newTaskSub.setId(snowflake.nextId());
newTaskSub.setPlanStartTime(System.currentTimeMillis());
newTaskSub.setPlanDuration(oldTaskSub.getPlanDuration());
newTaskSub.setPlanEndTime(System.currentTimeMillis()+oldTaskSub.getPlanDuration());
newTaskSub.setTaskDetailId(oldAndNewTaskDetailId.get(oldTaskSub.getTaskDetailId()));
//将任务详情的分解任务添加到分解任务集合中
newTaskSubList.add(newTaskSub);
}
}
}
}

12
common/src/main/java/com/ccsens/common/service/TaskService.java

@ -49,7 +49,7 @@ public class TaskService implements ITaskService {
@Resource
private ProTaskDetailDao taskDetailDao;
@Resource
private ProTaskSubMapper taskSubMapper;
private ProTaskSubDao taskSubDao;
@Resource
private ProTaskPluginDao taskPluginDao;
@Resource
@ -265,7 +265,7 @@ public class TaskService implements ITaskService {
@Override
public void updateTaskType(TaskDto.UpdateTaskType param, Long userId) throws Exception {
//验证任务是否存在
ProTaskSub proTaskSub = taskSubMapper.selectByPrimaryKey(param.getId());
ProTaskSub proTaskSub = taskSubDao.selectByPrimaryKey(param.getId());
if (ObjectUtil.isNull(proTaskSub)) {
throw new BaseException(CommonCodeError.NOT_TASK);
}
@ -293,7 +293,7 @@ public class TaskService implements ITaskService {
proTaskSub.setRealStartTime(now);
proTaskSub.setRealDuration(0L);
proTaskSub.setRealEndTime(0L);
taskSubMapper.updateByPrimaryKeySelective(proTaskSub);
taskSubDao.updateByPrimaryKeySelective(proTaskSub);
break;
case Constant.TaskOperationType.PAUSE:
//暂停 判断任务是否是进行中,
@ -305,7 +305,7 @@ public class TaskService implements ITaskService {
//计算当前任务实际时长
Long duration = calculateDuration(param.getId());
proTaskSub.setRealDuration(duration);
taskSubMapper.updateByPrimaryKeySelective(proTaskSub);
taskSubDao.updateByPrimaryKeySelective(proTaskSub);
break;
case Constant.TaskOperationType.TASK_CONTINUE:
//继续 判断任务是否是暂停中
@ -314,7 +314,7 @@ public class TaskService implements ITaskService {
}
//修改任务状态为进行中
proTaskSub.setTaskStatus(Constant.TaskType.PROCESSING);
taskSubMapper.updateByPrimaryKeySelective(proTaskSub);
taskSubDao.updateByPrimaryKeySelective(proTaskSub);
break;
case Constant.TaskOperationType.COMPLETE:
//TODO 验证交付物
@ -324,7 +324,7 @@ public class TaskService implements ITaskService {
//计算当前任务实际时长
Long d = calculateDuration(param.getId());
proTaskSub.setRealDuration(d);
taskSubMapper.updateByPrimaryKeySelective(proTaskSub);
taskSubDao.updateByPrimaryKeySelective(proTaskSub);
break;
default:
throw new BaseException(CommonCodeError.OPERATION_ERROR);

1
common/src/main/java/com/ccsens/common/util/CommonCodeError.java

@ -12,5 +12,6 @@ public class CommonCodeError extends CodeError {
public static final Code NOT_PERMISSION = new Code(3,"没有权限!", true);
public static final Code ROLE_ERROR = new Code(4,"角色信息错误!", true);
public static final Code OPERATION_ERROR = new Code(5,"请选择正确的操作!", true);
public static final Code PROJECT_NOT_FOUND = new Code(6,"项目不存在,请检查后再试!", true);
}

104
common/src/main/resources/application-dev.yml

@ -1,52 +1,52 @@
#server:
# port: 7200
# servlet:
# context-path:
#spring:
# snowflake:
# datacenterId: 1
# workerId: 1
# application:
# name: common
# datasource:
# type: com.alibaba.druid.pool.DruidDataSource
# rabbitmq:
# host: 192.168.0.99
# password: 111111
# port: 5672
# username: admin
# redis:
# database: 0
# host: 127.0.0.1
# jedis:
# pool:
# max-active: 200
# max-idle: 10
# max-wait: -1ms
# min-idle: 0
# password: ''
# port: 6379
# timeout: 1000ms
#swagger:
# enable: true
#mybatisCache:
# database: 1
# host: 127.0.0.1
# jedis:
# pool:
# max-active: 200
# max-idle: 10
# max-wait: -1
# min-idle: 0
# password: ''
# port: 6379
# timeout: 1000
#
#gatewayUrl: https://test.tall.wiki/gateway/
#notGatewayUrl: /home/staticrec/logo.png
#smsCode: 0
#
#file:
# path: /home/cloud/common/uploads/
# domain: http://localhost:7030/v1.0/
# imgDomain: http://localhost:7030/v1.0/uploads
server:
port: 7200
servlet:
context-path:
spring:
snowflake:
datacenterId: 1
workerId: 1
application:
name: common
datasource:
type: com.alibaba.druid.pool.DruidDataSource
rabbitmq:
host: 192.168.0.99
password: 111111
port: 5672
username: admin
redis:
database: 0
host: 127.0.0.1
jedis:
pool:
max-active: 200
max-idle: 10
max-wait: -1ms
min-idle: 0
password: ''
port: 6379
timeout: 1000ms
swagger:
enable: true
mybatisCache:
database: 1
host: 127.0.0.1
jedis:
pool:
max-active: 200
max-idle: 10
max-wait: -1
min-idle: 0
password: ''
port: 6379
timeout: 1000
gatewayUrl: https://test.tall.wiki/gateway/
notGatewayUrl: /home/staticrec/logo.png
smsCode: 0
file:
path: /home/cloud/common/uploads/
domain: http://localhost:7030/v1.0/
imgDomain: http://localhost:7030/v1.0/uploads

8
common/src/main/resources/application.yml

@ -1,4 +1,4 @@
#spring:
# profiles:
# active: dev
# include: util-dev,common
spring:
profiles:
active: dev
include: util-dev,common

37
common/src/main/resources/mapper_dao/LabelBusinessDao.xml

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.common.persist.dao.LabelBusinessDao">
<insert id="insertAllBusinessLabel">
INSERT INTO t_label_business (
id,
label_id,
user_id,
business_type,
business_id
)
VALUES
<foreach collection="businessLabelList" item="item" separator=",">
(#{item.id},#{item.labelId},#{item.userId},#{item.businessType},#{item.businessId})
</foreach>
</insert>
<select id="findBusinessLabelByBid" resultType="com.ccsens.common.bean.po.LabelBusiness">
SELECT
id,
label_id,
user_id,
business_type,
business_id
FROM
t_label_business
WHERE
rec_status=0
AND
business_id IN
<foreach collection="businessIdList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

33
common/src/main/resources/mapper_dao/ProParentTaskDao.xml

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.common.persist.dao.ProParentTaskDao">
<insert id="insertAllParentTask">
INSERT INTO t_pro_parent_task (
id,
task_detail_id,
parent_task_detail_id
)
VALUES
<foreach collection="newParentTaskList" item="item" separator=",">
(#{item.id},#{item.taskDetailId},#{item.parentTaskDetailId})
</foreach>
</insert>
<select id="findTaskByParentId" resultType="com.ccsens.common.bean.vo.TaskVo$TaskDetail">
SELECT
d.id AS detailId,
d.`name`,
d.description,
d.cycle,
pt.id AS parentTaskId,
pt.parent_task_detail_id AS parentTaskDetailId
FROM
t_pro_parent_task AS pt
LEFT JOIN t_pro_task_detail AS d ON d.id = pt.task_detail_id
WHERE
pt.parent_task_detail_id = #{oldProjectId}
AND pt.rec_status = 0 AND d.rec_status = 0
</select>
</mapper>

37
common/src/main/resources/mapper_dao/ProRoleDao.xml

@ -2,16 +2,19 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.common.persist.dao.ProRoleDao">
<select id="" parameterType="java.util.Map"
resultType="Long">
</select>
<insert id="insertRoleList">
INSERT INTO t_pro_role (
id,
`name`,
label_id,
project_id,
operator
)
VALUES
<foreach collection="newRoleList" item="item" separator=",">
(#{item.id},#{item.name},#{item.labelId},#{item.projectId},#{item.operator})
</foreach>
</insert>
<select id="findRoleOfProjectId" resultType="java.lang.Long">
SELECT
@ -67,4 +70,18 @@
and s.rec_status = 0
</select>
<select id="findRoleByProjectId" resultType="com.ccsens.common.bean.po.ProRole">
SELECT
id,
`name`,
label_id,
project_id,
operator
FROM
t_pro_role
WHERE
rec_status = 0
AND project_id = #{projectId}
</select>
</mapper>

28
common/src/main/resources/mapper_dao/ProRoleRepulsionDao.xml

@ -1,6 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.common.persist.dao.ProRoleRepulsionDao">
<insert id="insertRoleRepulsionList">
INSERT INTO t_pro_role_repulsion (
id,
role_id,
repulsion_role_id,
operator
)
VALUES
<foreach collection="newRoleRepulsionList" item="item" separator=",">
(#{item.id},#{item.roleId},#{item.repulsionRoleId},#{item.operator})
</foreach>
</insert>
<select id="findRepulsionByRoleId" resultType="java.lang.Long">
SELECT
@ -12,4 +24,20 @@
AND role_id = #{roleId}
</select>
<select id="findRepulsionByRoleIdList" resultType="com.ccsens.common.bean.po.ProRoleRepulsion">
SELECT
id,
role_id,
repulsion_role_id,
operator
FROM
t_pro_role_repulsion
WHERE
rec_status = 0
AND role_id IN
<foreach collection="oldRoleList" index="index" item="item" open="(" separator="," close=")">
#{item.id}
</foreach>
</select>
</mapper>

34
common/src/main/resources/mapper_dao/ProRoleTaskDao.xml

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.common.persist.dao.ProRoleTaskDao">
<insert id="insertAllRoleTask">
INSERT INTO t_pro_role_task (
id,
role_id,
task_id,
operator
)
VALUES
<foreach collection="roleTaskList" item="item" separator=",">
(#{item.id},#{item.roleId},#{item.taskId},#{item.operator})
</foreach>
</insert>
<select id="findRoleTaskByRoleId" resultType="com.ccsens.common.bean.po.ProRoleTask">
SELECT
id,
role_id,
task_id,
operator
FROM
t_pro_role_task
WHERE
rec_status = 0
AND role_id IN
<foreach collection="roleIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

17
common/src/main/resources/mapper_dao/ProTaskDetailDao.xml

@ -26,6 +26,19 @@
</collection>
</resultMap>
<insert id="insertAllTaskDetail">
INSERT INTO t_pro_task_detail (
id,
`name`,
description,
cycle
)
VALUES
<foreach collection="newTaskDetailList" item="item" separator=",">
(#{item.id},#{item.name},#{item.description},#{item.cycle})
</foreach>
</insert>
<select id="queryPermanentGlobalTask" resultMap="queryTask">
SELECT
ts.id,
@ -64,6 +77,7 @@
AND ts.plan_start_time = 0
AND ts.plan_duration = 0
AND rt.role_id = #{roleId}
ORDER BY ts.plan_start_time
</select>
<select id="queryGlobalTask" resultMap="queryTask">
@ -128,6 +142,7 @@
AND lltt.label_type = 0
AND llbb.business_type = 0
AND ll.`level` >= #{timeUnit}
ORDER BY ts.plan_start_time
</select>
<select id="queryRegularTask" resultMap="queryTask">
@ -204,6 +219,7 @@
AND lltt.label_type = 0
AND llbb.business_type = 0
AND ll.`level` >= #{timeUnit}
ORDER BY alltask.planStart
</select>
<select id="continueQueryTask" resultMap="queryTask">
@ -270,6 +286,7 @@
AND lltt.label_type = 0
AND llbb.business_type = 0
AND ll.`level` >= #{timeUnit}
ORDER BY alltask.planStart
</select>
<select id="projectIdByTaskDetailId" resultType="java.lang.Long">
SELECT

34
common/src/main/resources/mapper_dao/ProTaskFlowDao.xml

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.common.persist.dao.ProTaskFlowDao">
<insert id="insertAllTaskFlow">
INSERT INTO t_pro_task_flow (
id,
task_detail_id,
flow_type,
jump_task_detail_id
)
VALUES
<foreach collection="taskFlowList" item="item" separator=",">
(#{item.id},#{item.taskDetailId},#{item.flowType},#{item.jumpTaskDetailId})
</foreach>
</insert>
<select id="findTaskFlowByTaskIdList" resultType="com.ccsens.common.bean.po.ProTaskFlow">
SELECT
id,
task_detail_id,
flow_type,
jump_task_detail_id
FROM
t_pro_task_flow
WHERE
rec_status = 0
AND task_detail_id IN
<foreach collection="taskIdList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

38
common/src/main/resources/mapper_dao/ProTaskNotifyDao.xml

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.common.persist.dao.ProTaskNotifyDao">
<insert id="insertAllTaskNotify">
INSERT INTO t_pro_task_notify (
id,
task_detail_id,
lifecycle,
path,
appoint_param,
notify_type
)
VALUES
<foreach collection="roleTaskList" item="item" separator=",">
(#{item.id},#{item.taskDetailId},#{item.lifecycle},#{item.path},#{item.appointParam},#{item.notifyType})
</foreach>
</insert>
<select id="findTaskNotifyByTaskIdList" resultType="com.ccsens.common.bean.po.ProTaskNotify">
SELECT
id,
task_detail_id,
lifecycle,
path,
appoint_param,
notify_type
FROM
t_pro_task_notify
WHERE
rec_status = 0
AND task_detail_id IN
<foreach collection="taskIdList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

47
common/src/main/resources/mapper_dao/ProTaskPanelInfoDao.xml

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.common.persist.dao.ProTaskPanelInfoDao">
<insert id="insertAllTaskPanel">
INSERT INTO t_pro_task_panel_info (
id,
task_detail_id,
back_color,
round_corner,
border,
shadow,
width,
height,
`row`,
col
)
VALUES
<foreach collection="roleTaskList" item="item" separator=",">
(#{item.id},#{item.taskDetailId},#{item.backColor},#{item.roundCorner},#{item.border},#{item.shadow},#{item.width}
,#{item.height},#{item.row},#{item.col})
</foreach>
</insert>
<select id="findPanelByTaskIdList" resultType="com.ccsens.common.bean.po.ProTaskPanelInfo">
SELECT
id,
task_detail_id,
back_color,
round_corner,
border,
shadow,
width,
height,
`row`,
col
FROM
t_pro_task_panel_info
WHERE
rec_status = 0
AND task_detail_id IN
<foreach collection="taskIdList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

37
common/src/main/resources/mapper_dao/ProTaskPluginDao.xml

@ -2,6 +2,23 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.common.persist.dao.ProTaskPluginDao">
<insert id="insertAllTaskPlugin">
INSERT INTO t_pro_task_plugin (
id,
param,
plgin_row,
plgin_col,
task_detail_id,
plugin_id,
colspan,
rowspan
)
VALUES
<foreach collection="roleTaskList" item="item" separator=",">
(#{item.id},#{item.param},#{item.plginRow},#{item.plginCol},#{item.taskDetailId},#{item.pluginId},#{item.colspan},#{item.rowspan})
</foreach>
</insert>
<select id="queryTaskOfPlugin" resultType="com.ccsens.common.bean.vo.TaskVo$TaskPluginInfo">
SELECT
tp.plugin_id AS pluginId,
@ -18,4 +35,24 @@
AND tp.task_detail_id = #{detailTaskId}
</select>
<select id="findPluginByTaskIdList" resultType="com.ccsens.common.bean.po.ProTaskPlugin">
SELECT
id,
param,
plgin_row,
plgin_col,
task_detail_id,
plugin_id,
colspan,
rowspan
FROM
t_pro_task_plugin
WHERE
rec_status = 0
AND task_detail_id IN
<foreach collection="oldTaskIdList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

36
common/src/main/resources/mapper_dao/ProTaskProcessDao.xml

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.common.persist.dao.ProTaskProcessDao">
<insert id="insertAllTaskProcess">
INSERT INTO t_pro_task_process (
id,
task_detail_id,
next_task_detail_id,
process_type,
time_difference
)
VALUES
<foreach collection="roleTaskList" item="item" separator=",">
(#{item.id},#{item.taskDetailId},#{item.nextTaskDetailId},#{item.processType},#{item.timeDifference})
</foreach>
</insert>
<select id="findTaskProcessByTaskIdList" resultType="com.ccsens.common.bean.po.ProTaskProcess">
SELECT
id,
task_detail_id,
next_task_detail_id,
process_type,
time_difference
FROM
t_pro_task_process
WHERE
rec_status = 0
AND task_detail_id IN
<foreach collection="taskIdList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

32
common/src/main/resources/mapper_dao/ProTaskSubDao.xml

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.common.persist.dao.ProTaskSubDao">
<insert id="insertAllTaskSub">
INSERT INTO t_pro_task_sub (
id,
plan_start_time,
plan_duration,
plan_end_time,
task_detail_id
)
VALUES
<foreach collection="newTaskSubList" item="item" separator=",">
(#{item.id},#{item.planStartTime},#{item.planDuration},#{item.planEndTime},#{item.taskDetailId})
</foreach>
</insert>
<select id="findSubTaskByDetail" resultType="com.ccsens.common.bean.po.ProTaskSub">
SELECT
id,
plan_start_time,
plan_duration,
plan_end_time,
task_detail_id
FROM
t_pro_task_sub
WHERE
rec_status = 0
AND task_detail_id = #{id}
</select>
</mapper>

23
common/src/main/resources/mapper_dao/ProTaskVersionDao.xml

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.common.persist.dao.ProTaskVersionDao">
<select id="findVersionByProjectId" resultType="com.ccsens.common.bean.po.ProTaskVersion">
SELECT
id,
task_detail_id,
task_version_info,
project_type,
address
FROM
t_pro_task_version
WHERE
rec_status = 0
AND task_detail_id = #{projectId}
ORDER BY
created_at DESC
LIMIT 1
</select>
</mapper>

14
common/src/main/resources/mapper_raw/ProTaskFlowMapper.xml

@ -5,7 +5,7 @@
<id column="id" jdbcType="BIGINT" property="id" />
<result column="task_detail_id" jdbcType="BIGINT" property="taskDetailId" />
<result column="flow_type" jdbcType="BIGINT" property="flowType" />
<result column="jump_task_detail_id" jdbcType="INTEGER" property="jumpTaskDetailId" />
<result column="jump_task_detail_id" jdbcType="BIGINT" property="jumpTaskDetailId" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
@ -106,7 +106,7 @@
jump_task_detail_id, created_at, updated_at,
rec_status)
values (#{id,jdbcType=BIGINT}, #{taskDetailId,jdbcType=BIGINT}, #{flowType,jdbcType=BIGINT},
#{jumpTaskDetailId,jdbcType=INTEGER}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP},
#{jumpTaskDetailId,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP},
#{recStatus,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.common.bean.po.ProTaskFlow">
@ -145,7 +145,7 @@
#{flowType,jdbcType=BIGINT},
</if>
<if test="jumpTaskDetailId != null">
#{jumpTaskDetailId,jdbcType=INTEGER},
#{jumpTaskDetailId,jdbcType=BIGINT},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
@ -177,7 +177,7 @@
flow_type = #{record.flowType,jdbcType=BIGINT},
</if>
<if test="record.jumpTaskDetailId != null">
jump_task_detail_id = #{record.jumpTaskDetailId,jdbcType=INTEGER},
jump_task_detail_id = #{record.jumpTaskDetailId,jdbcType=BIGINT},
</if>
<if test="record.createdAt != null">
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
@ -198,7 +198,7 @@
set id = #{record.id,jdbcType=BIGINT},
task_detail_id = #{record.taskDetailId,jdbcType=BIGINT},
flow_type = #{record.flowType,jdbcType=BIGINT},
jump_task_detail_id = #{record.jumpTaskDetailId,jdbcType=INTEGER},
jump_task_detail_id = #{record.jumpTaskDetailId,jdbcType=BIGINT},
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
rec_status = #{record.recStatus,jdbcType=TINYINT}
@ -216,7 +216,7 @@
flow_type = #{flowType,jdbcType=BIGINT},
</if>
<if test="jumpTaskDetailId != null">
jump_task_detail_id = #{jumpTaskDetailId,jdbcType=INTEGER},
jump_task_detail_id = #{jumpTaskDetailId,jdbcType=BIGINT},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
@ -234,7 +234,7 @@
update t_pro_task_flow
set task_detail_id = #{taskDetailId,jdbcType=BIGINT},
flow_type = #{flowType,jdbcType=BIGINT},
jump_task_detail_id = #{jumpTaskDetailId,jdbcType=INTEGER},
jump_task_detail_id = #{jumpTaskDetailId,jdbcType=BIGINT},
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
rec_status = #{recStatus,jdbcType=TINYINT}

Loading…
Cancel
Save