Compare commits

..

2 Commits

  1. 94
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/service/impl/FunctionXTestServiceImpl.java

@ -9,10 +9,7 @@ import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType; import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
@ -114,7 +111,9 @@ public class FunctionXTestServiceImpl extends ServiceImpl<FunctionxTestMapper, F
List<FunctionxTest> listVo = new ArrayList<>(); List<FunctionxTest> listVo = new ArrayList<>();
for (int i = 1; i <= lastRowIndex; i++) { for (int i = 1; i <= lastRowIndex; i++) {
Row row = sheet.getRow(i); // 行 Row row = sheet.getRow(i); // 行
if(row!=null){ if (row == null ) {
continue;
} else {
short lastCellNum = row.getLastCellNum(); short lastCellNum = row.getLastCellNum();
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
for (int j = 0; j < lastCellNum; j++) { for (int j = 0; j < lastCellNum; j++) {
@ -122,7 +121,12 @@ public class FunctionXTestServiceImpl extends ServiceImpl<FunctionxTestMapper, F
if (cell == null) { if (cell == null) {
list.add(null); list.add(null);
} else { } else {
String cellValue = cell.getStringCellValue(); FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();
DataFormatter formatter = new DataFormatter();
//单元格不设置数字格式
cell.setCellStyle(null);
String cellValue = formatter.formatCellValue(cell,evaluator);
list.add(cellValue); list.add(cellValue);
} }
} }
@ -214,7 +218,7 @@ public class FunctionXTestServiceImpl extends ServiceImpl<FunctionxTestMapper, F
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("对应模块不能为空"); return Result.error("对应模块不能为空");
} else { } else {
if (pModuleId != null){ if (pModuleId != null && pModuleId.length()>0) {
String pid = ""; String pid = "";
for (Modulex modulex : modulexList) { for (Modulex modulex : modulexList) {
if (modulex.getModuleName().equals(pModuleId)) { if (modulex.getModuleName().equals(pModuleId)) {
@ -300,14 +304,30 @@ public class FunctionXTestServiceImpl extends ServiceImpl<FunctionxTestMapper, F
return Result.error("功能类型不能为空"); return Result.error("功能类型不能为空");
} else { } else {
switch (functionType) { switch (functionType) {
case "列表": type=0; break; case "列表":
case "新增": type=1; break; type = 0;
case "删除": type=2; break; break;
case "修改": type=3; break; case "增加":
case "查看": type=4; break; type = 1;
case "导入": type=5; break; break;
case "导出": type=6; break; case "删除":
case "其它": type=99; break; type = 2;
break;
case "修改":
type = 3;
break;
case "查看":
type = 4;
break;
case "导入":
type = 5;
break;
case "导出":
type = 6;
break;
case "其它":
type = 99;
break;
default: default:
message.put("isError", "true"); message.put("isError", "true");
message.put("status", "第" + (i + 2) + "行功能类型错误"); message.put("status", "第" + (i + 2) + "行功能类型错误");
@ -411,12 +431,24 @@ public class FunctionXTestServiceImpl extends ServiceImpl<FunctionxTestMapper, F
} else { } else {
// 值:未发布0、已发布1、开发中2、已完成3、已撤回4、已取消9;默认0 // 值:未发布0、已发布1、开发中2、已完成3、已撤回4、已取消9;默认0
switch (workStatus) { switch (workStatus) {
case "未发布": type=0; break; case "未发布":
case "已发布": type=1; break; type = 0;
case "开发中": type=2; break; break;
case "已完成": type=3; break; case "已发布":
case "已撤回": type=4; break; type = 1;
case "已取消": type=9; break; break;
case "开发中":
type = 2;
break;
case "已完成":
type = 3;
break;
case "已撤回":
type = 4;
break;
case "已取消":
type = 9;
break;
default: default:
message.put("isError", "true"); message.put("isError", "true");
message.put("status", "第" + (i + 2) + "行任务状态错误"); message.put("status", "第" + (i + 2) + "行任务状态错误");
@ -518,9 +550,15 @@ public class FunctionXTestServiceImpl extends ServiceImpl<FunctionxTestMapper, F
} else { } else {
// 值:正常1、停用0、废弃9;默认1 // 值:正常1、停用0、废弃9;默认1
switch (status) { switch (status) {
case "正常": type=1; break; case "正常":
case "停用": type=0; break; type = 1;
case "废弃": type=9; break; break;
case "停用":
type = 0;
break;
case "废弃":
type = 9;
break;
default: default:
message.put("isError", "true"); message.put("isError", "true");
message.put("status", "第" + (i + 2) + "行任务状态错误"); message.put("status", "第" + (i + 2) + "行任务状态错误");
@ -539,8 +577,12 @@ public class FunctionXTestServiceImpl extends ServiceImpl<FunctionxTestMapper, F
} else { } else {
// 值:当前1、历史0;默认1 // 值:当前1、历史0;默认1
switch (verisonStatus) { switch (verisonStatus) {
case "当前": type=1; break; case "当前":
case "历史": type=0; break; type = 1;
break;
case "历史":
type = 0;
break;
default: default:
message.put("isError", "true"); message.put("isError", "true");
message.put("status", "第" + (i + 2) + "行版本状态错误"); message.put("status", "第" + (i + 2) + "行版本状态错误");

Loading…
Cancel
Save