|
@@ -1,5 +1,6 @@
|
|
|
package cn.com.yusys.yusp.service;
|
|
package cn.com.yusys.yusp.service;
|
|
|
|
|
|
|
|
|
|
+import cn.com.yusys.yusp.commons.exception.BizException;
|
|
|
import cn.com.yusys.yusp.commons.util.StringUtils;
|
|
import cn.com.yusys.yusp.commons.util.StringUtils;
|
|
|
import cn.com.yusys.yusp.domain.dto.TagImportDto;
|
|
import cn.com.yusys.yusp.domain.dto.TagImportDto;
|
|
|
import cn.com.yusys.yusp.mapper.AitagTagInfoDao;
|
|
import cn.com.yusys.yusp.mapper.AitagTagInfoDao;
|
|
@@ -17,12 +18,31 @@ import java.util.*;
|
|
|
public class TagImportListener extends AnalysisEventListener<TagImportDto> {
|
|
public class TagImportListener extends AnalysisEventListener<TagImportDto> {
|
|
|
private final List<TagImportDto> dataList = new ArrayList<>();
|
|
private final List<TagImportDto> dataList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
+ private final String[] expectedHeaders = {"标签名称","标签代码","父标签名称","标签说明","标签关键词规则","标签判断说明"};
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
|
|
|
|
|
+ // 校验表头
|
|
|
|
|
+ if (headMap.size() != expectedHeaders.length) {
|
|
|
|
|
+ throw BizException.of("E014");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ for (int i = 0; i < expectedHeaders.length; i++) {
|
|
|
|
|
+ if (!expectedHeaders[i].equals(headMap.get(i))) {
|
|
|
|
|
+ throw BizException.of("E015");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void invoke(TagImportDto data, AnalysisContext context) {
|
|
public void invoke(TagImportDto data, AnalysisContext context) {
|
|
|
// 数据清洗
|
|
// 数据清洗
|
|
|
if (StringUtils.isBlank(data.getTagNm())) {
|
|
if (StringUtils.isBlank(data.getTagNm())) {
|
|
|
- return;
|
|
|
|
|
|
|
+ throw BizException.of("E012");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isBlank(data.getTagCode())) {
|
|
|
|
|
+ throw BizException.of("E013");
|
|
|
}
|
|
}
|
|
|
data.setTagNm(data.getTagNm().trim());
|
|
data.setTagNm(data.getTagNm().trim());
|
|
|
if (!StringUtils.isBlank(data.getParentName())) {
|
|
if (!StringUtils.isBlank(data.getParentName())) {
|