|
@@ -43,42 +43,58 @@ public class HandleData {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- public void startHandleData(List<Map<String, Object>> rerunTestList) {
|
|
|
|
|
|
|
+ public void startHandleData(List<Map<String, Object>> retList, String lisTable) {
|
|
|
List<Map<String, Object>> existList = ibpsRepository.qryExistData();
|
|
List<Map<String, Object>> existList = ibpsRepository.qryExistData();
|
|
|
- rerunTestList = cleanExistData(rerunTestList,existList);
|
|
|
|
|
- if (rerunTestList.size() > 0) {
|
|
|
|
|
|
|
+ retList = cleanExistData(retList,existList);
|
|
|
|
|
+ log.info("get data:"+retList.size());
|
|
|
|
|
+ if (retList.size() > 0) {
|
|
|
String fieldName = null;
|
|
String fieldName = null;
|
|
|
String fieldValue = null;
|
|
String fieldValue = null;
|
|
|
List<Map<String, Object>> insertList = new ArrayList<Map<String, Object>>();
|
|
List<Map<String, Object>> insertList = new ArrayList<Map<String, Object>>();
|
|
|
- for (Map entityMap : rerunTestList) {
|
|
|
|
|
|
|
+ for (Map entityMap : retList) {
|
|
|
Map<String, Object> insertMap = new HashMap<>();
|
|
Map<String, Object> insertMap = new HashMap<>();
|
|
|
for (Object entry : entityMap.keySet()) {
|
|
for (Object entry : entityMap.keySet()) {
|
|
|
fieldName = null;
|
|
fieldName = null;
|
|
|
fieldValue = null;
|
|
fieldValue = null;
|
|
|
fieldName = RerunSampleField.get(entry.toString());
|
|
fieldName = RerunSampleField.get(entry.toString());
|
|
|
Object value = entityMap.get(entry.toString());
|
|
Object value = entityMap.get(entry.toString());
|
|
|
- fieldValue = value != null ? value.toString() : null;
|
|
|
|
|
|
|
+ fieldValue = value != null ? value.toString() : "";
|
|
|
if (fieldName != null) {
|
|
if (fieldName != null) {
|
|
|
insertMap.put(fieldName, fieldValue);
|
|
insertMap.put(fieldName, fieldValue);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
//补充其他字段信息
|
|
//补充其他字段信息
|
|
|
- insertMap.put("id_", entityMap.get("SAMPLECODE")+"_"+entityMap.get("ITEMCODE"));
|
|
|
|
|
|
|
+ insertMap.put("id_", UUID.randomUUID().toString());
|
|
|
insertMap.put("shi_fou_guo_shen_", "已完成");
|
|
insertMap.put("shi_fou_guo_shen_", "已完成");
|
|
|
- String userInfo = ibpsRepository.getUserInfoByName(String.valueOf(entityMap.get("CREATEBY")));
|
|
|
|
|
- if (userInfo.split("\\^")[0].equals("-1")) {
|
|
|
|
|
|
|
+ String createUserInfo = ibpsRepository.getUserInfoByName(String.valueOf(entityMap.get("CREATEBY")));
|
|
|
|
|
+ String auditUserInfo = ibpsRepository.getUserInfoByName(String.valueOf(entityMap.get("AUDITUSER")));
|
|
|
|
|
+ if (createUserInfo.split("\\^")[0].equals("-1")) {
|
|
|
|
|
+ log.info("error userInfo,skip to insert:"+createUserInfo);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (auditUserInfo.split("\\^")[0].equals("-1")) {
|
|
|
|
|
+ log.info("error auditUserInfo,skip to insert:"+auditUserInfo);
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
LocalDateTime currentDateTime = LocalDateTime.now();
|
|
LocalDateTime currentDateTime = LocalDateTime.now();
|
|
|
DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
String formattedDateTime = currentDateTime.format(formatter2);
|
|
String formattedDateTime = currentDateTime.format(formatter2);
|
|
|
- insertMap.put("create_by_", userInfo.split("@")[0]);
|
|
|
|
|
|
|
+ insertMap.put("create_by_", createUserInfo.trim().split("@")[0]);
|
|
|
insertMap.put("create_time_", Timestamp.valueOf(String.valueOf(formattedDateTime)));
|
|
insertMap.put("create_time_", Timestamp.valueOf(String.valueOf(formattedDateTime)));
|
|
|
|
|
+ insertMap.put("bian_zhi_ren_", createUserInfo.trim().split("@")[0]);
|
|
|
|
|
+ insertMap.put("jian_yan_zhe_", auditUserInfo.trim().split("@")[0]);
|
|
|
|
|
+ insertMap.put("jian_yan_yuan_", auditUserInfo.trim().split("@")[0]);
|
|
|
insertMap.put("ri_qi_", String.valueOf(entityMap.get("CREATETIME")).split(" ")[0]);
|
|
insertMap.put("ri_qi_", String.valueOf(entityMap.get("CREATETIME")).split(" ")[0]);
|
|
|
- insertMap.put("bian_zhi_bu_men_", userInfo.split("@")[1]);
|
|
|
|
|
|
|
+ insertMap.put("bian_zhi_bu_men_", createUserInfo.split("@")[1]);
|
|
|
insertList.add(insertMap);
|
|
insertList.add(insertMap);
|
|
|
}
|
|
}
|
|
|
- //ibpsRepository.saveToTable(insertList, "t_fjbbjlb");
|
|
|
|
|
|
|
+// insertList = lisViewRepository.query2("ss");
|
|
|
|
|
+ String res = ibpsRepository.saveToTable(insertList, "t_fjbbjlb");
|
|
|
|
|
+ if(res.equals("success")){
|
|
|
|
|
+ log.info("success insert:"+insertList.size()+" datas");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.info("fail insert");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -89,18 +105,18 @@ public class HandleData {
|
|
|
// 1. 创建Set存储existList中所有id_的值(转换为字符串形式)
|
|
// 1. 创建Set存储existList中所有id_的值(转换为字符串形式)
|
|
|
Set<String> existIdSet = new HashSet<>();
|
|
Set<String> existIdSet = new HashSet<>();
|
|
|
for (Map<String, Object> existMap : existList) {
|
|
for (Map<String, Object> existMap : existList) {
|
|
|
- Object idObj = existMap.get("id_");
|
|
|
|
|
|
|
+ Object idObj = existMap.get("biao_ben_bian_hao");
|
|
|
existIdSet.add(idObj == null ? null : idObj.toString());
|
|
existIdSet.add(idObj == null ? null : idObj.toString());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 2. 过滤rerunTestList:只保留id不在existIdSet中的元素
|
|
// 2. 过滤rerunTestList:只保留id不在existIdSet中的元素
|
|
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
for (Map<String, Object> testMap : rerunTestList) {
|
|
for (Map<String, Object> testMap : rerunTestList) {
|
|
|
- Object idObj = testMap.get("SAMPLECODE")+"_"+testMap.get("ITEMCODE");
|
|
|
|
|
|
|
+ Object idObj = testMap.get("SAMPLECODE");
|
|
|
|
|
|
|
|
String idStr = idObj == null ? null : idObj.toString();
|
|
String idStr = idObj == null ? null : idObj.toString();
|
|
|
|
|
|
|
|
- // 如果当前id不在existIdSet中,则保留
|
|
|
|
|
|
|
+ // 如果当前条码不在existIdSet中,则保留
|
|
|
if (!existIdSet.contains(idStr)) {
|
|
if (!existIdSet.contains(idStr)) {
|
|
|
resultList.add(testMap);
|
|
resultList.add(testMap);
|
|
|
}
|
|
}
|