fuliqi
2024-10-12 3253dd3ba09579352a96bf8f3cf34f346920bd8c
ycl-server/src/main/java/com/ycl/calculate/IndexCalculationServe.java
@@ -19,14 +19,14 @@
 */
@Component
@Slf4j
public abstract class IndexCalculationServe <T extends BaseResult, S> extends IndexCalculationUtils {
public abstract class IndexCalculationServe<T extends BaseResult, S> extends IndexCalculationUtils {
    @Autowired
    private TMonitorMapper monitorMapper;
    //抽象方法,由子类编写具体逻辑算法
    protected abstract void updateAreaStats(Map<String, S> areaStatsMap, String key, T result);
    protected Map<String, S> getAreaStatsMap(List<T> list){
    protected Map<String, S> getAreaStatsMap(List<T> list, Boolean needDept) {
        if (CollectionUtils.isEmpty(list)) {
            log.info("数据为空");
            return null;
@@ -44,14 +44,16 @@
            updateAreaStats(areaStatsMap, deptId, result);
            // 处理省厅数据
            if (result.getProvinceTag()!=null && result.getProvinceTag()) {
            if (result.getProvinceTag() != null && result.getProvinceTag()) {
                String provinceKey = ApiConstants.Province + deptId;
                updateAreaStats(areaStatsMap, provinceKey, result);
            }
            // 处理公安部数据
            if (result.getDeptTag()!=null && result.getDeptTag()) {
                String deptKey = ApiConstants.Dept + deptId;
                updateAreaStats(areaStatsMap, deptKey, result);
            if (needDept) {
                if (result.getDeptTag() != null && result.getDeptTag()) {
                    String deptKey = ApiConstants.Dept + deptId;
                    updateAreaStats(areaStatsMap, deptKey, result);
                }
            }
        }
        return areaStatsMap;