1.解决pq公共方法查询监测点信息,母线,终端等信息

2.解决device模块swagger页面出不来问题
3.技术监督变电站台账接口增加
4.监测点试运行报告增加,间谐波电压和暂态列表
This commit is contained in:
wr
2024-08-01 11:41:19 +08:00
parent d972bbef80
commit cdbb4fe428
25 changed files with 2753 additions and 501 deletions

View File

@@ -21,16 +21,16 @@ import java.io.IOException;
contextId = "exportmodel")
public interface ReportFeignClient {
@PostMapping(value ="/exportModel",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
HttpResult<String> exportWorld(
@RequestParam("startTime") String startTime,
@RequestParam("endTime") String endTime,
@RequestParam("type") Integer type,
@RequestParam("lineIndex") String lineIndex,
@RequestParam("name") String name,
@RequestParam("reportNumber") String reportNumber,
@RequestParam("crmName") String crmName,
@RequestParam("isUrl") Boolean isUrl,
@RequestPart("file") MultipartFile file) throws IOException;
@PostMapping(value ="/exportModelJB",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
HttpResult<String> exportModelJB(
@RequestParam(value ="startTime",required = false) String startTime,
@RequestParam(value ="endTime",required = false) String endTime,
@RequestParam(value ="type",required = false) Integer type,
@RequestParam(value ="lineIndex",required = false) String lineIndex,
@RequestParam(value ="name",required = false) String name,
@RequestParam(value ="reportNumber",required = false) String reportNumber,
@RequestParam(value ="crmName",required = false) String crmName,
@RequestParam(value = "isUrl",required = false) Boolean isUrl,
@RequestPart(value ="file",required = false) MultipartFile file) throws IOException;
}

View File

@@ -41,7 +41,7 @@ public class ReportClientFallbackFactory implements FallbackFactory<ReportFeignC
return new ReportFeignClient() {
@Override
public HttpResult<String> exportWorld( String startTime, String endTime, Integer type, String lineIndex, String name, String reportNumber, String crmName, Boolean isUrl, MultipartFile file) throws IOException {
public HttpResult<String> exportModelJB( String startTime, String endTime, Integer type, String lineIndex, String name, String reportNumber, String crmName, Boolean isUrl, MultipartFile file) throws IOException {
log.error("{}异常,降级处理,异常为:{}", "获取谐波报告失败", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}

View File

@@ -26,7 +26,7 @@ public class WordUtil2 {
private final FileStorageUtil fileStorageUtil;
public void getWord(String path, Map<String, Object> params, String fileName, HttpServletResponse response)
public void getWord(String path, Map<String, Object> params, String fileName,List<List<String[]>> tableList, HttpServletResponse response)
throws Exception {
path = ClearPathUtil.cleanString(path);
InputStream inStream = null;
@@ -35,7 +35,12 @@ public class WordUtil2 {
try {
inStream = new ClassPathResource(path).getInputStream();;
doc = new CustomXWPFDocument(inStream);
this.replaceInTable(doc, params); // 替换表格里面的变量
if(CollUtil.isNotEmpty(tableList)){
this.replaceInTable(doc, params,tableList);
}else{
this.replaceInTable(doc, params);
}
// 替换表格里面的变量
this.replaceInPara(doc, params); // 替换文本里面的变量
} catch (IOException e) {
getError("获取报告模板异常,原因为:" + e);
@@ -96,7 +101,7 @@ public class WordUtil2 {
public String getReportFileUrl(String path,String fileName, Map<String, Object> params)
public String getReportFileUrl(String path,String fileName,List<List<String[]>> tableList, Map<String, Object> params)
throws Exception {
path = ClearPathUtil.cleanString(path);
InputStream inStream = null,in = null;
@@ -105,9 +110,12 @@ public class WordUtil2 {
try {
inStream = new ClassPathResource(path).getInputStream();;
doc = new CustomXWPFDocument(inStream);
this.replaceInTable(doc, params); // 替换表格里面的变量
if(CollUtil.isNotEmpty(tableList)){
this.replaceInTable(doc, params,tableList);
}else{
this.replaceInTable(doc, params);
}
this.replaceInPara(doc, params); // 替换文本里面的变量
//临时缓冲区
ByteArrayOutputStream out = new ByteArrayOutputStream();
doc.write(out);
@@ -299,9 +307,14 @@ public class WordUtil2 {
XWPFTableRow row = table.createRow();
List<XWPFTableCell> cells = row.getTableCells();
for (int j = 0; j < cells.size(); j++) {
XWPFTableCell cell = cells.get(j);
String s = tableList.get(i)[j];
cell.setText(s);
XWPFTableCell cell = cells.get(j);
cell.removeParagraph(0);
XWPFParagraph paragraph = cell.addParagraph();
paragraph.setAlignment(ParagraphAlignment.CENTER);
// 在段落中添加文本
XWPFRun run = paragraph.createRun();
run.setText(s);
}
}
}
@@ -325,7 +338,7 @@ public class WordUtil2 {
table = iterator.next();
if (table.getRows().size() > 1) {
// 判断表格是需要替换还是需要插入,判断逻辑有$为替换,表格无$为插入
if (this.matcher(table.getText()).find()) {
if (this.matcher(table.getText()).find()||this.matcherS(table.getText()).find()) {
rows = table.getRows();
for (XWPFTableRow row : rows) {
cells = row.getTableCells();
@@ -334,8 +347,10 @@ public class WordUtil2 {
processParagraphs(paragraphListTable, params, doc);
}
}
} else {
insertTable(table, tableList.get(num)); // 插入数据
}else {
if (CollUtil.isNotEmpty(tableList.get(num))){
insertTable(table, tableList.get(num)); // 插入数据
}
num++;
}
}
@@ -353,6 +368,11 @@ public class WordUtil2 {
Matcher matcher = pattern.matcher(str);
return matcher;
}
private Matcher matcherS(String str) {
Pattern pattern = Pattern.compile("\\$(.*?)\\$");
Matcher matcher = pattern.matcher(str);
return matcher;
}
/**
* 根据图片类型,取得对应的图片类型代码