package com.whyc.service;
|
|
import com.github.pagehelper.PageInfo;
|
import com.whyc.dto.Response;
|
import com.whyc.mapper.BattResDataMapper;
|
import com.whyc.pojo.BattResData;
|
import com.whyc.pojo.BattResDataInf;
|
import com.whyc.pojo.BatttestdataInf;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import javax.annotation.Resource;
|
import java.math.BigDecimal;
|
import java.util.List;
|
|
@Service
|
public class BattResDataService {
|
|
@Resource
|
private BattResDataMapper mapper;
|
|
@Autowired
|
private SubTablePageInfoService subService;
|
|
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());
|
BattResData resDataInf = subService.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;
|
}
|
//历史内阻数据查询
|
public Response getResInfoByBattGroupId(int battGroupId) {
|
String dbName="db_batt_testdata";
|
String tableName="tb_battresdata_"+String.valueOf(battGroupId);
|
String name=mapper.checkTable(dbName,tableName);
|
PageInfo pageInfo=new PageInfo();
|
if(name!=null){
|
List<BattResData> list=mapper.getResInfoByBattGroupId(battGroupId);
|
pageInfo.setList(list);
|
}
|
return new Response().set(1,pageInfo);
|
}
|
}
|