台站实体类增加字段category判断台站类型

台站运行管理查询台站信息时,台站类型增加根据category字段判断是否是自建台站车/船
关注台站列表存储,查询时调用台站类型查询方法修改
This commit is contained in:
qiaoqinzheng 2024-03-06 15:01:56 +08:00
parent 6ac9576cb1
commit 0b0856f687
4 changed files with 18 additions and 6 deletions

View File

@ -98,4 +98,7 @@ public class GardsStations implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date moddate;
@TableField(value = "CATEGORY")
private Integer category;
}

View File

@ -20,13 +20,19 @@ public class StationTypeUtil {
return stationTypes;
}
public String getStationType(Integer stationId){
public String getStationType(Integer stationId, Integer category){
String type = "";
List<StationType> stationTypeList = stationType.getTypes();
for (StationType stationType:stationTypeList) {
if (StringUtils.isNotBlank(stationType.getMinId()) && StringUtils.isNotBlank(stationType.getMaxId())){
if (stationId>Integer.valueOf(stationType.getMinId()) && stationId<=Integer.valueOf(stationType.getMaxId())){
type = stationType.getName();
if (category == 3) {
type = "Car";
} else if (category == 4) {
type = "Ship";
} else {
type = stationType.getName();
}
}
}
}

View File

@ -85,7 +85,7 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
StationOperation stationOperation = new StationOperation();
stationOperation.setStationId(gardsStation.getStationId());
stationOperation.setStationName(gardsStation.getStationCode());
stationOperation.setStationType(stationTypeUtil.getStationType(gardsStation.getStationId()));
stationOperation.setStationType(stationTypeUtil.getStationType(gardsStation.getStationId(), gardsStation.getCategory()));
stationOperation.setAltitude(Objects.isNull(gardsStation.getElevation())?"--":gardsStation.getElevation()+"m");
stationOperation.setLon(String.valueOf(gardsStation.getLon()));
stationOperation.setLat(String.valueOf(gardsStation.getLat()));

View File

@ -65,6 +65,8 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl<SysUserFocusStat
@Transactional
public Result create(UserFocusStation userFocusStation) {
Result result = new Result();
//查询全部台站信息
HashMap<String, Object> stationInfoMap = (HashMap<String, Object>) redisUtil.get("stationInfoMap");
//获取request
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
//获取当前操作人用户名
@ -101,12 +103,13 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl<SysUserFocusStat
this.baseMapper.delete(userFocusStationQueryWrapper);
List<SysUserFocusStationStation> focusStationStationList = new LinkedList<>();
for (Integer stationId:userFocusStation.getStationIds()) {
GardsStations stations = (GardsStations) stationInfoMap.get(stationId.toString());
SysUserFocusStationStation sysUserFocusStation = new SysUserFocusStationStation();
Long id = IdWorker.getId();
sysUserFocusStation.setId(String.valueOf(id));
sysUserFocusStation.setUserId(sysUser.getId());
sysUserFocusStation.setStationId(String.valueOf(stationId));
String stationType = stationTypeUtil.getStationType(stationId);
String stationType = stationTypeUtil.getStationType(stationId, stations.getCategory());
sysUserFocusStation.setStationType(stationType);
sysUserFocusStation.setCreateTime(LocalDateTime.now());
sysUserFocusStation.setCreateBy(username);
@ -244,7 +247,7 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl<SysUserFocusStat
//如果排班任务台站id数组中 不包含当前关注台站id 则关注台站正常存储
if (!taskStation.contains(stations.getStationId().toString())) {
//获取台站类型
String stationType = stationTypeUtil.getStationType(stations.getStationId());
String stationType = stationTypeUtil.getStationType(stations.getStationId(), stations.getCategory());
item.setStationType(stationType);
item.setStationCode(stations.getStationCode());
item.setLon(stations.getLon());
@ -268,7 +271,7 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl<SysUserFocusStat
//获取台站信息
GardsStations stations = (GardsStations) stationInfoMap.get(stationId);
//获取台站类型
String stationType = stationTypeUtil.getStationType(stations.getStationId());
String stationType = stationTypeUtil.getStationType(stations.getStationId(), stations.getCategory());
//将台站信息复制给关注台站实体类
BeanUtils.copyProperties(stations, item);
item.setStationId(stationId);