package com.whyc.service;
|
|
import com.whyc.dto.AllModel;
|
import com.whyc.dto.Batt_Maint_Dealarm;
|
import com.whyc.dto.Response;
|
import com.whyc.dto.ServiceModel;
|
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.List;
|
|
@Service
|
public class BattMaintDealarmService {
|
|
|
@Resource
|
private BatttestdataInfService service;
|
@Resource
|
private BattMaintDealarmMapper mapper;
|
@Resource
|
private BattInfMapper battInfMapper;
|
@Resource
|
private BatttestdataInfMapper batttestdataInfMapper;
|
|
/**
|
* //1.2电池组统计分析查询
|
*
|
* @param bmd
|
* @return
|
*/
|
|
// SELECT DISTINCT
|
// (
|
// db_battinf.tb_battinf.BattgroupId
|
// ),
|
// StationName1,
|
// StationName,
|
// stationip,
|
// BattGroupName,
|
// BattGroupName1,
|
// moncount,
|
// moncapstd,
|
// monvolstd,
|
// battproducer,
|
// battproductdate,
|
// battinusedate,
|
// db_batt_testdata.tb_batttestdata_inf.test_record_count,
|
// test_starttime
|
// FROM
|
// db_battinf.tb_battinf,
|
// db_batt_testdata.tb_batttestdata_inf
|
// WHERE
|
// db_battinf.tb_battinf.battgroupid = db_batt_testdata.tb_batttestdata_inf.battgroupid
|
// AND record_time >=?
|
// AND record_time <=?
|
//
|
// <if test="battGroupId==0">
|
// and db_battinf.tb_battinf.battgroupid!=#{battGroupId}
|
// </if>
|
// <if test="battGroupId!=0">
|
// and db_battinf.tb_battinf.battgroupid==#{battGroupId}
|
// </if>
|
//
|
//
|
// AND db_battinf.tb_battinf.BattgroupId IN (
|
// SELECT DISTINCT
|
// db_battinf.tb_battinf.battgroupid
|
// FROM
|
// db_battinf.tb_battinf,
|
// db_user.tb_user_battgroup_baojigroup_battgroup,
|
// db_user.tb_user_battgroup_baojigroup_usr,
|
// db_user.tb_user_inf
|
// WHERE
|
// db_user.tb_user_battgroup_baojigroup_battgroup.BattGroupId = db_battinf.tb_battinf.BattGroupId
|
// AND db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id = db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id
|
// AND db_user.tb_user_inf.uid = db_user.tb_user_battgroup_baojigroup_usr.uid
|
// AND db_user.tb_user_inf.uid =?
|
// AND db_battinf.tb_battinf.stationname1 LIKE ?
|
// AND db_battinf.tb_battinf.stationname LIKE ?
|
// )
|
//
|
//
|
// <if test="test_type==2">
|
// and test_type=2 //充电
|
// </if>
|
//
|
////用于放电类型
|
////全部
|
// <if test="test_type==3&&test_starttype=0">
|
// and test_type=3
|
// </if>
|
// <if test="test_type==3&&test_starttype=1">
|
// and (test_starttype<5 and test_type not in(2,9) and test_starttype!=2 AND test_starttype!=3)
|
// </if>
|
// <if test="test_type==3&&test_starttype=2">
|
// and (test_starttype=2 and test_type not in(2) )
|
// </if>
|
// <if test="test_type==3&&test_starttype=3">
|
// and (test_starttype=3 and test_type not in(2) )
|
// </if>
|
// order by db_battinf.tb_battinf.battgroupid asc,test_starttime asc
|
//
|
|
//TODO rzg battInfMapper
|
public Response<List<AllModel>> searchLow(Batt_Maint_Dealarm bmd) {
|
BatttestdataInf tdata = bmd.getBtestinf();//设定时间
|
List<Battinf> list = null;
|
// List<Battinf> list = battInfMapper.serchByTestType(bmd);
|
List<AllModel> listAll = new ArrayList<AllModel>();
|
if (list != null && list.size() > 0) {
|
for (int i = 0; i < list.size(); i++) {
|
Battinf binf = list.get(i);
|
tdata.setBattGroupId(binf.getBattGroupId());
|
tdata.setGroupVol(binf.getMonVolStd());//标存电压
|
tdata.setTestCap(binf.getMonCapStd());//标存容量
|
tdata.setTestRecordCount(binf.getNum());//次数
|
//该电池组的放电结果
|
List list1 = null;//该电池组的放电结果
|
// List list1 = batttestdataInfMapper.serchDischargeTest(tdata);//该电池组的放电结果
|
ServiceModel model = new ServiceModel();
|
if (list1 != null && list1.size() > 0) {
|
model.setCode(1);
|
model.setData(list1);//1.2电池组统计分析查询
|
model.setMsg("查询成功!");
|
} else {
|
model.setCode(0);
|
model.setMsg("查询失败!");
|
}
|
AllModel allmodel = new AllModel();
|
allmodel.setData(list.get(i));
|
allmodel.setTmodel(model);
|
listAll.add(allmodel);
|
}
|
}
|
return new Response<List<AllModel>>().set(1,listAll);
|
// return null;
|
}
|
|
/**
|
* 电池组性能评估
|
*
|
* @param bmd
|
* @return
|
*/
|
//TODO rzg battInfMapper
|
|
// SELECT SQL_CALC_FOUND_ROWS DISTINCT
|
// (
|
// db_battinf.tb_battinf.BattgroupId
|
// ),
|
// db_battinf.tb_battinf.stationid,
|
// StationName1,
|
// StationName,
|
// stationip,
|
// BattGroupName,
|
// BattGroupName1,
|
// moncount,
|
// moncapstd,
|
// monvolstd,
|
// battproducer,
|
// battproductdate,
|
// battinusedate
|
// FROM
|
// db_battinf.tb_battinf
|
// WHERE 1=1
|
//
|
// <if test="battGroupId==0">
|
// and db_battinf.tb_battinf.battgroupid!=#{battGroupId}
|
// </if>
|
//
|
// <if test="battGroupId!=0">
|
// and db_battinf.tb_battinf.battgroupid==#{battGroupId}
|
// </if>
|
//
|
// AND db_battinf.tb_battinf.BattgroupId IN (
|
// SELECT DISTINCT
|
// db_battinf.tb_battinf.battgroupid
|
// FROM
|
// db_battinf.tb_battinf,
|
// db_user.tb_user_battgroup_baojigroup_battgroup,
|
// db_user.tb_user_battgroup_baojigroup_usr,
|
// db_user.tb_user_inf
|
// WHERE
|
// db_user.tb_user_battgroup_baojigroup_battgroup.BattGroupId = db_battinf.tb_battinf.BattGroupId
|
// AND db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id = db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id
|
// AND db_user.tb_user_inf.uid = db_user.tb_user_battgroup_baojigroup_usr.uid
|
// AND db_user.tb_user_inf.uid =?
|
// AND db_battinf.tb_battinf.stationname1 LIKE ?
|
// AND db_battinf.tb_battinf.stationname LIKE ?
|
// )
|
//
|
// order by db_battinf.tb_battinf.battgroupid asc
|
//
|
|
|
//TODO RZG
|
public Response<List<AllModel>> searchByCondition(Batt_Maint_Dealarm bmd) {
|
|
BatttestdataInf tdata = bmd.getBtestinf();//设定时间
|
List<Battinf> list = null;
|
// List<Battinf> list = battInfMapper.serchGroupAssess(bmd);
|
List<AllModel> listAll = new ArrayList<AllModel>();
|
if (list != null && list.size() > 0) {
|
for (int i = 0; i < list.size(); i++) {
|
Battinf binf = list.get(i);
|
tdata.setBattGroupId(binf.getBattGroupId());
|
tdata.setGroupVol(binf.getMonVolStd());//标存电压
|
tdata.setTestCap(binf.getMonCapStd());//标存容量
|
//该电池组的放电结果
|
List list1 = null;//该电池组的放电结果
|
// List list1 = batttestdataInfMapper.serchDischargeTest(tdata);//该电池组的放电结果
|
ServiceModel model = new ServiceModel();
|
if (list1 != null && list1.size() > 0) {
|
model.setCode(1);
|
model.setData(list1);
|
model.setMsg("查询成功!");
|
} else {
|
model.setCode(0);
|
model.setMsg("查询失败!");
|
}
|
AllModel allmodel = new AllModel();
|
allmodel.setData(list.get(i));
|
allmodel.setTmodel(model);
|
listAll.add(allmodel);
|
}
|
}
|
return new Response<List<AllModel>>().set(1, listAll);
|
}
|
|
|
|
// SELECT
|
// battgroupid,
|
// test_curr,
|
// max_monvol,
|
// min_monvol,
|
// test_cap
|
// FROM
|
// db_batt_testdata.tb_batttestdata_inf
|
// WHERE
|
// battgroupid =?
|
// AND record_time >=?
|
// AND record_time <=?
|
// AND db_batt_testdata.tb_batttestdata_inf.data_available = 1
|
//
|
////充电放电选择 全部 test_type=0不加条件
|
////用于放电类型
|
////全部
|
// <if test="test_type==3&&test_starttype=0">
|
// and test_type=3
|
// </if>
|
// <if test="test_type==3&&test_starttype=1">
|
// and (test_starttype<5 and test_type not in(2,9) and test_starttype!=2 AND test_starttype!=3)
|
// </if>
|
// <if test="test_type==3&&test_starttype=2">
|
// and (test_starttype=2 and test_type not in(2) )
|
// </if>
|
// <if test="test_type==3&&test_starttype=3">
|
// and (test_starttype=3 and test_type not in(2) )
|
// </if>
|
//
|
// order by test_starttime desc
|
|
}
|