修改web-statistics模块配置

新增分页查询颗粒物数据接口
新增分页查询状态数据接口
新增分页查询气象数据接口
This commit is contained in:
qiaoqinzheng 2023-06-05 15:54:05 +08:00
parent 07ce768733
commit 1095f9345b
17 changed files with 605 additions and 8 deletions

View File

@ -0,0 +1,48 @@
package org.jeecg.modules.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.GardsMetData;
import org.jeecg.modules.entity.GardsSampleData;
import org.jeecg.modules.entity.GardsSohData;
import org.jeecg.modules.service.IGardsMetDataService;
import org.jeecg.modules.service.IGardsSampleDataService;
import org.jeecg.modules.service.IGardsSohDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("webStatistics")
@Api(value = "统计分析管理", tags = "统计分析管理")
public class WebStatisticsController {
@Autowired
private IGardsSampleDataService gardsSampleDataService;
@Autowired
private IGardsMetDataService gardsMetDataService;
@Autowired
private IGardsSohDataService gardsSohDataService;
@GetMapping("findParticulatePage")
@ApiOperation(value = "颗粒物分页查询", notes = "颗粒物分页查询")
public Result findParticulatePage(QueryRequest queryRequest, GardsSampleData gardsSampleData){
return gardsSampleDataService.findParticulatePage(queryRequest, gardsSampleData);
}
@GetMapping("findMetPage")
@ApiOperation(value = "气象数据分页查询", notes = "气象数据分页查询")
public Result findMetPage(QueryRequest queryRequest, GardsMetData gardsMetData){
return gardsMetDataService.findMetPage(queryRequest, gardsMetData);
}
@GetMapping("findSohPage")
@ApiOperation(value = "状态数据分页查询", notes = "状态数据分页查询")
public Result findSohPage(QueryRequest queryRequest, GardsSohData gardsSohData){
return gardsSohDataService.findSohPage(queryRequest, gardsSohData);
}
}

View File

@ -0,0 +1,61 @@
package org.jeecg.modules.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName(value = "gards_met_data")
public class GardsMetData implements Serializable {
@TableField(value = "STATION_ID")
private Integer stationId;
@TableField(value = "STATION_CODE")
private String stationCode;
@TableField(value = "MET_ID")
private Integer metId;
@TableField(value = "START_TIME")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
@TableField(value = "END_TIME")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
@TableField(value = "AVE_HUMIDITY")
private Integer aveHumidity;
@TableField(value = "AVGTEMPERATURE")
private Integer avgtemperature;
@TableField(value = "AVE_PRESSURE")
private Integer avePressure;
@TableField(value = "AVE_WIND_DIR")
private Integer aveWindDir;
@TableField(value = "AVE_WIND_SPEED")
private Integer aveWindSpeed;
@TableField(value = "RAINFALL")
private Integer rainfall;
@TableField(value = "INPUT_FILE_NAME")
private String inputFileName;
@TableField(value = "MODDATE")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date moddate;
}

View File

@ -0,0 +1,91 @@
package org.jeecg.modules.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName(value = "gards_sample_data")
public class GardsSampleData implements Serializable {
@TableField(value = "SITE_DET_CODE")
private String siteDetCode;
@TableField(value = "SAMPLE_ID")
private Integer sampleId;
@TableField(value = "STATION_ID")
private Integer stationId;
@TableField(value = "DETECTOR_ID")
private Integer detectorId;
@TableField(value = "INPUT_FILE_NAME")
private String inputFileName;
@TableField(value = "SAMPLE_TYPE")
private String sampleType;
@TableField(value = "DATA_TYPE")
private String dataType;
@TableField(value = "GEOMETRY")
private String geometry;
@TableField(value = "SPECTRAL_QUALIFIE")
private String spectralQualifie;
@TableField(value = "TRANSMIT_DTG")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date transmitDtg;
@TableField(value = "COLLECT_START")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date collectStart;
@TableField(value = "COLLECT_STOP")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date collectStop;
@TableField(value = "ACQUISITION_START")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date acquisitionStart;
@TableField(value = "ACQUISITION_STOP")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date acquisitionStop;
@TableField(value = "ACQUISITION_REAL_SEC")
private Integer acquisitionRealSec;
@TableField(value = "ACQUISITION_LIVE_SEC")
private Integer acquisitionLiveSec;
@TableField(value = "QUANTITY")
private Integer quantity;
@TableField(value = "STATUS")
private String status;
@TableField(value = "MODDATE")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date moddate;
@TableField(exist = false)
private String stationName;
@TableField(exist = false)
private String detectorName;
}

View File

@ -0,0 +1,54 @@
package org.jeecg.modules.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName(value = "gards_soh_data")
public class GardsSohData implements Serializable {
@TableField(value = "STATION_ID")
private Integer stationId;
@TableField(value = "STATION_CODE")
private String stationCode;
@TableField(value = "SOH_ID")
private Integer sohId;
@TableField(value = "START_TIME")
private Date startTime;
@TableField(value = "TIME")
private Integer time;
@TableField(value = "AVGFLOWRATE")
private Integer avgflowrate;
@TableField(value = "FLOWRATEDEV")
private Integer flowratedev;
@TableField(value = "INPUT_FILE_NAME")
private String inputFileName;
@TableField(value = "DETECTOR_ID")
private Integer detectorId;
@TableField(value = "MODDATE")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date moddate;
@TableField(exist = false)
private String stationName;
@TableField(exist = false)
private String detectorName;
}

View File

@ -0,0 +1,7 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.entity.GardsMetData;
public interface GardsMetDataMapper extends BaseMapper<GardsMetData> {
}

View File

@ -0,0 +1,7 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.entity.GardsSampleData;
public interface GardsSampleDataMapper extends BaseMapper<GardsSampleData> {
}

View File

@ -0,0 +1,7 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.entity.GardsSohData;
public interface GardsSohDataMapper extends BaseMapper<GardsSohData> {
}

View File

@ -0,0 +1,12 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.GardsMetData;
public interface IGardsMetDataService extends IService<GardsMetData> {
Result findMetPage(QueryRequest queryRequest, GardsMetData gardsMetData);
}

View File

@ -0,0 +1,18 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.GardsSampleData;
public interface IGardsSampleDataService extends IService<GardsSampleData> {
/**
* 分页查询颗粒物相关数据
* @param queryRequest
* @param gardsSampleData
* @return
*/
Result findParticulatePage(QueryRequest queryRequest, GardsSampleData gardsSampleData);
}

View File

@ -0,0 +1,12 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.GardsSohData;
public interface IGardsSohDataService extends IService<GardsSohData> {
Result findSohPage(QueryRequest queryRequest, GardsSohData gardsSohData);
}

View File

@ -0,0 +1,34 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.GardsMetData;
import org.jeecg.modules.mapper.GardsMetDataMapper;
import org.jeecg.modules.service.IGardsMetDataService;
import org.springframework.stereotype.Service;
import java.util.Objects;
@Service("gardsMetDataService")
@DS("ori")
public class GardsMetDataServiceImpl extends ServiceImpl<GardsMetDataMapper, GardsMetData> implements IGardsMetDataService {
@Override
public Result findMetPage(QueryRequest queryRequest, GardsMetData gardsMetData) {
Result result = new Result();
Page<GardsMetData> page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize());
LambdaQueryWrapper<GardsMetData> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Objects.nonNull(gardsMetData.getStationId()), GardsMetData::getStationId, gardsMetData.getStationId());
queryWrapper.ge(Objects.nonNull(gardsMetData.getStartTime()), GardsMetData::getStartTime, gardsMetData.getStartTime());
queryWrapper.le(Objects.nonNull(gardsMetData.getEndTime()), GardsMetData::getEndTime, gardsMetData.getEndTime());
Page<GardsMetData> metDataPage = this.baseMapper.selectPage(page, queryWrapper);
result.setSuccess(true);
result.setResult(metDataPage);
return result;
}
}

View File

@ -0,0 +1,70 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.entity.GardsSampleData;
import org.jeecg.modules.mapper.GardsSampleDataMapper;
import org.jeecg.modules.service.IGardsSampleDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@Service("gardsSampleDataService")
@DS("ori")
public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMapper,GardsSampleData> implements IGardsSampleDataService {
@Autowired
private RedisUtil redisUtil;
@Override
public Result findParticulatePage(QueryRequest queryRequest, GardsSampleData gardsSampleData) {
Result result = new Result();
//获取redis中缓存的台站信息
Map<Integer, String> stationMap = (Map<Integer, String>)redisUtil.get("stationMap");
//获取redis中缓存的探测器信息
Map<Integer, String> detectorsMap = (Map<Integer, String>)redisUtil.get("detectorsMap");
if (StringUtils.isBlank(gardsSampleData.getSampleType())){
result.error500("系统类型不能为空");
return result;
}
if (StringUtils.isBlank(gardsSampleData.getDataType())) {
result.error500("数据类型不能为空");
return result;
}
//声明page
Page<GardsSampleData> page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize());
//声明Lambda 传递参数进行条件查询
LambdaQueryWrapper<GardsSampleData> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(GardsSampleData::getSampleType, gardsSampleData.getSampleType());
queryWrapper.eq(GardsSampleData::getDataType, gardsSampleData.getDataType());
queryWrapper.eq(Objects.nonNull(gardsSampleData.getStationId()), GardsSampleData::getStationId, gardsSampleData.getStationId());
queryWrapper.ge(Objects.nonNull(gardsSampleData.getAcquisitionStart()), GardsSampleData::getAcquisitionStart, gardsSampleData.getAcquisitionStart());
queryWrapper.le(Objects.nonNull(gardsSampleData.getAcquisitionStop()), GardsSampleData::getAcquisitionStop, gardsSampleData.getAcquisitionStop());
//进行分页查询
Page<GardsSampleData> sampleDataPage = this.baseMapper.selectPage(page, queryWrapper);
sampleDataPage.getRecords().forEach(item->{
if (stationMap.containsKey(item.getStationId().toString())){
String stationName = stationMap.get(item.getStationId().toString());
item.setStationName(stationName);
}
if (detectorsMap.containsKey(item.getDetectorId().toString())){
String detectorName = detectorsMap.get(item.getDetectorId().toString());
item.setDetectorName(detectorName);
}
});
result.setSuccess(true);
result.setResult(sampleDataPage);
return result;
}
}

View File

@ -0,0 +1,53 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.entity.GardsSohData;
import org.jeecg.modules.mapper.GardsSohDataMapper;
import org.jeecg.modules.service.IGardsSohDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.Objects;
@Service("gardsSohDataService")
@DS("ori")
public class GardsSohDataServiceImpl extends ServiceImpl<GardsSohDataMapper, GardsSohData> implements IGardsSohDataService {
@Autowired
private RedisUtil redisUtil;
@Override
public Result findSohPage(QueryRequest queryRequest, GardsSohData gardsSohData) {
Result result = new Result();
//获取redis中缓存的台站信息
Map<Integer, String> stationMap = (Map<Integer, String>)redisUtil.get("stationMap");
//获取redis中缓存的探测器信息
Map<Integer, String> detectorsMap = (Map<Integer, String>)redisUtil.get("detectorsMap");
Page<GardsSohData> page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize());
LambdaQueryWrapper<GardsSohData> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Objects.nonNull(gardsSohData.getStationId()), GardsSohData::getStationId, gardsSohData.getStationId());
Page<GardsSohData> sohDataPage = this.baseMapper.selectPage(page, queryWrapper);
sohDataPage.getRecords().forEach(item->{
if (Objects.nonNull(item.getStationId()) && stationMap.containsKey(item.getStationId().toString())){
String stationName = stationMap.get(item.getStationId().toString());
item.setStationName(stationName);
}
if (Objects.nonNull(item.getDetectorId()) && detectorsMap.containsKey(item.getDetectorId().toString())){
String detectorName = detectorsMap.get(item.getDetectorId().toString());
item.setDetectorName(detectorName);
}
});
result.setSuccess(true);
result.setResult(sohDataPage);
return result;
}
}

View File

@ -0,0 +1,73 @@
package org.jeecg.modules.system.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.jeecg.config.valid.InsertGroup;
import org.jeecg.config.valid.UpdateGroup;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("GARDS_DETECTORS")
public class GardsDetectors implements Serializable {
@TableField(value = "DETECTOR_ID")
private Integer detectorId;
@TableField(value = "DETECTOR_CODE")
private String detectorCode;
@TableField(value = "LON")
private Double lon;
@TableField(value = "LAT")
private Double lat;
@TableField(value = "TYPE")
private String type;
@TableField(value = "CHANNELS")
private Double channels;
@TableField(value = "RATED_EFFICIENCY")
private Double ratedEfficiency;
@TableField(value = "RATED_RESOLUTION")
private Double ratedResolution;
@TableField(value = "ECAL_RANGE_MAX")
private Double ecalRangeMax;
@TableField(value = "DATE_BEGIN")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date dateBegin;
@TableField(value = "DATE_END")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date dateEnd;
@TableField(value = "STATUS")
private String status;
@TableField(value = "DESCRIPTION")
private String description;
@TableField(value = "MODDATE")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date moddate;
@TableField(value = "STATION_ID")
private Integer stationId;
@TableField(exist = false)
private String stationName;
}

View File

@ -0,0 +1,57 @@
package org.jeecg.modules.system.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName(value = "GARDS_STATIONS")
public class GardsStations implements Serializable {
@TableField(value = "STATION_ID")
private Integer stationId;
@TableField(value = "STATION_CODE")
private String stationCode;
@TableField(value = "COUNTRY_CODE")
private String countryCode;
@TableField(value = "TYPE")
private String type;
@TableField(value = "LON")
private Double lon;
@TableField(value = "LAT")
private Double lat;
@TableField(value = "ELEVATION")
private Double elevation;
@TableField(value = "DESCRIPTION")
private String description;
@TableField(value = "DATE_BEGIN")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date dateBegin;
@TableField(value = "DATE_END")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date dateEnd;
@TableField(value = "STATUS")
private String status;
@TableField(value = "MODDATE")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date moddate;
}

View File

@ -1,7 +0,0 @@
package org.jeecgframework.boot;
public class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}

View File

@ -1,4 +1,4 @@
package org.jeecgframework.boot;
package org.jeecg;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.util.oConvertUtils;