diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/EmailConstant.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/EmailConstant.java new file mode 100644 index 00000000..b547a7ee --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/EmailConstant.java @@ -0,0 +1,9 @@ +package org.jeecg.common.constant; + +/** + * 邮件服务常量 + */ +public class EmailConstant { + + public static final String EMAIL_STATUS_PREFIX = "email_status"; +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/FTPUtil.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/FTPUtil.java index 44f2e925..22e7468e 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/FTPUtil.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/FTPUtil.java @@ -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)) { diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/SysEmail.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/SysEmail.java index b0a4f1f1..820cdccf 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/SysEmail.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/SysEmail.java @@ -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; /** * 创建日期 diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/SysEmailLog.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/SysEmailLog.java index c6086d6c..5e448f9f 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/SysEmailLog.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/SysEmailLog.java @@ -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; - } diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/AlarmContactGroupController.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/AlarmContactGroupController.java index 74c26810..0d2981dc 100644 --- a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/AlarmContactGroupController.java +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/AlarmContactGroupController.java @@ -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); } diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/AlarmRuleController.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/AlarmRuleController.java index f8ced280..7b49f9a8 100644 --- a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/AlarmRuleController.java +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/AlarmRuleController.java @@ -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); } diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/common/CacheName.java b/jeecg-module-station-operation/src/main/java/org/jeecg/common/CacheName.java index 8addb981..b4e775de 100644 --- a/jeecg-module-station-operation/src/main/java/org/jeecg/common/CacheName.java +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/common/CacheName.java @@ -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"; diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/common/StationTypeUtil.java b/jeecg-module-station-operation/src/main/java/org/jeecg/common/StationTypeUtil.java new file mode 100644 index 00000000..a4428678 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/common/StationTypeUtil.java @@ -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; + } + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/StationOperationController.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/StationOperationController.java index b678d849..3c46f9b0 100644 --- a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/StationOperationController.java +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/StationOperationController.java @@ -54,8 +54,8 @@ public class StationOperationController { @GetMapping("getDataReceivingStatus") @ApiOperation(value = "查询台站监测数据信息", notes = "查询台站监测数据信息") - public void getDataReceivingStatus(List stationIds){ - stationOperationService.getDataReceivingStatus(stationIds); + public void getDataReceivingStatus(String userId){ + stationOperationService.getDataReceivingStatus(userId); } } diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/SysUserFocusStationController.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/SysUserFocusStationController.java index 871c7653..85ef4324 100644 --- a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/SysUserFocusStationController.java +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/SysUserFocusStationController.java @@ -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); + } + + + } diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationReceivingConfig.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationReceivingConfig.java new file mode 100644 index 00000000..1983fe79 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationReceivingConfig.java @@ -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 sysUserFocusStations; + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/SysUserFocusStation.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/SysUserFocusStation.java index 3f5f582e..a0a52da5 100644 --- a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/SysUserFocusStation.java +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/SysUserFocusStation.java @@ -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; + } diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/UserFocusStation.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/UserFocusStation.java new file mode 100644 index 00000000..1d4fac58 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/UserFocusStation.java @@ -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 stationIds; + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationReceivingConfigMapper.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationReceivingConfigMapper.java new file mode 100644 index 00000000..f20a592a --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationReceivingConfigMapper.java @@ -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 { +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationSampleDataMapper.xml b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationSampleDataMapper.xml index 3e5a2707..42c6fb36 100644 --- a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationSampleDataMapper.xml +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationSampleDataMapper.xml @@ -21,8 +21,8 @@ and MODDATE >= TO_DATE(#{startDate}, 'YYYY-MM-DD hh24:mi:ss') - ORDER BY ACQUISITION_STOP + ORDER BY ACQUISITION_STOP \ No newline at end of file diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationSohDataMapper.xml b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationSohDataMapper.xml index 7de1c54f..9ce2b2a2 100644 --- a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationSohDataMapper.xml +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationSohDataMapper.xml @@ -20,7 +20,6 @@ and MODDATE >= TO_DATE(#{startDate}, 'YYYY-MM-DD hh24:mi:ss') - ORDER BY ACQUISITION_STOP diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/ICacheTimeService.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/ICacheTimeService.java index 2dcd6bae..5913222d 100644 --- a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/ICacheTimeService.java +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/ICacheTimeService.java @@ -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> findCacheTime(); @RequestMapping("/gardsDetectors/findStationDetectors") - Map> findStationDetectors(List stationIds); + Map> findStationDetectors(@RequestBody List stationIds); } diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/IStationOperationService.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/IStationOperationService.java index d978c305..c6043d52 100644 --- a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/IStationOperationService.java +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/IStationOperationService.java @@ -41,9 +41,9 @@ public interface IStationOperationService extends IService { /** * 查询台站监测数据 - * @param stationIds + * @param userId * @return */ - Result getDataReceivingStatus(List stationIds); + Result getDataReceivingStatus(String userId); } diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/ISysUserFocusStationService.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/ISysUserFocusStationService.java index 1d6a289c..2483c574 100644 --- a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/ISysUserFocusStationService.java +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/ISysUserFocusStationService.java @@ -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 IService200 && 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 stationInfoMap = (HashMap) redisUtil.get("stationInfoMap"); GardsStations stations = stationInfoMap.get(stationId); if (Objects.nonNull(stations)){ @@ -114,10 +110,13 @@ public class StationOperationServiceImpl extends ServiceImpl nuclearFacilityMap = (HashMap) 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 stationIds) { + public Result getDataReceivingStatus(String userId) { Result result = new Result(); //获取四项缓存数据的对应内容 List> cacheList = cacheTimeService.findCacheTime(); @@ -332,6 +331,11 @@ public class StationOperationServiceImpl extends ServiceImpl userFocusStationQueryWrapper = new LambdaQueryWrapper<>(); + userFocusStationQueryWrapper.eq(SysUserFocusStation::getUserId, userId); + List userFocusStations = sysUserFocusStationMapper.selectList(userFocusStationQueryWrapper); + List stationIds = userFocusStations.stream().map(SysUserFocusStation::getStationId).collect(Collectors.toList()); //从redis中获取台站信息 Map stationInfoMap = (Map)redisUtil.get("stationMap"); //从redis中获取探测器信息 diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/SysUserFocusStationServiceImpl.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/SysUserFocusStationServiceImpl.java index 6d8c6ce0..1f8253d3 100644 --- a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/SysUserFocusStationServiceImpl.java +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/SysUserFocusStationServiceImpl.java @@ -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 implements ISysUserFocusStationService { @@ -28,6 +36,10 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl findList() { @@ -39,8 +51,11 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl 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 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 queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(StationReceivingConfig::getUserId, userId); + StationReceivingConfig receivingConfig = stationReceivingConfigMapper.selectOne(queryWrapper); + //如果用户对应的缓存配置信息为空时,查询字典表中的默认值 + if (Objects.isNull(receivingConfig)){ + receivingConfig = new StationReceivingConfig(); + //调用接口获取数据库中对应缓存配置信息默认值 + List> 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 focusStationQueryWrapper = new LambdaQueryWrapper<>(); + focusStationQueryWrapper.eq(SysUserFocusStation::getUserId, userId); + List sysUserFocusStations = this.baseMapper.selectList(focusStationQueryWrapper); + if (Objects.nonNull(sysUserFocusStations)){ + receivingConfig.setSysUserFocusStations(sysUserFocusStations); + } + result.setSuccess(true); + result.setResult(receivingConfig); + return result; + } + } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsDetectorsController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsDetectorsController.java index 6b215005..57060a17 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsDetectorsController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsDetectorsController.java @@ -71,7 +71,7 @@ public class GardsDetectorsController { } @RequestMapping("findStationDetectors") - public Map> findStationDetectors(List stationIds){ + public Map> findStationDetectors(@RequestBody List stationIds){ return gardsDetectorsService.findStationDetectors(stationIds); } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsDetectorsServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsDetectorsServiceImpl.java index 85b6c1bf..697d10de 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsDetectorsServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsDetectorsServiceImpl.java @@ -154,9 +154,10 @@ public class GardsDetectorsServiceImpl extends ServiceImpl> map = new HashMap<>(); if (CollectionUtils.isNotEmpty(stationIds)){ LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.in(GardsDetectors::getStationId, stationIds); List detectorsList = this.baseMapper.selectList(queryWrapper); for (String stationId:stationIds) { - List detectors = detectorsList.stream().filter(item -> item.getStationId().equals(stationId) && item.getStatus().equals("Operating")).collect(Collectors.toList()); + List detectors = detectorsList.stream().filter(item -> item.getStationId().equals(Integer.valueOf(stationId)) && item.getStatus().trim().equals("Operating")).collect(Collectors.toList()); map.put(stationId, detectors); } }