Przeglądaj źródła

Merge branch 'master' of http://39.106.8.246:3003/persagy/dmp

lixing 4 lat temu
rodzic
commit
9c1e788fa4

+ 54 - 0
dmp-common/src/main/java/com/persagy/dmp/common/excel/ExcelUtils.java

@@ -43,6 +43,60 @@ public class ExcelUtils {
         return null;
     }
 
+    public static List<List<Map<String, Object>>> read(InputStream inputStream, List<SheetReadInfo> infos, List<String> sheetNameList) {
+        List<List<Map<String, Object>>> answer = new ArrayList<>(infos.size());
+
+        try {
+            Workbook workbook = new XSSFWorkbook(inputStream);
+
+            for (int infoIndex = 0; infoIndex < infos.size(); infoIndex++) {
+                List<Map<String, Object>> result = new ArrayList<>();
+                answer.add(result);
+
+                Sheet sheet = workbook.getSheet(sheetNameList.get(infoIndex));
+                SheetReadInfo info = infos.get(infoIndex);
+                Integer startRow = info.getStartRow();
+                List<Integer> columnIndexs = info.getColumnIndexs();
+                List<String> keys = info.getColumnKeys();
+                List<String> types = info.getColumnTypes();
+
+                int lastRowNum = sheet.getLastRowNum();
+                for (int rowIndex = startRow; rowIndex < lastRowNum + 1; rowIndex++) {
+                    Row row = sheet.getRow(rowIndex);
+                    if (null == row) {
+                        System.err.println("==========rowIndex:" + rowIndex);
+                        continue;
+                    }
+                    Map<String, Object> data = new HashMap<>();
+                    for (int columnDefIndex = 0; columnDefIndex < columnIndexs.size(); columnDefIndex++) {
+                        Integer columnIndex = columnIndexs.get(columnDefIndex);
+                        String key = keys.get(columnDefIndex);
+                        String type = types.get(columnDefIndex);
+                        Cell cell = row.getCell(columnIndex);
+                        if (null == cell) {
+                            System.err.println("==========columnIndex:" + columnIndex);
+                            continue;
+                        }
+                        Object value = parseCell(cell, type);
+                        if (null != value) {
+                            data.put(key, value);
+                        }
+                    }
+                    if (0 < data.size()) {
+                        data.put(info.getSeqKey(), rowIndex);
+                        result.add(data);
+                    }
+                }
+            }
+            workbook.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+        }
+        return answer;
+
+    }
+
     public static List<List<Map<String, Object>>> read(InputStream inputStream, List<SheetReadInfo> infos) {
         List<List<Map<String, Object>>> answer = new ArrayList<>(infos.size());
 

+ 3 - 3
dmp-rwd-edit/src/main/java/com/persagy/dmp/rwd/edit/service/UploadService.java

@@ -100,9 +100,9 @@ public class UploadService {
         info2.add(14, "formater", "string");
         info2.add(15, "note", "string");
 
-        List<List<Map<String, Object>>> result = ExcelUtils.read(file.getInputStream(), Arrays.asList(new SheetReadInfo(), info1, info2));
-        List<ClassDefChangeRecord> classDefChangeRecordList = compareDataExcelReadClass(result.get(1));
-        List<FuncidDefChangeRecord> funcidDefChangeRecordList = compareDataExcelReadFuncid(result.get(2));
+        List<List<Map<String, Object>>> result = ExcelUtils.read(file.getInputStream(), Arrays.asList(info1, info2),Arrays.asList("类型变更","信息点变更"));
+        List<ClassDefChangeRecord> classDefChangeRecordList = compareDataExcelReadClass(result.get(0));
+        List<FuncidDefChangeRecord> funcidDefChangeRecordList = compareDataExcelReadFuncid(result.get(1));
 
         Map<String, Object> map = new HashMap<>();
         map.put("classDefChangeRecordList", classDefChangeRecordList);

+ 4 - 4
dmp-rwd-edit/src/main/resources/application-aliyun-test.yml

@@ -3,7 +3,7 @@ server:
 persagy:
   dmp:
     server: http://192.168.64.18:9930
-#    server: http://39.102.40.239:9970
+    #    server: http://39.102.40.239:9970
     exchange: exchange-dmp
     admin:
       routingKey: routing-dmp-rwdedit
@@ -13,9 +13,9 @@ spring:
     name: dmp-rwdedit
   datasource:
     driver-class-name: com.mysql.cj.jdbc.Driver
-    url: jdbc:mysql://localhost:9005/dmp_rwdedit?useUnicode=true&characterEncoding=utf-8&mysqlEncoding=utf8&useSSL=false
-    username: persagy
-    password: persagy@020
+    url: jdbc:mysql://192.168.64.15:9934/dmp_rwdedit?useUnicode=true&characterEncoding=utf-8&mysqlEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
+    username: root
+    password: brzj123456
     type: com.alibaba.druid.pool.DruidDataSource
   jpa:
     show-sql: true

+ 4 - 7
dmp-rwd-edit/src/main/resources/application.yml

@@ -16,12 +16,9 @@ spring:
     - dev,log-dev
   datasource:
     driver-class-name: com.mysql.cj.jdbc.Driver
-#    url: jdbc:mysql://192.168.64.15:9934/dmp_rwdedit?useUnicode=true&characterEncoding=utf-8&mysqlEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
-#    username: root
-#    password: brzj123456
-    url: jdbc:mysql://localhost:9005/dmp_rwdedit?useUnicode=true&characterEncoding=utf-8&mysqlEncoding=utf8&useSSL=false
-    username: persagy
-    password: persagy@020
+    url: jdbc:mysql://192.168.64.15:9934/dmp_rwdedit?useUnicode=true&characterEncoding=utf-8&mysqlEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
+    username: root
+    password: brzj123456
     type: com.alibaba.druid.pool.DruidDataSource
   jpa:
     show-sql: true
@@ -29,7 +26,7 @@ spring:
       ddl-auto: none
   redis:
     database: 10
-    host: 172.17.100.14
+    host: 192.168.64.15
     password: brzj123456
     port: 9944
     timeout: 6000

+ 4 - 0
dmp-rwd/src/main/java/com/persagy/dmp/rwd/service/ObjectInstanceDeleteService.java

@@ -5,6 +5,7 @@ import com.persagy.dmp.config.DmpParameterStorage;
 import com.persagy.dmp.rwd.config.RwdConstants;
 import com.persagy.dmp.rwd.entity.ObjectInstance;
 import com.persagy.dmp.rwd.entity.QObjectInstance;
+import com.persagy.dmp.rwd.entity.QRelationInstance;
 import com.persagy.dmp.rwd.model.DmpMessage;
 import org.springframework.stereotype.Service;
 
@@ -33,6 +34,7 @@ public class ObjectInstanceDeleteService extends BaseService {
 		}
 
 		QObjectInstance qt = QObjectInstance.objectInstance;
+		QRelationInstance rqt = QRelationInstance.relationInstance;
 		for (String id : idList) {
 			Optional<ObjectInstance> one = objectInstanceRepository.findOne(qt.id.eq(id)
 					.and(qt.groupCode.eq(DmpParameterStorage.getGroupCode()))
@@ -49,6 +51,8 @@ public class ObjectInstanceDeleteService extends BaseService {
 				entityManager.clear();
 
 				// TODO 关系处理
+				jpaQueryFactory.delete(rqt).where(rqt.objFrom.eq(entity.getId())).execute();
+				jpaQueryFactory.delete(rqt).where(rqt.objTo.eq(entity.getId())).execute();
 
 				// 消息通知
 				DmpMessage message = new DmpMessage(RwdConstants.MESSAGE_INSTANCE_OBJECT_DELETE, id);