whycxzp
2021-12-28 7a749d206342b596a67e43bc9971d0d74047dbbb
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
package com.whyc.service;
 
import com.whyc.mapper.BattResDataMapper;
import com.whyc.pojo.BattResData;
import com.whyc.pojo.BattResDataInf;
import com.whyc.pojo.BatttestdataInf;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.math.BigDecimal;
 
@Service
public class BattResDataService {
 
    @Resource
    private BattResDataMapper mapper;
 
    public BatttestdataInf calcBehindInfo(BatttestdataInf battTestDataInf) {
        //平均截止电压
        Float avgVol = mapper.calcAvgVol(battTestDataInf.getBattGroupId(),battTestDataInf.getTestRecordCount());
        if(avgVol !=null) {
            battTestDataInf.setAvgVol(BigDecimal.valueOf(avgVol).setScale(3, BigDecimal.ROUND_HALF_UP).floatValue());
        }
 
        //最低单体电压和编号
        BattResData resDataInf = mapper.getMinInfo(battTestDataInf.getBattGroupId(),battTestDataInf.getTestRecordCount());
        if(resDataInf !=null) {
            battTestDataInf.setMinMonvol(BigDecimal.valueOf(resDataInf.getMonVol()).setScale(3, BigDecimal.ROUND_HALF_UP).floatValue());
            battTestDataInf.setMinMonnum(resDataInf.getMonNum());
        }
 
        return battTestDataInf;
    }
}