whyclxw
2025-05-28 e16302f9d475c7cc4dd18c5abf1a23cb5502e362
src/main/java/com/whyc/service/BattTestDataInf2Service.java
@@ -8,6 +8,7 @@
import com.whyc.dto.TestDaoFactory;
import com.whyc.mapper.*;
import com.whyc.pojo.BatttestdataInf;
import com.whyc.pojo.PageParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -16,6 +17,7 @@
import java.math.BigDecimal;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class BattTestDataInf2Service {
@@ -47,9 +49,22 @@
    @Autowired
    private BattResDataService resDataService;
    @Autowired
    private PageParamService pageParamService;
    @Autowired
    private SubTablePageInfoService subService;
    /*新版接口不包含内阻数据
     * */
    public PageInfo<BatttestdataInf> calcTestData(BattTestDataDTO paramDto, Integer pageNum, Integer pageSize) {
        //获取充放电时间过滤参数
        List<PageParam> pageParamList = pageParamService.getList2ByCategoryId(14);
        int jcDischargeFilterTime = pageParamList.get(2).getStatus() * 60;
        int jcChargeFilterTime = pageParamList.get(3).getStatus() * 60;
        paramDto.setJcDischargeFilterTime(jcDischargeFilterTime);
        paramDto.setJcChargeFilterTime(jcChargeFilterTime);
        List<BatttestdataInf> calcDataList = new LinkedList<>();
        //查询电池组 电池信息或者电导信息
        PageHelper.startPage(pageNum, pageSize, true);
@@ -66,7 +81,7 @@
            battTestDataInf.setAlarmLowCoe4CapAlarm(alarmLowCoe4CapAlarm);
            battTestDataInf.setAlarmLowCoe4CapChange(alarmLowCoe4CapChange);
            //获取测试仪表类型
            battTestDataInf.setTeststarttypeHex(TestDaoFactory.getTest_starttypeHex(battTestDataInf.getTestStarttype(), battTestDataInf.getTestType()));
            battTestDataInf.setTeststarttypeHex(TestDaoFactory.getTest_starttypeHex(battTestDataInf.getTestStarttype(), battTestDataInf.getTestType(), battTestDataInf.getTestDatatype()));
            //通过stop表获取落后单体信息
            String exist = commonMapper.existTable("db_batt_testdata", "tb_batttestdatastop_" + battTestDataInf.getBattGroupId());
@@ -88,7 +103,7 @@
        List<BatttestdataInf> calcDataList = new LinkedList<>();
        //查询电池组 电池信息或者电导信息
        PageHelper.startPage(pageNum, pageSize, true);
        List<BatttestdataInf> battTestInfList = mapper.getTestInfList(paramDto);
        List<BatttestdataInf> battTestInfList = mapper.getTestInfList1(paramDto);
        PageInfo<BatttestdataInf> pageInfo = new PageInfo(battTestInfList);
        //查询电池测试过程具体电池组的落后单体相关信息
@@ -102,7 +117,7 @@
                battTestDataInf.setAlarmLowCoe4CapAlarm(alarmLowCoe4CapAlarm);
                battTestDataInf.setAlarmLowCoe4CapChange(alarmLowCoe4CapChange);
                //获取测试仪表类型
                battTestDataInf.setTeststarttypeHex(TestDaoFactory.getTest_starttypeHex(battTestDataInf.getTestStarttype(), battTestDataInf.getTestType()));
                battTestDataInf.setTeststarttypeHex(TestDaoFactory.getTest_starttypeHex1(battTestDataInf.getTestStarttype(), battTestDataInf.getTestType()));
                //通过stop表获取落后单体信息
                String exist = commonMapper.existTable("db_batt_testdata", "tb_batttestdatastop_" + battTestDataInf.getBattGroupId());
@@ -136,9 +151,13 @@
    public boolean delete(Integer num, Integer battGroupId, Integer testRecordCount, Integer testType) {
        //充电,放电,在线监测
        if(testType == BattTestEnum.TEST_TYPE_CHARGE.getValue() ||
        /*if(testType == BattTestEnum.TEST_TYPE_CHARGE.getValue() ||
                testType == BattTestEnum.TEST_TYPE_DISCHARGE.getValue()||
                testType == BattTestEnum.TEST_TYPE_MONITOR.getValue()
        )*/
        if(testType.equals(BattTestEnum.TEST_TYPE_CHARGE.getValue())  ||
                testType.equals(BattTestEnum.TEST_TYPE_DISCHARGE.getValue())||
                testType.equals(BattTestEnum.TEST_TYPE_MONITOR.getValue())
        ){
            //删除 测试表inf里的信息
            testDataInfMapper.deleteById(num);
@@ -149,7 +168,8 @@
            //删除 测试表inf里的信息
            resDataInfMapper.deleteById(num);
            //删除 测试表_battGroupId里面对应的单体信息
            resDataMapper.deleteByTestRecordCount(battGroupId,testRecordCount);
            //resDataMapper.deleteByTestRecordCount(battGroupId,testRecordCount);
            subService.deleteByTestRecordCount(battGroupId,testRecordCount);
        }
        return true;
    }