whyclxw
2025-05-28 e16302f9d475c7cc4dd18c5abf1a23cb5502e362
src/main/java/com/whyc/service/PwrdevAlarmHistoryService.java
@@ -14,6 +14,7 @@
import com.whyc.pojo.UserLog;
import com.whyc.util.ActionUtil;
import com.whyc.util.SubTablePageInfoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -35,6 +36,9 @@
    @Resource
    private SubTablePageInfoUtils subTablePageInfoUtils;
    @Autowired
    private SubTablePageInfoService subService;
    //查询所有的电源历史告警信息
    public Response getHistoryAllPage(PwrdevAlarmHistory pwrH) {
@@ -65,8 +69,7 @@
            PwrdevAlarmHistory p = (PwrdevAlarmHistory) temp;
            p.setAlarmName(AlarmDaoFactory.getAllAlarmName(p.getAlmType()));
        }
        List<Integer> levelList = subTablePageInfoUtils.getLevelList(uId,"db_pwrdev_alarm", "tb_pwrdev_alarm_history", "tb_pwrdev_alarm_history_?[0-9]*",param.getAlmTypes());
        return new Response<>().setII(1, pageInfo, levelList, "返回结果");
        return new Response<>().setII(1, pageInfo, null, "返回结果");
    }
    public Response getPageInfoForTX(PwrdevAlarmHistory param) throws ParseException {
@@ -83,14 +86,19 @@
        List<String> tableList = paramMapper.getParamList();
        //取第一条记录,即param表
        String alarmParamTableName = tableList.get(0);
        List<PwrdevAlarmParam>  paramList=paramMapper.searchAll(alarmParamTableName);
        //List<PwrdevAlarmParam>  paramList=paramMapper.searchAll(alarmParamTableName);
        List<PwrdevAlarmParam>  paramList=subService.searchAll(alarmParamTableName);
        for (Object obj:list) {
            PwrdevAlarmHistory p = (PwrdevAlarmHistory) obj;
            int almType = p.getAlmType();
            AtomicBoolean matchFlag = new AtomicBoolean(false);
            paramList.stream().forEach(temp->{
                if(temp.getAlarmId()  == almType ){
                    p.setAlarmName(temp.getAlarmName());
                    if (p.getAlmIndex() != 0) {
                        p.setAlarmName(temp.getAlarmName().replace("N", p.getAlmIndex() + ""));
                    }else{
                        p.setAlarmName(temp.getAlarmName());
                    }
                    matchFlag.set(true);
                    return;
                }
@@ -137,7 +145,8 @@
        List<String> tableList = paramMapper.getParamList();
        //取第一条记录,即param表
        String alarmParamTableName = tableList.get(0);
        List<PwrdevAlarmParam>  paramList=paramMapper.searchAll(alarmParamTableName);
        //List<PwrdevAlarmParam>  paramList=paramMapper.searchAll(alarmParamTableName);
        List<PwrdevAlarmParam>  paramList=subService.searchAll(alarmParamTableName);
        for (PwrdevAlarmHistory p:list) {
            int almType = p.getAlmType();
            AtomicBoolean matchFlag = new AtomicBoolean(false);
@@ -188,4 +197,16 @@
        mapper.insert(dataHistory);
    }
    public List<PwrdevAlarmHistory> getListByStationId(Date startTime, Date endTime, String stationId,String tableName) {
        //List list=mapper.getListByStationId(startTime,endTime,stationId,tableName);
        List list=subService.getListByStationId_pwr(startTime,endTime,stationId,tableName);
        return list;
    }
    public Response getLevelList(List<Integer> almTypes) {
        int uId = ActionUtil.getUser().getUId().intValue();
        List<Integer> levelList = subTablePageInfoUtils.getLevelList(uId,"db_pwrdev_alarm", "tb_pwrdev_alarm_history", "tb_pwrdev_alarm_history_?[0-9]*",almTypes);
        return new Response().set(1,levelList);
    }
}