故障修复,新增列表导出功能
This commit is contained in:
@@ -2,6 +2,7 @@ package com.sdm.capability.controller;
|
|||||||
|
|
||||||
import com.sdm.capability.model.entity.SimulationFlowTemplate;
|
import com.sdm.capability.model.entity.SimulationFlowTemplate;
|
||||||
import com.sdm.capability.model.req.flow.GetFlowTemplateReq;
|
import com.sdm.capability.model.req.flow.GetFlowTemplateReq;
|
||||||
|
import com.sdm.capability.model.req.flow.ReleaseFlowTemplateReq;
|
||||||
import com.sdm.capability.service.IFlowService;
|
import com.sdm.capability.service.IFlowService;
|
||||||
import com.sdm.common.common.SdmResponse;
|
import com.sdm.common.common.SdmResponse;
|
||||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||||
@@ -45,17 +46,17 @@ public class FlowController implements ISimulationFlowTemplateFeignClient {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除流程模版草稿
|
* 删除流程模版草稿
|
||||||
* @param uuid
|
* @param flowTemplate
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/deleteFlowTemplateDraft")
|
@PostMapping("/deleteFlowTemplateDraft")
|
||||||
public SdmResponse deleteFlowTemplateDraft(@RequestParam("uuid") String uuid) {
|
public SdmResponse deleteFlowTemplateDraft(@RequestBody SimulationFlowTemplate flowTemplate) {
|
||||||
return IFlowService.deleteFlowTemplateDraft(uuid);
|
return IFlowService.deleteFlowTemplateDraft(flowTemplate.uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/releaseFlowTemplate")
|
@PostMapping("/releaseFlowTemplate")
|
||||||
public SdmResponse releaseFlowTemplateDraft(@RequestParam("uuid") String uuid,@RequestParam("versionType") int versionType) {
|
public SdmResponse releaseFlowTemplateDraft(@RequestBody @Validated ReleaseFlowTemplateReq req) {
|
||||||
return IFlowService.releaseFlowTemplate(uuid,versionType);
|
return IFlowService.releaseFlowTemplate(req.uuid,req.versionType,req.approveTemplateName,req.approveTemplateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +101,7 @@ public class FlowController implements ISimulationFlowTemplateFeignClient {
|
|||||||
return IFlowService.getFlowTemplateInfo(uuid);
|
return IFlowService.getFlowTemplateInfo(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/flow/approveHandleNotice")
|
@PostMapping("/approveHandleNotice")
|
||||||
public SdmResponse receiveApproveNotice(LaunchApproveReq req) {
|
public SdmResponse receiveApproveNotice(LaunchApproveReq req) {
|
||||||
|
|
||||||
return IFlowService.handleApproveResult(req);
|
return IFlowService.handleApproveResult(req);
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import java.util.List;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface FlowMapper {
|
public interface FlowMapper {
|
||||||
|
|
||||||
@Insert("INSERT INTO simulation_flow_template(uuid,templateName,templateVersion,templateContent,viewContent,parentUuid,templateStatus,templateType,approveType,comment,tenantId,createName,creator) VALUES(#{template.uuid},#{template.templateName},#{template.templateVersion},#{template.templateContent},#{template.viewContent},#{template.parentUuid},#{template.templateStatus},#{template.templateType},#{template.approveType},#{template.comment},#{template.tenantId},#{template.createName},#{template.creator})")
|
@Insert("INSERT INTO simulation_flow_template(uuid,templateName,templateVersion,templateContent,viewContent,parentUuid,templateStatus,templateType,approveType,comment,templateCode,tenantId,createName,creator) VALUES(#{template.uuid},#{template.templateName},#{template.templateVersion},#{template.templateContent},#{template.viewContent},#{template.parentUuid},#{template.templateStatus},#{template.templateType},#{template.approveType},#{template.comment},#{template.templateCode},#{template.tenantId},#{template.createName},#{template.creator})")
|
||||||
int addFlowTemplate(@Param("template") SimulationFlowTemplate template);
|
int addFlowTemplate(@Param("template") SimulationFlowTemplate template);
|
||||||
|
|
||||||
@Update("UPDATE simulation_flow_template SET templateContent=#{template.templateContent},viewContent=#{template.viewContent},templateType=#{template.templateType},templateStatus=#{template.templateStatus},comment=#{template.comment} WHERE uuid=#{template.uuid}")
|
@Update("UPDATE simulation_flow_template SET templateContent=#{template.templateContent},viewContent=#{template.viewContent},approveType=#{template.approveType},templateType=#{template.templateType},templateStatus=#{template.templateStatus},comment=#{template.comment} WHERE uuid=#{template.uuid}")
|
||||||
int updateFlowTemplate(@Param("template") SimulationFlowTemplate template);
|
int updateFlowTemplate(@Param("template") SimulationFlowTemplate template);
|
||||||
|
|
||||||
@Delete("DELETE FROM simulation_flow_template WHERE uuid=#{uuid}")
|
@Delete("DELETE FROM simulation_flow_template WHERE uuid=#{uuid}")
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.sdm.capability.model.req.flow;
|
||||||
|
|
||||||
|
|
||||||
|
import com.sdm.common.entity.pojo.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ReleaseFlowTemplateReq extends BaseEntity {
|
||||||
|
public ReleaseFlowTemplateReq() {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String uuid;
|
||||||
|
|
||||||
|
public int versionType;
|
||||||
|
|
||||||
|
public String approveTemplateName;
|
||||||
|
|
||||||
|
public String approveTemplateId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -41,7 +41,7 @@ public interface IFlowService {
|
|||||||
* @param uuid
|
* @param uuid
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
SdmResponse releaseFlowTemplate(String uuid,int versionType);
|
SdmResponse releaseFlowTemplate(String uuid,int versionType,String approveTemplateName,String approveTemplateId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -77,9 +77,13 @@ public class FlowServiceImpl extends BaseService implements IFlowService {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
SimulationFlowTemplate template = templates.get(0);
|
SimulationFlowTemplate template = templates.get(0);
|
||||||
|
generateVersion(template.getTemplateVersion(),flowTemplate.getVersionType());
|
||||||
flowTemplate.setTemplateVersion(generateVersion(template.getTemplateVersion(),flowTemplate.getVersionType()));
|
flowTemplate.setTemplateVersion(generateVersion(template.getTemplateVersion(),flowTemplate.getVersionType()));
|
||||||
|
|
||||||
}
|
}
|
||||||
flowTemplate.setUuid(generateUuid("flow_template_"));
|
String uuid = generateUuid("flow_template_");
|
||||||
|
flowTemplate.setUuid(uuid);
|
||||||
|
response.setData(uuid);
|
||||||
flowTemplate.setCreator(creator);
|
flowTemplate.setCreator(creator);
|
||||||
flowTemplate.setTenantId(tenantId);
|
flowTemplate.setTenantId(tenantId);
|
||||||
flowTemplate.setCreateName(createName);
|
flowTemplate.setCreateName(createName);
|
||||||
@@ -112,7 +116,7 @@ public class FlowServiceImpl extends BaseService implements IFlowService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SdmResponse releaseFlowTemplate(String uuid,int versionType) {
|
public SdmResponse releaseFlowTemplate(String uuid,int versionType,String approveTemplateName,String approveTemplateId) {
|
||||||
SdmResponse response = SdmResponse.success();
|
SdmResponse response = SdmResponse.success();
|
||||||
String condition = "uuid='"+uuid+"'";
|
String condition = "uuid='"+uuid+"'";
|
||||||
List<SimulationFlowTemplate> templates = flowMapper.queryFlowTemplateByCondition(condition);
|
List<SimulationFlowTemplate> templates = flowMapper.queryFlowTemplateByCondition(condition);
|
||||||
@@ -123,7 +127,10 @@ public class FlowServiceImpl extends BaseService implements IFlowService {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
SimulationFlowTemplate templateDraft = templates.get(0);
|
SimulationFlowTemplate templateDraft = templates.get(0);
|
||||||
templateDraft.setApproveType(1);
|
templateDraft.approveType = 1;
|
||||||
|
templateDraft.approveFlowTemplateId = approveTemplateId;
|
||||||
|
templateDraft.approveFlowTemplateName = approveTemplateName;
|
||||||
|
templateDraft.versionType = versionType;
|
||||||
if(flowMapper.updateFlowTemplate(templateDraft) <= 0)
|
if(flowMapper.updateFlowTemplate(templateDraft) <= 0)
|
||||||
{
|
{
|
||||||
response = SdmResponse.failed("添加流程模版失败");
|
response = SdmResponse.failed("添加流程模版失败");
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.sdm.common.entity;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.http.codec.json.Jackson2SmileDecoder;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ExportExcelFormat {
|
||||||
|
@Schema(description = "表属性值")
|
||||||
|
@NotNull(message = "表属性值不能为空")
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
@Schema(description = "excel表头")
|
||||||
|
@NotNull(message = "excel表头不能为空")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@Schema(description = "属性值对应的字典编码")
|
||||||
|
private String dictCode;
|
||||||
|
|
||||||
|
@Schema(description = "字典值")
|
||||||
|
private JSONObject dictData;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.sdm.common.utils.excel;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ExcelCellValue {
|
||||||
|
private Object value = "";
|
||||||
|
private String valueType; //string or num
|
||||||
|
private boolean isMerge;
|
||||||
|
private Object mergeValue;
|
||||||
|
private int firstRow;
|
||||||
|
private int lastRow;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.sdm.common.utils.excel;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ExcelSheet {
|
||||||
|
private String sheetName;
|
||||||
|
|
||||||
|
private List<HeadVO> heads = new ArrayList<HeadVO>();
|
||||||
|
|
||||||
|
private List<RowValue> rowValues = new ArrayList<>();
|
||||||
|
}
|
||||||
@@ -2,12 +2,21 @@ package com.sdm.common.utils.excel;
|
|||||||
|
|
||||||
import com.alibaba.excel.EasyExcel;
|
import com.alibaba.excel.EasyExcel;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.sdm.common.entity.ExportExcelFormat;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.poi.ss.usermodel.*;
|
||||||
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.ReflectionUtils;
|
import org.springframework.util.ReflectionUtils;
|
||||||
|
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -93,4 +102,175 @@ public class ExcelUtil {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class ColumnMergeInfo
|
||||||
|
{
|
||||||
|
public int beginColumn;
|
||||||
|
public int endColumn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 写excel表头
|
||||||
|
* @param headerData
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static List<ColumnMergeInfo> writeSheetHeader(Workbook workbook,Sheet sheet,List<HeadVO> headerData)
|
||||||
|
{
|
||||||
|
Row headRow = sheet.createRow(0);
|
||||||
|
headRow.setHeight((short) -1);
|
||||||
|
Font font = makeFont(workbook,"微软雅黑",true,(short) 12,IndexedColors.BLACK.getIndex());
|
||||||
|
CellStyle headerStyle = makeStyle(workbook,font,BorderStyle.THIN);
|
||||||
|
headerStyle.setFillForegroundColor(IndexedColors.SKY_BLUE.getIndex());
|
||||||
|
headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||||
|
List<ColumnMergeInfo> mergeInfos = new ArrayList<>();
|
||||||
|
int cellIndex = 0;
|
||||||
|
for(HeadVO headVO : headerData)
|
||||||
|
{
|
||||||
|
Cell cell = headRow.createCell(cellIndex);
|
||||||
|
cell.setCellStyle(headerStyle);
|
||||||
|
cell.setCellValue(headVO.getKey());
|
||||||
|
sheet.autoSizeColumn(cellIndex);
|
||||||
|
cellIndex++;
|
||||||
|
}
|
||||||
|
return mergeInfos;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 写入excel行数据
|
||||||
|
* @param sheet
|
||||||
|
* @param rowValues
|
||||||
|
*/
|
||||||
|
private static void writeSheetRows(Workbook workbook,Sheet sheet,List<RowValue> rowValues,List<ColumnMergeInfo> columnMergeInfos)
|
||||||
|
{
|
||||||
|
int rowIndex = 1;
|
||||||
|
Map<String, CellRangeAddress> cellRangeAddressHashMap = new HashMap<>();
|
||||||
|
Font cellFont = makeFont(workbook,"宋体",false,(short) 11,IndexedColors.BLACK.getIndex());
|
||||||
|
CellStyle cellStyle = makeStyle(workbook,cellFont,BorderStyle.THIN);
|
||||||
|
for(RowValue rowValue : rowValues)
|
||||||
|
{
|
||||||
|
Row row = sheet.createRow(rowIndex);
|
||||||
|
int columnIndex = 0;
|
||||||
|
|
||||||
|
for(ExcelCellValue cellValue : rowValue.getCells())
|
||||||
|
{
|
||||||
|
Cell cell = row.createCell(columnIndex);
|
||||||
|
cell.setCellStyle(cellStyle);
|
||||||
|
cell.setCellValue(String.valueOf(cellValue.getValue()));
|
||||||
|
if(cellValue.isMerge())
|
||||||
|
{
|
||||||
|
String rangekey = cellValue.getFirstRow()+"-"+cellValue.getLastRow()+"-"+columnIndex;
|
||||||
|
if(!cellRangeAddressHashMap.containsKey(rangekey))
|
||||||
|
{
|
||||||
|
CellRangeAddress rangeAddress = new CellRangeAddress(cellValue.getFirstRow(),cellValue.getLastRow(),columnIndex,columnIndex);
|
||||||
|
cellRangeAddressHashMap.put(rangekey,rangeAddress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
columnIndex++;
|
||||||
|
}
|
||||||
|
rowIndex++;
|
||||||
|
}
|
||||||
|
cellRangeAddressHashMap.values().forEach(sheet::addMergedRegion);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字体
|
||||||
|
* @param fontName
|
||||||
|
* @param isBold
|
||||||
|
* @param fontSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static Font makeFont(Workbook workbook,String fontName,boolean isBold,short fontSize,short colorIndex)
|
||||||
|
{
|
||||||
|
Font font = workbook.createFont();
|
||||||
|
font.setBold(isBold);
|
||||||
|
font.setFontHeightInPoints(fontSize);
|
||||||
|
font.setFontName(fontName);
|
||||||
|
font.setColor(colorIndex);
|
||||||
|
return font;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建单元格风格
|
||||||
|
* @param workbook
|
||||||
|
* @param font
|
||||||
|
* @param
|
||||||
|
* @param borderStyle
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static CellStyle makeStyle(Workbook workbook,Font font,BorderStyle borderStyle)
|
||||||
|
{
|
||||||
|
CellStyle style = workbook.createCellStyle();
|
||||||
|
style.setBorderBottom(borderStyle);
|
||||||
|
style.setBorderLeft(borderStyle);
|
||||||
|
style.setBorderTop(borderStyle);
|
||||||
|
style.setBorderRight(borderStyle);
|
||||||
|
style.setFont(font);
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 导出excel
|
||||||
|
* @param sheets
|
||||||
|
* @param response
|
||||||
|
*/
|
||||||
|
public static void exportExcel(List<ExcelSheet> sheets, HttpServletResponse response) {
|
||||||
|
try {
|
||||||
|
Workbook workBook = new XSSFWorkbook();
|
||||||
|
for (ExcelSheet sheetData : sheets) {
|
||||||
|
Sheet sheet = workBook.createSheet(sheetData.getSheetName());
|
||||||
|
List<ColumnMergeInfo> columnMergeInfos = writeSheetHeader(workBook,sheet, sheetData.getHeads());
|
||||||
|
writeSheetRows(workBook,sheet, sheetData.getRowValues(), columnMergeInfos);
|
||||||
|
}
|
||||||
|
workBook.write(response.getOutputStream());
|
||||||
|
workBook.close();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出没有合并单元格excel
|
||||||
|
* @param dataArray
|
||||||
|
* @param exportExcelFormats
|
||||||
|
*/
|
||||||
|
public static void exportExcelNoMerge(JSONArray dataArray,List<ExportExcelFormat> exportExcelFormats,HttpServletResponse response)
|
||||||
|
{
|
||||||
|
ExcelSheet excelSheet = new ExcelSheet();
|
||||||
|
excelSheet.setSheetName("export sheet1");
|
||||||
|
//获取excel表头
|
||||||
|
List<HeadVO> excelHeader = new ArrayList<>();
|
||||||
|
for(ExportExcelFormat exportExcelFormat : exportExcelFormats)
|
||||||
|
{
|
||||||
|
HeadVO headVO = HeadVO.builder().build();
|
||||||
|
headVO.setKey(exportExcelFormat.getTitle());
|
||||||
|
excelHeader.add(headVO);
|
||||||
|
}
|
||||||
|
excelSheet.setHeads(excelHeader);
|
||||||
|
|
||||||
|
//获取excel表行数据
|
||||||
|
for(int index=0;index<dataArray.size();index++)
|
||||||
|
{
|
||||||
|
JSONObject rowObj = dataArray.getJSONObject(index);
|
||||||
|
RowValue rowValue = new RowValue();
|
||||||
|
for (ExportExcelFormat exportExcelFormat : exportExcelFormats)
|
||||||
|
{
|
||||||
|
ExcelCellValue cellValue = new ExcelCellValue();
|
||||||
|
String value = rowObj.getString(exportExcelFormat.getKey());
|
||||||
|
if(value != null && !"null".equalsIgnoreCase(value)) {
|
||||||
|
JSONObject dictData = exportExcelFormat.getDictData();
|
||||||
|
if(dictData != null)
|
||||||
|
{
|
||||||
|
value = dictData.getString(value);
|
||||||
|
}
|
||||||
|
cellValue.setValue(value);
|
||||||
|
}
|
||||||
|
rowValue.getCells().add(cellValue);
|
||||||
|
}
|
||||||
|
excelSheet.getRowValues().add(rowValue);
|
||||||
|
}
|
||||||
|
List<ExcelSheet> excelSheets = new ArrayList<>();
|
||||||
|
excelSheets.add(excelSheet);
|
||||||
|
exportExcel(excelSheets,response);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.sdm.common.utils.excel;
|
|||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -11,7 +12,7 @@ public class HeadVO implements Comparable<HeadVO> {
|
|||||||
/**
|
/**
|
||||||
* 列头名
|
* 列头名
|
||||||
*/
|
*/
|
||||||
private List<String> headTitle;
|
private List<String> headTitle = new ArrayList<>();
|
||||||
/**
|
/**
|
||||||
* 字段名
|
* 字段名
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.sdm.common.utils.excel;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RowValue {
|
||||||
|
|
||||||
|
private List<ExcelCellValue> cells = new ArrayList<ExcelCellValue>();
|
||||||
|
}
|
||||||
BIN
exportExcel.xlsx
Normal file
BIN
exportExcel.xlsx
Normal file
Binary file not shown.
@@ -1,12 +1,15 @@
|
|||||||
package com.sdm.system;
|
package com.sdm.system;
|
||||||
|
|
||||||
|
|
||||||
|
import com.sdm.common.utils.excel.ExcelUtil;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
import org.springframework.context.annotation.Import;
|
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@SpringBootApplication(scanBasePackages = {"com.sdm.system","com.sdm.common"})
|
@SpringBootApplication(scanBasePackages = {"com.sdm.system","com.sdm.common"})
|
||||||
@EnableDiscoveryClient
|
@EnableDiscoveryClient
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
|
|||||||
@@ -1,16 +1,20 @@
|
|||||||
package com.sdm.system.controller;
|
package com.sdm.system.controller;
|
||||||
|
|
||||||
import com.sdm.common.common.SdmResponse;
|
import com.sdm.common.common.SdmResponse;
|
||||||
|
import com.sdm.common.entity.ExportExcelFormat;
|
||||||
import com.sdm.system.model.req.tenant.TenantListReq;
|
import com.sdm.system.model.req.tenant.TenantListReq;
|
||||||
import com.sdm.system.model.req.tenant.TenantReq;
|
import com.sdm.system.model.req.tenant.TenantReq;
|
||||||
import com.sdm.system.service.ISysTenantService;
|
import com.sdm.system.service.ISysTenantService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 租户信息表 前端控制器
|
* 租户信息表 前端控制器
|
||||||
@@ -73,6 +77,12 @@ public class SysTenantController {
|
|||||||
return tenantService.listTenant(tenant);
|
return tenantService.listTenant(tenant);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/export")
|
||||||
|
@Operation(summary = "查询租户列表")
|
||||||
|
public SdmResponse listTenant(@RequestBody @Validated List<ExportExcelFormat> excelFormats ,HttpServletResponse httpservletResponse) {
|
||||||
|
return tenantService.exportTenant(excelFormats, httpservletResponse);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID查询租户信息
|
* 根据ID查询租户信息
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -65,10 +65,10 @@ public class SystemApproveController implements IApproveFeignClient {
|
|||||||
return approveServer.stopCidApprovalFlow(flowId);
|
return approveServer.stopCidApprovalFlow(flowId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/approveInnerNotice")
|
/*@PostMapping("/approveInnerNotice")
|
||||||
public SdmResponse systemApproveInnerNotice(@RequestBody LaunchApproveReq flowBean) {
|
public SdmResponse systemApproveInnerNotice(@RequestBody LaunchApproveReq flowBean) {
|
||||||
return SdmResponse.success();
|
return SdmResponse.success();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@GetMapping("/queryApproveFlowTempalte")
|
@GetMapping("/queryApproveFlowTempalte")
|
||||||
public SdmResponse queryApproveFlowTemplate()
|
public SdmResponse queryApproveFlowTemplate()
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class AppConfigureBean extends BaseBean {
|
|||||||
|
|
||||||
public int configType;//配置类型
|
public int configType;//配置类型
|
||||||
|
|
||||||
public String creator; //创建者
|
public long creator; //创建者
|
||||||
|
|
||||||
public String comment; //配置描述
|
public String comment; //配置描述
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,13 @@ package com.sdm.system.service;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.sdm.common.common.SdmResponse;
|
import com.sdm.common.common.SdmResponse;
|
||||||
|
import com.sdm.common.entity.ExportExcelFormat;
|
||||||
import com.sdm.system.model.entity.SysTenant;
|
import com.sdm.system.model.entity.SysTenant;
|
||||||
import com.sdm.system.model.req.tenant.TenantListReq;
|
import com.sdm.system.model.req.tenant.TenantListReq;
|
||||||
import com.sdm.system.model.req.tenant.TenantReq;
|
import com.sdm.system.model.req.tenant.TenantReq;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface ISysTenantService extends IService<SysTenant> {
|
public interface ISysTenantService extends IService<SysTenant> {
|
||||||
|
|
||||||
@@ -41,6 +45,14 @@ public interface ISysTenantService extends IService<SysTenant> {
|
|||||||
*/
|
*/
|
||||||
SdmResponse listTenant(TenantListReq tenant);
|
SdmResponse listTenant(TenantListReq tenant);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出租户列表
|
||||||
|
* @param excelFormats
|
||||||
|
* @param httpservletResponse
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
SdmResponse exportTenant(List<ExportExcelFormat> excelFormats , HttpServletResponse httpservletResponse);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID查询租户信息
|
* 根据ID查询租户信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -2,15 +2,21 @@ package com.sdm.system.service.impl.CID;
|
|||||||
|
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.sdm.common.common.SdmResponse;
|
import com.sdm.common.common.SdmResponse;
|
||||||
|
import com.sdm.common.entity.ExportExcelFormat;
|
||||||
import com.sdm.common.entity.resp.PageDataResp;
|
import com.sdm.common.entity.resp.PageDataResp;
|
||||||
|
import com.sdm.common.utils.excel.ExcelSheet;
|
||||||
|
import com.sdm.common.utils.excel.ExcelUtil;
|
||||||
import com.sdm.system.dao.SysTenantMapper;
|
import com.sdm.system.dao.SysTenantMapper;
|
||||||
import com.sdm.system.model.entity.SysTenant;
|
import com.sdm.system.model.entity.SysTenant;
|
||||||
import com.sdm.system.model.req.tenant.TenantListReq;
|
import com.sdm.system.model.req.tenant.TenantListReq;
|
||||||
import com.sdm.system.model.req.tenant.TenantReq;
|
import com.sdm.system.model.req.tenant.TenantReq;
|
||||||
import com.sdm.system.model.resp.TenantResp;
|
import com.sdm.system.model.resp.TenantResp;
|
||||||
import com.sdm.system.service.ISysTenantService;
|
import com.sdm.system.service.ISysTenantService;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -68,6 +74,27 @@ public class CIDtenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SdmResponse exportTenant(List<ExportExcelFormat> exportExcelFormats, HttpServletResponse httpServletResponse)
|
||||||
|
{
|
||||||
|
SdmResponse response = new SdmResponse();
|
||||||
|
TenantListReq req = new TenantListReq();
|
||||||
|
req.setSize(1000);
|
||||||
|
req.setCurrent(0);
|
||||||
|
SdmResponse tenantRespond = listTenant(req);
|
||||||
|
if(tenantRespond.isSuccess())
|
||||||
|
{
|
||||||
|
JSONObject dataObj = (JSONObject) tenantRespond.getData();
|
||||||
|
JSONArray jsonArray = dataObj.getJSONArray("data");
|
||||||
|
ExcelUtil.exportExcelNoMerge(jsonArray,exportExcelFormats,httpServletResponse);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
response = SdmResponse.failed(tenantRespond.getMessage());
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SdmResponse getTenantDetailById(Long tenantId) {
|
public SdmResponse getTenantDetailById(Long tenantId) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.sdm.common.common.SdmResponse;
|
import com.sdm.common.common.SdmResponse;
|
||||||
|
import com.sdm.common.entity.ExportExcelFormat;
|
||||||
import com.sdm.common.utils.PageUtils;
|
import com.sdm.common.utils.PageUtils;
|
||||||
import com.sdm.system.dao.SysTenantMapper;
|
import com.sdm.system.dao.SysTenantMapper;
|
||||||
import com.sdm.system.model.entity.SysTenant;
|
import com.sdm.system.model.entity.SysTenant;
|
||||||
@@ -12,6 +13,7 @@ import com.sdm.system.model.req.tenant.TenantListReq;
|
|||||||
import com.sdm.system.model.req.tenant.TenantReq;
|
import com.sdm.system.model.req.tenant.TenantReq;
|
||||||
import com.sdm.system.model.resp.TenantResp;
|
import com.sdm.system.model.resp.TenantResp;
|
||||||
import com.sdm.system.service.ISysTenantService;
|
import com.sdm.system.service.ISysTenantService;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.BeansException;
|
import org.springframework.beans.BeansException;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@@ -107,6 +109,11 @@ public class LocalSysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysT
|
|||||||
return PageUtils.getJsonObjectSdmResponse(tenantResps,pageInfo);
|
return PageUtils.getJsonObjectSdmResponse(tenantResps,pageInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SdmResponse exportTenant(List<ExportExcelFormat> excelFormats, HttpServletResponse httpservletResponse) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SdmResponse getTenantDetailById(Long tenantId) {
|
public SdmResponse getTenantDetailById(Long tenantId) {
|
||||||
SysTenant sysTenant = this.getById(tenantId);
|
SysTenant sysTenant = this.getById(tenantId);
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package com.sdm.system.service.impl;
|
package com.sdm.system.service.impl;
|
||||||
|
|
||||||
import com.sdm.common.common.SdmResponse;
|
import com.sdm.common.common.SdmResponse;
|
||||||
|
import com.sdm.common.common.ThreadLocalContext;
|
||||||
import com.sdm.common.service.BaseService;
|
import com.sdm.common.service.BaseService;
|
||||||
|
import com.sdm.common.utils.excel.*;
|
||||||
import com.sdm.system.dao.SimulationAppManageMapper;
|
import com.sdm.system.dao.SimulationAppManageMapper;
|
||||||
import com.sdm.system.model.entity.AppCenterItemBean;
|
import com.sdm.system.model.entity.AppCenterItemBean;
|
||||||
import com.sdm.system.model.entity.AppConfigureBean;
|
import com.sdm.system.model.entity.AppConfigureBean;
|
||||||
@@ -43,6 +45,8 @@ public class SimulationAppCenterServiceImpl extends BaseService implements ISimu
|
|||||||
|
|
||||||
SdmResponse response = SdmResponse.success();
|
SdmResponse response = SdmResponse.success();
|
||||||
appBean.uuid = generateUuid("app_center_");
|
appBean.uuid = generateUuid("app_center_");
|
||||||
|
appBean.tenantId = ThreadLocalContext.getTenantId();
|
||||||
|
appBean.creator = ThreadLocalContext.getUserId();
|
||||||
if(bHasSameNameSimulationApp(appBean))
|
if(bHasSameNameSimulationApp(appBean))
|
||||||
{
|
{
|
||||||
response = SdmResponse.failed("应用名称已存在");
|
response = SdmResponse.failed("应用名称已存在");
|
||||||
@@ -155,6 +159,7 @@ public class SimulationAppCenterServiceImpl extends BaseService implements ISimu
|
|||||||
@Override
|
@Override
|
||||||
public SdmResponse addSimulationAppConfig(AppConfigureBean configureBean) {
|
public SdmResponse addSimulationAppConfig(AppConfigureBean configureBean) {
|
||||||
SdmResponse response = SdmResponse.success();
|
SdmResponse response = SdmResponse.success();
|
||||||
|
configureBean.creator = ThreadLocalContext.getUserId();
|
||||||
if(bHasSameNameConfig(configureBean))
|
if(bHasSameNameConfig(configureBean))
|
||||||
{
|
{
|
||||||
response = SdmResponse.failed("存在同名的配置");
|
response = SdmResponse.failed("存在同名的配置");
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.sdm.task.model.entity;
|
package com.sdm.task.model.entity;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONArray;
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.sdm.common.entity.bo.BaseBean;
|
import com.sdm.common.entity.bo.BaseBean;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -92,7 +93,11 @@ public class TaskPoolUpdateBean extends ApproveBaseBean{
|
|||||||
public List<String> deletePerformances;
|
public List<String> deletePerformances;
|
||||||
|
|
||||||
public List<String> deletePerformanceExtras;
|
public List<String> deletePerformanceExtras;
|
||||||
|
/////评审预览数据结构
|
||||||
|
public JSONArray fullTableColumns;
|
||||||
|
|
||||||
|
public JSONArray fullTableData;
|
||||||
|
|
||||||
|
public JSONObject approvePreviewInfo;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user