| | |
| | | import com.whyc.pojo.*; |
| | | 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.boot.system.ApplicationHome; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | clear.setCreateTime(date); |
| | | //插入对应的站点id,用于后期用户相关 |
| | | Integer alarmType = clear.getAlarmType(); |
| | | String stationId; |
| | | Integer num = clear.getNum(); |
| | | if(alarmType == 1){ //电池告警 |
| | | stationId = battInfService.getStationIdByBattGroupId(clear.getBattGroupId()); |
| | | //添加到历史告警,移除告警确认数据 |
| | | BattAlarmDataVerify data = battAlarmService.getById(num); |
| | | battAlarmHistoryService.add(data); |
| | | battAlarmService.delete(num); |
| | | } else if (alarmType == 2) { //设备告警 |
| | | stationId = battInfService.getStationIdByDeviceId(clear.getDeviceId()); |
| | | DevAlarmDataVerify data = devAlarmService.getById(num); |
| | | devAlarmHistoryService.add(data); |
| | | devAlarmService.delete(num); |
| | | |
| | | }else{ //电源告警 |
| | | stationId = powerInfService.getStationIdByPowerDeviceId(clear.getPowerDeviceId()); |
| | | PwrDevAlarmVerify data = powerAlarmService.getById(num); |
| | | powerAlarmHistoryService.add(data); |
| | | powerAlarmService.delete(num); |
| | | } |
| | | clear.setStationId(stationId); |
| | | //处理文件 |
| | | String fileDirName = ""; |
| | | ApplicationHome applicationHome = new ApplicationHome(getClass()); |
| | |
| | | fileDirName = jarFile.toString(); |
| | | } |
| | | //文件夹按月度存储 |
| | | String root=fileDirName+"/fg_file/alarm_manual_clear/"+ DateUtil.YYYY_MM.format(date) + "/"; |
| | | //String root=fileDirName+"/fg_file/alarm_manual_clear/"+ DateUtil.YYYY_MM.format(date) + "/"; |
| | | String root=fileDirName+"/fg_file/alarm_manual_clear/"+ ThreadLocalUtil.format(date,5) + "/"; |
| | | List<String> filePathList = new ArrayList<>(); |
| | | try { |
| | | for (int i = 0; i < file.size(); i++) { |
| | | String fileFileName = file.get(i).getOriginalFilename(); |
| | | String filePath = root + DateUtil.YYYY_MM_DD_HH_MM_SS_UNION.format(date)+"_"+fileFileName; |
| | | //String filePath = root + DateUtil.YYYY_MM_DD_HH_MM_SS_UNION.format(date)+"_"+fileFileName; |
| | | String filePath = root + ThreadLocalUtil.format(date,7)+"_"+fileFileName; |
| | | createFilefolderIFNotExist(filePath); |
| | | file.get(i).transferTo(new File(filePath)); |
| | | String httpFilePath = filePath.replace(fileDirName, ""); |
| | |
| | | |
| | | } |
| | | |
| | | public Response getPage(int pageNum,int pageSize) { |
| | | public Response getPage(AlarmManualClear param) { |
| | | int userId = ActionUtil.getUser().getUId().intValue(); |
| | | //查询所有的记录分页 |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | List<AlarmManualClear> list = mapper.getAll(userId); |
| | | param.setDealUserId(userId); |
| | | PageHelper.startPage(param.getPageNum(),param.getPageSize()); |
| | | List<AlarmManualClear> list = mapper.getAll(param); |
| | | PageInfo<AlarmManualClear> pageInfo = new PageInfo<>(list); |
| | | ////装配电池/设备/电源信息 |
| | | //List<AlarmManualClear> dataList = pageInfo.getList(); |
| | |
| | | }); |
| | | return new Response().set(1,pageInfo); |
| | | } |
| | | |
| | | /** |
| | | * 查询实施表中所有的main_id |
| | | * @return |
| | | */ |
| | | public List<Integer> getAllMainIds(){ |
| | | return mapper.getAllMainIds(); |
| | | } |
| | | } |