|
|
@@ -78,7 +78,7 @@ public class ExcelServiceImpl implements ExcelService{
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Integer parseTemplet(Workbook wb, String caller) {
|
|
|
+ public Integer parseTemplet(Workbook wb, String caller, String fileName) {
|
|
|
if (wb == null || StringUtils.isEmpty(caller)) {
|
|
|
throw new BizException(BizExceptionCode.NULL_DATA);
|
|
|
}
|
|
|
@@ -96,6 +96,11 @@ public class ExcelServiceImpl implements ExcelService{
|
|
|
if (StringUtils.isEmpty(cols)) {
|
|
|
throw new BizException(12135, "没有查询到对应的excel配置");
|
|
|
}
|
|
|
+ //验证标题是否正确
|
|
|
+ String title = dataTemplet.getDt_title();
|
|
|
+ if (StringUtils.isEmpty(fileName) || fileName.indexOf(title) < 0) {
|
|
|
+ throw new BizException(BizExceptionCode.BIZ_IMPORT_ERROREXCEL);
|
|
|
+ }
|
|
|
//前端列表信息
|
|
|
List<TempletSet> templetSets = JSONArray.parseArray(cols, TempletSet.class);
|
|
|
Map<String, List<TempletSet>> columns = CollectionUtils.groupBy(templetSets, TempletSet::getPosition);
|
|
|
@@ -222,7 +227,7 @@ public class ExcelServiceImpl implements ExcelService{
|
|
|
for (TempletSet set : detail) {
|
|
|
//取excel值
|
|
|
value = data.get(set.getDescription());
|
|
|
- if ("true".equals(set.getNecessary()) && value.equals("")) {
|
|
|
+ if ("true".equals(set.getNecessary()) && StringUtils.isEmpty(value)) {
|
|
|
detailData = null;
|
|
|
//err.append("第" + (i + 3) + "行 " + set.getDescription() + " 必填字段未填写!<br/> ");
|
|
|
break;
|