|
@@ -8,7 +8,7 @@ import com.jiayue.ipp.common.data.entity.an.ParsingInfo;
|
|
import com.jiayue.ipp.common.data.entity.an.ParsingQxzInfo;
|
|
import com.jiayue.ipp.common.data.entity.an.ParsingQxzInfo;
|
|
import com.jiayue.ipp.common.data.entity.an.ParsingUrl;
|
|
import com.jiayue.ipp.common.data.entity.an.ParsingUrl;
|
|
import com.jiayue.ipp.common.data.enums.FileTypeEnum;
|
|
import com.jiayue.ipp.common.data.enums.FileTypeEnum;
|
|
-import com.jiayue.ipp.idp.dto.ParsingConstant;
|
|
|
|
|
|
+import com.jiayue.ipp.idp.dto.FileAnalysisStatusDto;
|
|
import com.jiayue.ipp.idp.mapper.an.ParsingQxzInfoMapper;
|
|
import com.jiayue.ipp.idp.mapper.an.ParsingQxzInfoMapper;
|
|
import com.jiayue.ipp.idp.service.WeatherStationInfoService;
|
|
import com.jiayue.ipp.idp.service.WeatherStationInfoService;
|
|
import com.jiayue.ipp.idp.service.WeatherStationStatusDataService;
|
|
import com.jiayue.ipp.idp.service.WeatherStationStatusDataService;
|
|
@@ -22,9 +22,6 @@ import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
-import java.time.Instant;
|
|
|
|
-import java.time.LocalDateTime;
|
|
|
|
-import java.time.ZoneId;
|
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@@ -58,9 +55,10 @@ public class ParsingQxzInfoServiceImpl extends ServiceImpl<ParsingQxzInfoMapper,
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public String parsing(File file, ParsingUrl parsingUrl) {
|
|
|
|
- String parsingStatus = ParsingConstant.FAIL;
|
|
|
|
-
|
|
|
|
|
|
+ public FileAnalysisStatusDto parsing(File file, ParsingUrl parsingUrl) {
|
|
|
|
+ FileAnalysisStatusDto fileAnalysisStatusDto = new FileAnalysisStatusDto();
|
|
|
|
+ fileAnalysisStatusDto.setFileName(file.getName());
|
|
|
|
+ fileAnalysisStatusDto.setFileType(FileTypeEnum.QXZ.name());
|
|
try {
|
|
try {
|
|
|
|
|
|
List<ParsingQxzInfo> parsingQxzInfos = baseMapper.selectList(Wrappers.lambdaQuery(ParsingQxzInfo.class).like(ParsingInfo::getStationCode, parsingUrl.getStationCode()));
|
|
List<ParsingQxzInfo> parsingQxzInfos = baseMapper.selectList(Wrappers.lambdaQuery(ParsingQxzInfo.class).like(ParsingInfo::getStationCode, parsingUrl.getStationCode()));
|
|
@@ -96,28 +94,32 @@ public class ParsingQxzInfoServiceImpl extends ServiceImpl<ParsingQxzInfoMapper,
|
|
w.setStationCode(parsingQxzInfo.getStationCode());
|
|
w.setStationCode(parsingQxzInfo.getStationCode());
|
|
w.setEquipmentId(weatherStationInfoList.get(0).getEquipmentNo());
|
|
w.setEquipmentId(weatherStationInfoList.get(0).getEquipmentNo());
|
|
weatherStationStatusDataService.save(w);
|
|
weatherStationStatusDataService.save(w);
|
|
- parsingStatus = FileTypeEnum.QXZ.name();
|
|
|
|
|
|
+ fileAnalysisStatusDto.setStatus("1");
|
|
log.info("解析QXZ文件:{} 成功! O(∩_∩)O", file.getName());
|
|
log.info("解析QXZ文件:{} 成功! O(∩_∩)O", file.getName());
|
|
} else {
|
|
} else {
|
|
- parsingStatus += "解析QXZ文件时间错误";
|
|
|
|
|
|
+ fileAnalysisStatusDto.setStatus("0");
|
|
|
|
+ fileAnalysisStatusDto.setMessage("解析气象站文件时间错误");
|
|
log.error("解析QXZ文件时间错误");
|
|
log.error("解析QXZ文件时间错误");
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- parsingStatus += "qxz暂无多行解析方式";
|
|
|
|
|
|
+ fileAnalysisStatusDto.setStatus("0");
|
|
|
|
+ fileAnalysisStatusDto.setMessage("气象站暂无多行解析方式");
|
|
log.info("qxz暂无多行解析方式");
|
|
log.info("qxz暂无多行解析方式");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- parsingStatus += "qxz未配置作为解析使用设备";
|
|
|
|
|
|
+ fileAnalysisStatusDto.setStatus("0");
|
|
|
|
+ fileAnalysisStatusDto.setMessage("气象站未配置作为解析使用设备");
|
|
log.info("qxz未配置作为解析使用设备");
|
|
log.info("qxz未配置作为解析使用设备");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- parsingStatus += "解析气象站数据失败";
|
|
|
|
|
|
+ fileAnalysisStatusDto.setStatus("0");
|
|
|
|
+ fileAnalysisStatusDto.setMessage("解析气象站数据失败!");
|
|
log.error("解析气象站数据失败! /(ㄒoㄒ)/~~", e);
|
|
log.error("解析气象站数据失败! /(ㄒoㄒ)/~~", e);
|
|
} finally {
|
|
} finally {
|
|
- return parsingStatus;
|
|
|
|
|
|
+ return fileAnalysisStatusDto;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|