whycxzp
2025-05-26 bf636b8d37cd48969c9df6a598b2ff16cbfb7557
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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<String,Object> map = new HashMap<>();
 
        CountDownLatch latch = new CountDownLatch(1);
        ThreadPoolExecutor poolExecutor = ThreadPoolExecutorFactory.getPoolExecutor();
 
        //站点信息统计,按站点类型和站点电压 TODO 待李军明确站点类型是什么字段,目前没有
        poolExecutor.execute(() -> {
            List<StationInf> stationInfList =stationInfService.getAllWithFields("station_type");
            Map<String, List<StationInf>> typeMap = stationInfList.stream().collect(Collectors.groupingBy(StationInf::getStationType));
 
            latch.countDown();
        });
 
        return response;
    }
}