whyclxw
5 天以前 8c635598000e40edfb3edf5934124ad48d60f62d
src/main/java/com/whyc/service/PwrdevAlarmService.java
@@ -10,26 +10,47 @@
import com.whyc.dto.AlarmDto;
import com.whyc.dto.Param.AlmAnalyseDto;
import com.whyc.dto.Real.AlmDto;
import com.whyc.dto.Real.RealDateDTO;
import com.whyc.dto.Response;
import com.whyc.factory.ThreadPoolExecutorFactory;
import com.whyc.mapper.PwrdevAlarmMapper;
import com.whyc.pojo.db_alarm.DevalarmData;
import com.whyc.pojo.db_data_history.BattRealdataId;
import com.whyc.pojo.db_data_history.PwrdevHistorydataId;
import com.whyc.pojo.db_param.AlmAnalysisParam;
import com.whyc.pojo.db_param.AppParam;
import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarm;
import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarmParam;
import com.whyc.pojo.db_station.BattInf;
import com.whyc.pojo.web_site.AlarmInspection;
import com.whyc.util.ActionUtil;
import com.whyc.util.DateUtil;
import com.whyc.util.ThreadLocalUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static java.lang.Thread.sleep;
@Service
public class PwrdevAlarmService {
    @Autowired(required = false)
    private PwrdevAlarmMapper mapper;
    @Autowired
    private AppParamService appParamService;
    @Autowired
    private AlmAnalysisParamService almAnalysisParamService;
    @Autowired
    private SubTablePageInfoService subTablePageInfoService;
    @Autowired
    private BattInfService battInfService;
    //获取电源实时告警信息
    public Response getPwrAlmReal(AlmDto almDto) {
        PageHelper.startPage(almDto.getPageNum(),almDto.getPageSize());
@@ -91,7 +112,22 @@
    public Response getPwrtAlmAnalyse(AlmAnalyseDto dto) {
        PageHelper .startPage(dto.getPageNum(),dto.getPageSize());
        List<PwrdevAlarm> list=mapper.getPwrtAlmAnalyse(dto);
        for (PwrdevAlarm pwrAlm:list) {
            pwrAlm.setAlmName(PowerAlarmEnum.getValue(pwrAlm.getAlmId()));
            //查询电源下所有的电池组id
            List<BattInf> binfList = battInfService.getBattgroupIdListByPowerId(pwrAlm.getPowerId());
            pwrAlm.setBinfList(binfList);
        }
        PageInfo pageInfo=new PageInfo(list);
        return new Response().setII(1,list!=null,pageInfo,"电源告警分析");
    }
    //查看当前是否存在交流停电告警
    public Integer judge3100014(Integer powerId) {
        QueryWrapper wrapper=new QueryWrapper();
        wrapper.eq("power_id",powerId);
        wrapper.eq("alm_id",PowerAlarmEnum.ALARM_3100014);
        wrapper.last("limit 1");
        PwrdevAlarm alm=mapper.selectOne( wrapper);
        return alm!=null?1:0;
    }
}