update:完善

This commit is contained in:
nieziyan 2023-08-01 21:28:36 +08:00
parent 24b115744a
commit 8e9f2fc4e1
10 changed files with 46 additions and 36 deletions

3
.gitignore vendored
View File

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

View File

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

View File

@ -5,7 +5,7 @@ import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.base.entity.postgre.AlarmLog; import org.jeecg.modules.base.entity.postgre.AlarmLog;
import org.jeecg.modules.service.IAlarmLogService; 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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; 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 com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.base.entity.postgre.AlarmLog; 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> { 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.entity.AlarmHistory;
import org.jeecg.modules.mapper.AlarmLogMapper; import org.jeecg.modules.mapper.AlarmLogMapper;
import org.jeecg.modules.service.IAlarmLogService; 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 org.springframework.stereotype.Service;
import java.time.LocalDate; import java.time.LocalDate;

View File

@ -846,7 +846,7 @@ public class CalculateStationData {
if( threadNum == works ){ if( threadNum == works ){
countDownLatch = new CountDownLatch(threadNum); countDownLatch = new CountDownLatch(threadNum);
//遍历台站信息 //遍历台站信息
for (int i=0 ; i<stationInfos.size(); i++){ for (int i = 0 ; i < works; i++){
//获取台站信息 //获取台站信息
StationInfo stationInfo = stationInfos.get(i); StationInfo stationInfo = stationInfos.get(i);
//声明一个实体类 //声明一个实体类
@ -872,28 +872,28 @@ public class CalculateStationData {
//声明一个变量 看当前台站信息需要分为多少组 //声明一个变量 看当前台站信息需要分为多少组
int Tworks = 0; int Tworks = 0;
//如果当前需要处理的台站数量是线程数量的整数倍 //如果当前需要处理的台站数量是线程数量的整数倍
if(works%threadNum == 0){ if(works % threadNum == 0){
//变量值 等于 需要处理的台站数量与线程数的商 //变量值 等于 需要处理的台站数量与线程数的商
Tworks = works/threadNum; // 300 30 10 Tworks = works / threadNum; // 300 30 10
} else { } else {
// 变量值 等于 需要处理的台站数量与线程数的商 +1 // 变量值 等于 需要处理的台站数量与线程数的商 +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<>(); List<StationInfo> infos = new ArrayList<>();
int startIndex = i * threadNum; 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); infos = stationInfos.subList(startIndex, endIndex);
}else {//如果超出台站数量 则从截取开始下标 截取到台站数组长度 }else {//如果超出台站数量 则从截取开始下标 截取到台站数组长度
infos = stationInfos.subList(startIndex, stationInfos.size()); infos = stationInfos.subList(startIndex, works);
} }
countDownLatch = new CountDownLatch(infos.size()); 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); StationInfo stationInfo = infos.get(j);
//声明一个实体类 //声明一个实体类
@ -904,7 +904,7 @@ public class CalculateStationData {
//调用线程计算率值 //调用线程计算率值
poolExecutor.execute(calculateDataRateThread); poolExecutor.execute(calculateDataRateThread);
} }
if (i==Tworks-1){ if (i == Tworks - 1){
try { try {
countDownLatch.await(); countDownLatch.await();
} catch (InterruptedException e) { } 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; return finallySta;
} }
} }

View File

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

View File

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

View File

@ -2,6 +2,7 @@ package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.base.entity.original.GardsSampleData;
import org.jeecg.modules.entity.GardsSampleDataWeb; import org.jeecg.modules.entity.GardsSampleDataWeb;
import java.util.List; 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"> <!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"> <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 SELECT
sam.SITE_DET_CODE, sam.SITE_DET_CODE,
sam.SAMPLE_ID, sam.SAMPLE_ID,
@ -41,7 +41,7 @@
</where> </where>
</select> </select>
<select id="findReviewedPage" resultType="org.jeecg.modules.base.entity.original.GardsSampleData"> <select id="findReviewedPage" resultType="org.jeecg.modules.entity.GardsSampleDataWeb">
SELECT SELECT
sam.SITE_DET_CODE, sam.SITE_DET_CODE,
sam.SAMPLE_ID, sam.SAMPLE_ID,