核设施新增查询全部信息,存入redis的接口
台站,探测器,核设施新增,修改,删除操作成功后更新redis数据 系统启动类增加存储核设施接口 修改台站运行管理下查询台站信息,核设施全部信息接口 台站运行管理新增查询台站详情信息接口
This commit is contained in:
parent
2ff56f704f
commit
f2c26efebc
|
@ -2,6 +2,7 @@ package org.jeecg.modules.controller;
|
||||||
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.modules.entity.StationOperation;
|
import org.jeecg.modules.entity.StationOperation;
|
||||||
import org.jeecg.modules.service.IStationOperationService;
|
import org.jeecg.modules.service.IStationOperationService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -26,5 +27,11 @@ public class StationOperationController {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("findInfo")
|
||||||
|
@ApiOperation(value = "查询台站/核设施详情信息", notes = "查询台站/核设施详情信息")
|
||||||
|
public Result findInfo(String stationId, String type){
|
||||||
|
Result result = stationOperationService.findInfo(stationId, type);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,20 +7,44 @@ import java.io.Serializable;
|
||||||
@Data
|
@Data
|
||||||
public class StationOperation implements Serializable {
|
public class StationOperation implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 台站/核设施id
|
||||||
|
*/
|
||||||
private Integer stationId;
|
private Integer stationId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 台站/核设施名称
|
||||||
|
*/
|
||||||
private String stationName;
|
private String stationName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 台站/核设施类型
|
||||||
|
*/
|
||||||
private String stationType;
|
private String stationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 海拔
|
||||||
|
*/
|
||||||
private String altitude;
|
private String altitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经度
|
||||||
|
*/
|
||||||
private String lon;
|
private String lon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 纬度
|
||||||
|
*/
|
||||||
private String lat;
|
private String lat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标记
|
||||||
|
*/
|
||||||
private String signal;
|
private String signal;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
package org.jeecg.modules.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import org.jeecg.modules.entity.GardsNuclearfacility;
|
|
||||||
|
|
||||||
public interface GardsNuclearfacilityMapper extends BaseMapper<GardsNuclearfacility> {
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
package org.jeecg.modules.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import org.jeecg.modules.entity.GardsStations;
|
|
||||||
|
|
||||||
public interface GardsStationsMapper extends BaseMapper<GardsStations> {
|
|
||||||
}
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.jeecg.modules.service;
|
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.modules.entity.StationOperation;
|
import org.jeecg.modules.entity.StationOperation;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -9,5 +10,6 @@ public interface IStationOperationService extends IService<StationOperation> {
|
||||||
|
|
||||||
List<StationOperation> findList(String status);
|
List<StationOperation> findList(String status);
|
||||||
|
|
||||||
|
Result findInfo(String stationId, String type);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,83 +1,98 @@
|
||||||
package org.jeecg.modules.service.impl;
|
package org.jeecg.modules.service.impl;
|
||||||
|
|
||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
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;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.modules.entity.GardsNuclearfacility;
|
import org.jeecg.common.util.RedisUtil;
|
||||||
import org.jeecg.modules.entity.GardsStations;
|
import org.jeecg.modules.system.entity.GardsNuclearfacility;
|
||||||
|
import org.jeecg.modules.system.entity.GardsStations;
|
||||||
import org.jeecg.modules.entity.StationOperation;
|
import org.jeecg.modules.entity.StationOperation;
|
||||||
import org.jeecg.modules.mapper.GardsNuclearfacilityMapper;
|
|
||||||
import org.jeecg.modules.mapper.GardsStationsMapper;
|
|
||||||
import org.jeecg.modules.mapper.StationOperationMapper;
|
import org.jeecg.modules.mapper.StationOperationMapper;
|
||||||
import org.jeecg.modules.service.IStationOperationService;
|
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 java.util.LinkedList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service("stationOperationService")
|
@Service("stationOperationService")
|
||||||
@DS("ora")
|
@DS("ora")
|
||||||
public class StationOperationServiceImpl extends ServiceImpl<StationOperationMapper, StationOperation> implements IStationOperationService {
|
public class StationOperationServiceImpl extends ServiceImpl<StationOperationMapper, StationOperation> implements IStationOperationService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private GardsStationsMapper gardsStationsMapper;
|
private RedisUtil redisUtil;
|
||||||
@Autowired
|
|
||||||
private GardsNuclearfacilityMapper gardsNuclearfacilityMapper;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<StationOperation> findList(String status) {
|
public List<StationOperation> findList(String status) {
|
||||||
//声明结果集合
|
//声明结果集合
|
||||||
List<StationOperation> result = new LinkedList<>();
|
List<StationOperation> result = new LinkedList<>();
|
||||||
//查询全部台站信息
|
//查询全部台站信息
|
||||||
List<GardsStations> stations = this.findStations();
|
HashMap<String, Object> stationInfoMap = (HashMap<String, Object>) redisUtil.get("stationInfoMap");
|
||||||
for (GardsStations gardsStation:stations) {
|
|
||||||
StationOperation stationOperation = new StationOperation();
|
|
||||||
stationOperation.setStationId(gardsStation.getStationId());
|
|
||||||
stationOperation.setStationName(gardsStation.getStationCode());
|
|
||||||
stationOperation.setStationType("IMS STATION");
|
|
||||||
stationOperation.setAltitude(Objects.isNull(gardsStation.getElevation())?"":gardsStation.getElevation()+"米");
|
|
||||||
stationOperation.setLon(String.valueOf(gardsStation.getLon()));
|
|
||||||
stationOperation.setLat(String.valueOf(gardsStation.getLat()));
|
|
||||||
stationOperation.setStatus(gardsStation.getStatus());
|
|
||||||
result.add(stationOperation);
|
|
||||||
}
|
|
||||||
//查询全部核设施信息
|
//查询全部核设施信息
|
||||||
List<GardsNuclearfacility> nuclearfacilities = this.findNuclearfacilities();
|
HashMap<String, Object> nuclearFacilityMap = (HashMap<String, Object>) redisUtil.get("nuclearFacilityMap");
|
||||||
for (GardsNuclearfacility nuclearfacility:nuclearfacilities) {
|
//遍历台站信息
|
||||||
StationOperation stationOperation = new StationOperation();
|
if (CollectionUtils.isNotEmpty(stationInfoMap)){
|
||||||
stationOperation.setStationId(nuclearfacility.getFacilityId());
|
for (Map.Entry<String, Object> gardsStations:stationInfoMap.entrySet()) {
|
||||||
stationOperation.setStationName(nuclearfacility.getFacilityName());
|
GardsStations gardsStation = (GardsStations)gardsStations.getValue();
|
||||||
stationOperation.setStationType("Nuclear Facility");
|
StationOperation stationOperation = new StationOperation();
|
||||||
stationOperation.setAltitude("--");
|
stationOperation.setStationId(gardsStation.getStationId());
|
||||||
stationOperation.setLon(nuclearfacility.getLongitude());
|
stationOperation.setStationName(gardsStation.getStationCode());
|
||||||
stationOperation.setLat(nuclearfacility.getLatitude());
|
stationOperation.setStationType("IMS STATION");
|
||||||
stationOperation.setStatus(nuclearfacility.getStatus());
|
stationOperation.setAltitude(Objects.isNull(gardsStation.getElevation())?"":gardsStation.getElevation()+"米");
|
||||||
result.add(stationOperation);
|
stationOperation.setLon(String.valueOf(gardsStation.getLon()));
|
||||||
|
stationOperation.setLat(String.valueOf(gardsStation.getLat()));
|
||||||
|
stationOperation.setStatus(gardsStation.getStatus());
|
||||||
|
result.add(stationOperation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//如果状态不为空
|
if (CollectionUtils.isNotEmpty(nuclearFacilityMap)){
|
||||||
|
//遍历核设施信息
|
||||||
|
for (Map.Entry<String, Object> nuclearfacilities:nuclearFacilityMap.entrySet()) {
|
||||||
|
GardsNuclearfacility nuclearfacility = (GardsNuclearfacility)nuclearfacilities.getValue();
|
||||||
|
StationOperation stationOperation = new StationOperation();
|
||||||
|
stationOperation.setStationId(nuclearfacility.getFacilityId());
|
||||||
|
stationOperation.setStationName(nuclearfacility.getFacilityName());
|
||||||
|
stationOperation.setStationType("Nuclear Facility");
|
||||||
|
stationOperation.setAltitude("--");
|
||||||
|
stationOperation.setLon(nuclearfacility.getLongitude());
|
||||||
|
stationOperation.setLat(nuclearfacility.getLatitude());
|
||||||
|
stationOperation.setStatus(nuclearfacility.getStatus());
|
||||||
|
result.add(stationOperation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//如果类型不为空
|
||||||
if (StringUtils.isNotBlank(status)){
|
if (StringUtils.isNotBlank(status)){
|
||||||
result = result.stream().filter(item-> item.getStatus().equals(status)).collect(Collectors.toList());
|
result = result.stream().filter(item-> StringUtils.isNotBlank(item.getStatus())&&item.getStatus().equalsIgnoreCase(status)).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* 查询全部台站信息
|
public Result findInfo(String stationId, String type) {
|
||||||
* @return
|
Result result = new Result();
|
||||||
*/
|
if (type.equals("IMS STATION")){
|
||||||
private List<GardsStations> findStations(){
|
HashMap<String, GardsStations> stationInfoMap = (HashMap<String, GardsStations>) redisUtil.get("stationInfoMap");
|
||||||
LambdaQueryWrapper<GardsStations> queryWrapper = new LambdaQueryWrapper<>();
|
GardsStations stations = stationInfoMap.get(stationId);
|
||||||
List<GardsStations> gardsStations = gardsStationsMapper.selectList(queryWrapper);
|
if (Objects.nonNull(stations)){
|
||||||
return gardsStations;
|
result.setResult(stations);
|
||||||
}
|
result.setSuccess(true);
|
||||||
|
}else {
|
||||||
private List<GardsNuclearfacility> findNuclearfacilities(){
|
result.error500("台站下对应信息不存在");
|
||||||
LambdaQueryWrapper<GardsNuclearfacility> queryWrapper = new LambdaQueryWrapper<>();
|
}
|
||||||
List<GardsNuclearfacility> gardsNuclearfacilities = gardsNuclearfacilityMapper.selectList(queryWrapper);
|
}else if(type.equals("Nuclear Facility")){
|
||||||
return gardsNuclearfacilities;
|
HashMap<String, GardsNuclearfacility> nuclearFacilityMap = (HashMap<String, GardsNuclearfacility>) redisUtil.get("nuclearFacilityMap");
|
||||||
|
GardsNuclearfacility nuclearfacility = nuclearFacilityMap.get(stationId);
|
||||||
|
if (Objects.nonNull(nuclearfacility)){
|
||||||
|
result.setResult(nuclearfacility);
|
||||||
|
result.setSuccess(true);
|
||||||
|
}else {
|
||||||
|
result.error500("核设施下对应信息不存在");
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
result.error500("当前类型不存在");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.system.util.JwtUtil;
|
import org.jeecg.common.system.util.JwtUtil;
|
||||||
import org.jeecg.common.util.SpringContextUtils;
|
import org.jeecg.common.util.SpringContextUtils;
|
||||||
import org.jeecg.modules.entity.GardsStations;
|
|
||||||
import org.jeecg.modules.entity.SysUser;
|
import org.jeecg.modules.entity.SysUser;
|
||||||
import org.jeecg.modules.entity.SysUserFocusStation;
|
import org.jeecg.modules.entity.SysUserFocusStation;
|
||||||
import org.jeecg.modules.mapper.SysUserFocusStationMapper;
|
import org.jeecg.modules.mapper.SysUserFocusStationMapper;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.jeecg.modules.entity;
|
package org.jeecg.modules.system.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.jeecg.modules.entity;
|
package org.jeecg.modules.system.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
|
@ -55,6 +55,6 @@ public interface IGardsDetectorsService extends IService<GardsDetectors> {
|
||||||
* 查询全部监测器信息
|
* 查询全部监测器信息
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<GardsDetectors> findDetectors();
|
void findDetectors();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,4 +58,8 @@ public interface IGardsNuclearfacilityService extends IService<GardsNuclearfacil
|
||||||
*/
|
*/
|
||||||
Result deleteById(Integer id);
|
Result deleteById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部核设施信息
|
||||||
|
*/
|
||||||
|
void findNuclearFacility();
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
import java.util.stream.Collectors;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
@Service("gardsDetectorsService")
|
@Service("gardsDetectorsService")
|
||||||
@DS("ora")
|
@DS("ora")
|
||||||
|
@ -98,6 +96,7 @@ public class GardsDetectorsServiceImpl extends ServiceImpl<GardsDetectorsMapper,
|
||||||
}
|
}
|
||||||
this.baseMapper.insert(gardsDetectors);
|
this.baseMapper.insert(gardsDetectors);
|
||||||
result.success("新增成功");
|
result.success("新增成功");
|
||||||
|
this.findDetectors();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,6 +123,7 @@ public class GardsDetectorsServiceImpl extends ServiceImpl<GardsDetectorsMapper,
|
||||||
detectorsQueryWrapper.eq(GardsDetectors::getDetectorId, gardsDetectors.getDetectorId());
|
detectorsQueryWrapper.eq(GardsDetectors::getDetectorId, gardsDetectors.getDetectorId());
|
||||||
this.baseMapper.update(gardsDetectors, detectorsQueryWrapper);
|
this.baseMapper.update(gardsDetectors, detectorsQueryWrapper);
|
||||||
result.success("修改成功");
|
result.success("修改成功");
|
||||||
|
this.findDetectors();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,20 +134,18 @@ public class GardsDetectorsServiceImpl extends ServiceImpl<GardsDetectorsMapper,
|
||||||
queryWrapper.eq(GardsDetectors::getDetectorId, id);
|
queryWrapper.eq(GardsDetectors::getDetectorId, id);
|
||||||
this.baseMapper.delete(queryWrapper);
|
this.baseMapper.delete(queryWrapper);
|
||||||
result.success("删除成功");
|
result.success("删除成功");
|
||||||
|
this.findDetectors();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||||
public List<GardsDetectors> findDetectors(){
|
public void findDetectors(){
|
||||||
List<GardsDetectors> gardsDetectors = this.baseMapper.selectList(new LambdaQueryWrapper<>());
|
if (redisUtil.hasKey("detectorsMap")){
|
||||||
HashMap<Integer, String> map = new HashMap<>();
|
redisUtil.del("detectorsMap");
|
||||||
if (CollectionUtils.isNotEmpty(gardsDetectors)){
|
|
||||||
for (GardsDetectors detectors:gardsDetectors) {
|
|
||||||
map.put(detectors.getDetectorId(),detectors.getDetectorCode());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
redisUtil.set("detectorsMap",map);
|
List<GardsDetectors> gardsDetectors = this.baseMapper.selectList(new LambdaQueryWrapper<>());
|
||||||
return gardsDetectors;
|
Map<Integer, String> detectorsMap = gardsDetectors.stream().collect(Collectors.toMap(GardsDetectors::getDetectorId, GardsDetectors::getDetectorCode));
|
||||||
|
redisUtil.set("detectorsMap",detectorsMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,12 +9,15 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.jeecg.common.api.QueryRequest;
|
import org.jeecg.common.api.QueryRequest;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.util.RedisUtil;
|
||||||
import org.jeecg.modules.system.entity.GardsNuclearfacility;
|
import org.jeecg.modules.system.entity.GardsNuclearfacility;
|
||||||
import org.jeecg.modules.system.mapper.GardsNuclearfacilityMapper;
|
import org.jeecg.modules.system.mapper.GardsNuclearfacilityMapper;
|
||||||
import org.jeecg.modules.system.service.IGardsNuclearfacilityService;
|
import org.jeecg.modules.system.service.IGardsNuclearfacilityService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -23,6 +26,9 @@ import java.util.stream.Collectors;
|
||||||
@DS("ora")
|
@DS("ora")
|
||||||
public class GardsNuclearfacilityServiceImpl extends ServiceImpl<GardsNuclearfacilityMapper, GardsNuclearfacility> implements IGardsNuclearfacilityService {
|
public class GardsNuclearfacilityServiceImpl extends ServiceImpl<GardsNuclearfacilityMapper, GardsNuclearfacility> implements IGardsNuclearfacilityService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisUtil redisUtil;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<IPage<GardsNuclearfacility>> findPage(QueryRequest queryRequest, GardsNuclearfacility gardsNuclearfacility) {
|
public Result<IPage<GardsNuclearfacility>> findPage(QueryRequest queryRequest, GardsNuclearfacility gardsNuclearfacility) {
|
||||||
Result<IPage<GardsNuclearfacility>> result = new Result<>();
|
Result<IPage<GardsNuclearfacility>> result = new Result<>();
|
||||||
|
@ -76,6 +82,7 @@ public class GardsNuclearfacilityServiceImpl extends ServiceImpl<GardsNuclearfac
|
||||||
}
|
}
|
||||||
this.baseMapper.insert(gardsNuclearfacility);
|
this.baseMapper.insert(gardsNuclearfacility);
|
||||||
result.success("新增成功");
|
result.success("新增成功");
|
||||||
|
this.findNuclearFacility();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,6 +110,7 @@ public class GardsNuclearfacilityServiceImpl extends ServiceImpl<GardsNuclearfac
|
||||||
nuclearfacilityQueryWrapper.eq(GardsNuclearfacility::getFacilityId, gardsNuclearfacility.getFacilityId());
|
nuclearfacilityQueryWrapper.eq(GardsNuclearfacility::getFacilityId, gardsNuclearfacility.getFacilityId());
|
||||||
this.baseMapper.update(gardsNuclearfacility, nuclearfacilityQueryWrapper);
|
this.baseMapper.update(gardsNuclearfacility, nuclearfacilityQueryWrapper);
|
||||||
result.success("修改成功");
|
result.success("修改成功");
|
||||||
|
this.findNuclearFacility();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +122,23 @@ public class GardsNuclearfacilityServiceImpl extends ServiceImpl<GardsNuclearfac
|
||||||
queryWrapper.eq(GardsNuclearfacility::getFacilityId, id);
|
queryWrapper.eq(GardsNuclearfacility::getFacilityId, id);
|
||||||
this.baseMapper.delete(queryWrapper);
|
this.baseMapper.delete(queryWrapper);
|
||||||
result.success("删除成功");
|
result.success("删除成功");
|
||||||
|
this.findNuclearFacility();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void findNuclearFacility() {
|
||||||
|
if (redisUtil.hasKey("nuclearFacilityMap")){
|
||||||
|
redisUtil.del("nuclearFacilityMap");
|
||||||
|
}
|
||||||
|
LambdaQueryWrapper<GardsNuclearfacility> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
List<GardsNuclearfacility> gardsNuclearfacilities = this.baseMapper.selectList(queryWrapper);
|
||||||
|
HashMap<String, Object> nuclearFacilityMap = new HashMap<>();
|
||||||
|
for (GardsNuclearfacility gardsNuclearfacility:gardsNuclearfacilities) {
|
||||||
|
nuclearFacilityMap.put(String.valueOf(gardsNuclearfacility.getFacilityId()), gardsNuclearfacility);
|
||||||
|
}
|
||||||
|
redisUtil.set("nuclearFacilityMap",nuclearFacilityMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service("gardsStationsService")
|
@Service("gardsStationsService")
|
||||||
@DS("ora")
|
@DS("ora")
|
||||||
|
@ -100,6 +102,7 @@ public class GardsStationsServiceImpl extends ServiceImpl<GardsStationsMapper, G
|
||||||
this.baseMapper.insert(gardsStations);
|
this.baseMapper.insert(gardsStations);
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.success("新增成功");
|
result.success("新增成功");
|
||||||
|
this.getGardsStations();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,6 +136,7 @@ public class GardsStationsServiceImpl extends ServiceImpl<GardsStationsMapper, G
|
||||||
this.baseMapper.update(gardsStations, stationsQueryWrapper);
|
this.baseMapper.update(gardsStations, stationsQueryWrapper);
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.success("修改成功");
|
result.success("修改成功");
|
||||||
|
this.getGardsStations();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,6 +153,7 @@ public class GardsStationsServiceImpl extends ServiceImpl<GardsStationsMapper, G
|
||||||
this.baseMapper.delete(wrapper);
|
this.baseMapper.delete(wrapper);
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.success("删除成功");
|
result.success("删除成功");
|
||||||
|
this.getGardsStations();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,14 +164,22 @@ public class GardsStationsServiceImpl extends ServiceImpl<GardsStationsMapper, G
|
||||||
@Override
|
@Override
|
||||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||||
public List<GardsStations> getGardsStations() {
|
public List<GardsStations> getGardsStations() {
|
||||||
|
if (redisUtil.hasKey("stationMap")){
|
||||||
|
redisUtil.del("stationMap");
|
||||||
|
}
|
||||||
|
if (redisUtil.hasKey("stationInfoMap")) {
|
||||||
|
redisUtil.del("stationInfoMap");
|
||||||
|
}
|
||||||
List<GardsStations> gardsStations = this.baseMapper.selectList(new LambdaQueryWrapper<>());
|
List<GardsStations> gardsStations = this.baseMapper.selectList(new LambdaQueryWrapper<>());
|
||||||
HashMap<Integer, String> map = new HashMap<>();
|
Map<Integer, String> stationMap = gardsStations.stream().collect(Collectors.toMap(GardsStations::getStationId, GardsStations::getStationCode));
|
||||||
|
HashMap<Integer, Object> stationInfoMap = new HashMap<>();
|
||||||
if (CollectionUtils.isNotEmpty(gardsStations)){
|
if (CollectionUtils.isNotEmpty(gardsStations)){
|
||||||
for (GardsStations station:gardsStations) {
|
for (GardsStations station:gardsStations) {
|
||||||
map.put(station.getStationId(),station.getStationCode());
|
stationInfoMap.put(station.getStationId(),station);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
redisUtil.set("stationMap",map);
|
redisUtil.set("stationMap",stationMap);
|
||||||
|
redisUtil.set("stationInfoMap",stationInfoMap);
|
||||||
return gardsStations;
|
return gardsStations;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import org.jeecg.common.base.BaseMap;
|
||||||
import org.jeecg.common.constant.GlobalConstants;
|
import org.jeecg.common.constant.GlobalConstants;
|
||||||
import org.jeecg.common.util.oConvertUtils;
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
import org.jeecg.modules.system.service.IGardsDetectorsService;
|
import org.jeecg.modules.system.service.IGardsDetectorsService;
|
||||||
|
import org.jeecg.modules.system.service.IGardsNuclearfacilityService;
|
||||||
import org.jeecg.modules.system.service.IGardsStationsService;
|
import org.jeecg.modules.system.service.IGardsStationsService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.CommandLineRunner;
|
import org.springframework.boot.CommandLineRunner;
|
||||||
|
@ -39,6 +40,8 @@ public class JeecgSystemCloudApplication extends SpringBootServletInitializer im
|
||||||
private IGardsStationsService gardsStationsService;
|
private IGardsStationsService gardsStationsService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IGardsDetectorsService gardsDetectorsService;
|
private IGardsDetectorsService gardsDetectorsService;
|
||||||
|
@Autowired
|
||||||
|
private IGardsNuclearfacilityService gardsNuclearfacilityService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||||
|
@ -76,5 +79,7 @@ public class JeecgSystemCloudApplication extends SpringBootServletInitializer im
|
||||||
gardsStationsService.getGardsStations();
|
gardsStationsService.getGardsStations();
|
||||||
//触发缓存一下探测器信息
|
//触发缓存一下探测器信息
|
||||||
gardsDetectorsService.findDetectors();
|
gardsDetectorsService.findDetectors();
|
||||||
|
//触发缓存一下核设施信息
|
||||||
|
gardsNuclearfacilityService.findNuclearFacility();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user