Browse Source

修改24号模型

main
sjh 1 year ago
parent
commit
571c989813
  1. 17
      src/main/java/com/biutag/supervision/service/ModelClueService.java

17
src/main/java/com/biutag/supervision/service/ModelClueService.java

@ -202,18 +202,23 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
if (!Objects.isNull(model) && model.getModelSql() != null) { if (!Objects.isNull(model) && model.getModelSql() != null) {
modelClues.addAll(getModelClueBySql(model.getModelSql(), modelId)); modelClues.addAll(getModelClueBySql(model.getModelSql(), modelId));
} }
System.out.println("测试10");
if (!modelClues.isEmpty()) { if (!modelClues.isEmpty()) {
List<ModelClue> result = new ArrayList<>(); List<ModelClue> result = new ArrayList<>();
for (ModelClue modelClue : modelClues) { for (ModelClue modelClue : modelClues) {
modelClue.setModelId(modelId); modelClue.setModelId(modelId);
modelClue.setCreateTime(LocalDateTime.now()); modelClue.setCreateTime(LocalDateTime.now());
System.out.println("测试12");
if (modelClue.getInvolveDepartName() != null && !modelClue.getInvolveDepartName().isEmpty()) { if (modelClue.getInvolveDepartName() != null && !modelClue.getInvolveDepartName().isEmpty()) {
System.out.println("测试13");
result.add(modelClue); result.add(modelClue);
} }
} }
System.out.println("测试14");
modelClueMapper.insert(result); modelClueMapper.insert(result);
modelClueRecordMapper.insert(new ModelClueRecord().setModelId(modelId).setSize(result.size()).setCreateTime(LocalDateTime.now()).setState("success")); modelClueRecordMapper.insert(new ModelClueRecord().setModelId(modelId).setSize(result.size()).setCreateTime(LocalDateTime.now()).setState("success"));
} else { } else {
System.out.println("测试15");
modelClueRecordMapper.insert(new ModelClueRecord().setModelId(modelId).setSize(0).setCreateTime(LocalDateTime.now()).setState("fail").setErrMsg("数据为空")); modelClueRecordMapper.insert(new ModelClueRecord().setModelId(modelId).setSize(0).setCreateTime(LocalDateTime.now()).setState("fail").setErrMsg("数据为空"));
} }
} }
@ -268,24 +273,34 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
return new ArrayList<>(); return new ArrayList<>();
} }
List<ModelClue> needsInsertModelClues = modelClues.stream().filter(item -> needsInsertIds.contains(item.getUniqueKey())).toList(); List<ModelClue> needsInsertModelClues = modelClues.stream().filter(item -> needsInsertIds.contains(item.getUniqueKey())).toList();
System.out.println("needsInsertModelClues:" + needsInsertModelClues.size());
String newSql = generateNewSql(sql, needsInsertIds, modelId); String newSql = generateNewSql(sql, needsInsertIds, modelId);
System.out.println("开始查询新sql"); System.out.println("开始查询新sql" + newSql);
List<Map<String, Object>> allData = modelClueDataMapper.selectByUniqueKeys(newSql); List<Map<String, Object>> allData = modelClueDataMapper.selectByUniqueKeys(newSql);
System.out.println("查询新sql完成,结果数量:" + allData.size()); System.out.println("查询新sql完成,结果数量:" + allData.size());
String originalFieldName = getKeyFieldName(sql); String originalFieldName = getKeyFieldName(sql);
System.out.println("originalFieldName:" + originalFieldName);
for (ModelClue modelClue : needsInsertModelClues) { for (ModelClue modelClue : needsInsertModelClues) {
for (Map<String, Object> data : allData) { for (Map<String, Object> data : allData) {
String keyColumn = (String) data.get(originalFieldName); String keyColumn = (String) data.get(originalFieldName);
System.out.println("测试1:" + keyColumn + "测试" + modelClue.getUniqueKey());
if (Objects.equals(keyColumn, modelClue.getUniqueKey())) { if (Objects.equals(keyColumn, modelClue.getUniqueKey())) {
System.out.println("测试2");
modelClue.setData(JSONObject.toJSONString(data)); modelClue.setData(JSONObject.toJSONString(data));
modelClue.setDistributionState("0"); modelClue.setDistributionState("0");
System.out.println("测试3");
SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper<SupExternalDepart>().eq(SupExternalDepart::getExternalId, modelClue.getInvolveDepartId()).last("LIMIT 1")); SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper<SupExternalDepart>().eq(SupExternalDepart::getExternalId, modelClue.getInvolveDepartId()).last("LIMIT 1"));
System.out.println("测试4"+modelClue.getInvolveDepartId());
if (supExternalDepart != null && supExternalDepart.getInternalShortName() != null && !supExternalDepart.getInternalShortName().isEmpty()) { if (supExternalDepart != null && supExternalDepart.getInternalShortName() != null && !supExternalDepart.getInternalShortName().isEmpty()) {
System.out.println("测试5");
modelClue.setInvolveDepartName(supExternalDepart.getInternalShortName()); modelClue.setInvolveDepartName(supExternalDepart.getInternalShortName());
modelClue.setInvolveDepartId(supExternalDepart.getInternalId()); modelClue.setInvolveDepartId(supExternalDepart.getInternalId());
} }
System.out.println("测试6");
setPerson(modelId, modelClue, data); setPerson(modelId, modelClue, data);
System.out.println("测试7");
generateThingDesc(modelId, modelClue, data); generateThingDesc(modelId, modelClue, data);
System.out.println("测试8");
break; break;
} }
} }

Loading…
Cancel
Save