|
|
@ -92,24 +92,20 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService { |
|
|
|
|
|
|
|
//根据开始事件验重,如果有时间重复的则本次不导入
|
|
|
|
List<Date> timeList = dcSdhsEventMapper.selectTimeList(); |
|
|
|
if (timeList != null && timeList.size() > 0 && importData != null && importData.size() > 0){ |
|
|
|
List<String> duplicateData = new ArrayList<>(); |
|
|
|
for (DcSdhsEvent importDatum : importData) { |
|
|
|
if (timeList.contains(importDatum.getStartTime())){ |
|
|
|
duplicateData.add(df.format(importDatum.getStartTime())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (duplicateData.size() > 0){ |
|
|
|
return AjaxResult.error("本次导入含有重复数据",duplicateData); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//整理数据后批量插入数据库
|
|
|
|
List<String> duplicateData = new ArrayList<>(); |
|
|
|
List<DcSdhsEvent> eventList = new ArrayList<>(); |
|
|
|
if (importData != null && importData.size() > 0) { |
|
|
|
for (DcSdhsEvent dcSdhsEvent : importData) { |
|
|
|
|
|
|
|
if (timeList != null && timeList.size() > 0){ |
|
|
|
if (timeList.contains(dcSdhsEvent.getStartTime())){ |
|
|
|
duplicateData.add(df.format(dcSdhsEvent.getStartTime())); |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//是否多车事故
|
|
|
|
String carNum = dcSdhsEvent.getCarNum(); |
|
|
|
if (StringUtils.isNotEmpty(carNum)) { |
|
|
@ -170,9 +166,9 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService { |
|
|
|
} |
|
|
|
|
|
|
|
//保存至数据库
|
|
|
|
int successNum = 0; |
|
|
|
if (eventList.size() > 0) { |
|
|
|
dcSdhsEventMapper.batchInsert(eventList); |
|
|
|
//redisCache.setCacheList(RedisKeyConstants.SDHS_EVENT, eventList);
|
|
|
|
successNum = dcSdhsEventMapper.batchInsert(eventList); |
|
|
|
} |
|
|
|
|
|
|
|
Map<String, Object> fileInfo = new HashMap<>(); |
|
|
@ -184,7 +180,12 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService { |
|
|
|
fileInfo.put("uploadTime", updateTime); |
|
|
|
|
|
|
|
redisCache.setCacheMapValue(RedisKeyConstants.SDHS_EVENT_FILE, now.getTime(), fileInfo); |
|
|
|
return AjaxResult.success("导入成功"); |
|
|
|
|
|
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
|
result.put("successNum",successNum); |
|
|
|
result.put("errorNum",duplicateData.size()); |
|
|
|
|
|
|
|
return AjaxResult.success(result); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -2232,4 +2233,10 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService { |
|
|
|
{ |
|
|
|
return dcSdhsEventMapper.deleteDcSdhsEventById(id); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public AjaxResult getDataCalendar(String month){ |
|
|
|
List<String> list = dcSdhsEventMapper.getDataCalendar(month); |
|
|
|
return AjaxResult.success(list); |
|
|
|
} |
|
|
|
} |
|
|
|