|
@@ -17,6 +17,10 @@ import com.management.platform.util.HttpRespMsg;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
import org.apache.poi.ss.usermodel.CellType;
|
|
import org.apache.poi.ss.usermodel.CellType;
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFCell;
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFRow;
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -302,9 +306,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
outputStream.close();
|
|
outputStream.close();
|
|
|
|
|
|
//解析表格
|
|
//解析表格
|
|
- HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(file));
|
|
|
|
|
|
+ XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(file));
|
|
//我们只需要第一个sheet
|
|
//我们只需要第一个sheet
|
|
- HSSFSheet sheet = workbook.getSheetAt(0);
|
|
|
|
|
|
+ XSSFSheet sheet = workbook.getSheetAt(0);
|
|
//由于第一行需要指明列对应的标题
|
|
//由于第一行需要指明列对应的标题
|
|
int rowNum = sheet.getLastRowNum();
|
|
int rowNum = sheet.getLastRowNum();
|
|
//获取当前表单模板 校验规则
|
|
//获取当前表单模板 校验规则
|
|
@@ -329,7 +333,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
List<SalesOrder> orderList = salesOrderMapper.getList(user);
|
|
List<SalesOrder> orderList = salesOrderMapper.getList(user);
|
|
List<Clue> clueList = clueMapper.selectList(new LambdaQueryWrapper<Clue>().eq(Clue::getCompanyId, user.getCompanyId()).eq(Clue::getIsDelete, 0).orderByDesc(Clue::getCreateTime));
|
|
List<Clue> clueList = clueMapper.selectList(new LambdaQueryWrapper<Clue>().eq(Clue::getCompanyId, user.getCompanyId()).eq(Clue::getIsDelete, 0).orderByDesc(Clue::getCreateTime));
|
|
for (int rowIndex = 1; rowIndex <= rowNum; rowIndex++) {
|
|
for (int rowIndex = 1; rowIndex <= rowNum; rowIndex++) {
|
|
- HSSFRow row = sheet.getRow(rowIndex);
|
|
|
|
|
|
+ XSSFRow row = sheet.getRow(rowIndex);
|
|
if (row == null) {
|
|
if (row == null) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
@@ -343,8 +347,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
for (int i = 0; i < cellNum; i++) {
|
|
for (int i = 0; i < cellNum; i++) {
|
|
JSONObject item = configObJSONArray.getJSONObject(i);
|
|
JSONObject item = configObJSONArray.getJSONObject(i);
|
|
String modelName = item.getString("model");
|
|
String modelName = item.getString("model");
|
|
- HSSFCell cell = row.getCell(i);
|
|
|
|
- if(cell!=null&&StringUtils.isNotEmpty(cell.getStringCellValue())){
|
|
|
|
|
|
+ XSSFCell cell = row.getCell(i);
|
|
|
|
+/* if(cell!=null&&StringUtils.isNotEmpty(cell.getStringCellValue())){
|
|
switch (item.getString("type")){
|
|
switch (item.getString("type")){
|
|
case "time":cell.setCellType(CellType.NUMERIC);
|
|
case "time":cell.setCellType(CellType.NUMERIC);
|
|
System.out.println(cell.getNumericCellValue());
|
|
System.out.println(cell.getNumericCellValue());
|
|
@@ -353,7 +357,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
break;
|
|
break;
|
|
default:cell.setCellType(CellType.STRING);
|
|
default:cell.setCellType(CellType.STRING);
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
if(modelName.equals("executorId")){
|
|
if(modelName.equals("executorId")){
|
|
if(!StringUtils.isEmpty(cell.getStringCellValue())){
|
|
if(!StringUtils.isEmpty(cell.getStringCellValue())){
|
|
List<String> executorNames = new ArrayList<>();
|
|
List<String> executorNames = new ArrayList<>();
|
|
@@ -382,7 +386,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
List<User> targetUserList= (List<User>) respMsg.data;
|
|
List<User> targetUserList= (List<User>) respMsg.data;
|
|
|
|
|
|
for (int rowIndex = 1; rowIndex <= rowNum; rowIndex++) {
|
|
for (int rowIndex = 1; rowIndex <= rowNum; rowIndex++) {
|
|
- HSSFRow row = sheet.getRow(rowIndex);
|
|
|
|
|
|
+ XSSFRow row = sheet.getRow(rowIndex);
|
|
if (row == null) {
|
|
if (row == null) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
@@ -403,7 +407,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
String className = modelName.substring(0, 1).toUpperCase() + modelName.substring(1);
|
|
String className = modelName.substring(0, 1).toUpperCase() + modelName.substring(1);
|
|
String getter="get"+className;
|
|
String getter="get"+className;
|
|
String setter="set"+className;
|
|
String setter="set"+className;
|
|
- HSSFCell cell = row.getCell(i);
|
|
|
|
|
|
+ XSSFCell cell = row.getCell(i);
|
|
if(cell!=null&&StringUtils.isNotEmpty(cell.getStringCellValue())){
|
|
if(cell!=null&&StringUtils.isNotEmpty(cell.getStringCellValue())){
|
|
switch (item.getString("type")){
|
|
switch (item.getString("type")){
|
|
case "time":cell.setCellType(CellType.NUMERIC);
|
|
case "time":cell.setCellType(CellType.NUMERIC);
|