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 index a4428678..9ac4a4b2 100644 --- 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 @@ -1,17 +1,36 @@ package org.jeecg.common; +import org.apache.commons.lang3.StringUtils; +import org.jeecg.modules.entity.StationType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.stream.Collectors; + +@Component 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"; + @Autowired + private StationType stationType; + + public List findAllStationType(){ + List stationTypeList = stationType.getTypes(); + List stationTypes = stationTypeList.stream().map(StationType::getName).collect(Collectors.toList()); + return stationTypes; + } + + public String getStationType(Integer stationId){ + String type = ""; + List 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(); + } + } } - return stationType; + return type; } } 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 0fa899dc..aa6d7b1a 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 @@ -24,10 +24,17 @@ public class StationOperationController { @Autowired private IStationOperationService stationOperationService; + @GetMapping("findStationType") + @ApiOperation(value = "查询台站,核设施类型", notes = "查询台站,核设施类型") + public List findStationType(){ + List result = stationOperationService.findStationType(); + return result; + } + @GetMapping("findList") @ApiOperation(value = "查询所有台站,核设施信息", notes = "查询所有台站,核设施信息") - public List findList(String status){ - List result = stationOperationService.findList(status); + public List findList(String status, String stationType){ + List result = stationOperationService.findList(status, stationType); return result; } diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationType.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationType.java new file mode 100644 index 00000000..87b50d82 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationType.java @@ -0,0 +1,24 @@ +package org.jeecg.modules.entity; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +@Data +@Component +@ConfigurationProperties(prefix = "station") +public class StationType implements Serializable { + + private String name; + + private String minId; + + private String maxId; + + private List types = new ArrayList<>(); + +} 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 2bc4d491..5b012fa3 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 @@ -86,4 +86,10 @@ public class SysUserFocusStation implements Serializable { @TableField(exist = false) private String status; + /** + * 台站编码 + */ + @TableField(exist = false) + private String stationCode; + } 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 c6043d52..2d508031 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 @@ -11,12 +11,18 @@ import java.util.List; public interface IStationOperationService extends IService { + /** + * 查询台站,核设施类型 + * @return + */ + List findStationType(); + /** * 查询台站,核设施信息 * @param status * @return */ - List findList(String status); + List findList(String status, String stationType); /** * 查看台站,核设施详情信息 diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/StationOperationServiceImpl.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/StationOperationServiceImpl.java index 6746a9c8..08c10a6e 100644 --- a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/StationOperationServiceImpl.java +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/StationOperationServiceImpl.java @@ -47,11 +47,20 @@ public class StationOperationServiceImpl extends ServiceImpl findList(String status) { + public List findStationType() { + List allStationType = stationTypeUtil.findAllStationType(); + allStationType.add("Nuclear Facility"); + return allStationType; + } + + @Override + public List findList(String status, String stationType) { //声明结果集合 List result = new LinkedList<>(); //查询全部台站信息 @@ -65,8 +74,7 @@ public class StationOperationServiceImpl extends ServiceImpl StringUtils.isNotBlank(item.getStatus())&&item.getStatus().equalsIgnoreCase(status)).collect(Collectors.toList()); + result = result.stream().filter(item-> StringUtils.isNotBlank(item.getStatus()) && item.getStatus().equalsIgnoreCase(status)).collect(Collectors.toList()); + } + //如果类型不为空 + if (StringUtils.isNotBlank(stationType)){ + result = result.stream().filter(item-> StringUtils.isNotBlank(item.getStationType()) && item.getStationType().equalsIgnoreCase(stationType)).collect(Collectors.toList()); } return result; } 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 7a48156e..0327a8e5 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 @@ -41,6 +41,8 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl findList() { @@ -52,8 +54,9 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl