Commit 41a3d7fa authored by litengwei's avatar litengwei

定时任务超时创建漏检记录

parent d95cbd34
......@@ -268,44 +268,43 @@ public class RouteServiceImpl extends ServiceImpl<RouteMapper, Route> implement
points.add(rp);
pointIds.add(rp.getPointId());
});
List<RoutePoint> savedPoints = iRoutePointDao.saveAll(points);
List<Map<String, Object>> pointRefItem = pointMapper.getPointRefItem(pointIds);
for (RoutePoint rt: routePoints
) {
em.persist(rt);
em.flush();
em.clear();
String excludeItems = rt.getExcludeItems();
Set<Long> excludeItemIdSet = new HashSet<>();
if (excludeItems != null && !excludeItems.isEmpty()) {
String[] itemIds = excludeItems.split(",");
for (String itemId : itemIds) {
try {
excludeItemIdSet.add(Long.valueOf(itemId));
} catch (Exception e) {
if (!savedPoints.isEmpty()) {
savedPoints.forEach(rp -> {
String excludeItems = rp.getExcludeItems();
Set<Long> excludeItemIdSet = new HashSet<>();
if (excludeItems != null && !excludeItems.isEmpty()) {
String[] itemIds = excludeItems.split(",");
for (String itemId : itemIds) {
try {
excludeItemIdSet.add(Long.valueOf(itemId));
} catch (Exception e) {
}
}
}
}
final int[] orderNum = {1};
pointRefItem.forEach(ref -> {
Long pointId = rt.getPointId();
if(pointId.equals(ref.get("pointId"))){
if(!excludeItemIdSet.contains(ref.get("itemId"))) {
RoutePointItem item = new RoutePointItem();
item.setPointInputItemId((Long) ref.get("id"));
item.setRoutePointId(rt.getId());
item.setPointClassifyId(ref.containsKey("classifyId")?Long.valueOf(ref.get("classifyId").toString()):null);
item.setOrderNo(orderNum[0]++);
item.setPointId(pointId);
item.setIsDelete(false);
items.add(item);
final int[] orderNum = {1};
pointRefItem.forEach(ref -> {
Long pointId = rp.getPointId();
if(pointId.equals(ref.get("pointId"))){
if(!excludeItemIdSet.contains(ref.get("itemId"))) {
RoutePointItem item = new RoutePointItem();
item.setPointInputItemId((Long) ref.get("id"));
item.setRoutePointId(rp.getId());
item.setPointClassifyId(ref.containsKey("classifyId")?Long.valueOf(ref.get("classifyId").toString()):null);
item.setOrderNo(orderNum[0]++);
item.setPointId(pointId);
item.setIsDelete(false);
items.add(item);
}
}
}
});
});
if(!items.isEmpty()) {
repositoryTs.batchSave(items);
for (RoutePointItem routePointItem: items
) {
iRoutePointItemDao.saveAndFlush(routePointItem);
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment