package com.whyc.service; import com.whyc.dto.Response; import com.whyc.factory.ThreadPoolExecutorFactory; import com.whyc.pojo.db_station.StationInf; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ThreadPoolExecutor; import java.util.stream.Collectors; @Service public class LeaderHomeService { @Autowired private PowerInfService powerInfService; @Autowired private BattInfService battInfService; @Autowired private StationInfService stationInfService; @Autowired private BatttestdataInfService bdTestDataInfService; public Response getAll() { Response response = new Response(); Map map = new HashMap<>(); CountDownLatch latch = new CountDownLatch(1); ThreadPoolExecutor poolExecutor = ThreadPoolExecutorFactory.getPoolExecutor(); //站点信息统计,按站点类型和站点电压 TODO 待李军明确站点类型是什么字段,目前没有 poolExecutor.execute(() -> { List stationInfList =stationInfService.getAllWithFields("station_type"); Map> typeMap = stationInfList.stream().collect(Collectors.groupingBy(StationInf::getStationType)); latch.countDown(); }); return response; } }