whyclxw
2022-01-07 dca5fa1b0367ccbc052ef953db6adb5c2e2bc64c
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package com.whyc.service;
 
import com.whyc.dto.BattMaintDealarm;
import com.whyc.dto.ReportBattDTO;
import com.whyc.dto.Response;
import com.whyc.mapper.BattInfMapper;
import com.whyc.mapper.BattMaintDealarmMapper;
import com.whyc.mapper.BatttestdataInfMapper;
import com.whyc.pojo.Battinf;
import com.whyc.pojo.BatttestdataInf;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
@Service
public class BattMaintDealarmService {
    @Resource
    private BattMaintDealarmMapper mapper;
    @Resource
    private BattInfMapper battInfMapper;
 
    @Resource
    private BatttestdataInfService batttestdataInfService;
 
    public Response searchLow(ReportBattDTO tinf, int userId){
        Response res = new Response();
        List<Battinf> battinfList = battInfMapper.searchByTestType(tinf, userId);
        List<Map> result = new ArrayList<>();
        if (battinfList!=null && battinfList.size()>0){
            BatttestdataInf btdinf = new BatttestdataInf();
            btdinf.setRecordTime(tinf.getRecordStartTime());
            btdinf.setRecordTime1(tinf.getRecordEndTime());
            btdinf.setTestType(tinf.getTestType());
            btdinf.setTestStarttype(tinf.getTestStartType());
            for (Battinf binf:battinfList) {
                btdinf.setBattGroupId(binf.getBattGroupId());
                btdinf.setGroupVol(binf.getMonVolStd());
                btdinf.setTestCap(binf.getMonCapStd());
                btdinf.setTestRecordCount(binf.getTestRecordCount());
                Map map = new HashMap();
                map.put("battinf",binf);
                //该电池组的放电结果
                List<BatttestdataInf> batttestdataInfList = batttestdataInfService.searchByTestType(btdinf);
                map.put("battTestDataInf",batttestdataInfList);
                result.add(map);
            }
        }
        return res.set(1,result,"查询成功");
    }
 
    //1.4电池性能评估
    public Response searchGroupAssess(ReportBattDTO tinf, int userId){
        List<Battinf> battinfList = battInfMapper.searchByTestType(tinf, userId);
        List<Map> result = new ArrayList<>();
        if (battinfList!=null && battinfList.size()>0){
            BatttestdataInf btdinf = new BatttestdataInf();
            btdinf.setRecordTime(tinf.getRecordStartTime());
            btdinf.setRecordTime1(tinf.getRecordEndTime());
            btdinf.setTestType(tinf.getTestType());
            btdinf.setTestStarttype(tinf.getTestStartType());
            for (Battinf binf:battinfList) {
                btdinf.setBattGroupId(binf.getBattGroupId());
                btdinf.setGroupVol(binf.getMonVolStd());
                btdinf.setTestCap(binf.getMonCapStd());
                Map map = new HashMap();
                map.put("battinf",binf);
                List<BatttestdataInf> batttestdataInfList = batttestdataInfService.searchDischargeTest(btdinf);
                map.put("battTestDataInf",batttestdataInfList);
                result.add(map);
            }
        }
        return new Response().set(1,result,"查询成功");
    }
 
 
 
}