This commit is contained in:
panbaolin 2023-08-30 17:18:22 +08:00
commit 26f16fc210
9 changed files with 68 additions and 9 deletions

View File

@ -21,7 +21,7 @@ public interface Prompt {
String DATA_NOT_EXITS = "The Query Data Does Not Exist!";
String DATA_IS_EMPTY = "The Query Data IS Empty!";
String DATA_IS_EMPTY = "The Query Data Is Empty!";
String FTP_ERR = "FTP Connection Failed!";
@ -41,7 +41,7 @@ public interface Prompt {
String UPLOAD_ERR = "File Upload Failure!";
String FILE_NAME_REPEAT = "File With The Same Name Appears, Stop Uploading!";
String FILE_IS_EMPTY = "The List Of Files You Uploaded Is Empty!";
String NEED_TIME = "The Start Time Or End Time Cannot Be Empty!";
}

View File

@ -0,0 +1,34 @@
package org.jeecg.modules.base.comparator;
import cn.hutool.core.util.StrUtil;
import org.jeecg.modules.base.dto.FileDto;
import java.util.Comparator;
public class FileComparator implements Comparator<FileDto> {
private String field;
private String order;
public FileComparator(String field, String order) {
this.field = field;
this.order = order;
}
@Override
public int compare(FileDto file1, FileDto file2) {
if (StrUtil.equals(order,"asc")) {
if (StrUtil.equals(field,"name")) {
return file1.getName().compareTo(file2.getName());
} else if (StrUtil.equals(field,"updateDate")) {
return file1.getUpdateDate().compareTo(file2.getUpdateDate());
}
} else if (StrUtil.equals(order,"desc")) {
if (StrUtil.equals(field,"name")) {
return file2.getName().compareTo(file1.getName());
} else if (StrUtil.equals(field,"updateDate")) {
return file2.getUpdateDate().compareTo(file1.getUpdateDate());
}
}
return 0;
}
}

View File

@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.Date;
@Data
public class FileDto implements Comparable<FileDto>{
public class FileDto{
private String name;
@ -16,9 +16,4 @@ public class FileDto implements Comparable<FileDto>{
@JsonFormat(pattern = DateConstant.DATE_TIME,timezone = DateConstant.TIME_ZONE)
private Date updateDate;
@Override
public int compareTo(@NotNull FileDto o) {
return this.name.compareTo(o.getName());
}
}

View File

@ -16,6 +16,7 @@ import org.jeecg.common.constant.enums.FileTypeEnum;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.FTPUtil;
import org.jeecg.common.util.PageUtil;
import org.jeecg.modules.base.comparator.FileComparator;
import org.jeecg.modules.base.dto.FileDto;
import org.jeecg.modules.base.vo.FileVo;
import org.jeecg.modules.service.ISpectrumFileService;
@ -70,6 +71,8 @@ public class SpectrumFileServiceImpl implements ISpectrumFileService {
}
fileList.add(oneFile);
}
if (CollUtil.isEmpty(fileList))
return Result.error(Prompt.FILE_IS_EMPTY);
ftpClient = ftpUtil.LoginFTP();
if (ObjectUtil.isNull(ftpClient))
return Result.error(Prompt.FTP_ERR);
@ -139,7 +142,9 @@ public class SpectrumFileServiceImpl implements ISpectrumFileService {
fileDto.setSize(formatSize(size));
fileDtos.add(fileDto);
}
Collections.sort(fileDtos);
String field = fileVo.getField();
String order = fileVo.getOrder();
fileDtos.sort(new FileComparator(field, order));
List<FileDto> records = PageUtil.page(pageNo, pageSize, fileDtos);
page.setRecords(records).setTotal(fileDtos.size());
return Result.OK(page);

View File

@ -61,6 +61,7 @@ public class CalculateDataRateThread implements Runnable{
calculateDataRate.setParameter(mRateparam);
//根据台站编码 查询 台站信息
StationInfo stationInfo = calCulStationDataService.getStationInfo(originalstationsinfo.getStationCode());
stationInfo.setUsed(calCulStationDataService.getUsed(Integer.valueOf(stationInfo.getId())));
//赋值台站信息
calculateDataRate.setMStationId(stationInfo.getId());
calculateDataRate.setMStationCode(stationInfo.getStationCode());

View File

@ -4,6 +4,8 @@ import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.entity.data.ProvisionData;
import org.jeecg.modules.entity.data.StationInfo;
import java.util.List;
public interface CalCulStationInfoMapper {
StationInfo getStationInfo(@Param("stationCode") String stationCode);
@ -62,4 +64,6 @@ public interface CalCulStationInfoMapper {
ProvisionData findSphdMetSohProvisionParticulate(@Param("SPHD_NUM") String SPHD_NUM, @Param("MET_NUM") String MET_NUM, @Param("curDateTime") String curDateTime, @Param("pretime") String pretime, @Param("sphdMetSoh") String sphdMetSoh, @Param("stationId") String stationId);
List<Integer> getUsed(Integer stationId);
}

View File

@ -395,4 +395,8 @@
</where>
</select>
<select id="getUsed" resultType="java.lang.Integer">
SELECT DETECTOR_ID FROM CONFIGURATION.GARDS_DETECTORS WHERE STATION_ID = #{stationId} AND STATUS = 'Operating'
</select>
</mapper>

View File

@ -61,4 +61,6 @@ public interface ICalCulStationDataService {
ProvisionData findSphdMetSohProvisionParticulate(String SPHD_NUM, String MET_NUM, String curDateTime, String pretime, String sphdMetSoh,String stationId);
String getUsed(Integer stationId);
}

View File

@ -1,12 +1,18 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import org.jeecg.modules.entity.data.ProvisionData;
import org.jeecg.modules.entity.data.StationInfo;
import org.jeecg.modules.mapper.CalCulStationInfoMapper;
import org.jeecg.modules.service.ICalCulStationDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
@Service("calCulStationDataService")
@DS("ora")
@ -440,5 +446,13 @@ public class CalCulStationInfoServiceImpl implements ICalCulStationDataService {
return sphdMetSohProvision;
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public String getUsed(Integer stationId){
List<Integer> detectorIds = calCulStationInfoMapper.getUsed(stationId);
String result = CollectionUtils.isNotEmpty(detectorIds) ? "YES" : "NO";
return result;
}
}