1、同步CID任务接口
2、导出任务、需求接口
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
package com.sdm.common.entity.req.task;
|
||||
|
||||
import com.sdm.common.entity.ExportExcelFormat;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DemandExportExcelFormat {
|
||||
|
||||
/**
|
||||
* 导出的基本属性值
|
||||
*/
|
||||
private List<ExportExcelFormat> exportExcelFormatList;
|
||||
|
||||
/**
|
||||
* 需求名称
|
||||
*/
|
||||
private String demandName;
|
||||
|
||||
/**
|
||||
* 需求状态
|
||||
*/
|
||||
private String demandStatus;
|
||||
|
||||
/**
|
||||
* 风险状态
|
||||
*/
|
||||
private String achieveStatus;
|
||||
|
||||
/**
|
||||
* 需求类型,0:我发起的 1:我确认的
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 当前页码
|
||||
*/
|
||||
private Integer current;
|
||||
|
||||
/**
|
||||
* 每页显示数量
|
||||
*/
|
||||
private Integer size;
|
||||
|
||||
/**
|
||||
* 排序顺序 按创建时间 0-先序/1-倒序排序
|
||||
*/
|
||||
private Integer sortOrder;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.sdm.common.entity.req.task;
|
||||
|
||||
import com.sdm.common.entity.ExportExcelFormat;
|
||||
import com.sdm.common.validator.annotation.EnumValue;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TaskExportExcelFormat {
|
||||
|
||||
/**
|
||||
* 导出的基本属性值
|
||||
*/
|
||||
private List<ExportExcelFormat> exportExcelFormatList;
|
||||
|
||||
/**
|
||||
* 任务名称
|
||||
*/
|
||||
private String taskName;
|
||||
|
||||
/**
|
||||
* 任务状态
|
||||
*/
|
||||
private String exeStatus;
|
||||
|
||||
/**
|
||||
* 风险状态
|
||||
*/
|
||||
private String achieveStatus;
|
||||
|
||||
/**
|
||||
* 任务类型,0:我执行的 1:我关注的 2:所有 3-我分发的
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 当前页码
|
||||
*/
|
||||
private Integer current;
|
||||
|
||||
/**
|
||||
* 每页显示数量
|
||||
*/
|
||||
private Integer size;
|
||||
|
||||
/**
|
||||
* 排序顺序 按创建时间 0-先序/1-倒序排序
|
||||
*/
|
||||
private Integer sortOrder;
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package com.sdm.project.controller;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.data.UploadFilesReq;
|
||||
import com.sdm.common.entity.req.task.DemandExportExcelFormat;
|
||||
import com.sdm.common.entity.req.task.TaskExportExcelFormat;
|
||||
import com.sdm.common.feign.inter.data.IDataFeignClient;
|
||||
import com.sdm.project.model.bo.ModifyProjectNode;
|
||||
import com.sdm.project.model.req.*;
|
||||
@@ -10,6 +12,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -89,4 +92,10 @@ public class SimulationDemandController {
|
||||
return demandService.uploadDemandFiles(req);
|
||||
}
|
||||
|
||||
@PostMapping("/exportDemand")
|
||||
@Operation(summary = "导出需求列表")
|
||||
public SdmResponse exportDemand(@RequestBody DemandExportExcelFormat demandExportExcelFormat , HttpServletResponse httpservletResponse) {
|
||||
return demandService.exportDemand(demandExportExcelFormat, httpservletResponse);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.sdm.project.controller;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.ExportExcelFormat;
|
||||
import com.sdm.common.entity.req.task.TaskExportExcelFormat;
|
||||
import com.sdm.project.model.bo.ModifyTaskNode;
|
||||
import com.sdm.project.model.req.*;
|
||||
import com.sdm.project.model.resp.TaskCountResp;
|
||||
@@ -8,6 +10,7 @@ import com.sdm.project.model.resp.UserWorkloadResp;
|
||||
import com.sdm.project.service.ITaskService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.apache.catalina.User;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -89,4 +92,22 @@ public class SimulationTaskController {
|
||||
return taskService.listUserWorkloadsWithinTimeFrame(req);
|
||||
}
|
||||
|
||||
@PostMapping("/exportTask")
|
||||
@Operation(summary = "导出任务列表")
|
||||
public SdmResponse exportTask(@RequestBody TaskExportExcelFormat taskExportExcelFormat , HttpServletResponse httpservletResponse) {
|
||||
return taskService.exportTask(taskExportExcelFormat, httpservletResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步CID创建的任务
|
||||
*
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/synchronizeCidTask")
|
||||
@Operation(summary = "同步CID创建的任务", description = "同步CID创建的任务")
|
||||
public SdmResponse synchronizeCidTask(@RequestBody SpdmSyncCidTaskReq req) {
|
||||
return taskService.synchronizeCidTask(req);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,12 +32,16 @@ public interface SimulationProjectMapper {
|
||||
|
||||
int batchAddSimulationTask(@Param("list") List<TaskNode> list);
|
||||
|
||||
int batchAddSimulationCidTask(@Param("list") List<CidTaskNode> list);
|
||||
|
||||
int batchAddSimulationTaskExtra(@Param("list") List<TaskExtraNode> list);
|
||||
|
||||
int batchAddSimulationTaskMember(@Param("list") List<TaskMemberNode> list);
|
||||
|
||||
int batchAddSimulationPerformance(@Param("list") List<TaskNode> list);
|
||||
|
||||
int batchAddSimulationCidPerformance(@Param("list") List<CidTaskNode> list);
|
||||
|
||||
int batchAddSimulationPerformanceExtra(@Param("list")List<TaskExtraNode> list);
|
||||
|
||||
|
||||
|
||||
193
project/src/main/java/com/sdm/project/model/bo/CidTaskNode.java
Normal file
193
project/src/main/java/com/sdm/project/model/bo/CidTaskNode.java
Normal file
@@ -0,0 +1,193 @@
|
||||
package com.sdm.project.model.bo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.sdm.common.entity.pojo.BaseEntity;
|
||||
import com.sdm.project.model.po.ProjectNodeExtraPo;
|
||||
import com.sdm.project.model.po.TaskNodeMemberPo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@Data
|
||||
public class CidTaskNode extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 当前节点id
|
||||
*/
|
||||
private String uuid;
|
||||
|
||||
private String ownRootNodeUuid;
|
||||
|
||||
/**
|
||||
* 父节点id
|
||||
*/
|
||||
private String parentId;
|
||||
|
||||
private String nodeId;
|
||||
|
||||
/**
|
||||
* 项目进度状态(未开始、进行中、已完成)
|
||||
*/
|
||||
private String exeStatus;
|
||||
|
||||
private String exeStatusValue;
|
||||
|
||||
/**
|
||||
* 项目进度状态
|
||||
*/
|
||||
private Integer progress;
|
||||
|
||||
private String progressStatusValue;
|
||||
|
||||
/**
|
||||
* 项目达成状态(红黄绿灯)
|
||||
*/
|
||||
private Integer achieveStatus;
|
||||
|
||||
private String achieveStatusValue;
|
||||
|
||||
/**
|
||||
* 仿真负责人
|
||||
*/
|
||||
private String sManager;
|
||||
|
||||
/**
|
||||
* 计划开始(精确到秒)
|
||||
*/
|
||||
private String beginTime;
|
||||
|
||||
/**
|
||||
* 计划结束(精确到秒)项目详情图片
|
||||
*/
|
||||
private String endTime;
|
||||
|
||||
/**
|
||||
* 标准工时
|
||||
*/
|
||||
private Integer days;
|
||||
|
||||
/**
|
||||
* 实际完成时间(精确到秒)
|
||||
*/
|
||||
private String finishTime;
|
||||
|
||||
/**
|
||||
* 实际工时
|
||||
*/
|
||||
private Integer realDays;
|
||||
|
||||
/**
|
||||
* 难度系数
|
||||
*/
|
||||
private Float difficult;
|
||||
|
||||
/**
|
||||
* 审批状态
|
||||
*/
|
||||
private String approvalStatus;
|
||||
|
||||
/**
|
||||
* 确认状态
|
||||
*/
|
||||
private String confirmStatus;
|
||||
|
||||
|
||||
/**
|
||||
* 项目经理
|
||||
*/
|
||||
private String managers;
|
||||
|
||||
/**
|
||||
* 拓展属性集合
|
||||
*/
|
||||
private List<ProjectNodeExtraPo> extraList;
|
||||
|
||||
/**
|
||||
* 项目详情图片
|
||||
*/
|
||||
private String detailImgUrl;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String description;
|
||||
|
||||
|
||||
/**
|
||||
* 达标方式
|
||||
*/
|
||||
private String method;
|
||||
|
||||
private String taskId;
|
||||
|
||||
/**
|
||||
* 目标值
|
||||
*/
|
||||
private String targetValue;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
|
||||
private List<CidTaskNode> children = new ArrayList<>(); //适配前端组件
|
||||
|
||||
|
||||
private String nodeVersion;
|
||||
|
||||
private Long tenantId;
|
||||
|
||||
private List<TaskExtraNode> taskExtraNodeList;
|
||||
|
||||
private List<TaskMemberNode> memberList;
|
||||
|
||||
private List<TaskExtraNode> extras;
|
||||
|
||||
private List<TaskNodeMemberPo> members;
|
||||
|
||||
private String levelType;
|
||||
|
||||
private String nodeLevel;
|
||||
|
||||
/**
|
||||
* 仿真负责人
|
||||
*/
|
||||
@JsonProperty(value = "pMemberList")
|
||||
private String pMemberList;
|
||||
|
||||
/**
|
||||
* 仿真执行人
|
||||
*/
|
||||
@JsonProperty(value = "eMemberList")
|
||||
private String eMemberList;
|
||||
|
||||
/**
|
||||
* 任务名称
|
||||
*/
|
||||
private String taskName;
|
||||
|
||||
/**
|
||||
* 任务编码
|
||||
*/
|
||||
private String taskCode;
|
||||
private String standard;
|
||||
private String englishName;
|
||||
private String performanceType;
|
||||
private String lowValue;
|
||||
private String highValue;
|
||||
private String analyseTarget;
|
||||
private String confidence;
|
||||
private String analyseSoftware;
|
||||
private String analyseSoftwares;
|
||||
private String department;
|
||||
private String section;
|
||||
private String group;
|
||||
@JsonProperty(value = "bCapacity")
|
||||
private String bCapacity;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class SpdmEditDemandReq extends BaseEntity {
|
||||
/**
|
||||
* 预留拓展属性
|
||||
*/
|
||||
private List<SpdmDemandExtraReq> extraList;
|
||||
private List<SpdmDemandExtraReq> extras;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
|
||||
@@ -102,6 +102,7 @@ public class SpdmNodeDetailReq extends BaseEntity {
|
||||
private String section;
|
||||
private String group;
|
||||
private String bCapacity;
|
||||
private String englishName;
|
||||
|
||||
@JsonProperty(value = "tag1")
|
||||
private String tag1;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.sdm.project.model.req;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.sdm.common.entity.pojo.BaseEntity;
|
||||
import com.sdm.project.model.bo.CidTaskNode;
|
||||
import com.sdm.project.model.bo.TaskNode;
|
||||
import com.sdm.project.model.bo.TaskNodeTag;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@Data
|
||||
public class SpdmSyncCidTaskReq extends BaseEntity {
|
||||
|
||||
List<CidTaskNode> taskList;
|
||||
|
||||
}
|
||||
@@ -2,7 +2,10 @@ package com.sdm.project.service;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.data.UploadFilesReq;
|
||||
import com.sdm.common.entity.req.task.DemandExportExcelFormat;
|
||||
import com.sdm.common.entity.req.task.TaskExportExcelFormat;
|
||||
import com.sdm.project.model.req.*;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@@ -22,4 +25,12 @@ public interface IDemandService {
|
||||
|
||||
SdmResponse uploadDemandFiles(UploadFilesReq req);
|
||||
|
||||
/**
|
||||
* 导出需求列表
|
||||
* @param demandExportExcelFormat
|
||||
* @param httpservletResponse
|
||||
* @return
|
||||
*/
|
||||
SdmResponse exportDemand(DemandExportExcelFormat demandExportExcelFormat , HttpServletResponse httpservletResponse);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.sdm.project.service;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.ExportExcelFormat;
|
||||
import com.sdm.common.entity.req.task.TaskExportExcelFormat;
|
||||
import com.sdm.project.model.bo.ModifyTaskNode;
|
||||
import com.sdm.project.model.req.*;
|
||||
import com.sdm.project.model.resp.GetAllRunResultByTaskIdResp;
|
||||
import com.sdm.project.model.resp.TaskCountResp;
|
||||
import com.sdm.project.model.resp.UserWorkloadResp;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@@ -36,4 +39,14 @@ public interface ITaskService {
|
||||
|
||||
SdmResponse<List<UserWorkloadResp>> listUserWorkloadsWithinTimeFrame(UserWorkloadReq req);
|
||||
|
||||
/**
|
||||
* 导出任务列表
|
||||
* @param taskExportExcelFormat
|
||||
* @param httpservletResponse
|
||||
* @return
|
||||
*/
|
||||
SdmResponse exportTask(TaskExportExcelFormat taskExportExcelFormat , HttpServletResponse httpservletResponse);
|
||||
|
||||
SdmResponse synchronizeCidTask(SpdmSyncCidTaskReq req);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,19 +2,23 @@ package com.sdm.project.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.common.ThreadLocalContext;
|
||||
import com.sdm.common.entity.ExportExcelFormat;
|
||||
import com.sdm.common.entity.enums.DirTypeEnum;
|
||||
import com.sdm.common.entity.req.data.CreateDirReq;
|
||||
import com.sdm.common.entity.req.data.UploadFilesReq;
|
||||
import com.sdm.common.entity.req.system.UserQueryReq;
|
||||
import com.sdm.common.entity.req.task.DemandExportExcelFormat;
|
||||
import com.sdm.common.entity.resp.system.CIDUserResp;
|
||||
import com.sdm.common.feign.impl.data.DataClientFeignClientImpl;
|
||||
import com.sdm.common.feign.impl.system.SysUserFeignClientImpl;
|
||||
import com.sdm.common.feign.inter.data.IDataFeignClient;
|
||||
import com.sdm.common.service.BaseService;
|
||||
import com.sdm.common.utils.RandomUtil;
|
||||
import com.sdm.common.utils.excel.ExcelUtil;
|
||||
import com.sdm.project.common.MemberTypeEnum;
|
||||
import com.sdm.project.common.TaskAchieveStatusEnum;
|
||||
import com.sdm.project.common.TaskExeStatusEnum;
|
||||
@@ -29,10 +33,12 @@ import com.sdm.project.model.po.TaskNodePo;
|
||||
import com.sdm.project.model.req.*;
|
||||
import com.sdm.project.model.vo.*;
|
||||
import com.sdm.project.service.IDemandService;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -164,7 +170,7 @@ public class DemandServiceImpl extends BaseService implements IDemandService {
|
||||
// 获取仿真执行人
|
||||
String eMemberList = req.getEMemberList();
|
||||
// 获取需求额外属性
|
||||
List<SpdmDemandExtraReq> demandExtraList = req.getExtraList();
|
||||
List<SpdmDemandExtraReq> demandExtraList = req.getExtras();
|
||||
String curDateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
req.setUpdateTime(curDateStr);
|
||||
if (mapper.editDemand(req, jobNumber) <= 0) {
|
||||
@@ -612,6 +618,23 @@ public class DemandServiceImpl extends BaseService implements IDemandService {
|
||||
return dataFeignClient.uploadFiles(req);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse exportDemand(DemandExportExcelFormat demandExportExcelFormat, HttpServletResponse httpServletResponse) {
|
||||
SdmResponse response = new SdmResponse();
|
||||
SpdmDemandListReq req = new SpdmDemandListReq();
|
||||
BeanUtils.copyProperties(demandExportExcelFormat,req);
|
||||
List<ExportExcelFormat> exportExcelFormats = demandExportExcelFormat.getExportExcelFormatList();
|
||||
SdmResponse taskRespond = list(req);
|
||||
if(taskRespond.isSuccess()) {
|
||||
JSONObject dataObj = (JSONObject) taskRespond.getData();
|
||||
JSONArray jsonArray = dataObj.getJSONArray("data");
|
||||
ExcelUtil.exportExcelNoMerge(jsonArray,exportExcelFormats,httpServletResponse);
|
||||
} else {
|
||||
response = SdmResponse.failed(taskRespond.getMessage());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
private String getLastNodeId(TaskNode taskNode) {
|
||||
// List<String> tag1 = taskNode.getTag1();
|
||||
// if (CollectionUtils.isNotEmpty(tag1)) {
|
||||
|
||||
@@ -1,38 +1,35 @@
|
||||
package com.sdm.project.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.common.ThreadLocalContext;
|
||||
import com.sdm.common.entity.ExportExcelFormat;
|
||||
import com.sdm.common.entity.constants.ProjectConstants;
|
||||
import com.sdm.common.entity.enums.DirTypeEnum;
|
||||
import com.sdm.common.entity.enums.NodeTypeEnum;
|
||||
import com.sdm.common.entity.req.data.CreateDirReq;
|
||||
import com.sdm.common.entity.req.system.UserQueryReq;
|
||||
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||
import com.sdm.common.entity.req.task.TaskExportExcelFormat;
|
||||
import com.sdm.common.entity.resp.system.CIDUserResp;
|
||||
import com.sdm.common.feign.impl.data.DataClientFeignClientImpl;
|
||||
import com.sdm.common.feign.impl.system.SysUserFeignClientImpl;
|
||||
import com.sdm.common.feign.inter.data.IDataFeignClient;
|
||||
import com.sdm.common.utils.RandomUtil;
|
||||
import com.sdm.common.utils.excel.ExcelUtil;
|
||||
import com.sdm.project.common.MemberTypeEnum;
|
||||
import com.sdm.project.common.RunPerformanceStatusEnum;
|
||||
import com.sdm.project.common.TaskExeStatusEnum;
|
||||
import com.sdm.project.dao.SimulationDemandMapper;
|
||||
import com.sdm.project.dao.SimulationNodeMapper;
|
||||
import com.sdm.project.dao.SimulationProjectMapper;
|
||||
import com.sdm.project.dao.SimulationTaskMapper;
|
||||
import com.sdm.project.model.bo.ModifyTaskNode;
|
||||
import com.sdm.project.model.bo.TaskExtraNode;
|
||||
import com.sdm.project.model.bo.TaskMemberNode;
|
||||
import com.sdm.project.model.bo.TaskNodeTag;
|
||||
import com.sdm.project.model.bo.*;
|
||||
import com.sdm.project.model.entity.*;
|
||||
import com.sdm.project.model.po.PerformanceNodePo;
|
||||
import com.sdm.project.model.po.ProjectNodePo;
|
||||
import com.sdm.project.model.po.TaskNodeMemberPo;
|
||||
import com.sdm.project.model.po.TaskRunPo;
|
||||
import com.sdm.project.model.po.*;
|
||||
import com.sdm.project.model.req.*;
|
||||
import com.sdm.project.model.resp.*;
|
||||
import com.sdm.project.model.vo.*;
|
||||
import com.sdm.project.service.*;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
@@ -43,7 +40,6 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -86,6 +82,9 @@ public class TaskServiceImpl implements ITaskService {
|
||||
@Autowired
|
||||
private ISimulationTaskAttentionService simulationTaskAttentionService;
|
||||
|
||||
@Autowired
|
||||
private DataClientFeignClientImpl dataClientFeignClient;
|
||||
|
||||
@Override
|
||||
public SdmResponse list(SpdmTaskListReq req) {
|
||||
Long tenantId = ThreadLocalContext.getTenantId();
|
||||
@@ -970,4 +969,176 @@ public class TaskServiceImpl implements ITaskService {
|
||||
return SdmResponse.success(userWorkloadRespList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse exportTask(TaskExportExcelFormat taskExportExcelFormat, HttpServletResponse httpServletResponse) {
|
||||
SdmResponse response = new SdmResponse();
|
||||
SpdmTaskListReq req = new SpdmTaskListReq();
|
||||
BeanUtils.copyProperties(taskExportExcelFormat,req);
|
||||
List<ExportExcelFormat> exportExcelFormats = taskExportExcelFormat.getExportExcelFormatList();
|
||||
SdmResponse taskRespond = list(req);
|
||||
if(taskRespond.isSuccess()) {
|
||||
JSONObject dataObj = (JSONObject) taskRespond.getData();
|
||||
JSONArray jsonArray = dataObj.getJSONArray("data");
|
||||
ExcelUtil.exportExcelNoMerge(jsonArray,exportExcelFormats,httpServletResponse);
|
||||
} else {
|
||||
response = SdmResponse.failed(taskRespond.getMessage());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse synchronizeCidTask(SpdmSyncCidTaskReq req) {
|
||||
log.info("同步CID任务的参数为:{}", req);
|
||||
Long tenantId = ThreadLocalContext.getTenantId();
|
||||
Long jobNumber = ThreadLocalContext.getUserId();
|
||||
List<CidTaskNode> taskNodeList = req.getTaskList();
|
||||
if (CollectionUtils.isEmpty(taskNodeList)) {
|
||||
log.error("同步CID任务的参数为空");
|
||||
return SdmResponse.failed("同步CID任务的参数为空");
|
||||
}
|
||||
SdmResponse response = SdmResponse.success();
|
||||
List<TaskMemberNode> projectNodeMemberList = new ArrayList<>();
|
||||
List<TaskExtraNode> projectNodeExtraList = new ArrayList<>();
|
||||
List<CidTaskNode> allPerformanceList = new ArrayList<>();
|
||||
List<TaskExtraNode> allPerformanceExtraList = new ArrayList<>();
|
||||
for (CidTaskNode task : taskNodeList) {
|
||||
task.setUuid(RandomUtil.generateString(32));
|
||||
task.setTenantId(tenantId);
|
||||
String pUserIdStr = task.getPMemberList();
|
||||
String eUserIdStr = task.getEMemberList();
|
||||
log.info("下发的仿真负责人为:{}", pUserIdStr);
|
||||
log.info("下发的仿真执行人为:{}", eUserIdStr);
|
||||
if (StringUtils.isNotBlank(pUserIdStr)) {
|
||||
String[] userIdArr = pUserIdStr.split(",");
|
||||
for (String userId : userIdArr) {
|
||||
TaskMemberNode taskMemberNode = new TaskMemberNode();
|
||||
taskMemberNode.setTaskId(task.getUuid());
|
||||
taskMemberNode.setNodeId(task.getUuid());
|
||||
taskMemberNode.setUserId(userId);
|
||||
taskMemberNode.setType(MemberTypeEnum.PRINCIPAL.getCode());
|
||||
projectNodeMemberList.add(taskMemberNode);
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(eUserIdStr)) {
|
||||
String[] userIdArr = eUserIdStr.split(",");
|
||||
for (String userId : userIdArr) {
|
||||
TaskMemberNode taskMemberNode = new TaskMemberNode();
|
||||
taskMemberNode.setTaskId(task.getUuid());
|
||||
taskMemberNode.setNodeId(task.getUuid());
|
||||
taskMemberNode.setUserId(userId);
|
||||
taskMemberNode.setType(MemberTypeEnum.EXECUTOR.getCode());
|
||||
projectNodeMemberList.add(taskMemberNode);
|
||||
}
|
||||
}
|
||||
List<TaskExtraNode> extraList = task.getTaskExtraNodeList();
|
||||
if (CollectionUtils.isNotEmpty(extraList)) {
|
||||
for (TaskExtraNode extra : extraList) {
|
||||
TaskExtraNode taskExtraNode = new TaskExtraNode();
|
||||
taskExtraNode.setTaskId(task.getUuid());
|
||||
taskExtraNode.setNodeId(task.getUuid());
|
||||
taskExtraNode.setPropertyName(extra.getPropertyName());
|
||||
taskExtraNode.setPropertyValue(extra.getPropertyValue());
|
||||
projectNodeExtraList.add(taskExtraNode);
|
||||
}
|
||||
}
|
||||
// 指标
|
||||
List<CidTaskNode> performanceList = task.getChildren();
|
||||
for (CidTaskNode performance : performanceList) {
|
||||
performance.setTaskId(task.getUuid());
|
||||
List<TaskExtraNode> performanceExtraList = performance.getTaskExtraNodeList();
|
||||
if (CollectionUtils.isNotEmpty(performanceExtraList)) {
|
||||
for (TaskExtraNode extra : performanceExtraList) {
|
||||
extra.setPerformanceId(performance.getUuid());
|
||||
extra.setTaskId(performance.getTaskId());
|
||||
extra.setNodeId(performance.getNodeId());
|
||||
allPerformanceExtraList.add(extra);
|
||||
}
|
||||
}
|
||||
allPerformanceList.add(performance);
|
||||
}
|
||||
}
|
||||
String createTime = DateUtil.now();
|
||||
Map<String, CidTaskNode> taskNodeMap = Map.of();
|
||||
if (CollectionUtils.isNotEmpty(taskNodeList)) {
|
||||
taskNodeList.forEach(projectNode -> {
|
||||
projectNode.setCreator(jobNumber);
|
||||
projectNode.setCreateTime(createTime);
|
||||
});
|
||||
if (projectMapper.batchAddSimulationCidTask(taskNodeList) <= 0) {
|
||||
response = SdmResponse.failed("新增任务失败");
|
||||
return response;
|
||||
}
|
||||
taskNodeMap = taskNodeList.stream().collect(Collectors.groupingBy(
|
||||
CidTaskNode::getUuid,
|
||||
Collectors.collectingAndThen(
|
||||
Collectors.toList(),
|
||||
list -> list.get(0)
|
||||
)
|
||||
));
|
||||
for (CidTaskNode taskNode : taskNodeList) {
|
||||
createDir(taskNode.getUuid(), null, taskNode.getTaskName());
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(projectNodeExtraList)) {
|
||||
projectNodeExtraList.forEach(projectNode -> projectNode.setCreateTime(createTime));
|
||||
if (projectMapper.batchAddSimulationTaskExtra(projectNodeExtraList) <= 0) {
|
||||
response = SdmResponse.failed("新增任务附加属性失败");
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(projectNodeMemberList)) {
|
||||
projectNodeMemberList.forEach(projectNode -> projectNode.setCreateTime(createTime));
|
||||
if (projectMapper.batchAddSimulationTaskMember(projectNodeMemberList) <= 0) {
|
||||
response = SdmResponse.failed("新增任务成员属性失败");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
// 指标
|
||||
if (CollectionUtils.isNotEmpty(allPerformanceList)) {
|
||||
allPerformanceList.forEach(projectNode -> projectNode.setCreateTime(createTime));
|
||||
if (projectMapper.batchAddSimulationCidPerformance(allPerformanceList) <= 0) {
|
||||
response = SdmResponse.failed("新增指标失败");
|
||||
return response;
|
||||
}
|
||||
List<TaskNodePo> newTaskNodeList = projectMapper.getTaskListByNodeIdList(allPerformanceList.stream().map(CidTaskNode::getTaskId).toList());
|
||||
Map<String, TaskNodePo> taskNodePoMap = Map.of();
|
||||
if (CollectionUtils.isNotEmpty(newTaskNodeList)) {
|
||||
taskNodePoMap = newTaskNodeList.stream().collect(Collectors.groupingBy(
|
||||
TaskNodePo::getUuid,
|
||||
Collectors.collectingAndThen(
|
||||
Collectors.toList(),
|
||||
list -> list.get(0)
|
||||
)
|
||||
));
|
||||
}
|
||||
for (CidTaskNode taskNode : allPerformanceList) {
|
||||
if (ObjectUtils.isEmpty(taskNodePoMap.get(taskNode.getTaskId())) && ObjectUtils.isEmpty(taskNodeMap.get(taskNode.getTaskId()))) {
|
||||
log.error("taskNodeMap不空,根据taskId:{},未查询到任务", taskNode.getTaskId());
|
||||
response = SdmResponse.failed("新增指标时,创建文件失败");
|
||||
return response;
|
||||
}
|
||||
createDir(taskNode.getUuid(),
|
||||
ObjectUtils.isNotEmpty(taskNodePoMap.get(taskNode.getTaskId())) ? taskNodePoMap.get(taskNode.getTaskId()).getUuid() : taskNodeMap.get(taskNode.getTaskId()).getUuid(),
|
||||
taskNode.getTaskName());
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(allPerformanceExtraList)) {
|
||||
allPerformanceExtraList.forEach(projectNode -> projectNode.setCreateTime(createTime));
|
||||
if (projectMapper.batchAddSimulationPerformanceExtra(allPerformanceExtraList) <= 0) {
|
||||
response = SdmResponse.failed("新增任务指标附加属性失败");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
private void createDir(String uuid, String parentUuid, String dirName) {
|
||||
CreateDirReq createDirReq = new CreateDirReq();
|
||||
createDirReq.setUuId(uuid);
|
||||
createDirReq.setParentUuId(parentUuid);
|
||||
createDirReq.setDirName(dirName);
|
||||
log.info("同步CID任务调用创建文件夹的参数为:{}", createDirReq);
|
||||
SdmResponse response = dataClientFeignClient.createDir(createDirReq);
|
||||
log.info("同步CID调用创建文件夹的返回值为:{}", response);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -70,6 +70,9 @@
|
||||
<if test="editNode.updateTime != null and editNode.updateTime != ''">
|
||||
update_time = #{editNode.updateTime}
|
||||
</if>
|
||||
<if test="editNode.englishName != null and editNode.englishName != ''">
|
||||
englishName = #{editNode.englishName}
|
||||
</if>
|
||||
</trim>
|
||||
where uuid = #{editNode.uuid}
|
||||
</update>
|
||||
|
||||
@@ -33,6 +33,16 @@
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="batchAddSimulationCidTask" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into simulation_task (uuid,task_name,task_code,task_pool_name,task_pool_version,node_id,days,standard,fold_id,status,achieve_status,begin_time,end_time,progress,exe_status,confidence,analyse_target,analyse_software,description,difficult,tenant_id
|
||||
,creator,create_time,department,sectionName,groupName,bCapacity,flowTemplate,englishName) values
|
||||
<foreach collection='list' item='it' index='index' separator=','>
|
||||
(#{it.uuid},#{it.taskName},#{it.taskCode},'','',#{it.nodeId},#{it.days},#{it.standard},'',1,0,
|
||||
#{it.beginTime},#{it.endTime},0,1,#{it.confidence},#{it.analyseTarget},#{it.analyseSoftwares},#{it.description},#{it.difficult},#{it.tenantId},
|
||||
#{it.creator},#{it.createTime},#{it.department},#{it.section},#{it.group},#{it.bCapacity},#{it.flowTemplate},#{it.englishName})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="batchAddSimulationTask" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into simulation_task (uuid,task_name,task_code,task_pool_name,task_pool_version,node_id,days,standard,fold_id,status,achieve_status,begin_time,end_time,progress,exe_status,confidence,analyse_target,analyse_software,description,difficult,tenant_id
|
||||
,creator,create_time,department,sectionName,groupName,bCapacity,flowTemplate,englishName,demand_id,tag1,tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9,tag10) values
|
||||
@@ -61,6 +71,13 @@
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="batchAddSimulationCidPerformance" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into simulation_performance (uuid,taskId,taskName,standard,nodeId,nodeName,nodeCode,englishName,performanceType,unit,lowValue,highValue,method,description,tenantId) values
|
||||
<foreach collection='list' item='it' index='index' separator=','>
|
||||
(#{it.uuid},#{it.taskId},#{it.taskName},#{it.standard},#{it.nodeId},#{it.nodeName},#{it.nodeCode},#{it.englishName},#{it.performanceType},#{it.unit},#{it.lowValue},#{it.highValue},#{it.method},#{it.description},#{it.tenantId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="batchAddSimulationPerformanceExtra">
|
||||
insert into simulation_performance_extra (uuid,performanceId,taskId,nodeId,poolName,propertyName,propertyValue,valueType,propertyClass) values
|
||||
<foreach collection='list' item='it' index='index' separator=','>
|
||||
|
||||
Reference in New Issue
Block a user