Browse Source

修改bug

master
刘忱 1 year ago
parent
commit
3dcad78923
  1. 8
      win-admin/src/main/java/com/win/web/controller/base/ExcelController.java
  2. 3
      win-admin/src/main/resources/logback-spring.xml
  3. 2
      win-common/src/main/java/com/win/common/constant/HttpStatus.java

8
win-admin/src/main/java/com/win/web/controller/base/ExcelController.java

@ -98,6 +98,9 @@ public class ExcelController {
JSONArray headerJsonArray = JSONArray.parse(jsonObject.getString("ttsupplierrsheader")); JSONArray headerJsonArray = JSONArray.parse(jsonObject.getString("ttsupplierrsheader"));
JSONArray lineJsonArray = JSONArray.parse(jsonObject.getString("ttsupplierrsline")); JSONArray lineJsonArray = JSONArray.parse(jsonObject.getString("ttsupplierrsline"));
List<String> fileNames = new ArrayList<>(); List<String> fileNames = new ArrayList<>();
if(headerJsonArray == null) {
return AjaxResult.error(HttpStatus.TTSUPPLIERRSHEADER_FAIL, "数据不存在ttsupplierrsheader");
}
for(int i = 0; i < headerJsonArray.size(); i++) { for(int i = 0; i < headerJsonArray.size(); i++) {
JSONObject jsonObjectHeader = headerJsonArray.getJSONObject(i); JSONObject jsonObjectHeader = headerJsonArray.getJSONObject(i);
String schmHeaderOrder = jsonObjectHeader.getString("schm_header_order"); String schmHeaderOrder = jsonObjectHeader.getString("schm_header_order");
@ -333,9 +336,11 @@ public class ExcelController {
nextCell.setCellStyle(cellStyle7); nextCell.setCellStyle(cellStyle7);
} }
} }
if (!forecastArray.isEmpty()) {
// 合并单元格 // 合并单元格
CellRangeAddress cellRangeAddress3 = new CellRangeAddress(14, 14, firmArray.size() + 6, firmArray.size() + forecastArray.size() + 5); CellRangeAddress cellRangeAddress3 = new CellRangeAddress(14, 14, firmArray.size() + 6, firmArray.size() + forecastArray.size() + 5);
sheet.addMergedRegion(cellRangeAddress3); sheet.addMergedRegion(cellRangeAddress3);
}
inputStream.close(); inputStream.close();
FileOutputStream outputStream = new FileOutputStream(filePath + "/" + fileName); FileOutputStream outputStream = new FileOutputStream(filePath + "/" + fileName);
workbook.write(outputStream); workbook.write(outputStream);
@ -507,9 +512,11 @@ public class ExcelController {
nextCell.setCellStyle(cellStyle7); nextCell.setCellStyle(cellStyle7);
} }
} }
if (!forecastArray.isEmpty()) {
// 合并单元格 // 合并单元格
CellRangeAddress cellRangeAddress3 = new CellRangeAddress(14, 14, firmArray.size() + 9, firmArray.size() + forecastArray.size() + 8); CellRangeAddress cellRangeAddress3 = new CellRangeAddress(14, 14, firmArray.size() + 9, firmArray.size() + forecastArray.size() + 8);
sheet.addMergedRegion(cellRangeAddress3); sheet.addMergedRegion(cellRangeAddress3);
}
inputStream.close(); inputStream.close();
FileOutputStream outputStream = new FileOutputStream(filePath + "/" + fileName); FileOutputStream outputStream = new FileOutputStream(filePath + "/" + fileName);
workbook.write(outputStream); workbook.write(outputStream);
@ -696,6 +703,7 @@ public class ExcelController {
private String fillGuowai2(String orderNo, JSONObject jsonObjectHeader, JSONArray orderArray, JSONArray firmArray, JSONArray forecastArray) throws IOException { private String fillGuowai2(String orderNo, JSONObject jsonObjectHeader, JSONArray orderArray, JSONArray firmArray, JSONArray forecastArray) throws IOException {
ClassPathResource templateFile = new ClassPathResource("guowai2.xls"); ClassPathResource templateFile = new ClassPathResource("guowai2.xls");
String filePath = WinConfig.getUploadPath(); String filePath = WinConfig.getUploadPath();
orderNo = orderNo.toUpperCase();
String fileName = orderNo + ".xls"; String fileName = orderNo + ".xls";
File file = new File(filePath); File file = new File(filePath);
if (!file.exists()) { if (!file.exists()) {

3
win-admin/src/main/resources/logback-spring.xml

@ -130,7 +130,8 @@
</springProfile> </springProfile>
<!-- test环境 --> <!-- test环境 -->
<springProfile name="test"> <springProfile name="test">
<root level="ERROR"> <root level="INFO">
<appender-ref ref="console"/>
<appender-ref ref="file_warn"/> <appender-ref ref="file_warn"/>
<appender-ref ref="file_error"/> <appender-ref ref="file_error"/>
</root> </root>

2
win-common/src/main/java/com/win/common/constant/HttpStatus.java

@ -127,6 +127,8 @@ public class HttpStatus
*/ */
public static final int EXECUTE_FAIL = 502; public static final int EXECUTE_FAIL = 502;
public static final int TTSUPPLIERRSHEADER_FAIL = 503;
/** /**
* 系统警告消息 * 系统警告消息
*/ */

Loading…
Cancel
Save