Commit de951683 authored by hongguangwu's avatar hongguangwu

MVP1.6.10工资相关

parent 7f8d678b
......@@ -176,7 +176,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
* @return: com.yifu.cloud.plus.v1.yifu.salary.vo.ExcelVo
**/
private R<ExcelSheetVo> readXls(InputStream inputStream, List<String> specialIdCardList, boolean titleFlag
, String sheetName, int idCardNum, Integer maxColumn) throws IOException {
, String sheetName, Integer idCardNum, Integer maxColumn) throws IOException {
HSSFWorkbook sheets = null;
ExcelSheetVo sheetVo = new ExcelSheetVo();
try {
......@@ -200,7 +200,10 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
// 内容行
int dataRow;
// 身份证所在列
int idCardColumn = idCardNum;
int idCardColumn = -1;
if (Common.isNotNull(idCardNum)) {
idCardColumn = idCardNum;
}
// 空白列起始号
int nullColumn = -1;
// 上一个空白行
......@@ -449,7 +452,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
* @return: com.yifu.cloud.plus.v1.yifu.salary.vo.ExcelVo
**/
private R<ExcelSheetVo> readXlsx(InputStream inputStream, List<String> specialIdCardList, boolean titleFlag
, String sheetName, int idCardNum, Integer maxColumn) throws IOException {
, String sheetName, Integer idCardNum, Integer maxColumn) throws IOException {
ExcelSheetVo sheetVo = new ExcelSheetVo();
Workbook sheets = null;
try {
......@@ -478,7 +481,10 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
// 内容行
int dataRow;
// 身份证所在列
int idCardColumn = idCardNum;
int idCardColumn = -1;
if (Common.isNotNull(idCardNum)) {
idCardColumn = idCardNum;
}
// 空白列起始号
int nullColumn = -1;
// 上一个空白行
......@@ -806,8 +812,8 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
}
List<TSalaryStandardOriginalDetail> detailList = tSalaryStandardOriginalDetailService.getTSalaryStandardOriginalDetailByOrgId(originalId);
Map<String, TSalaryStandardOriginalDetail> detailMap = new HashMap<>();
int idCardNum = -1;
if (detailList == null || detailList.isEmpty() || detailList.size() < 4) {
Integer idCardNum = -1;
if (detailList == null || detailList.isEmpty() || detailList.size() < 3) {
return R.failed("请检查表头配置!!");
}
// 忽略配置的表头,额外的表头
......@@ -832,6 +838,8 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
}
// 不固定表头配置
Map<String, TSalaryStandardOriginalDetail> notFixedTitleMap = new HashMap<>();
// 用来检测 不固定表头配置的表头,有没有都在
Map<String, Integer> notFixedKeyMap = new HashMap<>();
// 判断是否已重复存在
Map<String, Integer> curMap = new HashMap<>();
......@@ -841,6 +849,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
detail.setModelName(detail.getExcelName());
} else if (SalaryConstants.ID_NUMBER.equals(detail.getModelName())) {
idCardNum = detail.getColumnNo();
if (!isFixedColumn) {
idCardNum = null;
}
}
if (isFixedColumn) {
detailMap.put(String.valueOf(detail.getColumnNo()), detail);
......@@ -848,8 +859,10 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
if (Common.isNotNull(detail.getModelName()) || ignoreMap.get(detail.getExcelName()) != null) {
if (Common.isNotNull(detail.getExcelKey())) {
notFixedTitleMap.put(detail.getExcelKey(), detail);
notFixedKeyMap.put(detail.getExcelKey(), CommonConstants.ONE_INT);
} else {
notFixedTitleMap.put(detail.getExcelName(), detail);
notFixedKeyMap.put(detail.getExcelName(), CommonConstants.ONE_INT);
}
}
}
......@@ -902,8 +915,8 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
boolean isOther;
// 重复存在的表头值
Integer curValue;
StringBuilder repetitiveKey = new StringBuilder();
for (int i = 0; i < vo.getTitleList().size(); i++) {
isError = true;
rule = "等于";
title = vo.getTitleList().get(i);
titleStr = title.getContent();
......@@ -931,6 +944,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
if (Common.isNotNull(detailSet.getExcelRule())) {
rule = detailSet.getExcelRule();
}
if (Common.isEmpty(rule)) {
rule = "等于";
}
switch (rule) {
case "等于" : isError = !titleStr.equals(key); break;
case "包含" : isError = !titleStr.contains(key); break;
......@@ -946,6 +962,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
for (Map.Entry<String, TSalaryStandardOriginalDetail> entry : notFixedTitleMap.entrySet()) {
key = entry.getKey();
rule = entry.getValue().getExcelRule();
if (Common.isEmpty(rule)) {
rule = "等于";
}
switch (rule) {
case "等于" : isFixError = !titleStr.equals(key); break;
case "包含" : isFixError = !titleStr.contains(key); break;
......@@ -953,20 +972,23 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
}
// 表示匹配到了
if (!isFixError) {
isError = false;
curValue = curMap.get(key);
if (Common.isNotNull(curValue)) {
return R.failed("监测到多个“关键字"+ key +"”,请检查调整后再次提交");
repetitiveKey.append(key).append(";");
} else {
curMap.put(key, 1);
}
// 存储适配map,以做识别内容
detailMap.put(String.valueOf(title.getLineNum()), entry.getValue());
notFixedKeyMap.remove(key);
break;
}
}
if (isError && isOther) {
return R.failed("未找到对应配置的表头,请核实导入的原表信息后,重新尝试!!");
detailSet = detailMap.get(String.valueOf(title.getLineNum()));
if (detailSet == null && !isOther) {
detail = new TSalaryStandardOriginalDetail();
detail.setModelName(titleStr);
detailMap.put(String.valueOf(title.getLineNum()), detail);
}
}
} else if (isFixedColumn && detailMap.get(String.valueOf(title.getLineNum())) != null && Common.isNotNull(detailMap.get(String.valueOf(title.getLineNum())).getExcelName())) {
......@@ -974,6 +996,16 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
//return R.failed("表头与导入的不一致,第" + (i + 1) + "列应为【" + detailMap.get(String.valueOf(title.getLineNum())).getExcelName() + "】,实际为空!")
}
}
if (repetitiveKey.length() > 0) {
return R.failed("检测到关键字重复:" + repetitiveKey + " 请检查调整后再次提交");
}
if (notFixedKeyMap.size() > 0) {
StringBuilder titles = new StringBuilder();
for (String keyStr : notFixedTitleMap.keySet()) {
titles.append(keyStr).append(";");
}
return R.failed("配置的表头未找到:" + titles);
}
} else {
return R.failed("表格没有表头,请检查表格数据!");
}
......
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