Merge remote-tracking branch 'origin/station' into station
# Conflicts: # jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/SysEmailLog.java
This commit is contained in:
commit
ab96c858fc
|
@ -0,0 +1,9 @@
|
|||
package org.jeecg.common.constant;
|
||||
|
||||
/**
|
||||
* 邮件服务常量
|
||||
*/
|
||||
public class EmailConstant {
|
||||
|
||||
public static final String EMAIL_STATUS_PREFIX = "email_status";
|
||||
}
|
|
@ -50,11 +50,9 @@ public class FTPUtil {
|
|||
// 切换为本地被动模式,可以解决FTP上传后文件为空的问题,但需要服务器将FTP服务添加至防火墙白名单
|
||||
ftp.enterLocalPassiveMode();
|
||||
//连接
|
||||
ftp.connect("182.92.183.230", 21);
|
||||
// ftp.connect(host, port);
|
||||
ftp.connect(host, port);
|
||||
//登录
|
||||
ftp.login("xiao", "123456");
|
||||
// ftp.login(userName, password);
|
||||
ftp.login(userName, password);
|
||||
//判断是否连接成功
|
||||
int reply = ftp.getReplyCode();
|
||||
if (!FTPReply.isPositiveCompletion(reply)) {
|
||||
|
|
|
@ -22,10 +22,10 @@ public class SysEmail implements Serializable {
|
|||
private String id;
|
||||
|
||||
/**
|
||||
* 邮箱名称
|
||||
* email服务地址
|
||||
*/
|
||||
@TableField(value = "name")
|
||||
private String name;
|
||||
@TableField(value = "email_server_address")
|
||||
private String emailServerAddress;
|
||||
|
||||
/**
|
||||
* 邮箱类型(1-收件地址,2-发件地址)
|
||||
|
@ -34,7 +34,7 @@ public class SysEmail implements Serializable {
|
|||
private Integer emilType;
|
||||
|
||||
/**
|
||||
* email地址
|
||||
* 邮箱登录名称
|
||||
*/
|
||||
@TableField(value = "username")
|
||||
private String username;
|
||||
|
@ -49,7 +49,7 @@ public class SysEmail implements Serializable {
|
|||
* 端口
|
||||
*/
|
||||
@TableField(value = "port")
|
||||
private String port;
|
||||
private Integer port;
|
||||
|
||||
/**
|
||||
* 是否启用邮箱(0-不启用,1-启用)
|
||||
|
@ -58,10 +58,10 @@ public class SysEmail implements Serializable {
|
|||
private Integer enabled;
|
||||
|
||||
/**
|
||||
* 监测周期(秒)
|
||||
* 定时获取邮件时间周期(秒)
|
||||
*/
|
||||
@TableField(value = "monitoring_cycle")
|
||||
private Integer monitoringCycle;
|
||||
@TableField(value = "receive_mail_fixed_cycle")
|
||||
private Integer receiveMailFixedCycle;
|
||||
|
||||
/**
|
||||
* 创建日期
|
||||
|
|
|
@ -12,6 +12,9 @@ import java.io.Serializable;
|
|||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 邮件接收日志数据表
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "sys_email_log")
|
||||
public class SysEmailLog implements Serializable {
|
||||
|
@ -19,23 +22,37 @@ public class SysEmailLog implements Serializable {
|
|||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 邮件id
|
||||
*/
|
||||
@TableField(value = "email_id")
|
||||
private String emailId;
|
||||
|
||||
/**
|
||||
* 邮件主题
|
||||
*/
|
||||
@TableField(value = "subject")
|
||||
private String subject;
|
||||
|
||||
/**
|
||||
* 邮件内容
|
||||
*/
|
||||
@TableField(value = "context")
|
||||
private String context;
|
||||
|
||||
/**
|
||||
* 接收时间
|
||||
*/
|
||||
@TableField(value = "receive_time")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime receiveTime;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "create_time")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
|
|
|
@ -23,13 +23,13 @@ public class AlarmContactGroupController {
|
|||
|
||||
@GetMapping("findInfo")
|
||||
@ApiOperation(value = "查询报警联系人组信息详情", notes = "查询报警联系人组信息详情")
|
||||
public Result findPage(String id){
|
||||
public Result findInfo(String id){
|
||||
return alarmContactGroupService.findInfo(id);
|
||||
}
|
||||
|
||||
@PostMapping("create")
|
||||
@ApiOperation(value = "新增报警人联系人组", notes = "新增报警联系人组")
|
||||
public Result findPage(@RequestBody AlarmContactGroup alarmContactGroup){
|
||||
public Result create(@RequestBody AlarmContactGroup alarmContactGroup){
|
||||
return alarmContactGroupService.create(alarmContactGroup);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,13 +26,13 @@ public class AlarmRuleController {
|
|||
|
||||
@GetMapping("findInfo")
|
||||
@ApiOperation(value = "查看规则信息详情", notes = "查看规则信息详情")
|
||||
public Result findPage(String id){
|
||||
public Result findInfo(String id){
|
||||
return alarmRuleService.findInfo(id);
|
||||
}
|
||||
|
||||
@PostMapping("create")
|
||||
@ApiOperation(value = "新增规则信息", notes = "新增规则信息")
|
||||
public Result findPage(@RequestBody AlarmRule alarmRule){
|
||||
public Result create(@RequestBody AlarmRule alarmRule){
|
||||
return alarmRuleService.create(alarmRule);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ public class CacheName {
|
|||
|
||||
public static final String scaleInterval = "Scale interval";
|
||||
|
||||
public static final String timelineLength = "Timeline length ";
|
||||
public static final String timelineLength = "Timeline length";
|
||||
|
||||
public static final String updateIntervalTime = "Update interval time";
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package org.jeecg.common;
|
||||
|
||||
public class StationTypeUtil {
|
||||
|
||||
public static String getStationType(Integer stationId){
|
||||
String stationType = "";
|
||||
if (stationId<=200){
|
||||
stationType = "IMS STATION(P)";
|
||||
}else if(stationId>200 && stationId<=300){
|
||||
stationType = "IMS STATION(G)";
|
||||
}else if(stationId>300){
|
||||
stationType = "NRL";
|
||||
}
|
||||
return stationType;
|
||||
}
|
||||
|
||||
}
|
|
@ -54,8 +54,8 @@ public class StationOperationController {
|
|||
|
||||
@GetMapping("getDataReceivingStatus")
|
||||
@ApiOperation(value = "查询台站监测数据信息", notes = "查询台站监测数据信息")
|
||||
public void getDataReceivingStatus(List<String> stationIds){
|
||||
stationOperationService.getDataReceivingStatus(stationIds);
|
||||
public void getDataReceivingStatus(String userId){
|
||||
stationOperationService.getDataReceivingStatus(userId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import io.swagger.annotations.ApiOperation;
|
|||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.config.valid.InsertGroup;
|
||||
import org.jeecg.modules.entity.SysUserFocusStation;
|
||||
import org.jeecg.modules.entity.UserFocusStation;
|
||||
import org.jeecg.modules.service.ISysUserFocusStationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
@ -27,10 +28,10 @@ public class SysUserFocusStationController {
|
|||
return result;
|
||||
}
|
||||
|
||||
@PostMapping("create")
|
||||
@ApiOperation(value = "新增关注", notes = "新增关注")
|
||||
public Result create(@RequestBody @Validated(value = InsertGroup.class) SysUserFocusStation sysUserFocusStation){
|
||||
return sysUserFocusStationService.create(sysUserFocusStation);
|
||||
@PostMapping("saveUserFocusByUserId")
|
||||
@ApiOperation(value = "保存用户关注台站及缓存配置信息", notes = "保存用户关注台站及缓存配置信息")
|
||||
public Result create(@RequestBody UserFocusStation userFocusStation){
|
||||
return sysUserFocusStationService.create(userFocusStation);
|
||||
}
|
||||
|
||||
@DeleteMapping("deleteById")
|
||||
|
@ -39,4 +40,12 @@ public class SysUserFocusStationController {
|
|||
return sysUserFocusStationService.deleteById(stationId);
|
||||
}
|
||||
|
||||
@GetMapping("findUserFocusByUserId")
|
||||
@ApiOperation(value = "根据用户id查询用户的缓存配置信息及关注台站信息", notes = "根据用户id查询用户的缓存配置信息及关注台站信息")
|
||||
public Result findUserFocusByUserId(String userId){
|
||||
return sysUserFocusStationService.findUserFocusByUserId(userId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
package org.jeecg.modules.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@TableName(value = "station_receiving_config")
|
||||
public class StationReceivingConfig implements Serializable {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableField(value = "user_id")
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 缓存时间
|
||||
*/
|
||||
@TableField(value = "cache_time")
|
||||
private Double cacheTime;
|
||||
|
||||
/**
|
||||
* 间隔缩放
|
||||
*/
|
||||
@TableField(value = "scale_interval")
|
||||
private Double scaleInterval;
|
||||
|
||||
/**
|
||||
* 时间线长度
|
||||
*/
|
||||
@TableField(value = "timeline_length")
|
||||
private Double timelineLength;
|
||||
|
||||
/**
|
||||
* 更新间隔时间
|
||||
*/
|
||||
@TableField(value = "update_interval_time")
|
||||
private Double updateIntervalTime;
|
||||
|
||||
/**
|
||||
* 用户关注台站信息
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
List<SysUserFocusStation> sysUserFocusStations;
|
||||
|
||||
}
|
|
@ -41,9 +41,9 @@ public class SysUserFocusStation implements Serializable {
|
|||
/**
|
||||
* 类型
|
||||
*/
|
||||
@TableField(value = "type")
|
||||
@TableField(value = "station_type")
|
||||
@NotBlank(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
||||
private String type;
|
||||
private String stationType;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
|
@ -58,15 +58,21 @@ public class SysUserFocusStation implements Serializable {
|
|||
private String createBy;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
* 经度
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Double lon;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
* 纬度
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Double lat;
|
||||
|
||||
/**
|
||||
* 海拔
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String altitude;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package org.jeecg.modules.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class UserFocusStation implements Serializable {
|
||||
|
||||
/**
|
||||
* 缓存时间
|
||||
*/
|
||||
private Double cacheTime;
|
||||
|
||||
/**
|
||||
* 间隔缩放
|
||||
*/
|
||||
private Double scaleInterval;
|
||||
|
||||
/**
|
||||
* 时间线长度
|
||||
*/
|
||||
private Double timelineLength;
|
||||
|
||||
/**
|
||||
* 更新间隔时间
|
||||
*/
|
||||
private Double updateIntervalTime;
|
||||
|
||||
/**
|
||||
* 台站id集合
|
||||
*/
|
||||
private List<Integer> stationIds;
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package org.jeecg.modules.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.entity.StationReceivingConfig;
|
||||
|
||||
public interface StationReceivingConfigMapper extends BaseMapper<StationReceivingConfig> {
|
||||
}
|
|
@ -21,8 +21,8 @@
|
|||
<if test=" startDate!=null and startDate!='' ">
|
||||
and MODDATE >= TO_DATE(#{startDate}, 'YYYY-MM-DD hh24:mi:ss')
|
||||
</if>
|
||||
ORDER BY ACQUISITION_STOP
|
||||
</where>
|
||||
ORDER BY ACQUISITION_STOP
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -20,7 +20,6 @@
|
|||
<if test=" startDate!=null and startDate!='' ">
|
||||
and MODDATE >= TO_DATE(#{startDate}, 'YYYY-MM-DD hh24:mi:ss')
|
||||
</if>
|
||||
ORDER BY ACQUISITION_STOP
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.jeecg.modules.service;
|
|||
import org.jeecg.modules.system.entity.GardsDetectors;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -16,6 +17,6 @@ public interface ICacheTimeService {
|
|||
List<Map<String, String>> findCacheTime();
|
||||
|
||||
@RequestMapping("/gardsDetectors/findStationDetectors")
|
||||
Map<String, List<GardsDetectors>> findStationDetectors(List<String> stationIds);
|
||||
Map<String, List<GardsDetectors>> findStationDetectors(@RequestBody List<String> stationIds);
|
||||
|
||||
}
|
||||
|
|
|
@ -41,9 +41,9 @@ public interface IStationOperationService extends IService<StationOperation> {
|
|||
|
||||
/**
|
||||
* 查询台站监测数据
|
||||
* @param stationIds
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
Result getDataReceivingStatus(List<String> stationIds);
|
||||
Result getDataReceivingStatus(String userId);
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +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.entity.SysUserFocusStation;
|
||||
import org.jeecg.modules.entity.UserFocusStation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -16,9 +17,9 @@ public interface ISysUserFocusStationService extends IService<SysUserFocusStatio
|
|||
|
||||
/**
|
||||
* 新增关注的台站,核设施信息
|
||||
* @param sysUserFocusStation
|
||||
* @param userFocusStation
|
||||
*/
|
||||
Result create(SysUserFocusStation sysUserFocusStation);
|
||||
Result create(UserFocusStation userFocusStation);
|
||||
|
||||
/**
|
||||
* 取消关注
|
||||
|
@ -26,4 +27,11 @@ public interface ISysUserFocusStationService extends IService<SysUserFocusStatio
|
|||
*/
|
||||
Result deleteById(String stationId);
|
||||
|
||||
/**
|
||||
* 根据用户id查询对应的缓存配置信息
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
Result findUserFocusByUserId(String userId);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
@ -8,20 +9,18 @@ import com.spatial4j.core.distance.DistanceUtils;
|
|||
import com.spatial4j.core.shape.Rectangle;
|
||||
import org.jeecg.common.CacheName;
|
||||
import org.jeecg.common.PointUtil;
|
||||
import org.jeecg.common.StationTypeUtil;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.modules.base.entity.GardsMetData;
|
||||
import org.jeecg.modules.base.entity.GardsSampleData;
|
||||
import org.jeecg.modules.base.entity.GardsSohData;
|
||||
import org.jeecg.modules.entity.*;
|
||||
import org.jeecg.modules.mapper.StationMetDataMapper;
|
||||
import org.jeecg.modules.mapper.StationSampleDataMapper;
|
||||
import org.jeecg.modules.mapper.StationSohDataMapper;
|
||||
import org.jeecg.modules.mapper.*;
|
||||
import org.jeecg.modules.service.ICacheTimeService;
|
||||
import org.jeecg.modules.system.entity.GardsDetectors;
|
||||
import org.jeecg.modules.system.entity.GardsNuclearfacility;
|
||||
import org.jeecg.modules.system.entity.GardsStations;
|
||||
import org.jeecg.modules.mapper.StationOperationMapper;
|
||||
import org.jeecg.modules.service.IStationOperationService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -46,6 +45,8 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
|
|||
private StationSohDataMapper stationSohDataMapper;
|
||||
@Autowired
|
||||
private StationMetDataMapper stationMetDataMapper;
|
||||
@Autowired
|
||||
private SysUserFocusStationMapper sysUserFocusStationMapper;
|
||||
|
||||
private final SpatialContext spatialContext = SpatialContext.GEO;
|
||||
|
||||
|
@ -64,13 +65,8 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
|
|||
StationOperation stationOperation = new StationOperation();
|
||||
stationOperation.setStationId(gardsStation.getStationId());
|
||||
stationOperation.setStationName(gardsStation.getStationCode());
|
||||
if (gardsStation.getStationId()<=200){
|
||||
stationOperation.setStationType("IMS STATION(P)");
|
||||
}else if(gardsStation.getStationId()>200 && gardsStation.getStationId()<=300){
|
||||
stationOperation.setStationType("IMS STATION(G)");
|
||||
}else if(gardsStation.getStationId()>300){
|
||||
stationOperation.setStationType("NRL");
|
||||
}
|
||||
String stationType = StationTypeUtil.getStationType(gardsStation.getStationId());
|
||||
stationOperation.setStationType(stationType);
|
||||
stationOperation.setAltitude(Objects.isNull(gardsStation.getElevation())?"":gardsStation.getElevation()+"m");
|
||||
stationOperation.setLon(String.valueOf(gardsStation.getLon()));
|
||||
stationOperation.setLat(String.valueOf(gardsStation.getLat()));
|
||||
|
@ -103,7 +99,7 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
|
|||
@Override
|
||||
public Result findInfo(String stationId, String type) {
|
||||
Result result = new Result();
|
||||
if (type.equals("IMS STATION(P)") || type.equals("IMS STATION(G)")){
|
||||
if (type.equals("IMS STATION(P)") || type.equals("IMS STATION(G)") || type.equals("NRL")){
|
||||
HashMap<String, GardsStations> stationInfoMap = (HashMap<String, GardsStations>) redisUtil.get("stationInfoMap");
|
||||
GardsStations stations = stationInfoMap.get(stationId);
|
||||
if (Objects.nonNull(stations)){
|
||||
|
@ -114,10 +110,13 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
|
|||
}
|
||||
}else if(type.equals("Nuclear Facility")){
|
||||
HashMap<String, GardsNuclearfacility> nuclearFacilityMap = (HashMap<String, GardsNuclearfacility>) redisUtil.get("nuclearFacilityMap");
|
||||
//从缓存的核设施map中获取对应的核设施信息
|
||||
GardsNuclearfacility nuclearfacility = nuclearFacilityMap.get(stationId);
|
||||
if (Objects.nonNull(nuclearfacility)){
|
||||
nuclearfacility.setLongitude(PointUtil.calculate(nuclearfacility.getLatitude()));
|
||||
nuclearfacility.setLatitude(PointUtil.calculate(nuclearfacility.getLongitude()));
|
||||
String longitude = nuclearfacility.getLongitude();
|
||||
String latitude = nuclearfacility.getLatitude();
|
||||
nuclearfacility.setLongitude(PointUtil.calculate(latitude));
|
||||
nuclearfacility.setLatitude(PointUtil.calculate(longitude));
|
||||
result.setResult(nuclearfacility);
|
||||
result.setSuccess(true);
|
||||
}else {
|
||||
|
@ -316,7 +315,7 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result getDataReceivingStatus(List<String> stationIds) {
|
||||
public Result getDataReceivingStatus(String userId) {
|
||||
Result result = new Result();
|
||||
//获取四项缓存数据的对应内容
|
||||
List<Map<String, String>> cacheList = cacheTimeService.findCacheTime();
|
||||
|
@ -332,6 +331,11 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
|
|||
result.error500("缓存时间不能为空");
|
||||
return result;
|
||||
}
|
||||
//根据用户id查询出当前用户关注的台站信息
|
||||
LambdaQueryWrapper<SysUserFocusStation> userFocusStationQueryWrapper = new LambdaQueryWrapper<>();
|
||||
userFocusStationQueryWrapper.eq(SysUserFocusStation::getUserId, userId);
|
||||
List<SysUserFocusStation> userFocusStations = sysUserFocusStationMapper.selectList(userFocusStationQueryWrapper);
|
||||
List<String> stationIds = userFocusStations.stream().map(SysUserFocusStation::getStationId).collect(Collectors.toList());
|
||||
//从redis中获取台站信息
|
||||
Map<Integer, String> stationInfoMap = (Map<Integer, String>)redisUtil.get("stationMap");
|
||||
//从redis中获取探测器信息
|
||||
|
|
|
@ -3,15 +3,22 @@ package org.jeecg.modules.service.impl;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.CacheName;
|
||||
import org.jeecg.common.StationTypeUtil;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.modules.entity.StationReceivingConfig;
|
||||
import org.jeecg.modules.entity.SysUser;
|
||||
import org.jeecg.modules.entity.SysUserFocusStation;
|
||||
import org.jeecg.modules.entity.UserFocusStation;
|
||||
import org.jeecg.modules.mapper.StationReceivingConfigMapper;
|
||||
import org.jeecg.modules.mapper.SysUserFocusStationMapper;
|
||||
import org.jeecg.modules.mapper.SysUserMapper;
|
||||
import org.jeecg.modules.service.ICacheTimeService;
|
||||
import org.jeecg.modules.service.ISysUserFocusStationService;
|
||||
import org.jeecg.modules.system.entity.GardsStations;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -20,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service("sysUserFocusStationService")
|
||||
public class SysUserFocusStationServiceImpl extends ServiceImpl<SysUserFocusStationMapper, SysUserFocusStation> implements ISysUserFocusStationService {
|
||||
|
@ -28,6 +36,10 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl<SysUserFocusStat
|
|||
private RedisUtil redisUtil;
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
@Autowired
|
||||
private ICacheTimeService cacheTimeService;
|
||||
@Autowired
|
||||
private StationReceivingConfigMapper stationReceivingConfigMapper;
|
||||
|
||||
@Override
|
||||
public List<SysUserFocusStation> findList() {
|
||||
|
@ -39,8 +51,11 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl<SysUserFocusStat
|
|||
if (CollectionUtils.isNotEmpty(stationInfoMap)){
|
||||
if (Objects.nonNull(stationInfoMap.get(item.getStationId()))){
|
||||
GardsStations stations = (GardsStations) stationInfoMap.get(item.getStationId());
|
||||
String stationType = StationTypeUtil.getStationType(stations.getStationId());
|
||||
item.setStationType(stationType);
|
||||
item.setLon(stations.getLon());
|
||||
item.setLat(stations.getLat());
|
||||
item.setAltitude(Objects.isNull(stations.getElevation())?"":stations.getElevation()+"m");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -51,7 +66,7 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl<SysUserFocusStat
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public Result create(SysUserFocusStation sysUserFocusStation) {
|
||||
public Result create(UserFocusStation userFocusStation) {
|
||||
Result result = new Result();
|
||||
//获取request
|
||||
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
|
||||
|
@ -65,12 +80,49 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl<SysUserFocusStat
|
|||
result.error500("当前用户不存在!");
|
||||
return result;
|
||||
}
|
||||
Long id = IdWorker.getId();
|
||||
sysUserFocusStation.setId(String.valueOf(id));
|
||||
sysUserFocusStation.setUserId(sysUser.getId());
|
||||
sysUserFocusStation.setCreateTime(new Date());
|
||||
sysUserFocusStation.setCreateBy(username);
|
||||
this.baseMapper.insert(sysUserFocusStation);
|
||||
//判断传递参数信息是否为空
|
||||
if (Objects.nonNull(userFocusStation)){
|
||||
//通过用户id判断是否存在用户的缓存配置信息
|
||||
LambdaQueryWrapper<StationReceivingConfig> receivingConfigQueryWrapper = new LambdaQueryWrapper<>();
|
||||
receivingConfigQueryWrapper.eq(StationReceivingConfig::getUserId, sysUser.getId());
|
||||
StationReceivingConfig receivingConfig = stationReceivingConfigMapper.selectOne(receivingConfigQueryWrapper);
|
||||
//如果没有对应的用户缓存信息 则进行新增
|
||||
if (Objects.isNull(receivingConfig)){
|
||||
receivingConfig = new StationReceivingConfig();
|
||||
Long id = IdWorker.getId();
|
||||
receivingConfig.setId(id.toString());
|
||||
receivingConfig.setUserId(sysUser.getId());
|
||||
receivingConfig.setCacheTime(userFocusStation.getCacheTime());
|
||||
receivingConfig.setScaleInterval(userFocusStation.getScaleInterval());
|
||||
receivingConfig.setTimelineLength(userFocusStation.getTimelineLength());
|
||||
receivingConfig.setUpdateIntervalTime(userFocusStation.getUpdateIntervalTime());
|
||||
stationReceivingConfigMapper.insert(receivingConfig);
|
||||
}else {
|
||||
receivingConfig.setCacheTime(userFocusStation.getCacheTime());
|
||||
receivingConfig.setScaleInterval(userFocusStation.getScaleInterval());
|
||||
receivingConfig.setTimelineLength(userFocusStation.getTimelineLength());
|
||||
receivingConfig.setUpdateIntervalTime(userFocusStation.getUpdateIntervalTime());
|
||||
stationReceivingConfigMapper.updateById(receivingConfig);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(userFocusStation.getStationIds())){
|
||||
//根据用户id查询出对应的用户关注台站信息 删除用户的所有关注台站信息并重新保存
|
||||
LambdaQueryWrapper<SysUserFocusStation> userFocusStationQueryWrapper = new LambdaQueryWrapper<>();
|
||||
userFocusStationQueryWrapper.eq(SysUserFocusStation::getUserId, sysUser.getId());
|
||||
this.baseMapper.delete(userFocusStationQueryWrapper);
|
||||
for (Integer stationId:userFocusStation.getStationIds()) {
|
||||
SysUserFocusStation sysUserFocusStation = new SysUserFocusStation();
|
||||
Long id = IdWorker.getId();
|
||||
sysUserFocusStation.setId(String.valueOf(id));
|
||||
sysUserFocusStation.setUserId(sysUser.getId());
|
||||
sysUserFocusStation.setStationId(String.valueOf(stationId));
|
||||
String stationType = StationTypeUtil.getStationType(stationId);
|
||||
sysUserFocusStation.setStationType(stationType);
|
||||
sysUserFocusStation.setCreateTime(new Date());
|
||||
sysUserFocusStation.setCreateBy(username);
|
||||
this.baseMapper.insert(sysUserFocusStation);
|
||||
}
|
||||
}
|
||||
result.success("新增成功");
|
||||
return result;
|
||||
}
|
||||
|
@ -99,4 +151,44 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl<SysUserFocusStat
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result findUserFocusByUserId(String userId) {
|
||||
Result result = new Result();
|
||||
//根据用户id查询存储的缓存配置信息
|
||||
LambdaQueryWrapper<StationReceivingConfig> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(StationReceivingConfig::getUserId, userId);
|
||||
StationReceivingConfig receivingConfig = stationReceivingConfigMapper.selectOne(queryWrapper);
|
||||
//如果用户对应的缓存配置信息为空时,查询字典表中的默认值
|
||||
if (Objects.isNull(receivingConfig)){
|
||||
receivingConfig = new StationReceivingConfig();
|
||||
//调用接口获取数据库中对应缓存配置信息默认值
|
||||
List<Map<String, String>> cacheList = cacheTimeService.findCacheTime();
|
||||
for (int i=0; i< cacheList.size(); i++){
|
||||
if ( StringUtils.isNotBlank(cacheList.get(i).get(CacheName.cacheTime)) ){
|
||||
String cacheTime = cacheList.get(i).get(CacheName.cacheTime);
|
||||
receivingConfig.setCacheTime(Double.valueOf(cacheTime));
|
||||
}else if ( StringUtils.isNotBlank(cacheList.get(i).get(CacheName.scaleInterval)) ){
|
||||
String scaleInterval = cacheList.get(i).get(CacheName.scaleInterval);
|
||||
receivingConfig.setScaleInterval(Double.valueOf(scaleInterval));
|
||||
}else if ( StringUtils.isNotBlank(cacheList.get(i).get(CacheName.timelineLength)) ){
|
||||
String timelineLength = cacheList.get(i).get(CacheName.timelineLength);
|
||||
receivingConfig.setTimelineLength(Double.valueOf(timelineLength));
|
||||
}else if ( StringUtils.isNotBlank(cacheList.get(i).get(CacheName.updateIntervalTime)) ){
|
||||
String updateIntervalTime = cacheList.get(i).get(CacheName.updateIntervalTime);
|
||||
receivingConfig.setUpdateIntervalTime(Double.valueOf(updateIntervalTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
//根据用户id查询出用户的关注台站信息
|
||||
LambdaQueryWrapper<SysUserFocusStation> focusStationQueryWrapper = new LambdaQueryWrapper<>();
|
||||
focusStationQueryWrapper.eq(SysUserFocusStation::getUserId, userId);
|
||||
List<SysUserFocusStation> sysUserFocusStations = this.baseMapper.selectList(focusStationQueryWrapper);
|
||||
if (Objects.nonNull(sysUserFocusStations)){
|
||||
receivingConfig.setSysUserFocusStations(sysUserFocusStations);
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setResult(receivingConfig);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public class GardsDetectorsController {
|
|||
}
|
||||
|
||||
@RequestMapping("findStationDetectors")
|
||||
public Map<String, List<GardsDetectors>> findStationDetectors(List<String> stationIds){
|
||||
public Map<String, List<GardsDetectors>> findStationDetectors(@RequestBody List<String> stationIds){
|
||||
return gardsDetectorsService.findStationDetectors(stationIds);
|
||||
}
|
||||
|
||||
|
|
|
@ -154,9 +154,10 @@ public class GardsDetectorsServiceImpl extends ServiceImpl<GardsDetectorsMapper,
|
|||
Map<String, List<GardsDetectors>> map = new HashMap<>();
|
||||
if (CollectionUtils.isNotEmpty(stationIds)){
|
||||
LambdaQueryWrapper<GardsDetectors> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(GardsDetectors::getStationId, stationIds);
|
||||
List<GardsDetectors> detectorsList = this.baseMapper.selectList(queryWrapper);
|
||||
for (String stationId:stationIds) {
|
||||
List<GardsDetectors> detectors = detectorsList.stream().filter(item -> item.getStationId().equals(stationId) && item.getStatus().equals("Operating")).collect(Collectors.toList());
|
||||
List<GardsDetectors> detectors = detectorsList.stream().filter(item -> item.getStationId().equals(Integer.valueOf(stationId)) && item.getStatus().trim().equals("Operating")).collect(Collectors.toList());
|
||||
map.put(stationId, detectors);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user