1、项目列表导出
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
package com.sdm.common.entity.req.project;
|
||||
|
||||
import com.sdm.common.entity.ExportExcelFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ProjectExportExcelFormat {
|
||||
|
||||
/**
|
||||
* 导出的基本属性值
|
||||
*/
|
||||
private List<ExportExcelFormat> exportExcelFormatList;
|
||||
|
||||
/**
|
||||
* 节点类型
|
||||
*/
|
||||
private String nodeType;
|
||||
|
||||
/**
|
||||
* 节点子类型
|
||||
*/
|
||||
private String nodeSubType;
|
||||
|
||||
/**
|
||||
* 项目进度状态(未开始、进行中、已完成)
|
||||
*/
|
||||
private Integer progressStatus;
|
||||
|
||||
/**
|
||||
* 产品代号
|
||||
*/
|
||||
private String nodeCode;
|
||||
|
||||
/**
|
||||
* 项目经理
|
||||
*/
|
||||
private String manager;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
private String nodeName;
|
||||
}
|
||||
@@ -34,16 +34,6 @@ public class DemandExportExcelFormat {
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 当前页码
|
||||
*/
|
||||
private Integer current;
|
||||
|
||||
/**
|
||||
* 每页显示数量
|
||||
*/
|
||||
private Integer size;
|
||||
|
||||
/**
|
||||
* 排序顺序 按创建时间 0-先序/1-倒序排序
|
||||
*/
|
||||
|
||||
@@ -3,8 +3,10 @@ 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.project.DelNodeReq;
|
||||
import com.sdm.common.entity.req.project.ProjectExportExcelFormat;
|
||||
import com.sdm.common.entity.req.project.RenameNodeReq;
|
||||
import com.sdm.common.entity.req.project.SpdmNodeListReq;
|
||||
import com.sdm.common.entity.req.task.TaskExportExcelFormat;
|
||||
import com.sdm.common.entity.resp.AllNodeByProjectIdAndTypeResp;
|
||||
import com.sdm.common.entity.resp.project.SimulationNodeResp;
|
||||
import com.sdm.common.feign.inter.project.ISimulationNodeFeignClient;
|
||||
@@ -13,6 +15,7 @@ import com.sdm.project.service.INodeService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -111,7 +114,7 @@ public class SimulationNodeController implements ISimulationNodeFeignClient {
|
||||
*/
|
||||
@GetMapping("/getChildrenNodeList")
|
||||
@Operation(summary = "根据项目查询子节点列表", description = "根据项目查询子节点列表")
|
||||
public SdmResponse getChildrenNodeList(@RequestParam(value = "nodeId", required = true) String nodeId, @RequestParam(value = "nodeType", required = true) String nodeType) {
|
||||
public SdmResponse getChildrenNodeList(@RequestParam(value = "nodeId", required = true) Long nodeId, @RequestParam(value = "nodeType", required = true) String nodeType) {
|
||||
return nodeService.getChildrenNodeList(Collections.singletonList(nodeId), nodeType);
|
||||
}
|
||||
|
||||
@@ -263,4 +266,11 @@ public class SimulationNodeController implements ISimulationNodeFeignClient {
|
||||
return nodeService.querySimulationNodeByUuids(uuids);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/exportProject")
|
||||
@Operation(summary = "导出项目列表")
|
||||
public SdmResponse exportProject(@RequestBody ProjectExportExcelFormat projectExportExcelFormat , HttpServletResponse httpservletResponse) {
|
||||
return nodeService.exportProject(projectExportExcelFormat, httpservletResponse);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -150,6 +150,7 @@ public class SimulationRunController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/generateReport")
|
||||
@Operation(summary = "生成自动化报告", description = "生成自动化报告")
|
||||
public void generateReport(@RequestBody SpdmReportReq req, HttpServletResponse response) {
|
||||
runService.generateReport(req,response);
|
||||
}
|
||||
|
||||
@@ -180,4 +180,5 @@ public interface SimulationProjectMapper {
|
||||
|
||||
List<SimulationNodeResp> querySimulationNodeByUuids(@Param("list")List<String> uuids);
|
||||
|
||||
List<ProjectNodePo> getNodeByIdList(@Param("nodeIdList") List<Long> nodeIdList);
|
||||
}
|
||||
|
||||
@@ -4,12 +4,14 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.data.UploadFilesReq;
|
||||
import com.sdm.common.entity.req.project.DelNodeReq;
|
||||
import com.sdm.common.entity.req.project.ProjectExportExcelFormat;
|
||||
import com.sdm.common.entity.req.project.RenameNodeReq;
|
||||
import com.sdm.common.entity.req.project.SpdmNodeListReq;
|
||||
import com.sdm.common.entity.resp.AllNodeByProjectIdAndTypeResp;
|
||||
import com.sdm.common.entity.resp.project.SimulationNodeResp;
|
||||
import com.sdm.project.model.entity.SimulationNode;
|
||||
import com.sdm.project.model.req.*;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@@ -30,7 +32,7 @@ public interface INodeService extends IService<SimulationNode> {
|
||||
|
||||
SdmResponse getProjectMemberList(GetProjectListReq req);
|
||||
|
||||
SdmResponse getChildrenNodeList(List<String> projectNodeIdList, String nodeType);
|
||||
SdmResponse getChildrenNodeList(List<Long> projectNodeIdList, String nodeType);
|
||||
|
||||
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getAllNodeByBodeType(String nodeType, Long nodeId);
|
||||
|
||||
@@ -66,4 +68,6 @@ public interface INodeService extends IService<SimulationNode> {
|
||||
|
||||
SdmResponse<List<SimulationNodeResp>> querySimulationNodeByUuids(List<String> uuids);
|
||||
|
||||
SdmResponse exportProject(ProjectExportExcelFormat projectExportExcelFormat, HttpServletResponse httpservletResponse);
|
||||
|
||||
}
|
||||
|
||||
@@ -624,6 +624,8 @@ public class DemandServiceImpl extends BaseService implements IDemandService {
|
||||
SpdmDemandListReq req = new SpdmDemandListReq();
|
||||
BeanUtils.copyProperties(demandExportExcelFormat,req);
|
||||
List<ExportExcelFormat> exportExcelFormats = demandExportExcelFormat.getExportExcelFormatList();
|
||||
req.setCurrent(1);
|
||||
req.setSize(10000);
|
||||
SdmResponse taskRespond = list(req);
|
||||
if(taskRespond.isSuccess()) {
|
||||
JSONObject dataObj = (JSONObject) taskRespond.getData();
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.sdm.project.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.common.ThreadLocalContext;
|
||||
import com.sdm.common.entity.ExportExcelFormat;
|
||||
import com.sdm.common.entity.bo.DataDictionary;
|
||||
import com.sdm.common.entity.constants.TagConstant;
|
||||
import com.sdm.common.entity.enums.DirTypeEnum;
|
||||
@@ -11,6 +13,7 @@ import com.sdm.common.entity.enums.NodeTypeEnum;
|
||||
import com.sdm.common.entity.req.data.CreateDirReq;
|
||||
import com.sdm.common.entity.req.data.UploadFilesReq;
|
||||
import com.sdm.common.entity.req.project.DelNodeReq;
|
||||
import com.sdm.common.entity.req.project.ProjectExportExcelFormat;
|
||||
import com.sdm.common.entity.req.project.RenameNodeReq;
|
||||
import com.sdm.common.entity.req.project.SpdmNodeListReq;
|
||||
import com.sdm.common.entity.req.system.QueryGroupDetailReq;
|
||||
@@ -26,6 +29,7 @@ import com.sdm.common.feign.inter.data.IDataFeignClient;
|
||||
import com.sdm.common.log.CoreLogger;
|
||||
import com.sdm.common.utils.DateUtils;
|
||||
import com.sdm.common.utils.RandomUtil;
|
||||
import com.sdm.common.utils.excel.ExcelUtil;
|
||||
import com.sdm.project.dao.SimulationDemandMapper;
|
||||
import com.sdm.project.dao.SimulationNodeMapper;
|
||||
import com.sdm.project.dao.SimulationProjectMapper;
|
||||
@@ -43,6 +47,7 @@ import com.sdm.project.model.po.TaskNodePo;
|
||||
import com.sdm.project.model.req.*;
|
||||
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.collections4.MapUtils;
|
||||
@@ -648,19 +653,18 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse getChildrenNodeList(List<String> nodeIdList, String nodeType) {
|
||||
public SdmResponse getChildrenNodeList(List<Long> nodeIdList, String nodeType) {
|
||||
log.info("getChildrenNodeList,nodeIdList:{},nodeType:{}", nodeIdList, nodeType);
|
||||
List<ProjectNodePo> projectNodePoList = mapper.queryNodeListByParentNodeId(nodeIdList);
|
||||
List<ProjectNodePo> projectNodePoList = mapper.getNodeByIdList(nodeIdList);
|
||||
if (CollectionUtils.isEmpty(projectNodePoList)) {
|
||||
return SdmResponse.success(new ArrayList<>());
|
||||
}
|
||||
if (!nodeType.equals(projectNodePoList.get(0).getNodeType())) {
|
||||
return getChildrenNodeList(projectNodePoList.stream().map(ProjectNodePo::getUuid).toList(), nodeType);
|
||||
List<String> idList = projectNodePoList.stream().map(ProjectNodePo::getUuid).toList();
|
||||
List<ProjectNodePo> childrenProjectNodePoList = mapper.queryNodeListByParentNodeId(idList);
|
||||
if (!nodeType.equals(childrenProjectNodePoList.get(0).getNodeType())) {
|
||||
return getChildrenNodeList(childrenProjectNodePoList.stream().map(ProjectNodePo::getId).toList(), nodeType);
|
||||
}
|
||||
// if (!nodeType.equals(projectNodePoList.get(0).getNodeType())) {
|
||||
// return SdmResponse.success(new ArrayList<>());
|
||||
// }
|
||||
return SdmResponse.success(projectNodePoList);
|
||||
return SdmResponse.success(childrenProjectNodePoList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1406,4 +1410,23 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
return SdmResponse.success(simulationNodeResps);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse exportProject(ProjectExportExcelFormat projectExportExcelFormat, HttpServletResponse httpServletResponse) {
|
||||
SdmResponse response = new SdmResponse();
|
||||
SpdmNodeListReq req = new SpdmNodeListReq();
|
||||
BeanUtils.copyProperties(projectExportExcelFormat,req);
|
||||
req.setCurrent(1);
|
||||
req.setSize(10000);
|
||||
List<ExportExcelFormat> exportExcelFormats = projectExportExcelFormat.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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -977,6 +977,8 @@ public class TaskServiceImpl implements ITaskService {
|
||||
SdmResponse response = new SdmResponse();
|
||||
SpdmTaskListReq req = new SpdmTaskListReq();
|
||||
BeanUtils.copyProperties(taskExportExcelFormat,req);
|
||||
req.setCurrent(1);
|
||||
req.setSize(10000);
|
||||
List<ExportExcelFormat> exportExcelFormats = taskExportExcelFormat.getExportExcelFormatList();
|
||||
SdmResponse taskRespond = list(req);
|
||||
if(taskRespond.isSuccess()) {
|
||||
|
||||
@@ -576,7 +576,7 @@
|
||||
</select>
|
||||
|
||||
<select id="queryRunListByNodeIdList" resultType="com.sdm.project.model.po.TaskRunPo">
|
||||
select * from simulation_run where task_id in (
|
||||
select * from simulation_run where taskId in (
|
||||
<foreach collection='taskIdList' item='taskId' index='index' separator=','>
|
||||
#{taskId}
|
||||
</foreach>
|
||||
@@ -673,6 +673,14 @@
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="getNodeByIdList" resultType="com.sdm.project.model.po.ProjectNodePo">
|
||||
select * from simulation_node where id in (
|
||||
<foreach collection='nodeIdList' item='nodeId' index='index' separator=','>
|
||||
#{nodeId}
|
||||
</foreach>
|
||||
)
|
||||
</select>
|
||||
|
||||
<!-- <select id="getTaskList" resultType="com.sdm.project.entity.vo.SpdmTaskVo">-->
|
||||
<!-- select * from simulation_task where tenant_id = #{tenantId}-->
|
||||
<!-- <if test="taskName != null and taskName != ''">-->
|
||||
|
||||
Reference in New Issue
Block a user