|
@@ -349,7 +349,7 @@ object RelationTypeProjectService : RService<RelationTypeProject>(SMybatisDao(Re
|
|
|
logger.debug("识别编码:${code} ******************************************")
|
|
|
preExcelRelation(sheet, projectId!!, relType, code, zoneType)
|
|
|
|
|
|
- readExcelRelation(sheet, projectId, relType, zoneType)
|
|
|
+ readExcelRelation(sheet, projectId, relType, zoneType,code)
|
|
|
|
|
|
val outFile = File("/tmp/relation-$projectId-${relType}${zone}.xlsx")
|
|
|
workbook.write(outFile.outputStream())
|
|
@@ -437,7 +437,7 @@ object RelationTypeProjectService : RService<RelationTypeProject>(SMybatisDao(Re
|
|
|
* @param relType 关系类型
|
|
|
* @param zone 业务空间类型
|
|
|
*/
|
|
|
- private fun readExcelRelation(sheet: XSSFSheet, projectId: String, relType: String, zone: String? = null) {
|
|
|
+ private fun readExcelRelation(sheet: XSSFSheet, projectId: String, relType: String, zone: String? = null,code: String) {
|
|
|
try {
|
|
|
var zoneType = zone
|
|
|
val len = relType.indexOf("_")
|
|
@@ -484,9 +484,39 @@ object RelationTypeProjectService : RService<RelationTypeProject>(SMybatisDao(Re
|
|
|
}
|
|
|
val id1 = row.getCell(id1Col).toString()
|
|
|
val id2 = row.getCell(id2Col).toString()
|
|
|
+// if (code.compareTo("对象ID", true) == 0) {
|
|
|
+//
|
|
|
+// row.createCell(id1Col).setCellValue(id1)
|
|
|
+// row.createCell(id2Col).setCellValue(id2)
|
|
|
+//
|
|
|
+// } else {
|
|
|
+
|
|
|
+ val id1List = excelImport.findObjectId(projectId, codeTableMap[relType.substring(0, 2)]!!, codeColMap[code]!!, id1)
|
|
|
+ val id2List = excelImport.findObjectId(projectId, codeTableMap[relType.substring(3, 5)]!!, codeColMap[code]!!, id2)
|
|
|
+
|
|
|
+ if (id1List.count() < 1) {
|
|
|
+ row.createCell(stateCol).setCellValue("未找到主对象")
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if (id1List.count() > 1) {
|
|
|
+ row.createCell(stateCol).setCellValue("匹配到多个主对象")
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if (id2List.count() < 1) {
|
|
|
+ row.createCell(stateCol).setCellValue("未找到从对象")
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if (id2List.count() > 1) {
|
|
|
+ row.createCell(stateCol).setCellValue("匹配到多个从对象")
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ row.createCell(id1Col).setCellValue(id1List[0])
|
|
|
+ row.createCell(id2Col).setCellValue(id2List[0])
|
|
|
+// }
|
|
|
+
|
|
|
// 任意一个ID为空,则不能导入数据
|
|
|
if (id1.isEmpty() || id2.isEmpty()) {
|
|
|
- return
|
|
|
+ continue
|
|
|
}
|
|
|
if (cmd == "sp2sp"||cmd == "bd2sp"||cmd == "fl2sp"||cmd == "sh2sp"){
|
|
|
val space = spaceService.select(SFilter.eq("id", id2)).entity()
|