|
@@ -6,7 +6,6 @@ import com.sooka.sponest.event.centereventtdeptevent.domain.CentereventDeptEvent
|
|
|
import com.sooka.sponest.event.centereventteventcatalogue.mapper.CenterEventCommandCenterMapper;
|
|
|
import com.sooka.sponest.event.centereventteventcatalogue.service.ICenterEventCommandCenterService;
|
|
|
import org.apache.commons.collections4.MapUtils;
|
|
|
-import org.apache.http.client.utils.DateUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -28,19 +27,20 @@ public class CenterEventCommandCenterServiceImpl extends BaseService implements
|
|
|
@Autowired
|
|
|
private CenterEventCommandCenterMapper centerEventCommandCenterMapper;
|
|
|
|
|
|
- protected final String NUMBER = "num";
|
|
|
- protected final String UNPROCESSED = "unprocessed";
|
|
|
- protected final String PROCESSING = "processing";
|
|
|
- protected final String PROCESSED = "processed";
|
|
|
- private final static Map<String, List> hgjMap = new HashMap();
|
|
|
+ private static final String NUMBER = "num";
|
|
|
+ private static final String UNPROCESSED = "unprocessed";
|
|
|
+ private static final String PROCESSING = "processing";
|
|
|
+ private static final String PROCESSED = "processed";
|
|
|
+ private static final String MONTH = "month";
|
|
|
+ private static final Map<String, List> HGJ_MAP = new HashMap();
|
|
|
|
|
|
static {
|
|
|
- hgjMap.put(SI_PING, Arrays.asList(367, 3772, 3773, 3774, 3775, 3776, 3777, 3778));// 四平市行管局
|
|
|
- hgjMap.put(SHUANG_LIAO, Arrays.asList(377, 378, 379, 380, 381, 382, 3809, 384));// 双辽市行管局
|
|
|
- hgjMap.put(YI_TONG, Arrays.asList(386, 387, 388, 389, 390, 391, 3807, 393));// 伊通县行管局
|
|
|
- hgjMap.put(LI_SHU, Arrays.asList(401, 402, 403, 404, 405, 406, 3804, 408));// 梨树县行管局
|
|
|
- hgjMap.put(TIE_DONG, Arrays.asList(416, 417, 418, 419, 420, 421, 3800, 423));// 铁东区行管局
|
|
|
- hgjMap.put(TIE_XI, Arrays.asList(425, 426, 427, 428, 429, 430, 3796, 432));// 铁西区行管局
|
|
|
+ HGJ_MAP.put(SI_PING, Arrays.asList(367, 3772, 3773, 3774, 3775, 3776, 3777, 3778));// 四平市行管局
|
|
|
+ HGJ_MAP.put(SHUANG_LIAO, Arrays.asList(377, 378, 379, 380, 381, 382, 3809, 384));// 双辽市行管局
|
|
|
+ HGJ_MAP.put(YI_TONG, Arrays.asList(386, 387, 388, 389, 390, 391, 3807, 393));// 伊通县行管局
|
|
|
+ HGJ_MAP.put(LI_SHU, Arrays.asList(401, 402, 403, 404, 405, 406, 3804, 408));// 梨树县行管局
|
|
|
+ HGJ_MAP.put(TIE_DONG, Arrays.asList(416, 417, 418, 419, 420, 421, 3800, 423));// 铁东区行管局
|
|
|
+ HGJ_MAP.put(TIE_XI, Arrays.asList(425, 426, 427, 428, 429, 430, 3796, 432));// 铁西区行管局
|
|
|
}
|
|
|
|
|
|
public List<Map<String, Object>> dataFilter(List<Map<String, Object>> list) {
|
|
@@ -91,55 +91,49 @@ public class CenterEventCommandCenterServiceImpl extends BaseService implements
|
|
|
unprocessedMap.put(SHUANG_LIAO_NAME, unprocessedMap.get(SHUANG_LIAO_NAME) + MapUtils.getLong(map, UNPROCESSED));
|
|
|
processingMap.put(SHUANG_LIAO_NAME, processingMap.get(SHUANG_LIAO_NAME) + MapUtils.getLong(map, PROCESSING));
|
|
|
processedMap.put(SHUANG_LIAO_NAME, processedMap.get(SHUANG_LIAO_NAME) + MapUtils.getLong(map, PROCESSED));
|
|
|
- continue;
|
|
|
}
|
|
|
if (ancestors.contains(YI_TONG)) {
|
|
|
defaultMap.put(YI_TONG_NAME, defaultMap.get(YI_TONG_NAME) + MapUtils.getLong(map, NUMBER));
|
|
|
unprocessedMap.put(YI_TONG_NAME, unprocessedMap.get(YI_TONG_NAME) + MapUtils.getLong(map, UNPROCESSED));
|
|
|
processingMap.put(YI_TONG_NAME, processingMap.get(YI_TONG_NAME) + MapUtils.getLong(map, PROCESSING));
|
|
|
processedMap.put(YI_TONG_NAME, processedMap.get(YI_TONG_NAME) + MapUtils.getLong(map, PROCESSED));
|
|
|
- continue;
|
|
|
}
|
|
|
if (ancestors.contains(LI_SHU)) {
|
|
|
defaultMap.put(LI_SHU_NAME, defaultMap.get(LI_SHU_NAME) + MapUtils.getLong(map, NUMBER));
|
|
|
unprocessedMap.put(LI_SHU_NAME, unprocessedMap.get(LI_SHU_NAME) + MapUtils.getLong(map, UNPROCESSED));
|
|
|
processingMap.put(LI_SHU_NAME, processingMap.get(LI_SHU_NAME) + MapUtils.getLong(map, PROCESSING));
|
|
|
processedMap.put(LI_SHU_NAME, processedMap.get(LI_SHU_NAME) + MapUtils.getLong(map, PROCESSED));
|
|
|
- continue;
|
|
|
}
|
|
|
if (ancestors.contains(TIE_DONG)) {
|
|
|
defaultMap.put(TIE_DONG_NAME, defaultMap.get(TIE_DONG_NAME) + MapUtils.getLong(map, NUMBER));
|
|
|
unprocessedMap.put(TIE_DONG_NAME, unprocessedMap.get(TIE_DONG_NAME) + MapUtils.getLong(map, UNPROCESSED));
|
|
|
processingMap.put(TIE_DONG_NAME, processingMap.get(TIE_DONG_NAME) + MapUtils.getLong(map, PROCESSING));
|
|
|
processedMap.put(TIE_DONG_NAME, processedMap.get(TIE_DONG_NAME) + MapUtils.getLong(map, PROCESSED));
|
|
|
- continue;
|
|
|
}
|
|
|
if (ancestors.contains(TIE_XI)) {
|
|
|
defaultMap.put(TIE_XI_NAME, defaultMap.get(TIE_XI_NAME) + MapUtils.getLong(map, NUMBER));
|
|
|
unprocessedMap.put(TIE_XI_NAME, unprocessedMap.get(TIE_XI_NAME) + MapUtils.getLong(map, UNPROCESSED));
|
|
|
processingMap.put(TIE_XI_NAME, processingMap.get(TIE_XI_NAME) + MapUtils.getLong(map, PROCESSING));
|
|
|
processedMap.put(TIE_XI_NAME, processedMap.get(TIE_XI_NAME) + MapUtils.getLong(map, PROCESSED));
|
|
|
- continue;
|
|
|
}
|
|
|
if (ancestors.contains(SI_PING)) {
|
|
|
defaultMap.put(SI_PING_NAME, defaultMap.get(SI_PING_NAME) + MapUtils.getLong(map, NUMBER));
|
|
|
unprocessedMap.put(SI_PING_NAME, unprocessedMap.get(SI_PING_NAME) + MapUtils.getLong(map, UNPROCESSED));
|
|
|
processingMap.put(SI_PING_NAME, processingMap.get(SI_PING_NAME) + MapUtils.getLong(map, PROCESSING));
|
|
|
processedMap.put(SI_PING_NAME, processedMap.get(SI_PING_NAME) + MapUtils.getLong(map, PROCESSED));
|
|
|
- continue;
|
|
|
}
|
|
|
}
|
|
|
List<Map<String, Object>> result = new ArrayList<>();
|
|
|
- for (String key : defaultMap.keySet()) {
|
|
|
- String[] keys = key.split("_");
|
|
|
+ for (Map.Entry<String, Long> entry : defaultMap.entrySet()) {
|
|
|
+ String[] keys = entry.getKey().split("_");
|
|
|
// 不要四平市
|
|
|
if (!SI_PING.equals(keys[0])) {
|
|
|
map = new HashMap<>();
|
|
|
map.put("name", keys[1]);
|
|
|
- map.put(NUMBER, defaultMap.get(key));
|
|
|
- map.put(UNPROCESSED, unprocessedMap.get(key));
|
|
|
- map.put(PROCESSING, processingMap.get(key));
|
|
|
- map.put(PROCESSED, processedMap.get(key));
|
|
|
+ map.put(NUMBER, entry.getValue());
|
|
|
+ map.put(UNPROCESSED, unprocessedMap.get(entry.getKey()));
|
|
|
+ map.put(PROCESSING, processingMap.get(entry.getKey()));
|
|
|
+ map.put(PROCESSED, processedMap.get(entry.getKey()));
|
|
|
result.add(map);
|
|
|
}
|
|
|
}
|
|
@@ -174,20 +168,20 @@ public class CenterEventCommandCenterServiceImpl extends BaseService implements
|
|
|
setSookaDataBase(centereventTDeptEvent);
|
|
|
List<Map<String, Object>> result = centerEventCommandCenterMapper.getFireLoss(centereventTDeptEvent);
|
|
|
// 提取已存在的年-月
|
|
|
- List<String> originDate = result.stream().map(item -> MapUtils.getString(item, "month")).collect(Collectors.toList());
|
|
|
+ List<String> originDate = result.stream().map(item -> MapUtils.getString(item, MONTH)).collect(Collectors.toList());
|
|
|
// 获取不存在的年-月
|
|
|
int year = LocalDate.now().getYear();
|
|
|
List<String> newDate = Arrays.asList(year + "-01", year + "-02", year + "-03", year + "-04", year + "-05", year + "-06", year + "-07", year + "-08", year + "-09", year + "-10", year + "-11", year + "-12");
|
|
|
newDate = newDate.stream().filter(o -> !originDate.contains(o)).collect(Collectors.toList());
|
|
|
newDate.forEach(date -> {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("month", date);
|
|
|
+ map.put(MONTH, date);
|
|
|
map.put("loss", 0L);
|
|
|
map.put("blazes", 0L);
|
|
|
result.add(map);
|
|
|
});
|
|
|
// 排序
|
|
|
- Collections.sort(result, (o1, o2) -> MapUtils.getString(o1, "month").compareTo(MapUtils.getString(o2, "month")));
|
|
|
+ Collections.sort(result, (o1, o2) -> MapUtils.getString(o1, MONTH).compareTo(MapUtils.getString(o2, MONTH)));
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -212,9 +206,9 @@ public class CenterEventCommandCenterServiceImpl extends BaseService implements
|
|
|
@Override
|
|
|
public List<Map<String, Object>> getEventHgjCount(CentereventDeptEvent centereventTDeptEvent) {
|
|
|
setSookaDataBase(centereventTDeptEvent);
|
|
|
- List hgjList = hgjMap.get(String.valueOf(centereventTDeptEvent.getDeptId()));
|
|
|
+ List hgjList = HGJ_MAP.get(String.valueOf(centereventTDeptEvent.getDeptId()));
|
|
|
if (StringUtils.isEmpty(hgjList)) {// 非三县两区用户,默认返四平市
|
|
|
- hgjList = hgjMap.get(SI_PING);
|
|
|
+ hgjList = HGJ_MAP.get(SI_PING);
|
|
|
}
|
|
|
centereventTDeptEvent.getParams().put("hgj", hgjList);
|
|
|
return centerEventCommandCenterMapper.getEventHgjCount(centereventTDeptEvent);
|
|
@@ -256,73 +250,4 @@ public class CenterEventCommandCenterServiceImpl extends BaseService implements
|
|
|
setSookaDataBase(centereventTDeptEvent);
|
|
|
return centerEventCommandCenterMapper.getEventPoint(centereventTDeptEvent);
|
|
|
}
|
|
|
-
|
|
|
- @Override
|
|
|
- public Map<String, String> getEventReport(CentereventDeptEvent centereventTDeptEvent) {
|
|
|
- setSookaDataBase(centereventTDeptEvent);
|
|
|
- // 类型
|
|
|
- List<Map<String, Object>> typeList = centerEventCommandCenterMapper.getEventReportType(centereventTDeptEvent);
|
|
|
- // 市级行管局
|
|
|
- centereventTDeptEvent.getParams().put("deptIds", Arrays.asList(367, 3772, 3773, 3774, 3775, 3776, 3777, 3778));
|
|
|
- List<Map<String, Object>> hgjList = centerEventCommandCenterMapper.getEventReportHgj(centereventTDeptEvent);
|
|
|
- // 三县两区
|
|
|
- List<Map<String, Object>> bmList = centerEventCommandCenterMapper.getEventReportBm(centereventTDeptEvent);
|
|
|
- bmList = dataFilter(bmList);
|
|
|
- // 返回值
|
|
|
- Map<String, String> resultMap = new HashMap<>();
|
|
|
- resultMap.put("start", DateUtils.formatDate(DateUtils.parseDate(MapUtils.getString(centereventTDeptEvent.getParams(), "start")), "yyyy年MM月dd日 HH时mm分ss秒"));
|
|
|
- resultMap.put("end", DateUtils.formatDate(DateUtils.parseDate(MapUtils.getString(centereventTDeptEvent.getParams(), "end")), "yyyy年MM月dd日 HH时mm分ss秒"));
|
|
|
- Long num = 0L;
|
|
|
- Long processed = 0L;
|
|
|
- Long processing = 0L;
|
|
|
- StringBuilder typeBuilder = new StringBuilder();
|
|
|
- for (Map<String, Object> map : typeList) {
|
|
|
- num += MapUtils.getLong(map, "num");
|
|
|
- processed += MapUtils.getLong(map, "processed");
|
|
|
- processing += MapUtils.getLong(map, "processing");
|
|
|
- typeBuilder.append(" ");
|
|
|
- typeBuilder.append(MapUtils.getString(map, "name"));
|
|
|
- typeBuilder.append("事件总数:");
|
|
|
- typeBuilder.append(MapUtils.getString(map, "num"));
|
|
|
- typeBuilder.append(",已处理:");
|
|
|
- typeBuilder.append(MapUtils.getString(map, "processed"));
|
|
|
- typeBuilder.append(",处理中:");
|
|
|
- typeBuilder.append(MapUtils.getString(map, "processing"));
|
|
|
- typeBuilder.append("。");
|
|
|
- typeBuilder.append(System.getProperty("line.separator"));
|
|
|
- }
|
|
|
- resultMap.put("num", String.valueOf(num));
|
|
|
- resultMap.put("processed", String.valueOf(processed));
|
|
|
- resultMap.put("processing", String.valueOf(processing));
|
|
|
- resultMap.put("type", typeBuilder.toString());
|
|
|
- StringBuilder hgjBuilder = new StringBuilder();
|
|
|
- for (Map<String, Object> map : hgjList) {
|
|
|
- hgjBuilder.append(" ");
|
|
|
- hgjBuilder.append(MapUtils.getString(map, "name"));
|
|
|
- hgjBuilder.append("事件总数:");
|
|
|
- hgjBuilder.append(MapUtils.getString(map, "num"));
|
|
|
- hgjBuilder.append(",已处理:");
|
|
|
- hgjBuilder.append(MapUtils.getString(map, "processed"));
|
|
|
- hgjBuilder.append(",处理中:");
|
|
|
- hgjBuilder.append(MapUtils.getString(map, "processing"));
|
|
|
- hgjBuilder.append("。");
|
|
|
- hgjBuilder.append(System.getProperty("line.separator"));
|
|
|
- }
|
|
|
- resultMap.put("hgj", hgjBuilder.toString());
|
|
|
- StringBuilder bmBuilder = new StringBuilder();
|
|
|
- for (Map<String, Object> map : bmList) {
|
|
|
- bmBuilder.append(" ");
|
|
|
- bmBuilder.append(MapUtils.getString(map, "name"));
|
|
|
- bmBuilder.append("事件总数:");
|
|
|
- bmBuilder.append(MapUtils.getString(map, "num"));
|
|
|
- bmBuilder.append(",已处理:");
|
|
|
- bmBuilder.append(MapUtils.getString(map, "processed"));
|
|
|
- bmBuilder.append(",处理中:");
|
|
|
- bmBuilder.append(MapUtils.getString(map, "processing"));
|
|
|
- bmBuilder.append("。");
|
|
|
- bmBuilder.append(System.getProperty("line.separator"));
|
|
|
- }
|
|
|
- resultMap.put("bm", bmBuilder.toString());
|
|
|
- return resultMap;
|
|
|
- }
|
|
|
}
|