Merge remote-tracking branch 'origin/main'

This commit is contained in:
2025-12-01 12:16:24 +08:00
6 changed files with 120 additions and 9 deletions

View File

@@ -8,6 +8,6 @@ import org.springframework.web.bind.annotation.RequestBody;
@FeignClient(name = "data",contextId = "dataAnalysisFeignClient")
public interface IDataAnalysisFeignClient {
@PostMapping("/getSimulationTaskFile")
@PostMapping("/dataAnalysis/getSimulationTaskFile")
public SdmResponse getSimulationTaskFile(@RequestBody GetSimulationTaskFileReq getSimulationTaskFileReq);
}

View File

@@ -0,0 +1,17 @@
package com.sdm.common.utils.excel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class ExcelHeaderInfo {
@Schema(description = "Excel表头对应再库中数据字段属性")
private String keyType;
@Schema(description = "Excel表头显示名称")
private String title;
@Schema(description = "表头列是否显示")
private boolean bShow = true;
}

View File

@@ -127,6 +127,8 @@ public class ExcelUtil {
int cellIndex = 0;
for(HeadVO headVO : headerData)
{
if(!headVO.getExcelHeaderInfo().isBShow())
continue;
Cell cell = headRow.createCell(cellIndex);
cell.setCellStyle(headerStyle);
cell.setCellValue(headVO.getKey());
@@ -141,7 +143,7 @@ public class ExcelUtil {
* @param sheet
* @param rowValues
*/
private static void writeSheetRows(Workbook workbook,Sheet sheet,List<RowValue> rowValues,List<ColumnMergeInfo> columnMergeInfos)
private static void writeSheetRows(Workbook workbook,Sheet sheet,List<RowValue> rowValues,List<ColumnMergeInfo> columnMergeInfos,List<HeadVO> headers)
{
int rowIndex = 1;
Map<String, CellRangeAddress> cellRangeAddressHashMap = new HashMap<>();
@@ -154,6 +156,11 @@ public class ExcelUtil {
for(ExcelCellValue cellValue : rowValue.getCells())
{
HeadVO headVO = headers.get(columnIndex);
if(!headVO.getExcelHeaderInfo().isBShow()) {
columnIndex++;
continue;
}
Cell cell = row.createCell(columnIndex);
cell.setCellStyle(cellStyle);
cell.setCellValue(String.valueOf(cellValue.getValue()));
@@ -219,7 +226,7 @@ public class ExcelUtil {
for (ExcelSheet sheetData : sheets) {
Sheet sheet = workBook.createSheet(sheetData.getSheetName());
List<ColumnMergeInfo> columnMergeInfos = writeSheetHeader(workBook,sheet, sheetData.getHeads());
writeSheetRows(workBook,sheet, sheetData.getRowValues(), columnMergeInfos);
writeSheetRows(workBook,sheet, sheetData.getRowValues(), columnMergeInfos,sheetData.getHeads());
}
workBook.write(response.getOutputStream());
workBook.close();
@@ -242,6 +249,10 @@ public class ExcelUtil {
{
HeadVO headVO = HeadVO.builder().build();
headVO.setKey(exportExcelFormat.getTitle());
ExcelHeaderInfo excelHeaderInfo = new ExcelHeaderInfo();
excelHeaderInfo.setTitle(exportExcelFormat.getTitle());
excelHeaderInfo.setKeyType(exportExcelFormat.getKey());
headVO.setExcelHeaderInfo(excelHeaderInfo);
excelHeader.add(headVO);
}
return excelHeader;
@@ -367,6 +378,10 @@ public class ExcelUtil {
else
{
JSONArray children = jsonObject.getJSONArray("children");
if(children != null && children.isEmpty())
{
children = null;
}
if(children != null)
{
for(int i=0;i<children.size();i++)
@@ -378,6 +393,14 @@ public class ExcelUtil {
paraseJsonObject(child,formats,parentData);
}
}
else
{
paraseData.keyValues.add("");
while (iterator.hasNext()) {
iterator.next();
paraseData.keyValues.add("");
}
}
break;
}
}
@@ -487,7 +510,6 @@ public class ExcelUtil {
computeParaseData(data,rowNum);
combineParaseData(data,paraseDataMap,0,rowNum);
rowNum += data.lines;
}
int columnSize = paraseDataMap.size();
int rowIndex = 0;

View File

@@ -17,6 +17,11 @@ public class HeadVO implements Comparable<HeadVO> {
* 字段名
*/
private String key;
/**
* 表头详细属性
*/
private ExcelHeaderInfo excelHeaderInfo;
/**
* 主排序
*/

View File

@@ -4,12 +4,14 @@ import com.alibaba.fastjson2.JSONObject;
import com.github.pagehelper.PageInfo;
import com.sdm.common.common.SdmResponse;
import com.sdm.common.entity.enums.NodeTypeEnum;
import com.sdm.common.entity.req.data.GetSimulationTaskFileReq;
import com.sdm.common.entity.req.data.UploadFilesReq;
import com.sdm.common.entity.resp.PageDataResp;
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
import com.sdm.common.feign.impl.data.DataAnalysisFeignClientImpl;
import com.sdm.common.feign.inter.data.IDataFeignClient;
import com.sdm.common.utils.PageUtils;
import com.sdm.project.common.KeyResultTypeEnum;
import com.sdm.project.model.entity.SimulationRunKeyResult;
import com.sdm.project.model.req.KeyResultReq;
@@ -33,6 +35,8 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@RestController
@@ -43,6 +47,9 @@ public class YAModelController {
@Autowired
private IDataFeignClient dataFeignClient;
@Autowired
private DataAnalysisFeignClientImpl dataAnalysisFeignClient;
@Resource
INodeService nodeService;
@@ -84,10 +91,10 @@ public class YAModelController {
BosimSaveNodeInfoRsp rsp = new BosimSaveNodeInfoRsp();
if(uploadRespond.isSuccess())
{
JSONObject data = (JSONObject) uploadRespond.getData();
LinkedHashMap data = (LinkedHashMap) uploadRespond.getData();
rsp.setCode("200");
rsp.setMessage("success");
long fileId = data.getLong("fileId");
int fileId = (int)data.get("fileId");
rsp.getWorkRequest().add(String.valueOf(fileId));
}
return rsp;
@@ -125,10 +132,10 @@ public class YAModelController {
BosimSaveNodeInfoRsp rsp = new BosimSaveNodeInfoRsp();
if(uploadRespond.isSuccess())
{
JSONObject data = (JSONObject) uploadRespond.getData();
HashMap data = (HashMap) uploadRespond.getData();
rsp.setCode("200");
rsp.setMessage("success");
long fileId = data.getLong("fileId");
int fileId = (int)data.get("fileId");
rsp.getWorkRequest().add(String.valueOf(fileId));
}
return rsp;
@@ -268,6 +275,44 @@ public class YAModelController {
}
/**
* 获取Task下模型文件信息
* @param outsideReq
* @return
*/
@PostMapping("GetTaskModels")
public SdmResponse getTaskModels(@RequestBody @Validated GetTaskSimulatinFileReq outsideReq)
{
GetSimulationTaskFileReq req = new GetSimulationTaskFileReq();
req.setUuid(outsideReq.getTaskId());
req.setFileBizType(1);
req.setSize(outsideReq.getSize());
req.setCurrent(outsideReq.getCurrent());
return dataAnalysisFeignClient.getSimulationTaskFile(req);
}
/**
* 获取Task下报告文件信息
* @param outsideReq
* @return
*/
@PostMapping("GetTaskReports")
public SdmResponse getTaskReports(@RequestBody @Validated GetTaskSimulatinFileReq outsideReq)
{
GetSimulationTaskFileReq req = new GetSimulationTaskFileReq();
req.setUuid(outsideReq.getTaskId());
req.setFileBizType(2);
req.setSize(outsideReq.getSize());
req.setCurrent(outsideReq.getCurrent());
return dataAnalysisFeignClient.getSimulationTaskFile(req);
}
public void downloadSimulationFile(long fileId)
{
}
@PostMapping("syncCidProject")
public BosimSaveProjectTaskRsp syncCidProject(@RequestBody @Validated SyncCidProjectReq req)

View File

@@ -0,0 +1,22 @@
package com.sdm.project.model.req.YA;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Data
public class GetTaskSimulatinFileReq {
@Schema(description = "项目ID")
@NotBlank(message = "项目ID不能为空")
private String taskId;
@Schema(description = "当前页")
@NotNull(message = "当前页不能为空")
private Integer current;
@Schema(description = "每页数据大小")
@NotNull(message = "显示页大小不能为空")
private Integer size;
}