提交 bb635a88 authored 作者: xc's avatar xc

[excel导入]添加备注模板

上级 696cd8b3
...@@ -30,7 +30,7 @@ public class ExcelController { ...@@ -30,7 +30,7 @@ public class ExcelController {
@PostMapping("/import") @PostMapping("/import")
public ResponseEntity importExcel(){ public ResponseEntity importExcel(){
//@RequestParam int id //@RequestParam int id
int id = 14; int id = 15;
return excelData.getExcelData(id); return excelData.getExcelData(id);
} }
......
...@@ -10,7 +10,10 @@ import java.util.List; ...@@ -10,7 +10,10 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
@Data @Data
public class ExcelErrorVo { public class ExcelErrorVo {
private String fileName; private String fileName;//文件名字
List<String> result; private String uintName;//本单位名字
private String tel;//本单位联系方式
private String buildTel;//承建单位联系方式
List<String> result;//预览有问题的文件结果
} }
...@@ -12,6 +12,7 @@ public class ExcelVo { ...@@ -12,6 +12,7 @@ public class ExcelVo {
private Integer total; private Integer total;
private Integer successNum; private Integer successNum;
private Integer errorNum; private Integer errorNum;
private Integer importNum;
private List<ExcelErrorVo> list; private List<ExcelErrorVo> list;
} }
package com.tykj.model_layer.excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
@Data
public class ExcelRemarks {
@ApiModelProperty("表名.字段名")
private String className;
@ApiModelProperty("备注标识")
private String remark;
@ApiModelProperty("连接方式")
private String type;
@ApiModelProperty("连接字符")
private String jointMark;
@ApiModelProperty("备注位置")
private int[] location;
}
...@@ -4,14 +4,13 @@ import java.io.*; ...@@ -4,14 +4,13 @@ import java.io.*;
import java.util.Properties; import java.util.Properties;
public class Template { public class Template {
private String path = System.getProperty("user.dir") + "/template.txt";
/** /**
* 把模板数据保存在txt文件中 * 把模板数据保存在txt文件中
* @param data 模板json数据;{className.propertyName:[1,2]} * @param data 模板json数据;{className.propertyName:[1,2]}
* key为类名.属性名,value为该属性在模板excel中的位置[行,列] * key为类名.属性名,value为该属性在模板excel中的位置[行,列]
*/ */
public void saveTemplate(String data){ public void saveTemplate(String data, String fileName){
String path = System.getProperty("user.dir") + "/" + fileName;
Properties properties = new Properties(); Properties properties = new Properties();
try { try {
System.out.println(path); System.out.println(path);
...@@ -34,8 +33,8 @@ public class Template { ...@@ -34,8 +33,8 @@ public class Template {
* 前端没有传模板的时候,读取本地模板 * 前端没有传模板的时候,读取本地模板
* @return * @return
*/ */
public String getTemplate(){ public String getTemplate(String fileName){
String pathname = path; String pathname = System.getProperty("user.dir") + "/" + fileName;
try{ try{
String result = ""; String result = "";
FileReader fileReader = null; FileReader fileReader = null;
......
...@@ -4,6 +4,16 @@ spring: ...@@ -4,6 +4,16 @@ spring:
password: Huang123+ password: Huang123+
url: jdbc:mysql://47.106.142.73:3306/dataTest?useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8&nullCatalogMeansCurrent=true url: jdbc:mysql://47.106.142.73:3306/dataTest?useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8&nullCatalogMeansCurrent=true
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
hikari:
read-only: false
connection-timeout: 60000
idle-timeout: 60000
validation-timeout: 3000
max-lifetime: 60000
login-timeout: 5
maximum-pool-size: 60
minimum-idle: 10
jpa: jpa:
show-sql: true show-sql: true
hibernate: hibernate:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论