1、新增 导出知识库接口
2、任务模块导出接口 bugfix
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package com.sdm.common.entity.req.data;
|
||||
|
||||
import com.sdm.common.entity.ExportExcelFormat;
|
||||
import com.sdm.common.entity.req.task.DemandExportExcelParam;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class KnowledgeExportExcelFormat {
|
||||
|
||||
/**
|
||||
* 导出的基本属性值
|
||||
*/
|
||||
private List<ExportExcelFormat> excelHeaders;
|
||||
|
||||
/**
|
||||
* 导出知识库的可选查询参数
|
||||
*/
|
||||
private KnowledgeExportExcelParam params;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.sdm.common.entity.req.data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class KnowledgeExportExcelParam extends BaseReq{
|
||||
|
||||
@Schema(description = "搜索类型: 0全名搜索, 1包含搜索, 2后缀搜索, 3正则表达式")
|
||||
private byte searchType; //0:全名搜索 1:包含搜索 2:后缀搜索 3:正则表达式
|
||||
|
||||
/**
|
||||
* 父目录ID
|
||||
*/
|
||||
@Schema(description = "父目录ID")
|
||||
private Long parentDirId;
|
||||
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
@Schema(description = "文件名称")
|
||||
private String fileName;
|
||||
|
||||
|
||||
@Schema(description = "上传人id")
|
||||
private String uploadUserId;
|
||||
|
||||
}
|
||||
@@ -21,7 +21,7 @@ public class ProjectExportExcelParam {
|
||||
/**
|
||||
* 项目进度状态(未开始、进行中、已完成)
|
||||
*/
|
||||
private Integer progressStatus;
|
||||
private String exeStatus;
|
||||
|
||||
/**
|
||||
* 产品代号
|
||||
|
||||
@@ -42,4 +42,9 @@ public class SpdmNodeListReq {
|
||||
*/
|
||||
private String nodeName;
|
||||
|
||||
/**
|
||||
* 项目状态
|
||||
*/
|
||||
private String exeStatus;
|
||||
|
||||
}
|
||||
|
||||
@@ -45,4 +45,9 @@ public class TaskExportExcelParam {
|
||||
private Integer sortOrder;
|
||||
|
||||
private List<TaskNodeTag> idMap;
|
||||
|
||||
/**
|
||||
* 今明任务 筛选计划结束时间为今明两天的
|
||||
*/
|
||||
private String todayTmrTasks;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.sdm.data.controller;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.data.*;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import com.sdm.common.entity.req.task.DemandExportExcelFormat;
|
||||
import com.sdm.common.entity.resp.PageDataResp;
|
||||
import com.sdm.common.entity.resp.data.BatchAddFileInfoResp;
|
||||
import com.sdm.common.entity.resp.data.ChunkUploadMinioFileResp;
|
||||
@@ -423,5 +424,11 @@ public class DataFileController implements IDataFeignClient {
|
||||
IDataFileService.downloadFileToLocal(fileId,path);
|
||||
}
|
||||
|
||||
@PostMapping("/exportKnowledgeList")
|
||||
@Operation(summary = "导出知识库", description = "导出知识库")
|
||||
public SdmResponse exportKnowledgeList(@RequestBody KnowledgeExportExcelFormat knowledgeExportExcelFormat , HttpServletResponse httpservletResponse) {
|
||||
return IDataFileService.exportKnowledgeList(knowledgeExportExcelFormat, httpservletResponse);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -320,7 +320,17 @@ public interface IDataFileService {
|
||||
|
||||
/**
|
||||
* 下载文件到本地临时目录
|
||||
* @param fileId 文件id
|
||||
* @param path 临时目录路径
|
||||
*/
|
||||
void downloadFileToLocal(Long fileId,String path);
|
||||
|
||||
/**
|
||||
* 导出知识库
|
||||
* @param knowledgeExportExcelFormat 导出参数
|
||||
* @param httpservletResponse
|
||||
* @return
|
||||
*/
|
||||
SdmResponse exportKnowledgeList(KnowledgeExportExcelFormat knowledgeExportExcelFormat, HttpServletResponse httpservletResponse);
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.sdm.data.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
@@ -8,6 +9,7 @@ import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.common.ThreadLocalContext;
|
||||
import com.sdm.common.entity.ExportExcelFormat;
|
||||
import com.sdm.common.entity.constants.NumberConstants;
|
||||
import com.sdm.common.entity.constants.PermConstants;
|
||||
import com.sdm.common.entity.enums.*;
|
||||
@@ -16,6 +18,7 @@ import com.sdm.common.entity.req.project.SpdmNodeListReq;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import com.sdm.common.entity.req.system.UserListReq;
|
||||
import com.sdm.common.entity.req.system.UserQueryReq;
|
||||
import com.sdm.common.entity.req.task.DemandExportExcelParam;
|
||||
import com.sdm.common.entity.resp.PageDataResp;
|
||||
import com.sdm.common.entity.resp.data.BatchAddFileInfoResp;
|
||||
import com.sdm.common.entity.resp.data.ChunkUploadMinioFileResp;
|
||||
@@ -31,6 +34,7 @@ import com.sdm.common.utils.CidApproveUtil;
|
||||
import com.sdm.common.utils.CidSysUserUtil;
|
||||
import com.sdm.common.utils.PageUtils;
|
||||
import com.sdm.common.utils.ProjectUtil;
|
||||
import com.sdm.common.utils.excel.ExcelUtil;
|
||||
import com.sdm.data.model.bo.ApprovalFileDataContentsModel;
|
||||
import com.sdm.data.model.entity.FileMetadataExtension;
|
||||
import com.sdm.data.model.entity.FileMetadataInfo;
|
||||
@@ -2348,4 +2352,30 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse exportKnowledgeList(KnowledgeExportExcelFormat knowledgeExportExcelFormat, HttpServletResponse httpServletResponse) {
|
||||
SdmResponse response = new SdmResponse();
|
||||
FileSearchReq req = new FileSearchReq();
|
||||
KnowledgeExportExcelParam params = knowledgeExportExcelFormat.getParams();
|
||||
if (ObjectUtils.isNotEmpty(params)) {
|
||||
BeanUtils.copyProperties(params,req);
|
||||
}
|
||||
List<ExportExcelFormat> exportExcelFormats = knowledgeExportExcelFormat.getExcelHeaders();
|
||||
req.setCurrent(1);
|
||||
req.setSize(10000);
|
||||
SdmResponse taskRespond = fileSearch(req);
|
||||
if(taskRespond.isSuccess()) {
|
||||
if (!(taskRespond.getData() instanceof PageDataResp)) {
|
||||
ExcelUtil.exportExcelNoMerge(new JSONArray(),exportExcelFormats,httpServletResponse);
|
||||
return response;
|
||||
}
|
||||
PageDataResp dataObj = (PageDataResp) taskRespond.getData();
|
||||
Object data = dataObj.getData();
|
||||
ExcelUtil.exportExcelNoMerge(JSONArray.from(data),exportExcelFormats,httpServletResponse);
|
||||
} else {
|
||||
response = SdmResponse.failed(taskRespond.getMessage());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.sdm.data.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.sdm.common.common.ResultCode;
|
||||
import com.sdm.common.common.SdmIterator;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.common.ThreadLocalContext;
|
||||
import com.sdm.common.entity.ExportExcelFormat;
|
||||
import com.sdm.common.entity.constants.PermConstants;
|
||||
import com.sdm.common.entity.data.*;
|
||||
import com.sdm.common.entity.enums.UserRole;
|
||||
@@ -15,6 +17,7 @@ import com.sdm.common.entity.resp.data.BatchAddFileInfoResp;
|
||||
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||
import com.sdm.common.service.CommonService;
|
||||
import com.sdm.common.utils.*;
|
||||
import com.sdm.common.utils.excel.ExcelUtil;
|
||||
import com.sdm.data.dao.DataMapper;
|
||||
import com.sdm.data.dao.SystemMapper;
|
||||
import com.sdm.data.dao.UserMapper;
|
||||
@@ -28,6 +31,7 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -1583,6 +1587,27 @@ public class SystemFileIDataFileServiceImpl implements IDataFileService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse exportKnowledgeList(KnowledgeExportExcelFormat knowledgeExportExcelFormat, HttpServletResponse httpServletResponse) {
|
||||
SdmResponse response = new SdmResponse();
|
||||
FileSearchReq req = new FileSearchReq();
|
||||
KnowledgeExportExcelParam params = knowledgeExportExcelFormat.getParams();
|
||||
if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(params)) {
|
||||
BeanUtils.copyProperties(params,req);
|
||||
}
|
||||
List<ExportExcelFormat> exportExcelFormats = knowledgeExportExcelFormat.getExcelHeaders();
|
||||
req.setCurrent(1);
|
||||
req.setSize(10000);
|
||||
SdmResponse taskRespond = fileSearch(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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public interface SimulationNodeMapper extends BaseMapper<SimulationNode> {
|
||||
int addNodeExtraBatch(@Param("addNodeExtraList") List<SpdmNodeExtraReq> addNodeExtraList);
|
||||
|
||||
|
||||
List<SpdmNodeVo> getNodeList(@Param("nodeType") String nodeType, @Param("nodeSubType") String nodeSubType, @Param("progressStatus") Integer progressStatus, @Param("nodeCode") String nodeCode,
|
||||
List<SpdmNodeVo> getNodeList(@Param("nodeType") String nodeType, @Param("nodeSubType") String nodeSubType, @Param("exeStatus") String exeStatus, @Param("nodeCode") String nodeCode,
|
||||
@Param("manager") String manager, @Param("nodeName") String nodeName, @Param("tenantId") Long tenantId, @Param("pos") int pos, @Param("limit") int limit);
|
||||
|
||||
int getNodeListCount(@Param("nodeType") String nodeType, @Param("nodeSubType") String nodeSubType, @Param("progressStatus") Integer progressStatus, @Param("nodeCode") String nodeCode,
|
||||
|
||||
@@ -238,7 +238,7 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
int pos = (req.getCurrent() - 1) * req.getSize();
|
||||
int limit = req.getSize();
|
||||
Long tenantId = ThreadLocalContext.getTenantId();
|
||||
List<SpdmNodeVo> nodeList = nodeMapper.getNodeList(req.getNodeType(), req.getNodeSubType(), req.getProgressStatus(), req.getNodeCode(), req.getManager(), req.getNodeName(),
|
||||
List<SpdmNodeVo> nodeList = nodeMapper.getNodeList(req.getNodeType(), req.getNodeSubType(), req.getExeStatus(), req.getNodeCode(), req.getManager(), req.getNodeName(),
|
||||
tenantId, pos, limit);
|
||||
CoreLogger.info("getNodeList param:{},tenantId:{}", JSONObject.toJSONString(req), tenantId);
|
||||
if (CollectionUtils.isEmpty(nodeList)) {
|
||||
|
||||
@@ -202,8 +202,8 @@
|
||||
<if test="nodeSubType != null and nodeSubType != ''">
|
||||
and sn.nodeSubType = #{nodeSubType}
|
||||
</if>
|
||||
<if test="progressStatus != null">
|
||||
and sn.progress = #{progressStatus}
|
||||
<if test="exeStatus != null and exeStatus != ''">
|
||||
and sn.exe_status = #{exeStatus}
|
||||
</if>
|
||||
<if test="nodeCode != null and nodeCode != ''">
|
||||
and sn.nodeCode like CONCAT('%',#{nodeCode},'%')
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
<select id="getTaskList" resultType="com.sdm.project.model.vo.SpdmTaskVo">
|
||||
select * from simulation_task where tenant_id = #{tenantId}
|
||||
<if test="req.taskName != null and req.taskName != ''">
|
||||
and task_name = #{req.taskName}
|
||||
and task_name like CONCAT('%',#{req.taskName},'%')
|
||||
</if>
|
||||
<if test="req.progress != null and req.progress != ''">
|
||||
and progress = #{req.progress}
|
||||
|
||||
Reference in New Issue
Block a user