|
@@ -3,12 +3,18 @@ package com.cpp.web.service.datafactory.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.cpp.web.domain.datafactory.ParsingLog;
|
|
import com.cpp.web.domain.datafactory.ParsingLog;
|
|
|
|
+import com.cpp.web.domain.datafactory.enums.FileTypeEnum;
|
|
import com.cpp.web.domain.enums.DataSourcesEnum;
|
|
import com.cpp.web.domain.enums.DataSourcesEnum;
|
|
|
|
+import com.cpp.web.domain.station.ElectricField;
|
|
import com.cpp.web.mapper.datafactory.ParsingLogMapper;
|
|
import com.cpp.web.mapper.datafactory.ParsingLogMapper;
|
|
import com.cpp.web.service.datafactory.ParsingLogService;
|
|
import com.cpp.web.service.datafactory.ParsingLogService;
|
|
|
|
+import com.cpp.web.service.station.ElectricFieldService;
|
|
|
|
+import com.cpp.web.utils.DateTimeUtil;
|
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@@ -19,13 +25,12 @@ import java.util.List;
|
|
* @date 2022-05-11 18:07:03
|
|
* @date 2022-05-11 18:07:03
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
|
|
+@RequiredArgsConstructor
|
|
public class ParsingLogServiceImpl extends ServiceImpl<ParsingLogMapper, ParsingLog> implements ParsingLogService {
|
|
public class ParsingLogServiceImpl extends ServiceImpl<ParsingLogMapper, ParsingLog> implements ParsingLogService {
|
|
|
|
|
|
private final ParsingLogMapper parsingLogMapper;
|
|
private final ParsingLogMapper parsingLogMapper;
|
|
|
|
|
|
- public ParsingLogServiceImpl(ParsingLogMapper parsingLogMapper) {
|
|
|
|
- this.parsingLogMapper = parsingLogMapper;
|
|
|
|
- }
|
|
|
|
|
|
+ private final ElectricFieldService electricFieldService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public QueryWrapper<ParsingLog> getByStationCodeAndCreateTimeAndFileStatusAndFileType(String stationCode, Date startTime, Date endTime, String fileStatus, String fileType) {
|
|
public QueryWrapper<ParsingLog> getByStationCodeAndCreateTimeAndFileStatusAndFileType(String stationCode, Date startTime, Date endTime, String fileStatus, String fileType) {
|
|
@@ -46,34 +51,34 @@ public class ParsingLogServiceImpl extends ServiceImpl<ParsingLogMapper, Parsing
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public QueryWrapper<ParsingLog> getByStationCodeAndCreateTimeAndFileType(String stationCode, Date startTime, Date endTime, String fileType,String dataSources,String parsingDescribe,String parsingFileStatus) {
|
|
|
|
|
|
+ public QueryWrapper<ParsingLog> getByStationCodeAndCreateTimeAndFileType(String stationCode, Date startTime, Date endTime, String fileType, String dataSources, String parsingDescribe, String parsingFileStatus) {
|
|
QueryWrapper<ParsingLog> wrapper = new QueryWrapper<>();
|
|
QueryWrapper<ParsingLog> wrapper = new QueryWrapper<>();
|
|
|
|
|
|
- if ("未知".equals(stationCode)){
|
|
|
|
|
|
+ if ("未知".equals(stationCode)) {
|
|
wrapper.isNull("station_code");
|
|
wrapper.isNull("station_code");
|
|
- }else if (stationCode != null && !"".equals(stationCode)){
|
|
|
|
|
|
+ } else if (stationCode != null && !"".equals(stationCode)) {
|
|
wrapper.eq("station_code", stationCode);
|
|
wrapper.eq("station_code", stationCode);
|
|
}
|
|
}
|
|
- if (null != startTime && !"".equals(startTime) && null != endTime && !"".equals(endTime)){
|
|
|
|
|
|
+ if (null != startTime && !"".equals(startTime) && null != endTime && !"".equals(endTime)) {
|
|
wrapper.between("parsing_time", startTime, endTime);
|
|
wrapper.between("parsing_time", startTime, endTime);
|
|
}
|
|
}
|
|
- if (null != fileType && !"".equals(fileType)){
|
|
|
|
|
|
+ if (null != fileType && !"".equals(fileType)) {
|
|
wrapper.eq("file_type", fileType);
|
|
wrapper.eq("file_type", fileType);
|
|
}
|
|
}
|
|
- if (null != dataSources && !"".equals(dataSources)){
|
|
|
|
|
|
+ if (null != dataSources && !"".equals(dataSources)) {
|
|
wrapper.eq("data_sources", DataSourcesEnum.valueOf(dataSources));
|
|
wrapper.eq("data_sources", DataSourcesEnum.valueOf(dataSources));
|
|
}
|
|
}
|
|
- if ("null".equals(parsingDescribe)){
|
|
|
|
- wrapper.eq("parsing_describe","");
|
|
|
|
|
|
+ if ("null".equals(parsingDescribe)) {
|
|
|
|
+ wrapper.eq("parsing_describe", "");
|
|
}
|
|
}
|
|
- if ("notNull".equals(parsingDescribe)){
|
|
|
|
- wrapper.ne("parsing_describe","");
|
|
|
|
|
|
+ if ("notNull".equals(parsingDescribe)) {
|
|
|
|
+ wrapper.ne("parsing_describe", "");
|
|
}
|
|
}
|
|
- if (null != parsingFileStatus && !"".equals(parsingFileStatus) && "成功".equals(parsingFileStatus)){
|
|
|
|
- wrapper.eq("parsing_file_status",parsingFileStatus);
|
|
|
|
|
|
+ if (null != parsingFileStatus && !"".equals(parsingFileStatus) && "成功".equals(parsingFileStatus)) {
|
|
|
|
+ wrapper.eq("parsing_file_status", parsingFileStatus);
|
|
}
|
|
}
|
|
- if (null != parsingFileStatus && !"".equals(parsingFileStatus) && "失败".equals(parsingFileStatus)){
|
|
|
|
- wrapper.eq("parsing_file_status",parsingFileStatus);
|
|
|
|
|
|
+ if (null != parsingFileStatus && !"".equals(parsingFileStatus) && "失败".equals(parsingFileStatus)) {
|
|
|
|
+ wrapper.eq("parsing_file_status", parsingFileStatus);
|
|
}
|
|
}
|
|
return wrapper;
|
|
return wrapper;
|
|
}
|
|
}
|
|
@@ -81,17 +86,41 @@ public class ParsingLogServiceImpl extends ServiceImpl<ParsingLogMapper, Parsing
|
|
@Override
|
|
@Override
|
|
public List<ParsingLog> findByTimeBetweenAndFileTypeAndStationCode(Date startTime, Date endTime, String fileType, String stationCode) {
|
|
public List<ParsingLog> findByTimeBetweenAndFileTypeAndStationCode(Date startTime, Date endTime, String fileType, String stationCode) {
|
|
QueryWrapper<ParsingLog> wrapper = new QueryWrapper<>();
|
|
QueryWrapper<ParsingLog> wrapper = new QueryWrapper<>();
|
|
- if (stationCode != null && !"".equals(stationCode)){
|
|
|
|
- wrapper.eq("station_code",stationCode);
|
|
|
|
|
|
+ if (stationCode != null && !"".equals(stationCode)) {
|
|
|
|
+ wrapper.eq("station_code", stationCode);
|
|
}
|
|
}
|
|
- if (null != startTime && !"".equals(startTime) && null != endTime && !"".equals(endTime)){
|
|
|
|
- wrapper.between("parsing_time",startTime,endTime);
|
|
|
|
|
|
+ if (null != startTime && !"".equals(startTime) && null != endTime && !"".equals(endTime)) {
|
|
|
|
+ wrapper.between("parsing_time", startTime, endTime);
|
|
}
|
|
}
|
|
- if (null != fileType && !"".equals(fileType)){
|
|
|
|
- wrapper.eq("file_type",fileType);
|
|
|
|
|
|
+ if (null != fileType && !"".equals(fileType)) {
|
|
|
|
+ wrapper.eq("file_type", fileType);
|
|
}
|
|
}
|
|
- wrapper.eq("data_sources","E1");
|
|
|
|
|
|
+ wrapper.eq("data_sources", "E1");
|
|
List<ParsingLog> parsingLogs = parsingLogMapper.selectList(wrapper);
|
|
List<ParsingLog> parsingLogs = parsingLogMapper.selectList(wrapper);
|
|
return parsingLogs;
|
|
return parsingLogs;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<ElectricField> notTodayLogStation(FileTypeEnum fileTypeEnum, DataSourcesEnum dataSourcesEnum) {
|
|
|
|
+ Date date = DateTimeUtil.getDayStartTime(System.currentTimeMillis());
|
|
|
|
+
|
|
|
|
+ QueryWrapper<ParsingLog> wrapper = new QueryWrapper<>();
|
|
|
|
+ wrapper.ge("parsing_time", date);
|
|
|
|
+ wrapper.eq("data_sources", dataSourcesEnum.name());
|
|
|
|
+ wrapper.eq("file_type", fileTypeEnum.name());
|
|
|
|
+ List<ParsingLog> parsingLogs = parsingLogMapper.selectList(wrapper);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ List<ElectricField> electricFields = electricFieldService.list();
|
|
|
|
+
|
|
|
|
+ List<ElectricField> electricFieldList = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ for (ElectricField electricField : electricFields) {
|
|
|
|
+ if (!parsingLogs.stream().anyMatch(p->p.getStationCode().equals(electricField.getStationCode()))){
|
|
|
|
+ electricFieldList.add(electricField);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return electricFieldList;
|
|
|
|
+ }
|
|
}
|
|
}
|