|
@@ -40,8 +40,9 @@ public class ImportCommissionHelp {
|
|
|
final NodeCollection childNodes = body.getChildNodes();
|
|
|
for(int m = 0, n = childNodes.getCount(); m < n; m++) {
|
|
|
Node node = childNodes.get(m);
|
|
|
-
|
|
|
- if(node.getNodeType() == 5) { //表格
|
|
|
+ int nodeType = node.getNodeType();
|
|
|
+ String text = node.getText();
|
|
|
+ if(node.getNodeType() == NodeType.TABLE) { //表格
|
|
|
Table table = (Table) node;
|
|
|
//table转换成json结构
|
|
|
final List<JSONObject> treeDetailList = ImportCommissionHelp.table2Json(table);
|
|
@@ -51,42 +52,44 @@ public class ImportCommissionHelp {
|
|
|
detail.setId(SecurityUtil.getUUID());
|
|
|
detail.setDeleted("0");
|
|
|
detail.setPid(importDto.getId());
|
|
|
- if(ObjectUtil.isEmpty(rowJson.getString("NO."))){
|
|
|
- throw new CustomException("字段 'NO.' 不能为空");
|
|
|
- }
|
|
|
- detail.setChapterno(rowJson.getString("NO."));
|
|
|
-
|
|
|
- if(ObjectUtil.isEmpty(rowJson.getString("模式1"))){
|
|
|
- throw new CustomException("字段 '模式1' 不能为空");
|
|
|
- }
|
|
|
- detail.setClassification(rowJson.getString("模式1"));
|
|
|
-
|
|
|
- if(ObjectUtil.isEmpty(rowJson.getString("模式2"))){
|
|
|
- throw new CustomException("字段 '模式2' 不能为空");
|
|
|
- }
|
|
|
- detail.setClassificationtwo(rowJson.getString("模式2"));
|
|
|
-
|
|
|
- detail.setChtestcontent(rowJson.getString("测试内容中文"));
|
|
|
- detail.setEntestcontent(rowJson.getString("测试内容英文"));
|
|
|
- //detail.setTestmethod(rowJson.getString("标准测试方法"));
|
|
|
-
|
|
|
- if(ObjectUtil.isEmpty(rowJson.getString("标准测试时间"))){
|
|
|
- throw new CustomException("字段 '标准测试时间' 不能为空");
|
|
|
+ // 表格的概要
|
|
|
+ if(rowJson.size() == 1){
|
|
|
+ detail.setTesttime("0");// 测试时间
|
|
|
+ detail.setAcceptancecriteria("概要说明"); //接收标准
|
|
|
+ detail.setClassification("铭牌参数"); // 模式一
|
|
|
+ detail.setClassificationtwo("静态检查"); // 模式二
|
|
|
+ detail.setChtestcontent(rowJson.getString("NO.")); //测试内容中文
|
|
|
+ }else {
|
|
|
+ if (ObjectUtil.isEmpty(rowJson.getString("NO."))) {
|
|
|
+ throw new CustomException("字段 'NO.' 不能为空");
|
|
|
+ }
|
|
|
+ detail.setChapterno(rowJson.getString("NO."));
|
|
|
+ if (ObjectUtil.isEmpty(rowJson.getString("模式1"))) {
|
|
|
+ throw new CustomException("字段 '模式1' 不能为空");
|
|
|
+ }
|
|
|
+ detail.setClassification(rowJson.getString("模式1"));
|
|
|
+ if (ObjectUtil.isEmpty(rowJson.getString("模式2"))) {
|
|
|
+ throw new CustomException("字段 '模式2' 不能为空");
|
|
|
+ }
|
|
|
+ detail.setClassificationtwo(rowJson.getString("模式2"));
|
|
|
+ detail.setChtestcontent(rowJson.getString("测试内容中文"));
|
|
|
+ detail.setEntestcontent(rowJson.getString("测试内容英文"));
|
|
|
+ if (ObjectUtil.isEmpty(rowJson.getString("标准测试时间"))) {
|
|
|
+ throw new CustomException("字段 '标准测试时间' 不能为空");
|
|
|
+ }
|
|
|
+ detail.setTesttime(rowJson.getString("标准测试时间"));
|
|
|
+ if (ObjectUtil.isEmpty(rowJson.getString("接收标准"))) {
|
|
|
+ throw new CustomException("字段 '接收标准' 不能为空");
|
|
|
+ }
|
|
|
+ detail.setAcceptancecriteria(rowJson.getString("接收标准"));
|
|
|
+ String testAddress = rowJson.getString("测试地点");
|
|
|
+ if (ObjectUtil.isEmpty(testAddress) || ObjectUtil.isEmpty(importDto.getDictMap().get(testAddress))) {
|
|
|
+ testAddress = "10";
|
|
|
+ } else {
|
|
|
+ testAddress = importDto.getDictMap().get(testAddress).getValue();
|
|
|
+ }
|
|
|
+ detail.setTestaddress(testAddress);
|
|
|
}
|
|
|
- detail.setTesttime(rowJson.getString("标准测试时间"));
|
|
|
-
|
|
|
- if(ObjectUtil.isEmpty(rowJson.getString("接收标准"))){
|
|
|
- throw new CustomException("字段 '接收标准' 不能为空");
|
|
|
- }
|
|
|
- detail.setAcceptancecriteria(rowJson.getString("接收标准"));
|
|
|
-
|
|
|
- String testAddress = rowJson.getString("测试地点");
|
|
|
- if(ObjectUtil.isEmpty(testAddress) || ObjectUtil.isEmpty(importDto.getDictMap().get(testAddress))) {
|
|
|
- testAddress = "10";
|
|
|
- } else {
|
|
|
- testAddress = importDto.getDictMap().get(testAddress).getValue();
|
|
|
- }
|
|
|
- detail.setTestaddress(testAddress);
|
|
|
if(ObjectUtil.isNotEmpty(treeDo.getFullpid())) {
|
|
|
detail.setTreefullid(treeDo.getFullpid().concat(",").concat(treeDo.getId()));
|
|
|
} else {
|
|
@@ -112,11 +115,9 @@ public class ImportCommissionHelp {
|
|
|
detail.setThreelevelclassification(fullpids[3]);
|
|
|
detail.setFouronelevelclassification(treeDo.getId());
|
|
|
}
|
|
|
-
|
|
|
detailList.add(detail);
|
|
|
}
|
|
|
-
|
|
|
- } else if(node.getNodeType() == 8) { //段落
|
|
|
+ } else if(node.getNodeType() == NodeType.PARAGRAPH) { //段落
|
|
|
Paragraph paragraph = (Paragraph) node;
|
|
|
if(!paragraph.getParagraphFormat().isHeading()) { //标题
|
|
|
continue;
|