Browse Source

导出再导入

ptos
zy_Java 3 years ago
parent
commit
3d028c8e2c
  1. 2
      src/main/java/com/ccsens/ptccsens/persist/dao/PluDeliverDao.java
  2. 3
      src/main/java/com/ccsens/ptccsens/persist/dao/ProMemberDao.java
  3. 12
      src/main/java/com/ccsens/ptccsens/persist/dao/ProMemberStakeholderDao.java
  4. 7
      src/main/java/com/ccsens/ptccsens/persist/dao/ProProjectDao.java
  5. 11
      src/main/java/com/ccsens/ptccsens/persist/dao/ProRoleDao.java
  6. 17
      src/main/java/com/ccsens/ptccsens/persist/dao/ProTaskDetailDao.java
  7. 2
      src/main/java/com/ccsens/ptccsens/persist/dao/ProTaskPluginDao.java
  8. 1
      src/main/java/com/ccsens/ptccsens/persist/dao/ProTaskSubDao.java
  9. 285
      src/main/java/com/ccsens/ptccsens/service/ExportService.java
  10. 21
      src/main/java/com/ccsens/ptccsens/service/IExportService.java
  11. 340
      src/main/java/com/ccsens/ptccsens/service/ImportService.java
  12. 43
      src/main/java/com/ccsens/ptccsens/service/TallService.java
  13. 56
      src/main/resources/mapper_dao/PluDeliverDao.xml
  14. 68
      src/main/resources/mapper_dao/ProMemberDao.xml
  15. 66
      src/main/resources/mapper_dao/ProMemberStakeholderDao.xml
  16. 18
      src/main/resources/mapper_dao/ProProjectDao.xml
  17. 102
      src/main/resources/mapper_dao/ProRoleDao.xml
  18. 104
      src/main/resources/mapper_dao/ProTaskDetailDao.xml
  19. 92
      src/main/resources/mapper_dao/ProTaskPluginDao.xml
  20. 79
      src/main/resources/mapper_dao/ProTaskSubDao.xml

2
src/main/java/com/ccsens/ptccsens/persist/dao/PluDeliverDao.java

@ -11,7 +11,7 @@ import java.util.List;
* @author
*/
public interface PluDeliverDao extends PluDeliverMapper {
void insertReplace(PluDeliver pluDeliver);
/**
* 查询任务下的交付物信息
* @param taskId 任务id

3
src/main/java/com/ccsens/ptccsens/persist/dao/ProMemberDao.java

@ -1,5 +1,6 @@
package com.ccsens.ptccsens.persist.dao;
import com.ccsens.ptccsens.bean.po.ProMember;
import com.ccsens.ptccsens.persist.mapper.ProMemberMapper;
import org.apache.ibatis.annotations.Param;
@ -20,4 +21,6 @@ public interface ProMemberDao extends ProMemberMapper {
* @return 列表
*/
List<Long> queryMembersOfProject(@Param("projectId") Long projectId);
void insertReplace(ProMember proMember);
}

12
src/main/java/com/ccsens/ptccsens/persist/dao/ProMemberStakeholderDao.java

@ -0,0 +1,12 @@
package com.ccsens.ptccsens.persist.dao;
import com.ccsens.ptccsens.bean.po.ProMemberStakeholder;
import com.ccsens.ptccsens.persist.mapper.ProMemberStakeholderMapper;
/**
* @author
*/
public interface ProMemberStakeholderDao extends ProMemberStakeholderMapper {
void insertReplace(ProMemberStakeholder memberStakeholder);
}

7
src/main/java/com/ccsens/ptccsens/persist/dao/ProProjectDao.java

@ -1,6 +1,7 @@
package com.ccsens.ptccsens.persist.dao;
import com.ccsensptos.tallsdk.bean.vo.TallProjectVo;
import com.ccsensptos.tallsdk.bean.vo.TallWbsVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@ -17,4 +18,10 @@ public interface ProProjectDao {
*/
TallProjectVo.ProjectInfo findProjectById(@Param("projectId") Long projectId);
/**
* 查询wbs内的展示信息
* @param projectId 项目id
* @return 返回项目信息
*/
TallWbsVo.WbsProjectInfo getWbsProjectId(@Param("projectId") Long projectId);
}

11
src/main/java/com/ccsens/ptccsens/persist/dao/ProRoleDao.java

@ -4,6 +4,7 @@ package com.ccsens.ptccsens.persist.dao;
import com.ccsens.ptccsens.bean.po.ProRole;
import com.ccsens.ptccsens.persist.mapper.ProRoleMapper;
import com.ccsensptos.tallsdk.bean.vo.TallRoleVo;
import com.ccsensptos.tallsdk.bean.vo.TallWbsVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@ -72,4 +73,14 @@ public interface ProRoleDao extends ProRoleMapper {
* @return 返回角色id
*/
List<Long> getRoleIdBySubTaskId(@Param("taskSubId")Long taskSubId);
/**
* 通过项目id查询wbs内的角色成员信息
* @param projectId 项目id
* @param isPm 0项目经理 1项目成员
* @return 返回角色和成员信息
*/
List<TallWbsVo.WbsRole> getWbsRoleInfo(@Param("projectId")Long projectId, @Param("isPm")int isPm);
void insertReplace(ProRole role);
}

17
src/main/java/com/ccsens/ptccsens/persist/dao/ProTaskDetailDao.java

@ -1,16 +1,19 @@
package com.ccsens.ptccsens.persist.dao;
import com.ccsens.ptccsens.bean.dto.TaskDto;
import com.ccsens.ptccsens.bean.po.ProTaskDetail;
import com.ccsens.ptccsens.bean.po.ProTaskSub;
import com.ccsens.ptccsens.bean.vo.TaskVo;
import com.ccsens.ptccsens.persist.mapper.ProTaskDetailMapper;
import com.ccsensptos.tallsdk.bean.vo.TallProjectVo;
import com.ccsensptos.tallsdk.bean.vo.TallTaskVo;
import com.ccsensptos.tallsdk.bean.vo.TallWbsVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ProTaskDetailDao extends ProTaskDetailMapper {
void insertReplace(ProTaskDetail taskDetail);
/**
* 根据任务详情id查找项目id
* @param taskDetailId 任务ID
@ -117,4 +120,18 @@ public interface ProTaskDetailDao extends ProTaskDetailMapper {
* @return 任务状态
*/
Byte getTaskTypeBySubTaskId(@Param("taskSubId")Long taskSubId);
/**
* WBS通过项目id查找一级任务信息
* @param projectId 项目id
* @return 一级任务信息
*/
List<TallWbsVo.WbsTaskInfo> getWbsTaskByProjectId(@Param("projectId")Long projectId);
/**
* WBS根据一级任务id查询二级任务信息
* @param firstId 一级任务Id
* @return 返回二级任务信息
*/
List<TallWbsVo.WbsSecondTask> getSecondTask(@Param("firstId")String firstId);
}

2
src/main/java/com/ccsens/ptccsens/persist/dao/ProTaskPluginDao.java

@ -1,5 +1,6 @@
package com.ccsens.ptccsens.persist.dao;
import com.ccsens.ptccsens.bean.po.ProTaskPlugin;
import com.ccsens.ptccsens.persist.mapper.ProTaskPluginMapper;
import com.ccsensptos.tallsdk.bean.vo.TallTaskVo;
import org.apache.ibatis.annotations.Param;
@ -19,6 +20,7 @@ public interface ProTaskPluginDao extends ProTaskPluginMapper {
*/
List<TallTaskVo.TaskPluginInfo> queryTaskOfPlugin(@Param("detailTaskId") Long detailTaskId);
void insertReplace(ProTaskPlugin proTaskPlugin);
// /**
// * 根据任务id列表查询任务插件
// * @param oldTaskIdList 任务id列表

1
src/main/java/com/ccsens/ptccsens/persist/dao/ProTaskSubDao.java

@ -49,4 +49,5 @@ public interface ProTaskSubDao extends ProTaskSubMapper {
*/
Long getTimeByProgressTask(@Param("timeNode")Long timeNode, @Param("roleId")Long roleId);
void insertReplace(ProTaskSub taskSub);
}

285
src/main/java/com/ccsens/ptccsens/service/ExportService.java

@ -0,0 +1,285 @@
package com.ccsens.ptccsens.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import com.ccsens.util.PoiUtil;
import com.ccsens.util.PropUtil;
import com.ccsensptos.tallsdk.bean.vo.TallWbsVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
/**
* @author
*/
@Slf4j
@Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class ExportService implements IExportService {
@Override
public String exportWbs(TallWbsVo.WbsProjectInfo wbsProjectInfo, List<TallWbsVo.WbsTaskInfo> wbsTaskInfo, TallWbsVo.WbsRoleInfo wbsRoleInfo) throws Exception {
Workbook wb = new XSSFWorkbook();
//生成wbs表的数据
List<List<PoiUtil.PoiUtilCell>> wbs = generateWbs(wbsProjectInfo,wbsTaskInfo);
//生成项目成员表的数据
List<List<PoiUtil.PoiUtilCell>> member = generateMember(wbsRoleInfo);
//写入数据
PoiUtil.exportWB("WBS", wbs, wb);
PoiUtil.exportWB("项目成员表", member, wb);
//生成文件
String fileName = "exportWbs/" + DateUtil.today() + "/" + System.currentTimeMillis() + ".xlsx";
String path = PropUtil.path + fileName;
File tmpFile = new File(path);
if (!tmpFile.getParentFile().exists()) {
tmpFile.getParentFile().mkdirs();
}
OutputStream stream = new FileOutputStream(tmpFile);
wb.write(stream);
stream.close();
return PropUtil.notGatewayUrl + "/" + fileName;
}
/**
* 生成wbs表的数据
*/
private List<List<PoiUtil.PoiUtilCell>> generateWbs(TallWbsVo.WbsProjectInfo wbsProjectInfo, List<TallWbsVo.WbsTaskInfo> wbsTaskInfo) {
List<List<PoiUtil.PoiUtilCell>> wbs = new ArrayList<>();
//项目标题
generateWbsProject(wbs,wbsProjectInfo);
//任务
generateWbsTask(wbs,wbsTaskInfo);
return wbs;
}
/**
* 生成项目数据
*/
private void generateWbsProject(List<List<PoiUtil.PoiUtilCell>> wbs, TallWbsVo.WbsProjectInfo wbsProjectInfo) {
//项目标题
List<PoiUtil.PoiUtilCell> projectHeader = new ArrayList<>();
projectHeader.add(new PoiUtil.PoiUtilCell("项目信息(Project Information)",6,1));
wbs.add(projectHeader);
//项目表头
List<PoiUtil.PoiUtilCell> projectTitle = new ArrayList<>();
projectTitle.add(new PoiUtil.PoiUtilCell("名称"));
projectTitle.add(new PoiUtil.PoiUtilCell("描述"));
projectTitle.add(new PoiUtil.PoiUtilCell("地点"));
projectTitle.add(new PoiUtil.PoiUtilCell("开始时间"));
projectTitle.add(new PoiUtil.PoiUtilCell("结束时间"));
projectTitle.add(new PoiUtil.PoiUtilCell("版本号"));
wbs.add(projectTitle);
//项目信息
List<PoiUtil.PoiUtilCell> projectInfo = new ArrayList<>();
projectInfo.add(new PoiUtil.PoiUtilCell(wbsProjectInfo.getProjectName(),wbsProjectInfo.getProjectId(),1,1));
projectInfo.add(new PoiUtil.PoiUtilCell(wbsProjectInfo.getDescription()));
projectInfo.add(new PoiUtil.PoiUtilCell(wbsProjectInfo.getAddress()));
projectInfo.add(new PoiUtil.PoiUtilCell(wbsProjectInfo.getStartTime()));
projectInfo.add(new PoiUtil.PoiUtilCell(wbsProjectInfo.getEndTime()));
projectInfo.add(new PoiUtil.PoiUtilCell(wbsProjectInfo.getVersion()));
wbs.add(projectInfo);
List<PoiUtil.PoiUtilCell> s1 = new ArrayList<>();
wbs.add(s1);
}
/**
* 生成任务数据
*/
private void generateWbsTask(List<List<PoiUtil.PoiUtilCell>> wbs, List<TallWbsVo.WbsTaskInfo> wbsTaskInfo) {
//任务标题
List<PoiUtil.PoiUtilCell> taskHeader = new ArrayList<>();
taskHeader.add(new PoiUtil.PoiUtilCell("项目任务分解(PWBS)",15,1));
wbs.add(taskHeader);
//任务表头
List<PoiUtil.PoiUtilCell> taskTitle = new ArrayList<>();
taskTitle.add(new PoiUtil.PoiUtilCell("序号"));
taskTitle.add(new PoiUtil.PoiUtilCell("任务(节点"));
taskTitle.add(new PoiUtil.PoiUtilCell("二级任务(节点)"));
taskTitle.add(new PoiUtil.PoiUtilCell("任务描述/要求"));
taskTitle.add(new PoiUtil.PoiUtilCell("时间/开始时间"));
taskTitle.add(new PoiUtil.PoiUtilCell("结束时间"));
taskTitle.add(new PoiUtil.PoiUtilCell("任务时长"));
taskTitle.add(new PoiUtil.PoiUtilCell("标签"));
taskTitle.add(new PoiUtil.PoiUtilCell("负责人"));
taskTitle.add(new PoiUtil.PoiUtilCell("检查人"));
taskTitle.add(new PoiUtil.PoiUtilCell("交付物"));
taskTitle.add(new PoiUtil.PoiUtilCell("即时奖惩"));
taskTitle.add(new PoiUtil.PoiUtilCell("插件1"));
taskTitle.add(new PoiUtil.PoiUtilCell("插件2"));
taskTitle.add(new PoiUtil.PoiUtilCell("插件3"));
wbs.add(taskTitle);
//任务信息
if(CollectionUtil.isEmpty(wbsTaskInfo)){
return;
}
//序号
int num = 1;
//循环添加一级任务
for (TallWbsVo.WbsTaskInfo task : wbsTaskInfo) {
if(CollectionUtil.isEmpty(task.getSecondTaskList())){
continue;
}
for (int i = 0; i < task.getSecondTaskList().size(); i++) {
TallWbsVo.WbsSecondTask secondTask = task.getSecondTaskList().get(i);
//行
List<PoiUtil.PoiUtilCell> taskRow = new ArrayList<>();
//序号
taskRow.add(new PoiUtil.PoiUtilCell("" + num++));
//一级任务
if(i == 0){
taskRow.add(new PoiUtil.PoiUtilCell(task.getFirstName(),task.getFirstId(),1,task.getSecondTaskList().size()));
}else {
taskRow.add(new PoiUtil.PoiUtilCell());
}
//任务名
taskRow.add(new PoiUtil.PoiUtilCell(secondTask.getTaskName(),secondTask.getSubId(),1,1));
//描述
taskRow.add(new PoiUtil.PoiUtilCell(secondTask.getDescription(),secondTask.getDetailId(),1,1));
//开始时间
if("0".equals(secondTask.getStartTime()) || secondTask.getStartTime() == null){
taskRow.add(new PoiUtil.PoiUtilCell());
}else {
taskRow.add(new PoiUtil.PoiUtilCell(secondTask.getStartTime()));
}
//结束时间
if("0".equals(secondTask.getEndTime()) || secondTask.getEndTime() == null){
taskRow.add(new PoiUtil.PoiUtilCell());
}else {
taskRow.add(new PoiUtil.PoiUtilCell(secondTask.getEndTime()));
}
//TODO 任务时长
taskRow.add(new PoiUtil.PoiUtilCell());
//标签
taskRow.add(new PoiUtil.PoiUtilCell(secondTask.getLabel()));
//负责人
taskRow.add(new PoiUtil.PoiUtilCell(secondTask.getExecutor()));
//检查人
taskRow.add(new PoiUtil.PoiUtilCell(secondTask.getChecker()));
//交付物
if("0".equals(secondTask.getDeliverId()) || secondTask.getDeliverId() == null){
taskRow.add(new PoiUtil.PoiUtilCell());
}else {
taskRow.add(new PoiUtil.PoiUtilCell(secondTask.getDeliverName(),secondTask.getDeliverId(),1,1));
}
//即时奖惩
taskRow.add(new PoiUtil.PoiUtilCell());
//插件1
if("0".equals(secondTask.getPluginOneId()) || secondTask.getPluginOneId() == null){
taskRow.add(new PoiUtil.PoiUtilCell());
}else {
taskRow.add(new PoiUtil.PoiUtilCell(secondTask.getPluginOneName(),secondTask.getPluginOneId(),1,1));
}
//插件2
if("0".equals(secondTask.getPluginTwoId()) || secondTask.getPluginTwoId() == null){
taskRow.add(new PoiUtil.PoiUtilCell());
}else {
taskRow.add(new PoiUtil.PoiUtilCell(secondTask.getPluginTwoName(),secondTask.getPluginTwoId(),1,1));
}
//插件3
if("0".equals(secondTask.getPluginThreeId()) || secondTask.getPluginThreeId() == null){
taskRow.add(new PoiUtil.PoiUtilCell());
}else {
taskRow.add(new PoiUtil.PoiUtilCell(secondTask.getPluginThreeName(),secondTask.getPluginThreeId(),1,1));
}
wbs.add(taskRow);
}
}
}
/**
* 生成wbs表的数据
*/
private List<List<PoiUtil.PoiUtilCell>> generateMember(TallWbsVo.WbsRoleInfo wbsRoleInfo) {
List<List<PoiUtil.PoiUtilCell>> wbs = new ArrayList<>();
//标题
List<PoiUtil.PoiUtilCell> memberHeader = new ArrayList<>();
memberHeader.add(new PoiUtil.PoiUtilCell("项目成员(Project Members)",6,1));
wbs.add(memberHeader);
//表头
List<PoiUtil.PoiUtilCell> memberTitle = new ArrayList<>();
memberTitle.add(new PoiUtil.PoiUtilCell("序号"));
memberTitle.add(new PoiUtil.PoiUtilCell("系统角色"));
memberTitle.add(new PoiUtil.PoiUtilCell("本项目角色"));
memberTitle.add(new PoiUtil.PoiUtilCell("成员"));
memberTitle.add(new PoiUtil.PoiUtilCell("电话"));
memberTitle.add(new PoiUtil.PoiUtilCell("奖惩干系人"));
memberTitle.add(new PoiUtil.PoiUtilCell("干系人电话"));
memberTitle.add(new PoiUtil.PoiUtilCell("对谁不可见"));
wbs.add(memberTitle);
int num = 1;
//项目经理
generateRole(wbs,wbsRoleInfo.getPmList(),true,num);
//项目成员
generateRole(wbs,wbsRoleInfo.getRoleList(),false,num);
return wbs;
}
/**
* 生成角色和成员信息
*/
private void generateRole(List<List<PoiUtil.PoiUtilCell>> wbs, List<TallWbsVo.WbsRole> pmList, boolean isPm, int num) {
if(CollectionUtil.isNotEmpty(pmList)){
//获取成员数量
int memberNum = 0;
for (TallWbsVo.WbsRole role : pmList) {
if(CollectionUtil.isNotEmpty(role.getMemberList())){
for (TallWbsVo.WbsMember ignored : role.getMemberList()) {
memberNum++;
}
}
}
for (int i = 0; i < pmList.size(); i++) {
TallWbsVo.WbsRole role = pmList.get(i);
if(CollectionUtil.isNotEmpty(role.getMemberList())){
for (int j = 0; j < role.getMemberList().size(); j++) {
TallWbsVo.WbsMember member = role.getMemberList().get(j);
List<PoiUtil.PoiUtilCell> roleInfo = new ArrayList<>();
roleInfo.add(new PoiUtil.PoiUtilCell("" + num++));
//系统角色
if(i == 0 && j == 0){
if(isPm){
roleInfo.add(new PoiUtil.PoiUtilCell("项目经理",1,memberNum == 0 ? 1 : memberNum));
}else {
roleInfo.add(new PoiUtil.PoiUtilCell("项目成员",1,memberNum == 0 ? 1 : memberNum));
}
}else {
roleInfo.add(new PoiUtil.PoiUtilCell());
}
//角色
if(j == 0){
roleInfo.add(new PoiUtil.PoiUtilCell(role.getRoleName(),role.getRoleId(),1,role.getMemberList().size()));
}else {
roleInfo.add(new PoiUtil.PoiUtilCell());
}
//成员名
roleInfo.add(new PoiUtil.PoiUtilCell(member.getMemberName(),member.getMemberId(),1,1));
//成员电话
roleInfo.add(new PoiUtil.PoiUtilCell(member.getMemberPhone()));
//奖惩干系人
roleInfo.add(new PoiUtil.PoiUtilCell(member.getStakeholderName(),member.getStakeholderId(),1,1));
//奖惩干系人电话
roleInfo.add(new PoiUtil.PoiUtilCell(member.getStakeholderPhone()));
//对谁不可见
if(j == 0){
roleInfo.add(new PoiUtil.PoiUtilCell(role.getRepulsion(),1,role.getMemberList().size()));
}else {
roleInfo.add(new PoiUtil.PoiUtilCell());
}
wbs.add(roleInfo);
}
}
}
}
}
}

21
src/main/java/com/ccsens/ptccsens/service/IExportService.java

@ -0,0 +1,21 @@
package com.ccsens.ptccsens.service;
import com.ccsensptos.tallsdk.bean.vo.TallWbsVo;
import java.io.FileNotFoundException;
import java.util.List;
/**
* @author
*/
public interface IExportService {
/**
* 导出wbs
* @param wbsProjectInfo 项目信息
* @param wbsTaskInfo 任务信息
* @param wbsRoleInfo 角色成员信息
* @return 返回文件的下载路径
*/
String exportWbs(TallWbsVo.WbsProjectInfo wbsProjectInfo, List<TallWbsVo.WbsTaskInfo> wbsTaskInfo, TallWbsVo.WbsRoleInfo wbsRoleInfo) throws FileNotFoundException, Exception;
}

340
src/main/java/com/ccsens/ptccsens/service/ImportService.java

@ -7,13 +7,13 @@ import cn.hutool.core.util.StrUtil;
import com.ccsens.ptccsens.bean.dto.RoleDto;
import com.ccsens.ptccsens.bean.dto.TaskDto;
import com.ccsens.ptccsens.bean.po.*;
import com.ccsens.ptccsens.util.Constant;
import com.ccsens.ptccsens.bean.vo.ProjectVo;
import com.ccsens.ptccsens.persist.dao.*;
import com.ccsens.ptccsens.persist.mapper.ProMemberStakeholderMapper;
import com.ccsens.ptccsens.util.BasicsCodeError;
import com.ccsens.ptccsens.util.BasicsConstant;
import com.ccsens.ptccsens.util.Constant;
import com.ccsens.util.ExcelUtil;
import com.ccsens.util.PropUtil;
import com.ccsens.util.StringUtil;
import com.ccsens.util.cron.CronConstant;
import com.ccsens.util.cron.NatureToDate;
@ -62,7 +62,7 @@ public class ImportService implements IImportService {
@Resource
private ProRoleMemberDao roleMemberDao;
@Resource
private ProMemberStakeholderMapper memberStakeholderMapper;
private ProMemberStakeholderDao memberStakeholderDao;
@Resource
private ProRoleRepulsionDao repulsionDao;
@Resource
@ -203,7 +203,7 @@ public class ImportService implements IImportService {
throw new BaseException(BasicsCodeError.WSB_NOT_TASK_HEADER);
}
//添加项目
ProjectVo.SysProject project = readProject(wbsSheet, projectStart, userId,projectId);
ProjectVo.SysProject project = readProject(wbsSheet, projectStart, userId);
if(ObjectUtil.isNull(project)){
throw new BaseException(BasicsCodeError.WSB_NOT_PROJECT_HEADER);
}
@ -253,36 +253,54 @@ public class ImportService implements IImportService {
roleMember.setRoleId(role.getId());
roleMember.setMemberId(memberId);
roleMemberDao.insertSelective(roleMember);
// //TODO 在tall客户端添加项目和用户的关联信息
// ProjectDto.SaveProjectDto saveProjectDto = new ProjectDto.SaveProjectDto();
// saveProjectDto.setId(project.getId());
// saveProjectDto.setName(project.getName());
// saveProjectDto.setStartTime(project.getBeginTime());
// saveProjectDto.setEndTime(project.getEndTime());
// saveProjectDto.setUrl(PropUtil.domain);
//
// saveProjectDto.setUserIdList(userIdSet);
// JsonResponse jsonResponse = tall3FeignClient.saveProjectList(saveProjectDto);
// if (null == jsonResponse){
// throw new BaseException(BasicsCodeError.FEIGN_ERROR);
// }
//获取项目信息
// BeanUtil.copyProperties(saveProjectDto,projectInfo);
//返回项目信息
projectInfo.setId(project.getId());
projectInfo.setName(project.getName());
projectInfo.setStartTime(project.getBeginTime());
projectInfo.setEndTime(project.getEndTime());
projectInfo.setUrl(PropUtil.notGatewayUrl);
projectInfo.setBusinessCode(Constant.BUSINESS_CODE);
}
/**
* 读取项目信息
*/
private ProjectVo.SysProject readProject(XSSFSheet wbsSheet, int projectStart, Long userId, Long projectId) {
private ProjectVo.SysProject readProject(XSSFSheet wbsSheet, int projectStart, Long userId) {
ProjectVo.SysProject project = new ProjectVo.SysProject();
// TODO 查询是否项目是否存在
if (ObjectUtil.isNotNull(projectId)) {
//获取项目信息的那一行
XSSFRow row = wbsSheet.getRow(projectStart + 1);
if (ObjectUtil.isNull(row)) {
throw new BaseException(BasicsCodeError.WSB_NOT_PROJECT_HEADER);
}
//项目名
String projectName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(0)));
//项目id
String projectIdCell = ExcelUtil.getCellComment(row.getCell(0));
//详情
String description = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(1)));
//项目地点
String address = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(2)));
//开始时间
String beginTime = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(3)));
//结束时间
String endTime = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(4)));
//版本
String version = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(5)));
if (StrUtil.isEmpty(projectName)) {
throw new BaseException(BasicsCodeError.WBS_NOT_PROJECT_NAME.addMsg(wbsSheet.getSheetName(),projectStart+1));
}
//TODO 验证是否有项目id且项目id合法
Long projectId = null;
if(StrUtil.isNotBlank(projectIdCell)){
try {
projectId = Long.parseLong(projectIdCell);
}catch (Exception e) {
log.info("项目id分解异常");
}
project = projectDao.selectById(projectId);
if (ObjectUtil.isNotNull(project)) {
project.setId(projectId);
project.setImportType((byte)1);
project.setImportType((byte) 1);
//删除之前的项目详情
projectDao.updateStatusById(projectId);
//删除之前的项目分解
@ -305,36 +323,18 @@ public class ImportService implements IImportService {
labelBusinessDao.updateByExampleSelective(labelBusiness,labelBusinessExample);
}
}
//获取项目信息的那一行
XSSFRow row = wbsSheet.getRow(projectStart + 1);
if (ObjectUtil.isNull(row)) {
throw new BaseException(BasicsCodeError.WSB_NOT_PROJECT_HEADER);
}
//项目名
String projectName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(0)));
//详情
String description = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(1)));
//项目时间
String address = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(2)));
//开始时间
String beginTime = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(3)));
//结束时间
String endTime = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(4)));
//版本
String version = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(5)));
if (StrUtil.isEmpty(projectName)) {
throw new BaseException(BasicsCodeError.WBS_NOT_PROJECT_NAME.addMsg(wbsSheet.getSheetName(),projectStart+1));
}
//项目名不能重复(当前用户创建的项目内名字不能重复)
//根据userId查找已创建的项目
List<ProjectVo.SysProject> sysProjectList = projectDao.queryByCreator(userId);
if(CollectionUtil.isNotEmpty(sysProjectList)){
sysProjectList.forEach(p -> {
if(projectName.equalsIgnoreCase(p.getName())){
//如果名称重复则提示错误信息
throw new BaseException(BasicsCodeError.PROJECT_NAME_REPEAT.addMsg(wbsSheet.getSheetName(),projectStart+1,projectName));
}
});
if(0 == project.getImportType()) {
List<ProjectVo.SysProject> sysProjectList = projectDao.queryByCreator(userId);
if (CollectionUtil.isNotEmpty(sysProjectList)) {
sysProjectList.forEach(p -> {
if (projectName.equalsIgnoreCase(p.getName())) {
//如果名称重复则提示错误信息
throw new BaseException(BasicsCodeError.PROJECT_NAME_REPEAT.addMsg(wbsSheet.getSheetName(), projectStart + 1, projectName));
}
});
}
}
//判断时间是否正确
String begin = ExcelUtil.getCellValue(row.getCell(3));
@ -351,24 +351,14 @@ public class ImportService implements IImportService {
//日期格式错误
throw new BaseException(BasicsCodeError.WBS_PROJECT_TIME_ERROR.addMsg(wbsSheet.getSheetName(),projectStart+1));
}
//添加项目信息(任务详情)
ProTaskDetail taskDetail = new ProTaskDetail();
if (0 == project.getImportType()) {
taskDetail.setId(snowflake.nextId());
}
if (1 == project.getImportType()) {
taskDetail.setId(projectId);
}
taskDetail.setId((1 == project.getImportType() && projectId != null) ? projectId : snowflake.nextId());
taskDetail.setName(projectName);
taskDetail.setDescription(description);
if (0 == project.getImportType()){
taskDetailDao.insertSelective(taskDetail);
}
if (1 == project.getImportType()){
taskDetailDao.updateByPrimaryKeySelective(taskDetail);
}
project.setId(taskDetail.getId());
project.setName(projectName);
// taskDetailDao.insertSelective(taskDetail);
taskDetailDao.insertReplace(taskDetail);
//添加(任务分解)
ProTaskSub taskSub = new ProTaskSub();
taskSub.setId(snowflake.nextId());
@ -377,8 +367,6 @@ public class ImportService implements IImportService {
taskSub.setPlanEndTime(eTime);
taskSub.setPlanDuration(eTime - bTime);
taskSubDao.insertSelective(taskSub);
project.setBeginTime(bTime);
project.setEndTime(eTime);
//添加版本信息
ProTaskVersion taskVersion = new ProTaskVersion();
taskVersion.setId(snowflake.nextId());
@ -391,6 +379,10 @@ public class ImportService implements IImportService {
//添加任务标签关联信息
saveLabelTask(taskDetail.getId(), labelId);
project.setId(taskDetail.getId());
project.setName(projectName);
project.setBeginTime(bTime);
project.setEndTime(eTime);
return project;
}
@ -435,7 +427,7 @@ public class ImportService implements IImportService {
memberStakeholder.setRecStatus((byte)2);
ProMemberStakeholderExample memberStakeholderExample = new ProMemberStakeholderExample();
memberStakeholderExample.createCriteria().andMemeberIdIn(memberIdList);
memberStakeholderMapper.updateByExampleSelective(memberStakeholder,memberStakeholderExample);
memberStakeholderDao.updateByExampleSelective(memberStakeholder,memberStakeholderExample);
//删除对谁不可见
ProRoleRepulsion roleRepulsion = new ProRoleRepulsion();
roleRepulsion.setRecStatus((byte)2);
@ -470,9 +462,12 @@ public class ImportService implements IImportService {
//项目角色
String roleName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(2)));
if((StrUtil.isEmpty(roleName) || "/".equalsIgnoreCase(roleName)) && ObjectUtil.isNull(roleId)){ continue; }
//角色id
String roleIdCell = ExcelUtil.getCellComment(row.getCell(2));
//成员
String memberName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(3)));
//成员id
String memberIdCell = ExcelUtil.getCellComment(row.getCell(3));
//角色手机号
String memberPhone = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(4)));
if((StrUtil.isNotEmpty(memberName) && !"/".equalsIgnoreCase(memberName)) && (StrUtil.isEmpty(memberPhone) || !memberPhone.matches(Constant.PHONE_REGEX))){
@ -480,6 +475,8 @@ public class ImportService implements IImportService {
}
//奖惩干系人
String stakeholderName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(5)));
//奖惩干系人id
String stakeholderIdCell = ExcelUtil.getCellComment(row.getCell(5));
//干系人电话
String stakeholderPhone = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(6)));
if((StrUtil.isNotEmpty(stakeholderName) && !"/".equalsIgnoreCase(stakeholderName)) && (StrUtil.isEmpty(stakeholderPhone) || !stakeholderPhone.matches(Constant.PHONE_REGEX))){
@ -487,12 +484,19 @@ public class ImportService implements IImportService {
}
//添加角色
if(StrUtil.isNotEmpty(roleName) && !"/".equalsIgnoreCase(roleName)){
if(StrUtil.isNotBlank(roleIdCell)){
try {
roleId = Long.parseLong(roleIdCell);
}catch (Exception e){
log.info("角色id解析失败");
}
}
ProRole role = new ProRole();
role.setId(snowflake.nextId());
role.setId((1 == project.getImportType() && roleId != null) ? roleId : snowflake.nextId());
role.setName(roleName);
role.setProjectId(project.getId());
role.setLabelId(sysRoleId);
roleDao.insertSelective(role);
roleDao.insertReplace(role);
roleId = role.getId();
roleMap.put(roleName,role.getId());
}
@ -505,8 +509,13 @@ public class ImportService implements IImportService {
memberId = wbsMembers.getId();
}
if(ObjectUtil.isNull(memberId)){
//TODO 根据成员手机号查找userId 成员关联userId
if(StrUtil.isNotBlank(memberIdCell)){
try {
memberId = Long.parseLong(memberIdCell);
}catch (Exception e){
log.info("成员id解析失败");
}
}
//根据手机号获取userId
ProUser user = userDao.getUserIdByPhone(memberPhone);
if(ObjectUtil.isNull(user)){
@ -519,15 +528,42 @@ public class ImportService implements IImportService {
Long userId = user.getId();
//添加成员至数据库
ProMember proMember = new ProMember();
proMember.setId(snowflake.nextId());
proMember.setId((1 == project.getImportType() && memberId != null) ? memberId : snowflake.nextId());
proMember.setName(memberName);
proMember.setPhone(memberPhone);
proMember.setProjectId(project.getId());
proMember.setUserId(userId);
memberDao.insertSelective(proMember);
memberDao.insertReplace(proMember);
RoleDto.WbsMember member = new RoleDto.WbsMember(proMember.getId(),userId);
memberMap.put(memberName+"_"+memberPhone,member);
memberId = proMember.getId();
//添加奖惩干系人
if(StrUtil.isNotEmpty(stakeholderName) && !"/".equalsIgnoreCase(roleName)){
//根据干系人手机号查找userId 奖惩干系人关联userId
ProUser stakeholderUser = userDao.getUserIdByPhone(stakeholderPhone);
if(ObjectUtil.isNull(stakeholderUser)){
//如果未查到用户则添加一条新的用户信息
stakeholderUser = new ProUser();
stakeholderUser.setId(snowflake.nextId());
stakeholderUser.setPhone(stakeholderPhone);
userDao.insertSelective(stakeholderUser);
}
Long stakeholderId = null;
if(StrUtil.isNotBlank(stakeholderIdCell)){
try {
stakeholderId = Long.parseLong(stakeholderIdCell);
}catch (Exception e){
log.info("奖惩干系人id解析失败");
}
}
ProMemberStakeholder memberStakeholder = new ProMemberStakeholder();
memberStakeholder.setId((1 == project.getImportType() && stakeholderId != null) ? stakeholderId : snowflake.nextId());
memberStakeholder.setMemeberId(memberId);
memberStakeholder.setStakeholderName(stakeholderName);
memberStakeholder.setStakeholderPhone(stakeholderPhone);
memberStakeholder.setUserId(stakeholderUser.getId());
memberStakeholderDao.insertReplace(memberStakeholder);
}
}
//添加角色成员关联信息
ProRoleMember roleMember = new ProRoleMember();
@ -535,26 +571,6 @@ public class ImportService implements IImportService {
roleMember.setRoleId(roleId);
roleMember.setMemberId(memberId);
roleMemberDao.insertSelective(roleMember);
//添加奖惩干系人
if(StrUtil.isNotEmpty(stakeholderName) && !"/".equalsIgnoreCase(roleName)){
//TODO 根据干系人手机号查找userId 奖惩干系人关联userId
ProUser user = userDao.getUserIdByPhone(stakeholderPhone);
if(ObjectUtil.isNull(user)){
//TODO 如果未查到用户则添加一条新的用户信息
user = new ProUser();
user.setId(snowflake.nextId());
user.setPhone(stakeholderPhone);
userDao.insertSelective(user);
}
Long userId = user.getId();
ProMemberStakeholder memberStakeholder = new ProMemberStakeholder();
memberStakeholder.setId(snowflake.nextId());
memberStakeholder.setMemeberId(memberId);
memberStakeholder.setStakeholderName(stakeholderName);
memberStakeholder.setStakeholderPhone(stakeholderPhone);
memberStakeholder.setUserId(userId);
memberStakeholderMapper.insertSelective(memberStakeholder);
}
}
}
//添加对谁不可见
@ -664,21 +680,29 @@ public class ImportService implements IImportService {
if(StrUtil.isEmpty(firstTaskName) && ObjectUtil.isNull(firstTaskId)){
continue;
}
//一级任务id
String firstTaskIdCell = ExcelUtil.getCellComment(row.getCell(1));
if(StrUtil.isNotEmpty(firstTaskName)){
//添加一级任务
firstTaskId = saveFirstTask(project, firstTaskName);
firstTaskId = saveFirstTask(project, firstTaskName,firstTaskIdCell);
}
//二级任务名
String taskName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(2)));
if(StrUtil.isEmpty(taskName)){
continue;
}
//二级任务分解id
String subIdCell = ExcelUtil.getCellComment(row.getCell(2));
//二级任务详情id
String detailIdCell = ExcelUtil.getCellComment(row.getCell(3));
//任务描述
String description = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(3)));
//重要性标签
String vitalLabel = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(7)));
//负责人
String executorRole = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(8)));
//检查人
String checkerRole = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(9)));
//开始时间
String beginTime = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(4)));
//结束时间
@ -687,17 +711,30 @@ public class ImportService implements IImportService {
String duration = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(6)));
//交付物
String deliver = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(10)));
//二级任务详情id
String deliverIdCell = ExcelUtil.getCellComment(row.getCell(10));
//插件
String plugin1 = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(12)));
String pluginIdCell1 = ExcelUtil.getCellComment(row.getCell(12));
String plugin2 = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(13)));
String pluginIdCell2 = ExcelUtil.getCellComment(row.getCell(13));
String plugin3 = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(14)));
String pluginIdCell3 = ExcelUtil.getCellComment(row.getCell(14));
if(StrUtil.isNotEmpty(taskName)){
Long detailId = null;
if(StrUtil.isNotBlank(detailIdCell)){
try {
detailId = Long.parseLong(detailIdCell);
}catch (Exception e){
log.info("任务详情id解析失败");
}
}
//添加二级任务信息(任务详情)
ProTaskDetail taskDetail = new ProTaskDetail();
taskDetail.setId(snowflake.nextId());
taskDetail.setId((1 == project.getImportType() && detailId != null) ? detailId : snowflake.nextId());
taskDetail.setName(taskName);
taskDetail.setDescription(description);
taskDetailDao.insertSelective(taskDetail);
taskDetailDao.insertReplace(taskDetail);
//任务关联信息(关联一级任务)
ProParentTask parentTask = new ProParentTask();
parentTask.setId(snowflake.nextId());
@ -715,7 +752,7 @@ public class ImportService implements IImportService {
labelBusiness.setBusinessId(taskDetail.getId());
labelBusiness.setLabelId(labelId);
labelBusinessDao.insertSelective(labelBusiness);
//任务和角色关联
//任务和负责人关联
if(StrUtil.isEmpty(executorRole)){
throw new BaseException(BasicsCodeError.WBS_NOT_FIND_ROLE.addMsg(wbsSheet.getSheetName(),i+1,executorRole));
}
@ -732,15 +769,47 @@ public class ImportService implements IImportService {
roleTaskMapper.insertSelective(roleTask);
}
//任务和检查人关联
if(StrUtil.isNotEmpty(checkerRole)){
Long checkerRoleId = roleMap.get(checkerRole);
if(ObjectUtil.isNull(checkerRoleId)){
throw new BaseException(BasicsCodeError.WBS_NOT_FIND_ROLE.addMsg(wbsSheet.getSheetName(),i+1,checkerRole));
}
ProRoleTask roleTask = new ProRoleTask();
roleTask.setId(snowflake.nextId());
roleTask.setRoleDuty((byte) 1);
roleTask.setRoleId(checkerRoleId);
roleTask.setTaskId(taskDetail.getId());
roleTaskMapper.insertSelective(roleTask);
}else {
throw new BaseException(BasicsCodeError.WBS_NOT_FIND_ROLE.addMsg(wbsSheet.getSheetName(),i+1,executorRole));
}
//处理时间、添加任务分解、添加任务标签
taskStartTime = taskSaveTime(taskStartTime, project, beginTime, endTime, duration, taskDetail.getId(),wbsSheet,i+1,deliver);
Long subId = null;
if(StrUtil.isNotBlank(subIdCell)){
try {
subId = Long.parseLong(subIdCell);
}catch (Exception e){
log.info("任务分解id解析失败");
}
}
Long deliverId = null;
if(StrUtil.isNotBlank(deliverIdCell)){
try {
deliverId = Long.parseLong(deliverIdCell);
}catch (Exception e){
log.info("交付物id解析失败");
}
}
taskStartTime = taskSaveTime(subId, taskStartTime, project, beginTime, endTime, duration, taskDetail.getId(),wbsSheet,i+1,deliver,deliverId);
//添加时间颗粒度标签并关联
Long timeLabel = labelDao.getLabelByTypeAndLevel(0, 4);
saveLabelTask(taskDetail.getId(),timeLabel);
//TODO 插件
Long taskPlugin1 = plugin(plugin1,taskDetail.getId(),1,wbsSheet,i+1);
Long taskPlugin2 = plugin(plugin2,taskDetail.getId(),2,wbsSheet,i+1);
Long taskPlugin3 = plugin(plugin3,taskDetail.getId(),3,wbsSheet,i+1);
Long taskPlugin1 = plugin(project,pluginIdCell1,plugin1,taskDetail.getId(),1,wbsSheet,i+1);
Long taskPlugin2 = plugin(project,pluginIdCell2,plugin2,taskDetail.getId(),2,wbsSheet,i+1);
Long taskPlugin3 = plugin(project,pluginIdCell3,plugin3,taskDetail.getId(),3,wbsSheet,i+1);
TaskDto.TaskPluginId taskPlugin = new TaskDto.TaskPluginId(taskPlugin1,taskPlugin2,taskPlugin3);
taskMap.put(sequence + "_" + taskName, taskPlugin);
}
@ -751,22 +820,23 @@ public class ImportService implements IImportService {
//TODO 添加默认插件
}
}
private Long plugin(String plugin, Long taskId, int row, XSSFSheet wbsSheet, int errorRow) {
private Long plugin(ProjectVo.SysProject project, String pluginIdCell, String plugin, Long taskId, int row, XSSFSheet wbsSheet, int errorRow) {
Long taskPlugin = null;
if(StrUtil.isNotEmpty(plugin)){
//根据插件名称查找插件id
// Long pluginId = taskPluginDao.getPluginIdByName(plugin);
// Long pluginId = 1L;
// if(ObjectUtil.isNull(pluginId)){
// throw new BaseException(BasicsCodeError.PLUGIN_NAME_ERROR.addMsg(wbsSheet.getSheetName(),errorRow,plugin));
// }
if(StrUtil.isNotBlank(pluginIdCell)){
try {
taskPlugin = Long.parseLong(pluginIdCell);
}catch (Exception e){
log.info("任务插件id解析失败");
}
}
TallPluginVo.BusinessPluginInfo pluginByCodeAndName = PluginUtil.getPluginByCodeAndName(Constant.BUSINESS_CODE, plugin);
if(ObjectUtil.isNull(pluginByCodeAndName)){
throw new BaseException(BasicsCodeError.PLUGIN_NAME_ERROR.addMsg(wbsSheet.getSheetName(),errorRow,plugin));
}
//添加插件
ProTaskPlugin proTaskPlugin = new ProTaskPlugin();
proTaskPlugin.setId(snowflake.nextId());
proTaskPlugin.setId((1 == project.getImportType() && taskPlugin != null) ? taskPlugin : snowflake.nextId());
proTaskPlugin.setTaskDetailId(taskId);
proTaskPlugin.setPluginId(pluginByCodeAndName.getPluginId());
proTaskPlugin.setBusinessPluginId(pluginByCodeAndName.getBusinessPluginId());
@ -777,13 +847,13 @@ public class ImportService implements IImportService {
proTaskPlugin.setRowspan(1);
proTaskPlugin.setColspan(1);
proTaskPlugin.setCode(plugin);
proTaskPluginDao.insertSelective(proTaskPlugin);
proTaskPluginDao.insertReplace(proTaskPlugin);
taskPlugin = proTaskPlugin.getId();
}
return taskPlugin;
}
private Long taskSaveTime(Long taskStartTime, ProjectVo.SysProject project, String beginTime, String endTime, String duration, Long taskDetailId, XSSFSheet wbsSheet, int row,String deliver) {
private Long taskSaveTime(Long subId, Long taskStartTime, ProjectVo.SysProject project, String beginTime, String endTime, String duration, Long taskDetailId, XSSFSheet wbsSheet, int row, String deliver, Long deliverId) {
if(StrUtil.isEmpty(beginTime) || "日常".equalsIgnoreCase(beginTime)){
if(StrUtil.isEmpty(beginTime) && StrUtil.isNotEmpty(duration)){
@ -805,17 +875,17 @@ public class ImportService implements IImportService {
Long durationTime = Long.parseLong(trimNum) * aLong;
//添加任务分解
ProTaskSub taskSub = new ProTaskSub();
taskSub.setId(snowflake.nextId());
taskSub.setId((1 == project.getImportType() && subId != null) ? subId : snowflake.nextId());
taskSub.setTaskDetailId(taskDetailId);
taskSub.setPlanDuration(durationTime);
taskSub.setPlanStartTime(taskStartTime);
taskStartTime += durationTime;
taskSub.setPlanEndTime(taskStartTime);
taskSubDao.insertSelective(taskSub);
taskSubDao.insertReplace(taskSub);
//TODO 添加交付物信息
//添加交付物信息
if(StrUtil.isNotBlank(deliver)) {
saveDeliver(deliver, taskSub);
saveDeliver(project, deliverId, deliver, taskSub);
}
//查找定期任务标签并关联任务
Long taskLabel = labelDao.getLabelByTypeAndLevel(1, 3);
@ -824,12 +894,12 @@ public class ImportService implements IImportService {
}else {
//添加任务分解
ProTaskSub taskSub = new ProTaskSub();
taskSub.setId(snowflake.nextId());
taskSub.setId((1 == project.getImportType() && subId != null) ? subId : snowflake.nextId());
taskSub.setTaskDetailId(taskDetailId);
taskSubDao.insertSelective(taskSub);
taskSubDao.insertReplace(taskSub);
//添加交付物信息
if(StrUtil.isNotBlank(deliver)) {
saveDeliver(deliver, taskSub);
saveDeliver(project, deliverId, deliver, taskSub);
}
//查找日常任务标签并关联信息
Long label = labelDao.getLabelByTypeAndLevel(1, 2);
@ -843,15 +913,15 @@ public class ImportService implements IImportService {
eTime = StrUtil.isEmpty(endTime) ? project.getEndTime() : Long.parseLong(endTime);
//添加任务分解
ProTaskSub taskSub = new ProTaskSub();
taskSub.setId(snowflake.nextId());
taskSub.setId((1 == project.getImportType() && subId != null) ? subId : snowflake.nextId());
taskSub.setTaskDetailId(taskDetailId);
taskSub.setPlanEndTime(eTime);
taskSub.setPlanStartTime(bTime);
taskSub.setPlanDuration(eTime - bTime);
taskSubDao.insertSelective(taskSub);
taskSubDao.insertReplace(taskSub);
//添加交付物信息
if(StrUtil.isNotBlank(deliver)) {
saveDeliver(deliver, taskSub);
saveDeliver(project, deliverId, deliver, taskSub);
}
//查找定期任务标签并关联任务
Long taskLabel = labelDao.getLabelByTypeAndLevel(1, 3);
@ -904,25 +974,33 @@ public class ImportService implements IImportService {
return taskStartTime;
}
private void saveDeliver(String deliver, ProTaskSub taskSub) {
private void saveDeliver(ProjectVo.SysProject project, Long deliverId, String deliver, ProTaskSub taskSub) {
PluDeliver pluDeliver = new PluDeliver();
pluDeliver.setId(snowflake.nextId());
pluDeliver.setId((1 == project.getImportType() && deliverId != null) ? deliverId : snowflake.nextId());
pluDeliver.setTaskSubId(taskSub.getId());
pluDeliver.setName(deliver);
pluDeliverDao.insertSelective(pluDeliver);
pluDeliverDao.insertReplace(pluDeliver);
}
/**
* 添加一级任务
*/
private Long saveFirstTask(ProjectVo.SysProject project, String firstTaskName) {
private Long saveFirstTask(ProjectVo.SysProject project, String firstTaskName, String firstIdCell) {
Long firstTaskId = null;
if(StrUtil.isNotBlank(firstIdCell)){
try {
firstTaskId = Long.parseLong(firstIdCell);
}catch (Exception e){
log.info("一级任务id解析失败");
}
}
//TODO 一级任务负责人是项目经理
Long firstTaskId;
ProTaskDetail taskDetail = new ProTaskDetail();
taskDetail.setId(snowflake.nextId());
taskDetail.setId((1 == project.getImportType() && firstTaskId != null) ? firstTaskId : snowflake.nextId());
taskDetail.setName(firstTaskName);
taskDetailDao.insertSelective(taskDetail);
taskDetailDao.insertReplace(taskDetail);
firstTaskId = taskDetail.getId();
//添加任务分解
ProTaskSub taskSub = new ProTaskSub();

43
src/main/java/com/ccsens/ptccsens/service/TallService.java

@ -24,10 +24,7 @@ import com.ccsensptos.tallsdk.bean.dto.TallProjectDto;
import com.ccsensptos.tallsdk.bean.dto.TallRoleDto;
import com.ccsensptos.tallsdk.bean.dto.TallTaskDto;
import com.ccsensptos.tallsdk.bean.dto.TallTokenDto;
import com.ccsensptos.tallsdk.bean.vo.TallProjectVo;
import com.ccsensptos.tallsdk.bean.vo.TallRoleVo;
import com.ccsensptos.tallsdk.bean.vo.TallTaskVo;
import com.ccsensptos.tallsdk.bean.vo.TallTokenVo;
import com.ccsensptos.tallsdk.bean.vo.*;
import com.ccsensptos.tallsdk.service.ITallService;
import com.ccsensptos.tallsdk.util.TokenUtil;
import com.github.pagehelper.PageHelper;
@ -81,6 +78,8 @@ public class TallService implements ITallService {
private PluDeliverDao pluDeliverDao;
@Resource
private FinanceService financeService;
@Resource
private IExportService exportService;
@SneakyThrows
@Override
@ -120,6 +119,42 @@ public class TallService implements ITallService {
return importService.importWbs(fullPath,user.getId(),null);
}
@SneakyThrows
@Override
public TallWbsVo.WbsPath exportWbs(String token, TallProjectDto.ProjectById param) {
//TODO 验证项目id是否正确
//TODO 暂时只查询二级任务,不管二级以下的子任务
//查询下项目信息
TallWbsVo.WbsProjectInfo wbsProjectInfo = proProjectDao.getWbsProjectId(param.getProjectId());
if(ObjectUtil.isNull(wbsProjectInfo)){
throw new BaseException(BasicsCodeError.PROJECT_NOT_FOUND);
}
//查询一级任务信息
List<TallWbsVo.WbsTaskInfo> wbsTaskInfo = taskDetailDao.getWbsTaskByProjectId(param.getProjectId());
if(CollectionUtil.isNotEmpty(wbsTaskInfo)){
wbsTaskInfo.forEach(taskInfo -> {
//查询二级任务
List<TallWbsVo.WbsSecondTask> secondTaskList = taskDetailDao.getSecondTask(taskInfo.getFirstId());
taskInfo.setSecondTaskList(secondTaskList);
});
}
//查询角色成员信息
TallWbsVo.WbsRoleInfo wbsRoleInfo = new TallWbsVo.WbsRoleInfo();
//查询项目经理的角色信息
List<TallWbsVo.WbsRole> pmList = proRoleDao.getWbsRoleInfo(param.getProjectId(),0);
//查询项目成员的角色信息
List<TallWbsVo.WbsRole> roleList = proRoleDao.getWbsRoleInfo(param.getProjectId(),1);
wbsRoleInfo.setPmList(pmList);
wbsRoleInfo.setRoleList(roleList);
//生成excel数据并导入文件
String url = exportService.exportWbs(wbsProjectInfo,wbsTaskInfo,wbsRoleInfo);
TallWbsVo.WbsPath wbsPath = new TallWbsVo.WbsPath();
wbsPath.setUrl(url);
return wbsPath;
}
@Override
public TallProjectVo.ProjectInfo findProjectById(String header, TallProjectDto.ProjectById params) {
TallProjectVo.ProjectInfo projectById = proProjectDao.findProjectById(params.getProjectId());

56
src/main/resources/mapper_dao/PluDeliverDao.xml

@ -36,6 +36,62 @@
</foreach>
</insert>
<insert id="insertReplace" parameterType="com.ccsens.ptccsens.bean.po.PluDeliver">
replace into t_plu_deliver
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="taskSubId != null">
task_sub_id,
</if>
<if test="name != null">
name,
</if>
<if test="description != null">
description,
</if>
<if test="operator != null">
operator,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="recStatus != null">
rec_status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="taskSubId != null">
#{taskSubId,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="operator != null">
#{operator,jdbcType=BIGINT},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="recStatus != null">
#{recStatus,jdbcType=TINYINT},
</if>
</trim>
</insert>
<select id="getDeliverByTask" resultMap="deliverOfTask">
SELECT
r.*,

68
src/main/resources/mapper_dao/ProMemberDao.xml

@ -22,4 +22,72 @@
rec_status = 0
AND project_id = #{projectId}
</select>
<insert id="insertReplace" parameterType="com.ccsens.ptccsens.bean.po.ProMember">
replace into t_pro_member
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="projectId != null">
project_id,
</if>
<if test="phone != null">
phone,
</if>
<if test="name != null">
name,
</if>
<if test="avatarUrl != null">
avatar_url,
</if>
<if test="operator != null">
operator,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="recStatus != null">
rec_status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="projectId != null">
#{projectId,jdbcType=BIGINT},
</if>
<if test="phone != null">
#{phone,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="avatarUrl != null">
#{avatarUrl,jdbcType=VARCHAR},
</if>
<if test="operator != null">
#{operator,jdbcType=BIGINT},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="recStatus != null">
#{recStatus,jdbcType=TINYINT},
</if>
</trim>
</insert>
</mapper>

66
src/main/resources/mapper_dao/ProMemberStakeholderDao.xml

@ -0,0 +1,66 @@
<?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.ptccsens.persist.dao.ProMemberStakeholderDao">
<insert id="insertReplace" parameterType="com.ccsens.ptccsens.bean.po.ProMemberStakeholder">
replace into t_pro_member_stakeholder
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="memeberId != null">
memeber_id,
</if>
<if test="stakeholderName != null">
stakeholder_name,
</if>
<if test="stakeholderPhone != null">
stakeholder_phone,
</if>
<if test="userId != null">
user_id,
</if>
<if test="operator != null">
operator,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="recStatus != null">
rec_status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="memeberId != null">
#{memeberId,jdbcType=BIGINT},
</if>
<if test="stakeholderName != null">
#{stakeholderName,jdbcType=VARCHAR},
</if>
<if test="stakeholderPhone != null">
#{stakeholderPhone,jdbcType=VARCHAR},
</if>
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="operator != null">
#{operator,jdbcType=BIGINT},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="recStatus != null">
#{recStatus,jdbcType=TINYINT},
</if>
</trim>
</insert>
</mapper>

18
src/main/resources/mapper_dao/ProProjectDao.xml

@ -25,5 +25,21 @@
s.plan_start_time DESC
LIMIT 1
</select>
<select id="getWbsProjectId" resultType="com.ccsensptos.tallsdk.bean.vo.TallWbsVo$WbsProjectInfo">
SELECT
d.id as projectId,
d.`name` as projectName,
d.description,
if(s.plan_start_time = 0,0,FROM_UNIXTIME(s.plan_start_time/1000,'%Y-%m-%d %H:%i')) as startTime,
if(s.plan_end_time = 0,0,FROM_UNIXTIME(s.plan_end_time/1000,'%Y-%m-%d %H:%i')) as endTime,
v.address,
v.task_version_info as version
FROM
t_pro_task_detail d
LEFT JOIN t_pro_task_sub s on d.id = s.task_detail_id and s.rec_status = 0
LEFT JOIN t_pro_task_version v on v.task_detail_id = d.id and v.rec_status = 0
WHERE
d.id = #{projectId}
and d.rec_status = 0
</select>
</mapper>

102
src/main/resources/mapper_dao/ProRoleDao.xml

@ -1,6 +1,61 @@
<?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.ptccsens.persist.dao.ProRoleDao">
<insert id="insertReplace" parameterType="com.ccsens.ptccsens.bean.po.ProRole">
replace into t_pro_role
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="labelId != null">
label_id,
</if>
<if test="projectId != null">
project_id,
</if>
<if test="operator != null">
operator,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="recStatus != null">
rec_status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="labelId != null">
#{labelId,jdbcType=BIGINT},
</if>
<if test="projectId != null">
#{projectId,jdbcType=BIGINT},
</if>
<if test="operator != null">
#{operator,jdbcType=BIGINT},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="recStatus != null">
#{recStatus,jdbcType=TINYINT},
</if>
</trim>
</insert>
<select id="findRoleOfProjectId" resultType="java.lang.Long">
SELECT
@ -134,4 +189,51 @@
and s.id = #{taskSubId}
</select>
<resultMap id="wbsRole" type="com.ccsensptos.tallsdk.bean.vo.TallWbsVo$WbsRole">
<id column="roleId" property="roleId"/>
<result column="roleName" property="roleName"/>
<result column="repulsion" property="repulsion"/>
<collection property="memberList" ofType="com.ccsensptos.tallsdk.bean.vo.TallWbsVo$WbsMember">
<id column="memberId" property="memberId"/>
<result column="memberName" property="memberName"/>
<result column="memberPhone" property="memberPhone"/>
<result column="stakeholderId" property="stakeholderId"/>
<result column="stakeholderName" property="stakeholderName"/>
<result column="stakeholderPhone" property="stakeholderPhone"/>
</collection>
</resultMap>
<select id="getWbsRoleInfo" resultMap="wbsRole">
SELECT
role.*,
m.id as memberId,
m.`name` as memberName,
m.phone as memberPhone,
ms.id as stakeholderId,
ms.stakeholder_name as stakeholderName,
ms.stakeholder_phone as stakeholderPhone
FROM
(
SELECT
r.id as roleId,
r.`name` as roleName,
GROUP_CONCAT(pr.`name`) as repulsion
FROM
t_pro_role r
LEFT JOIN t_pro_role_repulsion rr on r.id = rr.role_id and rr.rec_status = 0
LEFT JOIN t_pro_role pr on pr.id = rr.repulsion_role_id and pr.rec_status = 0
WHERE
r.project_id = #{projectId}
<if test="isPm == 0">
and r.label_id = 34
</if>
<if test="isPm == 1">
and r.label_id = 32
</if>
GROUP BY r.id
) role
LEFT JOIN t_pro_role_member rm on role.roleId = rm.role_id and rm.rec_status = 0
LEFT JOIN t_pro_member m on m.id = rm.member_id and m.rec_status = 0
LEFT JOIN t_pro_member_stakeholder ms on m.id = ms.memeber_id and ms.rec_status = 0
</select>
</mapper>

104
src/main/resources/mapper_dao/ProTaskDetailDao.xml

@ -1,6 +1,55 @@
<?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.ptccsens.persist.dao.ProTaskDetailDao">
<insert id="insertReplace" parameterType="com.ccsens.ptccsens.bean.po.ProTaskDetail">
replace into t_pro_task_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="description != null">
description,
</if>
<if test="cycle != null">
cycle,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="recStatus != null">
rec_status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="cycle != null">
#{cycle,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="recStatus != null">
#{recStatus,jdbcType=TINYINT},
</if>
</trim>
</insert>
<select id="projectIdByTaskDetailId" resultType="java.lang.Long">
SELECT
b.business_id
@ -537,4 +586,59 @@
and b.rec_status = 0
and l.rec_status = 0
</select>
<select id="getWbsTaskByProjectId" resultType="com.ccsensptos.tallsdk.bean.vo.TallWbsVo$WbsTaskInfo">
SELECT
d.id as firstId,
d.`name` as firstName
FROM
t_pro_parent_task p,
t_pro_task_detail d
WHERE
p.task_detail_id = d.id
and p.parent_task_detail_id = #{projectId}
and p.rec_status = 0
and d.rec_status = 0
</select>
<select id="getSecondTask" resultType="com.ccsensptos.tallsdk.bean.vo.TallWbsVo$WbsSecondTask">
SELECT
task.*,
Max(case tp.plgin_row when 1 then tp.id else 0 end ) pluginOneId,
Max(case tp.plgin_row when 1 then tp.`code` else null end ) pluginOneName,
Max(case tp.plgin_row when 2 then tp.id else 0 end ) pluginTwoId,
Max(case tp.plgin_row when 2 then tp.`code` else null end ) pluginTwoName,
Max(case tp.plgin_row when 3 then tp.id else 0 end ) pluginThreeId,
Max(case tp.plgin_row when 3 then tp.`code` else null end ) pluginThreeName
FROM
(
SELECT
d.id as detailId,
s.id as subId,
d.`name` as taskName,
d.description,
if(s.plan_start_time = 0,0,FROM_UNIXTIME(s.plan_start_time/1000,'%Y-%m-%d %H:%i')) as startTime,
if(s.plan_end_time = 0,0,FROM_UNIXTIME(s.plan_end_time/1000,'%Y-%m-%d %H:%i')) as endTime,
(SELECT l.description FROM t_label_business b LEFT JOIN t_label l on l.id = b.label_id and l.rec_status = 0 WHERE b.business_id = d.id and b.rec_status = 0 and b.business_type = 0 and label_type_id = 3 limit 1) as label,
GROUP_CONCAT(r1.`name` ORDER BY rt.id) as executor,
GROUP_CONCAT(r2.`name` ORDER BY rt.id) as checker,
de.id as deliverId,
de.`name` as deliverName
FROM
t_pro_parent_task p
LEFT JOIN t_pro_task_detail d on p.task_detail_id = d.id
LEFT JOIN t_pro_task_sub s on d.id = s.task_detail_id and s.rec_status = 0
LEFT JOIN t_pro_role_task rt on d.id = rt.task_id and rt.rec_status = 0
LEFT JOIN t_pro_role r1 on rt.role_id = r1.id and r1.rec_status = 0 and rt.role_duty = 0
LEFT JOIN t_pro_role r2 on rt.role_id = r2.id and r2.rec_status = 0 and rt.role_duty = 1
LEFT JOIN t_plu_deliver de on de.task_sub_id = s.id and de.rec_status = 0
WHERE
p.task_detail_id = d.id
and p.parent_task_detail_id = #{firstId}
and p.rec_status = 0
and d.rec_status = 0
GROUP BY s.id
) task
LEFT JOIN t_pro_task_plugin tp on tp.task_detail_id = task.detailId and tp.rec_status = 0
GROUP BY task.subId
</select>
</mapper>

92
src/main/resources/mapper_dao/ProTaskPluginDao.xml

@ -1,7 +1,97 @@
<?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.ptccsens.persist.dao.ProTaskPluginDao">
<insert id="insertReplace" parameterType="com.ccsens.ptccsens.bean.po.ProTaskPlugin">
replace into t_pro_task_plugin
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="param != null">
param,
</if>
<if test="plginRow != null">
plgin_row,
</if>
<if test="plginCol != null">
plgin_col,
</if>
<if test="taskDetailId != null">
task_detail_id,
</if>
<if test="pluginId != null">
plugin_id,
</if>
<if test="businessPluginId != null">
business_plugin_id,
</if>
<if test="code != null">
code,
</if>
<if test="pluginInner != null">
plugin_inner,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="recStatus != null">
rec_status,
</if>
<if test="colspan != null">
colspan,
</if>
<if test="rowspan != null">
rowspan,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="param != null">
#{param,jdbcType=VARCHAR},
</if>
<if test="plginRow != null">
#{plginRow,jdbcType=INTEGER},
</if>
<if test="plginCol != null">
#{plginCol,jdbcType=INTEGER},
</if>
<if test="taskDetailId != null">
#{taskDetailId,jdbcType=BIGINT},
</if>
<if test="pluginId != null">
#{pluginId,jdbcType=BIGINT},
</if>
<if test="businessPluginId != null">
#{businessPluginId,jdbcType=BIGINT},
</if>
<if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
<if test="pluginInner != null">
#{pluginInner,jdbcType=TINYINT},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="recStatus != null">
#{recStatus,jdbcType=TINYINT},
</if>
<if test="colspan != null">
#{colspan,jdbcType=INTEGER},
</if>
<if test="rowspan != null">
#{rowspan,jdbcType=INTEGER},
</if>
</trim>
</insert>
<!-- <insert id="insertAllTaskPlugin">-->
<!-- INSERT INTO t_pro_task_plugin (-->
<!-- id,-->

79
src/main/resources/mapper_dao/ProTaskSubDao.xml

@ -15,6 +15,85 @@
(#{item.id},#{item.planStartTime},#{item.planDuration},#{item.planEndTime},#{item.taskDetailId})
</foreach>
</insert>
<insert id="insertReplace" parameterType="com.ccsens.ptccsens.bean.po.ProTaskSub">
replace into t_pro_task_sub
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="planStartTime != null">
plan_start_time,
</if>
<if test="planDuration != null">
plan_duration,
</if>
<if test="planEndTime != null">
plan_end_time,
</if>
<if test="realStartTime != null">
real_start_time,
</if>
<if test="realDuration != null">
real_duration,
</if>
<if test="realEndTime != null">
real_end_time,
</if>
<if test="taskStatus != null">
task_status,
</if>
<if test="taskDetailId != null">
task_detail_id,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="recStatus != null">
rec_status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="planStartTime != null">
#{planStartTime,jdbcType=BIGINT},
</if>
<if test="planDuration != null">
#{planDuration,jdbcType=BIGINT},
</if>
<if test="planEndTime != null">
#{planEndTime,jdbcType=BIGINT},
</if>
<if test="realStartTime != null">
#{realStartTime,jdbcType=BIGINT},
</if>
<if test="realDuration != null">
#{realDuration,jdbcType=BIGINT},
</if>
<if test="realEndTime != null">
#{realEndTime,jdbcType=BIGINT},
</if>
<if test="taskStatus != null">
#{taskStatus,jdbcType=TINYINT},
</if>
<if test="taskDetailId != null">
#{taskDetailId,jdbcType=BIGINT},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="recStatus != null">
#{recStatus,jdbcType=TINYINT},
</if>
</trim>
</insert>
<update id="deleteOldSubTask">
update
t_pro_task_sub

Loading…
Cancel
Save