Merge remote-tracking branch 'origin/station' into station

This commit is contained in:
qiaoqinzheng 2023-08-02 10:36:07 +08:00
commit 614e0205d0
10 changed files with 46 additions and 36 deletions

3
.gitignore vendored
View File

@ -9,3 +9,6 @@ rebel.xml
## front
**/*.lock
## json
/json/

View File

@ -1,4 +1,4 @@
package org.jeecg.modules.vo;
package org.jeecg.modules.base.vo;
import lombok.Data;
import org.jeecg.common.api.QueryRequest;
@ -9,10 +9,15 @@ import java.util.List;
@Data
public class AlarmVo extends QueryRequest implements Serializable {
private String name;
private List<String> type;
private String startDate;
private String endDate;
private Integer pageStart;
// 标记根据条件查询但不进行分页
private String pageFlag;
}

View File

@ -5,7 +5,7 @@ import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.base.entity.postgre.AlarmLog;
import org.jeecg.modules.service.IAlarmLogService;
import org.jeecg.modules.vo.AlarmVo;
import org.jeecg.modules.base.vo.AlarmVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

View File

@ -3,7 +3,7 @@ package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.base.entity.postgre.AlarmLog;
import org.jeecg.modules.vo.AlarmVo;
import org.jeecg.modules.base.vo.AlarmVo;
public interface IAlarmLogService extends IService<AlarmLog> {

View File

@ -16,7 +16,7 @@ import org.jeecg.modules.base.entity.postgre.AlarmLog;
import org.jeecg.modules.entity.AlarmHistory;
import org.jeecg.modules.mapper.AlarmLogMapper;
import org.jeecg.modules.service.IAlarmLogService;
import org.jeecg.modules.vo.AlarmVo;
import org.jeecg.modules.base.vo.AlarmVo;
import org.springframework.stereotype.Service;
import java.time.LocalDate;

View File

@ -846,7 +846,7 @@ public class CalculateStationData {
if( threadNum == works ){
countDownLatch = new CountDownLatch(threadNum);
//遍历台站信息
for (int i=0 ; i<stationInfos.size(); i++){
for (int i = 0 ; i < works; i++){
//获取台站信息
StationInfo stationInfo = stationInfos.get(i);
//声明一个实体类
@ -872,28 +872,28 @@ public class CalculateStationData {
//声明一个变量 看当前台站信息需要分为多少组
int Tworks = 0;
//如果当前需要处理的台站数量是线程数量的整数倍
if(works%threadNum == 0){
if(works % threadNum == 0){
//变量值 等于 需要处理的台站数量与线程数的商
Tworks = works/threadNum; // 300 30 10
Tworks = works / threadNum; // 300 30 10
} else {
// 变量值 等于 需要处理的台站数量与线程数的商 +1
Tworks = works/threadNum + 1; // 301 30 11
Tworks = works / threadNum + 1; // 301 30 11
}
//遍历需要查询的组数
for (int i=0; i<Tworks; i++){
for (int i = 0; i < Tworks; i++){
//根据每组的台站大小 分割台站数组
List<StationInfo> infos = new ArrayList<>();
int startIndex = i * threadNum;
int endIndex = ((i + 1) * threadNum) - 1;
int endIndex = ((i + 1) * threadNum);
//判断当前结束下标是否超出台站数量 没有超出说明还在范围内 正常截取数组
if (endIndex <= stationInfos.size()){
if (endIndex <= works){
infos = stationInfos.subList(startIndex, endIndex);
}else {//如果超出台站数量 则从截取开始下标 截取到台站数组长度
infos = stationInfos.subList(startIndex, stationInfos.size());
infos = stationInfos.subList(startIndex, works);
}
countDownLatch = new CountDownLatch(infos.size());
//遍历当前组的台站并进行计算
for (int j=0; j<infos.size(); j++){
for (int j = 0; j < infos.size(); j++){
//获取台站信息
StationInfo stationInfo = infos.get(j);
//声明一个实体类
@ -904,7 +904,7 @@ public class CalculateStationData {
//调用线程计算率值
poolExecutor.execute(calculateDataRateThread);
}
if (i==Tworks-1){
if (i == Tworks - 1){
try {
countDownLatch.await();
} catch (InterruptedException e) {
@ -924,13 +924,6 @@ public class CalculateStationData {
}
}
}
//声明一个结束时间
Date endTime = new Date();
long diffTime = (endTime.getTime() - startTime.getTime())/1000;
log.info("获取台站信息和数据率总耗时:"+diffTime);
return finallySta;
}
}

View File

@ -27,7 +27,7 @@ public class StationOperationController {
}
@GetMapping("findList")
@ApiOperation(value = "查询所有台站/核设施信息", notes = "查询所有台站/核设施信息")
@ApiOperation(value = "查询台站/核设施信息", notes = "查询台站/核设施信息")
public List<StationOperation> findList(String status, String stationType){
List<StationOperation> result = stationOperationService.findList(status, stationType);
return result;

View File

@ -28,6 +28,7 @@ import org.jeecg.modules.service.IStationOperationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@ -38,18 +39,25 @@ import java.util.stream.Collectors;
public class StationOperationServiceImpl extends ServiceImpl<StationOperationMapper, StationOperation> implements IStationOperationService {
@Autowired
private RedisUtil redisUtil;
@Autowired
private ICacheTimeService cacheTimeService;
@Autowired
@Resource
private StationSampleDataMapper stationSampleDataMapper;
@Autowired
@Resource
private StationSohDataMapper stationSohDataMapper;
@Autowired
@Resource
private StationMetDataMapper stationMetDataMapper;
@Autowired
@Resource
private SysUserFocusStationMapper sysUserFocusStationMapper;
@Autowired
private StationTypeUtil stationTypeUtil;
@Autowired
private CalculateStationData calCulateStationData;
@ -518,13 +526,14 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
@Override
public Result getDataProvisionEfficiency() {
Result result = new Result();
//获取所有的台站信息
// 获取所有的台站信息
HashMap<String, GardsStations> stationInfoMap = (HashMap<String, GardsStations>) redisUtil.get("stationInfoMap");
//获取所有的台站信息
List<GardsStations> stations = stationInfoMap.values().stream().sorted(Comparator.comparing(GardsStations::getStationId)).collect(Collectors.toList());
// 获取所有的台站信息
List<GardsStations> stations = stationInfoMap.values().stream()
.sorted(Comparator.comparing(GardsStations::getStationId))
.collect(Collectors.toList());
List<StationInfo> stationInfos = new ArrayList<>();
for (GardsStations gardsStations:stations) {
for (GardsStations gardsStations : stations) {
StationInfo stationInfo = new StationInfo();
stationInfo.setStationCode(gardsStations.getStationCode());
stationInfo.setCountryCode(gardsStations.getCountryCode());
@ -532,9 +541,8 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
}
RateParam mRateParam = calCulateStationData.initParameter();
List<StationInfo> stationInfoList = calCulateStationData.mutiThreadGetStationInfo(stationInfos,mRateParam);
result.setSuccess(true);
result.setResult(stationInfoList);
return result;
return Result.OK(stationInfoList);
}
}

View File

@ -2,6 +2,7 @@ package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.base.entity.original.GardsSampleData;
import org.jeecg.modules.entity.GardsSampleDataWeb;
import java.util.List;

View File

@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mapper.GardsSampleDataWebMapper">
<select id="findAutoPage" resultType="org.jeecg.modules.base.entity.original.GardsSampleData">
<select id="findAutoPage" resultType="org.jeecg.modules.entity.GardsSampleDataWeb">
SELECT
sam.SITE_DET_CODE,
sam.SAMPLE_ID,
@ -41,7 +41,7 @@
</where>
</select>
<select id="findReviewedPage" resultType="org.jeecg.modules.base.entity.original.GardsSampleData">
<select id="findReviewedPage" resultType="org.jeecg.modules.entity.GardsSampleDataWeb">
SELECT
sam.SITE_DET_CODE,
sam.SAMPLE_ID,