|
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.dskj.znzn.transData.common.base.PageR;
|
|
import com.dskj.znzn.transData.common.base.PageR;
|
|
-import com.dskj.znzn.transData.common.base.R;
|
|
|
|
import com.dskj.znzn.transData.common.exception.BusinessException;
|
|
import com.dskj.znzn.transData.common.exception.BusinessException;
|
|
import com.dskj.znzn.transData.web.common.entity.SysConf;
|
|
import com.dskj.znzn.transData.web.common.entity.SysConf;
|
|
import com.dskj.znzn.transData.web.common.service.ISysConfService;
|
|
import com.dskj.znzn.transData.web.common.service.ISysConfService;
|
|
@@ -19,6 +18,7 @@ import com.dskj.znzn.transData.web.dataTransfer.outData.*;
|
|
import com.dskj.znzn.transData.web.dataTransfer.service.IDataTransferService;
|
|
import com.dskj.znzn.transData.web.dataTransfer.service.IDataTransferService;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -38,6 +38,7 @@ import java.util.*;
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
@RequiredArgsConstructor(onConstructor = @__({@Autowired}))
|
|
@RequiredArgsConstructor(onConstructor = @__({@Autowired}))
|
|
|
|
+@Slf4j
|
|
public class DataTransferServiceImpl extends ServiceImpl<DataTransferMapper, DataTransfer> implements IDataTransferService {
|
|
public class DataTransferServiceImpl extends ServiceImpl<DataTransferMapper, DataTransfer> implements IDataTransferService {
|
|
|
|
|
|
private final DataTransferMapper dataTransferMapper;
|
|
private final DataTransferMapper dataTransferMapper;
|
|
@@ -250,6 +251,91 @@ public class DataTransferServiceImpl extends ServiceImpl<DataTransferMapper, Dat
|
|
return results;
|
|
return results;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public List<DataTransfer> recentlyImportedSuccessful5Data() {
|
|
|
|
+ LambdaQueryWrapper<DataTransfer> wrapper = Wrappers.lambdaQuery();
|
|
|
|
+ wrapper.eq(DataTransfer::getTransferStatus, 1).eq(DataTransfer::getStatus, 1);
|
|
|
|
+ wrapper.orderByDesc(DataTransfer::getUpdateTime);
|
|
|
|
+ wrapper.last("limit 5");
|
|
|
|
+ List<DataTransfer> transferList = list(wrapper);
|
|
|
|
+ if (!transferList.isEmpty()) {
|
|
|
|
+ for (DataTransfer transfer : transferList) {
|
|
|
|
+ transfer.setTransferTypeName(sysConfService.getValueByType("trans_type", transfer.getTransferType()));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return transferList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<PltIndexMoreOutData> pltIndexMore() {
|
|
|
|
+ List<ClassificationImportDataDetailsQuery> datas = dataTransferMapper.classificationImportDataDetails();
|
|
|
|
+ List<SysConf> confList = sysConfService.getByType("trans_type");
|
|
|
|
+ Map<String, List<ClassificationImportDataDetailsQuery>> windFarmMap = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ for (ClassificationImportDataDetailsQuery query : datas) {
|
|
|
|
+ if (windFarmMap.containsKey(query.getWindFarmCode())) {
|
|
|
|
+ windFarmMap.get(query.getWindFarmCode()).add(query);
|
|
|
|
+ } else {
|
|
|
|
+ List<ClassificationImportDataDetailsQuery> list = new ArrayList<>();
|
|
|
|
+ list.add(query);
|
|
|
|
+ windFarmMap.put(query.getWindFarmCode(), list);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ List<PltIndexMoreOutData> pltIndexMoreOutDataList = new ArrayList<>();
|
|
|
|
+ windFarmMap.forEach((key, value) -> {
|
|
|
|
+ Map<String, ClassificationImportDataDetailsQuery> typeMap = new HashMap<>();
|
|
|
|
+ for (ClassificationImportDataDetailsQuery query : value) {
|
|
|
|
+ typeMap.put(query.getTransferType(), query);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ PltIndexMoreOutData data = new PltIndexMoreOutData();
|
|
|
|
+ data.setWindFarmCode(key);
|
|
|
|
+ data.setWindFarmName(value.get(0).getWindFarmName());
|
|
|
|
+
|
|
|
|
+ for (SysConf sysConf : confList) {
|
|
|
|
+ ClassificationImportDataDetailsQuery query = typeMap.get(sysConf.getParamKey());
|
|
|
|
+ String type = sysConf.getParamKey();
|
|
|
|
+ switch (type) {
|
|
|
|
+ case "minute":
|
|
|
|
+ data.setMinuteTimeAreaList(converAreaStrToList(typeMap.containsKey(type), query));
|
|
|
|
+ break;
|
|
|
|
+ case "second":
|
|
|
|
+ data.setSecondTimeAreaList(converAreaStrToList(typeMap.containsKey(type), query));
|
|
|
|
+ break;
|
|
|
|
+ case "warn":
|
|
|
|
+ data.setWarnTimeAreaList(converAreaStrToList(typeMap.containsKey(type), query));
|
|
|
|
+ break;
|
|
|
|
+ case "fault":
|
|
|
|
+ data.setFaultTimeAreaList(converAreaStrToList(typeMap.containsKey(type), query));
|
|
|
|
+ break;
|
|
|
|
+ case "wave":
|
|
|
|
+ data.setVibrationTimeAreaList(converAreaStrToList(typeMap.containsKey(type), query));
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ log.warn("当前类型" + type + "未显示");
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ pltIndexMoreOutDataList.add(data);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ return pltIndexMoreOutDataList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private List<String> converAreaStrToList(boolean contains, ClassificationImportDataDetailsQuery query) {
|
|
|
|
+ if(null == query){
|
|
|
|
+ return Collections.emptyList();
|
|
|
|
+ }
|
|
|
|
+ String timeAreaStr = query.getTimeArea();
|
|
|
|
+ if (null == timeAreaStr || StringUtils.isBlank(timeAreaStr) || !contains) {
|
|
|
|
+ return Collections.emptyList();
|
|
|
|
+ } else {
|
|
|
|
+ List<String> areaList = Arrays.asList(timeAreaStr.split(","));
|
|
|
|
+ Collections.sort(areaList);
|
|
|
|
+ return areaList;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
public static void main(String[] args) throws ParseException {
|
|
public static void main(String[] args) throws ParseException {
|
|
List<GetTimeRangeOutData> results = new ArrayList<>();
|
|
List<GetTimeRangeOutData> results = new ArrayList<>();
|