Commit f4cc5f02 authored by hongguangwu's avatar hongguangwu

Merge branch 'develop'

parents 5f0c9327 91d9c1ff
...@@ -51,11 +51,6 @@ ...@@ -51,11 +51,6 @@
<groupId>com.yifu.cloud.plus.v1</groupId> <groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-log</artifactId> <artifactId>yifu-common-log</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-archives-api</artifactId>
<version>1.0.0</version>
</dependency>
<dependency> <dependency>
<groupId>com.yifu.cloud.plus.v1</groupId> <groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-insurances-api</artifactId> <artifactId>yifu-insurances-api</artifactId>
...@@ -88,6 +83,11 @@ ...@@ -88,6 +83,11 @@
<version>1.0.0</version> <version>1.0.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.monitorjbl</groupId>
<artifactId>xlsx-streamer</artifactId>
<version>2.2.0</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -20,6 +20,7 @@ import com.alibaba.fastjson.JSON; ...@@ -20,6 +20,7 @@ import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.monitorjbl.xlsx.StreamingReader;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard; import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
...@@ -38,11 +39,7 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryUploadParamVo; ...@@ -38,11 +39,7 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryUploadParamVo;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
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.*;
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.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -127,9 +124,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -127,9 +124,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
InputStream inputStream = file.getInputStream(); InputStream inputStream = file.getInputStream();
//根据文件格式 对应不同的api解析 //根据文件格式 对应不同的api解析
if (filename.endsWith(".xlsx")) { if (filename.endsWith(".xlsx")) {
voR = readXlsx(inputStream, specialIdCardList, true, sheetName); voR = readXlsx(inputStream, specialIdCardList, true, sheetName, -1);
} else { } else {
voR = readXls(inputStream, specialIdCardList, true, sheetName); voR = readXls(inputStream, specialIdCardList, true, sheetName, -1);
} }
if (voR != null && voR.getCode() == CommonConstants.SUCCESS) { if (voR != null && voR.getCode() == CommonConstants.SUCCESS) {
vo = voR.getData(); vo = voR.getData();
...@@ -158,7 +155,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -158,7 +155,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
* @return: com.yifu.cloud.plus.v1.yifu.salary.vo.ExcelVo * @return: com.yifu.cloud.plus.v1.yifu.salary.vo.ExcelVo
**/ **/
private R<ExcelSheetVo> readXls(InputStream inputStream, List<String> specialIdCardList, boolean titleFlag private R<ExcelSheetVo> readXls(InputStream inputStream, List<String> specialIdCardList, boolean titleFlag
, String sheetName) throws IOException { , String sheetName, int idCardNum) throws IOException {
HSSFWorkbook sheets = null; HSSFWorkbook sheets = null;
ExcelSheetVo sheetVo = new ExcelSheetVo(); ExcelSheetVo sheetVo = new ExcelSheetVo();
try { try {
...@@ -182,7 +179,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -182,7 +179,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
// 内容行 // 内容行
int dataRow; int dataRow;
// 身份证所在列 // 身份证所在列
int idCardColumn = -1; int idCardColumn = idCardNum;
// 空白列起始号 // 空白列起始号
int nullColumn = -1; int nullColumn = -1;
// 上一个空白行 // 上一个空白行
...@@ -199,6 +196,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -199,6 +196,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
// 极限空白表头列,超过阈值,将不继续循环列 // 极限空白表头列,超过阈值,将不继续循环列
int maxTitleNullColumNum = 50; int maxTitleNullColumNum = 50;
HSSFCell cell; HSSFCell cell;
// 极限空白身份证,超过将不循环行
int maxIdCardNullRow = 50;
int idCardNullNum = 0;
// 循环每个sheet // 循环每个sheet
for (int i = 0; i < sheetNum; i++) { for (int i = 0; i < sheetNum; i++) {
sheetAt = sheets.getSheetAt(i); sheetAt = sheets.getSheetAt(i);
...@@ -211,6 +211,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -211,6 +211,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
// 初始化每个sheet的数据行 // 初始化每个sheet的数据行
dataRow = 0; dataRow = 0;
dataRowFlag = true; dataRowFlag = true;
idCardNullNum = 0;
// 循环当前sheet的每行内容 // 循环当前sheet的每行内容
for (int rowNum = 0; rowNum <= sheetAt.getLastRowNum(); rowNum++) { for (int rowNum = 0; rowNum <= sheetAt.getLastRowNum(); rowNum++) {
...@@ -259,19 +260,32 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -259,19 +260,32 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
//sheetVo.setErrorInfo("请注意单元格格式,第" + (i + 1) + "个sheet,第" + (rowNum + 1) + "行第" + (cellNum + 1) + "列。" + e.getMessage()) //sheetVo.setErrorInfo("请注意单元格格式,第" + (i + 1) + "个sheet,第" + (rowNum + 1) + "行第" + (cellNum + 1) + "列。" + e.getMessage())
//return sheetVo //return sheetVo
} }
if (Common.isNotNull(cellValue) && dataRowFlag if (dataRowFlag) {
&& (((cellValue.length() == 15 || cellValue.length() == 18) && regIdCard(cellValue)) if (idCardColumn != -1) {
if (idCardColumn == cellNum && Common.isNotNull(cellValue) &&
(((cellValue.length() == 15 || cellValue.length() == 18) && regIdCard(cellValue))
// 特殊身份证允许识别
|| regSpecialIdCard(cellValue, specialIdCardList))) {
dataRow = rowNum;
dataRowFlag = false;
}
} else {
if (Common.isNotNull(cellValue) &&
(((cellValue.length() == 15 || cellValue.length() == 18) && regIdCard(cellValue))
// 特殊身份证允许识别 // 特殊身份证允许识别
|| regSpecialIdCard(cellValue, specialIdCardList))) { || regSpecialIdCard(cellValue, specialIdCardList))) {
dataRow = rowNum; dataRow = rowNum;
idCardColumn = cellNum; idCardColumn = cellNum;
dataRowFlag = false; dataRowFlag = false;
} }
}
}
columnVo.setLineNum(cellNum); columnVo.setLineNum(cellNum);
columnVo.setContent(cellValue);
if (Common.isNotNull(cellValue)) { if (Common.isNotNull(cellValue)) {
cellValue = cellValue.trim().replaceAll("\\s+", "");
titleMap.put(String.valueOf(cellNum), cellValue); titleMap.put(String.valueOf(cellNum), cellValue);
} }
columnVo.setContent(cellValue);
if (nullFlag) { if (nullFlag) {
contentMap.put(String.valueOf(cellNum), cellValue); contentMap.put(String.valueOf(cellNum), cellValue);
if (dataRowFlag) { if (dataRowFlag) {
...@@ -342,22 +356,25 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -342,22 +356,25 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
} }
} }
if (!dataRowFlag) { if (!dataRowFlag) {
if (idCardColumn != -1) {
if (Common.isEmpty(idCardValue)) {
idCardNullNum++;
}
if (Common.isNotNull(idCardValue)) {
contentList.add(contentMap); contentList.add(contentMap);
}
}
} else { } else {
titleList = new ArrayList<>(columnList); titleList = new ArrayList<>(columnList);
} }
} }
if (rowNum >= 50 && dataRowFlag) { if (rowNum >= 50 && dataRowFlag) {
return R.failed("未找到身份证所在的数据行,请检查表数据!"); return R.failed("请检查模板与配置是否一致!未找到身份证所在的数据行,请检查表数据!");
} }
if (titleFlag && !dataRowFlag) { if (titleFlag && !dataRowFlag) {
break; break;
} }
// 阻断空白行 if (idCardNullNum >= maxIdCardNullRow) {
if (idCardColumn != -1 && Common.isEmpty(idCardValue)) {
if (!contentList.isEmpty() && contentList.size() > 1) {
contentList.remove(contentList.size() - 1);
}
break; break;
} }
} }
...@@ -393,9 +410,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -393,9 +410,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
* @return: com.yifu.cloud.plus.v1.yifu.salary.vo.ExcelVo * @return: com.yifu.cloud.plus.v1.yifu.salary.vo.ExcelVo
**/ **/
private R<ExcelSheetVo> readXlsx(InputStream inputStream, List<String> specialIdCardList, boolean titleFlag private R<ExcelSheetVo> readXlsx(InputStream inputStream, List<String> specialIdCardList, boolean titleFlag
, String sheetName) throws IOException { , String sheetName, int idCardNum) throws IOException {
XSSFWorkbook sheets = null;
ExcelSheetVo sheetVo = new ExcelSheetVo(); ExcelSheetVo sheetVo = new ExcelSheetVo();
Workbook sheets = null;
try { try {
List<ExcelColumnVo> titleList; List<ExcelColumnVo> titleList;
List<ExcelColumnVo> columnList; List<ExcelColumnVo> columnList;
...@@ -406,10 +423,15 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -406,10 +423,15 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
Map<String, String> contentMap; Map<String, String> contentMap;
// 存储每一列有值的表头 // 存储每一列有值的表头
Map<String, String> titleMap = new HashMap<>(); Map<String, String> titleMap = new HashMap<>();
sheets = new XSSFWorkbook(inputStream); //sheets = new SXSSFWorkbook(inputStream);
sheets = StreamingReader.builder()
.rowCacheSize(1000) // 缓存到内存中的行数(默认是10)
.bufferSize(10240) // 读取资源时,缓存到内存的字节大小(默认是1024)
.open(inputStream);
// sheet // sheet
XSSFSheet sheetAt; //XSSFSheet sheetAt;
XSSFRow row; //XSSFRow row;
// 获取sheet数量 // 获取sheet数量
int sheetNum = sheets.getNumberOfSheets(); int sheetNum = sheets.getNumberOfSheets();
// 每个单元格内容 // 每个单元格内容
...@@ -417,7 +439,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -417,7 +439,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
// 内容行 // 内容行
int dataRow; int dataRow;
// 身份证所在列 // 身份证所在列
int idCardColumn = -1; int idCardColumn = idCardNum;
// 空白列起始号 // 空白列起始号
int nullColumn = -1; int nullColumn = -1;
// 上一个空白行 // 上一个空白行
...@@ -433,9 +455,14 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -433,9 +455,14 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
boolean nullFlag = true; boolean nullFlag = true;
// 极限空白表头列,超过阈值,将不继续循环列 // 极限空白表头列,超过阈值,将不继续循环列
int maxTitleNullColumNum = 50; int maxTitleNullColumNum = 50;
XSSFCell cell; // 极限空白身份证,超过将不循环行
int maxIdCardNullRow = 50;
int idCardNullNum = 0;
Cell cell;
// 循环每个sheet // 循环每个sheet
Sheet sheetAt;
for (int i = 0; i < sheetNum; i++) { for (int i = 0; i < sheetNum; i++) {
//sheetAt = sheets.getSheetAt(i);
sheetAt = sheets.getSheetAt(i); sheetAt = sheets.getSheetAt(i);
if (Common.isNotNull(sheetAt.getSheetName()) && Common.isNotNull(sheetName) if (Common.isNotNull(sheetAt.getSheetName()) && Common.isNotNull(sheetName)
&& sheetName.equals(sheetAt.getSheetName())) { && sheetName.equals(sheetAt.getSheetName())) {
...@@ -447,7 +474,12 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -447,7 +474,12 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
dataRow = 0; dataRow = 0;
dataRowFlag = true; dataRowFlag = true;
// 循环当前sheet的每行内容 // 循环当前sheet的每行内容
for (int rowNum = 0; rowNum <= sheetAt.getLastRowNum(); rowNum++) { //for (int rowNum = 0; rowNum <= sheetAt.getLastRowNum(); rowNum++) {
idCardNullNum = 0;
int rowNum = 0;
for (Row row : sheetAt) {
nullColumn = -1; nullColumn = -1;
preNullColumn = -1; preNullColumn = -1;
...@@ -457,7 +489,6 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -457,7 +489,6 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
idCardValue = null; idCardValue = null;
contentMap = new HashMap<>(); contentMap = new HashMap<>();
columnList = new ArrayList<>(); columnList = new ArrayList<>();
row = sheetAt.getRow(rowNum);
if (row != null) { if (row != null) {
for (int cellNum = 0; cellNum < row.getLastCellNum(); cellNum++) { for (int cellNum = 0; cellNum < row.getLastCellNum(); cellNum++) {
columnVo = new ExcelColumnVo(); columnVo = new ExcelColumnVo();
...@@ -467,8 +498,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -467,8 +498,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
cellValue = ""; cellValue = "";
} else { } else {
if (cell.getCellType() == CellType.FORMULA) { if (cell.getCellType() == CellType.FORMULA) {
cell.setCellType(CellType.STRING); cellValue = String.valueOf(cell.getStringCellValue());
cellValue = cell.getStringCellValue();
} else if (CellType.STRING == cell.getCellType()) { } else if (CellType.STRING == cell.getCellType()) {
cellValue = row.getCell(cellNum).getStringCellValue(); cellValue = row.getCell(cellNum).getStringCellValue();
} else if (CellType.NUMERIC == cell.getCellType()) { } else if (CellType.NUMERIC == cell.getCellType()) {
...@@ -494,19 +524,32 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -494,19 +524,32 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
//sheetVo.setErrorInfo("请注意单元格格式,第" + (i + 1) + "个sheet,第" + (rowNum + 1) + "行第" + (cellNum + 1) + "列。" + e.getMessage()) //sheetVo.setErrorInfo("请注意单元格格式,第" + (i + 1) + "个sheet,第" + (rowNum + 1) + "行第" + (cellNum + 1) + "列。" + e.getMessage())
//return sheetVo //return sheetVo
} }
if (Common.isNotNull(cellValue) && dataRowFlag if (dataRowFlag) {
&& (((cellValue.length() == 15 || cellValue.length() == 18) && regIdCard(cellValue)) if (idCardColumn != -1) {
if (idCardColumn == cellNum && Common.isNotNull(cellValue) &&
(((cellValue.length() == 15 || cellValue.length() == 18) && regIdCard(cellValue))
// 特殊身份证允许识别
|| regSpecialIdCard(cellValue, specialIdCardList))) {
dataRow = rowNum;
dataRowFlag = false;
}
} else {
if (Common.isNotNull(cellValue) &&
(((cellValue.length() == 15 || cellValue.length() == 18) && regIdCard(cellValue))
// 特殊身份证允许识别 // 特殊身份证允许识别
|| regSpecialIdCard(cellValue, specialIdCardList))) { || regSpecialIdCard(cellValue, specialIdCardList))) {
dataRow = rowNum; dataRow = rowNum;
idCardColumn = cellNum; idCardColumn = cellNum;
dataRowFlag = false; dataRowFlag = false;
} }
}
}
columnVo.setLineNum(cellNum); columnVo.setLineNum(cellNum);
columnVo.setContent(cellValue);
if (Common.isNotNull(cellValue)) { if (Common.isNotNull(cellValue)) {
cellValue = cellValue.trim().replaceAll("\\s+", "");
titleMap.put(String.valueOf(cellNum), cellValue); titleMap.put(String.valueOf(cellNum), cellValue);
} }
columnVo.setContent(cellValue);
if (nullFlag) { if (nullFlag) {
contentMap.put(String.valueOf(cellNum), cellValue); contentMap.put(String.valueOf(cellNum), cellValue);
if (dataRowFlag) { if (dataRowFlag) {
...@@ -577,7 +620,14 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -577,7 +620,14 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
} }
} }
if (!dataRowFlag) { if (!dataRowFlag) {
if (idCardColumn != -1) {
if (Common.isEmpty(idCardValue)) {
idCardNullNum++;
}
if (Common.isNotNull(idCardValue)) {
contentList.add(contentMap); contentList.add(contentMap);
}
}
} else { } else {
titleList = new ArrayList<>(columnList); titleList = new ArrayList<>(columnList);
} }
...@@ -585,14 +635,11 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -585,14 +635,11 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
if (rowNum >= 50 && dataRowFlag) { if (rowNum >= 50 && dataRowFlag) {
return R.failed("未找到身份证所在的数据行,请检查表数据!"); return R.failed("未找到身份证所在的数据行,请检查表数据!");
} }
rowNum++;
if (titleFlag && !dataRowFlag) { if (titleFlag && !dataRowFlag) {
break; break;
} }
// 阻断空白行 if (idCardNullNum >= maxIdCardNullRow) {
if (idCardColumn != -1 && Common.isEmpty(idCardValue)) {
if (!contentList.isEmpty() && contentList.size() > 1) {
contentList.remove(contentList.size() - 1);
}
break; break;
} }
} }
...@@ -605,7 +652,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -605,7 +652,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
return R.ok(sheetVo); return R.ok(sheetVo);
} }
} }
} catch (IOException e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
if (sheets != null) { if (sheets != null) {
sheets.close(); sheets.close();
...@@ -688,6 +735,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -688,6 +735,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
} }
List<TSalaryStandardOriginalDetail> detailList = tSalaryStandardOriginalDetailService.getTSalaryStandardOriginalDetailByOrgId(originalId); List<TSalaryStandardOriginalDetail> detailList = tSalaryStandardOriginalDetailService.getTSalaryStandardOriginalDetailByOrgId(originalId);
Map<String, TSalaryStandardOriginalDetail> detailMap = new HashMap<>(); Map<String, TSalaryStandardOriginalDetail> detailMap = new HashMap<>();
int idCardNum = -1;
for (TSalaryStandardOriginalDetail detail : detailList) { for (TSalaryStandardOriginalDetail detail : detailList) {
if (Common.isEmpty(detail.getModelName()) if (Common.isEmpty(detail.getModelName())
&& ("是否新员工(默认否)".equals(detail.getExcelName()) && ("是否新员工(默认否)".equals(detail.getExcelName())
...@@ -699,6 +747,8 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -699,6 +747,8 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
|| "手机号码".equals(detail.getExcelName()) || "手机号码".equals(detail.getExcelName())
|| "计税月份".equals(detail.getExcelName()))) { || "计税月份".equals(detail.getExcelName()))) {
detail.setModelName(detail.getExcelName()); detail.setModelName(detail.getExcelName());
} else if (SalaryConstants.ID_NUMBER.equals(detail.getModelName())) {
idCardNum = detail.getColumnNo();
} }
detailMap.put(String.valueOf(detail.getColumnNo()), detail); detailMap.put(String.valueOf(detail.getColumnNo()), detail);
} }
...@@ -724,9 +774,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -724,9 +774,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
ExcelSheetVo vo; ExcelSheetVo vo;
//根据文件格式 对应不同的api解析 //根据文件格式 对应不同的api解析
if (filename.endsWith(".xlsx")) { if (filename.endsWith(".xlsx")) {
voR = readXlsx(inputStream, specialIdCardList, false, sheetName); voR = readXlsx(inputStream, specialIdCardList, false, sheetName, idCardNum);
} else { } else {
voR = readXls(inputStream, specialIdCardList, false, sheetName); voR = readXls(inputStream, specialIdCardList, false, sheetName, idCardNum);
} }
if (voR != null && voR.getCode() == CommonConstants.SUCCESS) { if (voR != null && voR.getCode() == CommonConstants.SUCCESS) {
vo = voR.getData(); vo = voR.getData();
...@@ -774,11 +824,11 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -774,11 +824,11 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
|| !"计税月份".equals(title.getContent())) || !"计税月份".equals(title.getContent()))
) { ) {
return R.failed("未找到对应配置的表头,请核实导入的原表信息后,重新尝试!!"); return R.failed("未找到对应配置的表头,请核实导入的原表信息后,重新尝试!!");
//return R.failed("表头与导入的不一致,第" + (i + 1) + "列应为【" + detailMap.get(String.valueOf(title.getLineNum())).getExcelName() + "】,实际为【" + title.getContent() + "】"); //return R.failed("表头与导入的不一致,第" + (i + 1) + "列应为【" + detailMap.get(String.valueOf(title.getLineNum())).getExcelName() + "】,实际为【" + title.getContent() + "】")
} }
} else if (detailMap.get(String.valueOf(title.getLineNum())) != null && Common.isNotNull(detailMap.get(String.valueOf(title.getLineNum())).getExcelName())) { } else if (detailMap.get(String.valueOf(title.getLineNum())) != null && Common.isNotNull(detailMap.get(String.valueOf(title.getLineNum())).getExcelName())) {
return R.failed("未找到对应配置的表头,请核实导入的原表信息后,重新尝试!!!"); return R.failed("未找到对应配置的表头,请核实导入的原表信息后,重新尝试!!!");
//return R.failed("表头与导入的不一致,第" + (i + 1) + "列应为【" + detailMap.get(String.valueOf(title.getLineNum())).getExcelName() + "】,实际为空!"); //return R.failed("表头与导入的不一致,第" + (i + 1) + "列应为【" + detailMap.get(String.valueOf(title.getLineNum())).getExcelName() + "】,实际为空!")
} }
} }
} else { } else {
...@@ -803,12 +853,13 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -803,12 +853,13 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
detail = detailMap.get(column.getKey()); detail = detailMap.get(column.getKey());
if (detail != null && Common.isNotNull(detail.getModelName())) { if (detail != null && Common.isNotNull(detail.getModelName())) {
value = column.getValue(); value = column.getValue();
if (Common.isNotNull(value)) {
try { try {
if ("REDUCE".equals(detail.getFlag())) { if ("REDUCE".equals(detail.getFlag())) {
value = String.valueOf(new BigDecimal(value).negate()); value = String.valueOf(new BigDecimal(value).negate());
} }
oldValue = newRowMap.get(detail.getModelName()); oldValue = newRowMap.get(detail.getModelName());
if (oldValue != null) { if (Common.isNotNull(oldValue)) {
value = String.valueOf(new BigDecimal(oldValue).add(new BigDecimal(value)) value = String.valueOf(new BigDecimal(oldValue).add(new BigDecimal(value))
.setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP)); .setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP));
} }
...@@ -824,6 +875,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -824,6 +875,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
} }
} }
} }
}
if (Common.isEmpty(check.getIdCard())) { if (Common.isEmpty(check.getIdCard())) {
return R.failed("数据行第 " + i + " 行,无身份证号!"); return R.failed("数据行第 " + i + " 行,无身份证号!");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment