格式化代码
This commit is contained in:
parent
84cb8e45a1
commit
b73dc2b9e2
|
@ -106,19 +106,19 @@ public class CalculateDataRateThread implements Runnable {
|
|||
//修改使用efficCalculType判断台站类型
|
||||
String efficCalculType = calculateDataRate.getMEfficCalculType();
|
||||
//判断台站编码及台站类型
|
||||
if ((StringUtils.isNotBlank(stationCode) && stationCode.substring(2, 3).equals("X")) && (StringUtils.isNotBlank(efficCalculType) && efficCalculType.equals("SAUNA"))) {
|
||||
//切割台站编码 如果 第三个字符是 X 并且 台站类型是 SAUNA
|
||||
if ((StringUtils.isNotBlank(stationCode) && stationCode.charAt(2) == 'X') && (StringUtils.isNotBlank(efficCalculType) && efficCalculType.equals("SAUNA"))) {
|
||||
//切割台站编码 如果 第三个字符是 X 并且 EFFIC_CALCUL_TYPE类型是 SAUNA
|
||||
mRate = saunacalc(calculateDataRate);
|
||||
} else if ((StringUtils.isNotBlank(stationCode) && stationCode.charAt(2) == 'X') && (StringUtils.isNotBlank(efficCalculType) && efficCalculType.equals("SAUNA2"))) {
|
||||
//切割台站编码 如果 第三个字符是 X 并且 EFFIC_CALCUL_TYPE类型是 SAUNA2
|
||||
mRate = saunacalc2(calculateDataRate);
|
||||
} else if ((StringUtils.isNotBlank(stationCode) && stationCode.substring(2, 3).equals("X")) && (StringUtils.isNotBlank(efficCalculType) && efficCalculType.equals("SPALAX"))) {
|
||||
//切割台站编码 如果 第三个字符是 X 并且 台站类型是 SPALAX
|
||||
} else if ((StringUtils.isNotBlank(stationCode) && stationCode.charAt(2) == 'X') && (StringUtils.isNotBlank(efficCalculType) && efficCalculType.equals("SPALAX"))) {
|
||||
//切割台站编码 如果 第三个字符是 X 并且 EFFIC_CALCUL_TYPE类型是 SPALAX
|
||||
mRate = spalaxcalc(calculateDataRate);
|
||||
}else if ((StringUtils.isNotBlank(stationCode) && stationCode.charAt(2) == 'X') && (StringUtils.isNotBlank(efficCalculType) && efficCalculType.equals("SPALAX_PLC"))) {
|
||||
} else if ((StringUtils.isNotBlank(stationCode) && stationCode.charAt(2) == 'X') && (StringUtils.isNotBlank(efficCalculType) && efficCalculType.equals("SPALAX_PLC"))) {
|
||||
//切割台站编码 如果 第三个字符是 X 并且 EFFIC_CALCUL_TYPE类型是 SPALAX-PLC
|
||||
mRate = spalaxcalcPLC(calculateDataRate);
|
||||
} else if (StringUtils.isNotBlank(stationCode) && stationCode.substring(2, 3).equals("P")) {
|
||||
} else if (StringUtils.isNotBlank(stationCode) && stationCode.charAt(2) == 'P') {
|
||||
//切割台站编码 如果 第三个字符是 P
|
||||
mRate = particulatecalc(calculateDataRate);
|
||||
}
|
||||
|
@ -639,8 +639,7 @@ public class CalculateDataRateThread implements Runnable {
|
|||
collectHigh = param.getPhdf().getCollectHigh();
|
||||
liveQc = param.getPhdf().getLiveQc();
|
||||
number = param.getPhdf().getNumber();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
liveLow = calculateDataRate.getMParameter().getPhdfSpalaxPLC().getLiveLow();
|
||||
liveHigh = calculateDataRate.getMParameter().getPhdfSpalaxPLC().getLiveHigh();
|
||||
quantity = calculateDataRate.getMParameter().getPhdfSpalaxPLC().getQuantity();
|
||||
|
@ -649,7 +648,7 @@ public class CalculateDataRateThread implements Runnable {
|
|||
liveQc = calculateDataRate.getMParameter().getPhdfSpalaxPLC().getLiveQc();
|
||||
number = calculateDataRate.getMParameter().getPhdfSpalaxPLC().getNumber();
|
||||
}
|
||||
ProvisionData phdfProvisionEfficiency = calCulStationDataService.findPhdfProvisionEfficiencySpalaxPLC(liveLow, liveHigh, quantity, collectLow, collectHigh, liveQc, curDateTime, pretime, number, stationId);
|
||||
ProvisionData phdfProvisionEfficiency = calCulStationDataService.findPhdfProvisionEfficiencySpalaxPLC(liveLow, liveHigh, quantity, collectLow, collectHigh, liveQc, curDateTime, pretime, number, stationId);
|
||||
if (Objects.nonNull(phdfProvisionEfficiency)) {
|
||||
double phdf_efficient = phdfProvisionEfficiency.getDataEfficiency();
|
||||
mRate.setPhdfEfficient(phdf_efficient);
|
||||
|
@ -657,9 +656,9 @@ public class CalculateDataRateThread implements Runnable {
|
|||
|
||||
//判断当前台站编码是否属于特殊计算的台站 计算PHD的数据提供率
|
||||
if (mSpecialparam.containsKey(calculateDataRate.getMStationCode())) {
|
||||
number = param.getPhd().getNumber();
|
||||
number = param.getPhd().getNumber();
|
||||
} else {
|
||||
number = calculateDataRate.getMParameter().getPhdSpalaxPLC().getNumber();
|
||||
number = calculateDataRate.getMParameter().getPhdSpalaxPLC().getNumber();
|
||||
}
|
||||
ProvisionData phdProvisionRate = calCulStationDataService.findPhdProvisionRateSpalaxPLC(curDateTime, pretime, number, stationId);
|
||||
if (Objects.nonNull(phdProvisionRate)) {
|
||||
|
@ -669,22 +668,21 @@ public class CalculateDataRateThread implements Runnable {
|
|||
|
||||
//判断当前台站编码是否属于特殊计算的台站 计算PHD的数据提供率
|
||||
if (mSpecialparam.containsKey(calculateDataRate.getMStationCode())) {
|
||||
liveLow = param.getPhd().getLiveLow();
|
||||
liveHigh = param.getPhd().getLiveHigh();
|
||||
quantity = param.getPhd().getQuantity();
|
||||
collectLow = param.getPhd().getCollectLow();
|
||||
collectHigh = param.getPhd().getCollectHigh();
|
||||
liveQc = param.getPhd().getLiveQc();
|
||||
number = param.getPhd().getNumber();
|
||||
}
|
||||
else {
|
||||
liveLow = calculateDataRate.getMParameter().getPhdSpalaxPLC().getLiveLow();
|
||||
liveHigh = calculateDataRate.getMParameter().getPhdSpalaxPLC().getLiveHigh();
|
||||
quantity = calculateDataRate.getMParameter().getPhdSpalaxPLC().getQuantity();
|
||||
collectLow = calculateDataRate.getMParameter().getPhdSpalaxPLC().getCollectLow();
|
||||
collectHigh = calculateDataRate.getMParameter().getPhdSpalaxPLC().getCollectHigh();
|
||||
liveQc = calculateDataRate.getMParameter().getPhdSpalaxPLC().getLiveQc();
|
||||
number = calculateDataRate.getMParameter().getPhdSpalaxPLC().getNumber();
|
||||
liveLow = param.getPhd().getLiveLow();
|
||||
liveHigh = param.getPhd().getLiveHigh();
|
||||
quantity = param.getPhd().getQuantity();
|
||||
collectLow = param.getPhd().getCollectLow();
|
||||
collectHigh = param.getPhd().getCollectHigh();
|
||||
liveQc = param.getPhd().getLiveQc();
|
||||
number = param.getPhd().getNumber();
|
||||
} else {
|
||||
liveLow = calculateDataRate.getMParameter().getPhdSpalaxPLC().getLiveLow();
|
||||
liveHigh = calculateDataRate.getMParameter().getPhdSpalaxPLC().getLiveHigh();
|
||||
quantity = calculateDataRate.getMParameter().getPhdSpalaxPLC().getQuantity();
|
||||
collectLow = calculateDataRate.getMParameter().getPhdSpalaxPLC().getCollectLow();
|
||||
collectHigh = calculateDataRate.getMParameter().getPhdSpalaxPLC().getCollectHigh();
|
||||
liveQc = calculateDataRate.getMParameter().getPhdSpalaxPLC().getLiveQc();
|
||||
number = calculateDataRate.getMParameter().getPhdSpalaxPLC().getNumber();
|
||||
}
|
||||
ProvisionData phdProvisionEfficiency = calCulStationDataService.findPhdProvisionEfficiencySpalaxPLC(liveLow, liveHigh, quantity, collectLow, collectHigh, liveQc, curDateTime, pretime, number, stationId);
|
||||
if (Objects.nonNull(phdProvisionEfficiency)) {
|
||||
|
@ -699,7 +697,7 @@ public class CalculateDataRateThread implements Runnable {
|
|||
} else {
|
||||
met = calculateDataRate.getMParameter().getMet();
|
||||
}
|
||||
ProvisionData metProvision = calCulStationDataService.findMetProvisionSpalax(curDateTime, pretime, met, stationId);
|
||||
ProvisionData metProvision = calCulStationDataService.findMetProvisionSpalax(curDateTime, pretime, met, stationId);
|
||||
if (Objects.nonNull(metProvision)) {
|
||||
double metNum = metProvision.getDataRate();
|
||||
mRate.setMet(metNum);
|
||||
|
@ -712,7 +710,7 @@ public class CalculateDataRateThread implements Runnable {
|
|||
} else {
|
||||
soh = calculateDataRate.getMParameter().getSoh();
|
||||
}
|
||||
ProvisionData sohProvision = calCulStationDataService.findSohProvisionSpalax(curDateTime, pretime, soh, stationId);
|
||||
ProvisionData sohProvision = calCulStationDataService.findSohProvisionSpalax(curDateTime, pretime, soh, stationId);
|
||||
if (Objects.nonNull(sohProvision)) {
|
||||
double sohNum = sohProvision.getDataRate();
|
||||
mRate.setSoh(sohNum);
|
||||
|
@ -738,7 +736,7 @@ public class CalculateDataRateThread implements Runnable {
|
|||
} else {
|
||||
sphdMetSoh = calculateDataRate.getMParameter().getSphdMetSoh().getSpalaxEverydaynums();
|
||||
}
|
||||
ProvisionData sphdMetSohProvision = calCulStationDataService.findSphdMetSohProvisionSpalax(SPHD_NUM, MET_NUM, curDateTime, pretime, sphdMetSoh, stationId);
|
||||
ProvisionData sphdMetSohProvision = calCulStationDataService.findSphdMetSohProvisionSpalax(SPHD_NUM, MET_NUM, curDateTime, pretime, sphdMetSoh, stationId);
|
||||
if (Objects.nonNull(sphdMetSohProvision)) {
|
||||
double phd_met_soh = sphdMetSohProvision.getDataRate();
|
||||
mRate.setPhdMetSoh(phd_met_soh);
|
||||
|
|
|
@ -194,13 +194,13 @@ public class CalculateStationData {
|
|||
Node node = childNodes.item(i);
|
||||
switch (node.getNodeName()) {
|
||||
case "SAUNA":
|
||||
sphdMetSoh.setSaunaEverydaynums(getNodeValue(node,"number"));
|
||||
sphdMetSoh.setSaunaEverydaynums(getNodeValue(node, "number"));
|
||||
break;
|
||||
case "SPALAX":
|
||||
sphdMetSoh.setSpalaxEverydaynums(getNodeValue(node,"number"));
|
||||
sphdMetSoh.setSpalaxEverydaynums(getNodeValue(node, "number"));
|
||||
break;
|
||||
case "PARTICULATE":
|
||||
sphdMetSoh.setParticulateEverydaynums(getNodeValue(node,"number"));
|
||||
sphdMetSoh.setParticulateEverydaynums(getNodeValue(node, "number"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1318,12 +1318,13 @@ public class CalculateStationData {
|
|||
//endregion
|
||||
|
||||
/**
|
||||
* 多线程获取台站数据的提供率和有效率
|
||||
* 多线程获取台站数据的提供率和有效率
|
||||
*
|
||||
* @param stationInfos 台站信息列表
|
||||
*/
|
||||
public void mutiThreadGetStationInfo(List<StationInfo> stationInfos, RateParam mRateParam) {
|
||||
//声明一个数组用于接收最后的结果情况
|
||||
Map<String, StationInfo> finallySta = Objects.nonNull(redisUtil.get("dataStationInfoList"))? (Map<String, StationInfo>) redisUtil.get("dataStationInfoList"):new HashMap<>();
|
||||
Map<String, StationInfo> finallySta = Objects.nonNull(redisUtil.get("dataStationInfoList")) ? (Map<String, StationInfo>) redisUtil.get("dataStationInfoList") : new HashMap<>();
|
||||
//声明一个线程池
|
||||
ThreadPoolExecutor poolExecutor = null;
|
||||
//声明一个CountDownLatch监听是否完成全部线程
|
||||
|
@ -1334,7 +1335,7 @@ public class CalculateStationData {
|
|||
int works = stationInfos.size();
|
||||
threadNum = works;
|
||||
// 如果线程数不等于0
|
||||
if (threadNum != 0){
|
||||
if (threadNum != 0) {
|
||||
//获取机器可用核心数
|
||||
int maximumPoolSize = maximumPoolSizeProperties.getStation();//Runtime.getRuntime().availableProcessors();
|
||||
//初始化线程池
|
||||
|
@ -1347,13 +1348,13 @@ public class CalculateStationData {
|
|||
return t;
|
||||
}
|
||||
};
|
||||
poolExecutor = new ThreadPoolExecutor(15,maximumPoolSize,10, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(),threadFactory);
|
||||
poolExecutor = new ThreadPoolExecutor(15, maximumPoolSize, 10, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), threadFactory);
|
||||
}
|
||||
// 线程数 等于 需要处理的台站数量
|
||||
if( threadNum == works ){
|
||||
if (threadNum == works) {
|
||||
countDownLatch = new CountDownLatch(threadNum);
|
||||
//遍历台站信息
|
||||
for (int i = 0 ; i < works; i++){
|
||||
for (int i = 0; i < works; i++) {
|
||||
//获取台站信息
|
||||
StationInfo stationInfo = stationInfos.get(i);
|
||||
//声明一个实体类
|
||||
|
@ -1370,7 +1371,7 @@ public class CalculateStationData {
|
|||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
//关闭线程池
|
||||
if(poolExecutor != null) {
|
||||
if (poolExecutor != null) {
|
||||
poolExecutor.shutdownNow();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,74 +30,74 @@ public class StationOperationController {
|
|||
|
||||
@GetMapping("findStationType")
|
||||
@ApiOperation(value = "查询台站/核设施类型", notes = "查询台站/核设施类型")
|
||||
public List<String> findStationType(){
|
||||
public List<String> findStationType() {
|
||||
List<String> result = stationOperationService.findStationType();
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("findList")
|
||||
@ApiOperation(value = "查询台站/核设施信息", notes = "查询台站/核设施信息")
|
||||
public List<StationOperation> findList(String status, String stationType){
|
||||
public List<StationOperation> findList(String status, String stationType) {
|
||||
List<StationOperation> result = stationOperationService.findList(status, stationType);
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("findListApp")
|
||||
@ApiOperation(value = "查询台站/核设施信息", notes = "查询台站/核设施信息")
|
||||
public List<StationOperation> findListApp(@RequestParam String status,@RequestParam String stationType){
|
||||
public List<StationOperation> findListApp(@RequestParam String status, @RequestParam String stationType) {
|
||||
List<StationOperation> result = stationOperationService.findList(status, stationType);
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("findInfo")
|
||||
@ApiOperation(value = "查询台站/核设施详情信息", notes = "查询台站/核设施详情信息")
|
||||
public Result findInfo(String stationId, String type){
|
||||
public Result findInfo(String stationId, String type) {
|
||||
Result result = stationOperationService.findInfo(stationId, type);
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("findInfoApp")
|
||||
@ApiOperation(value = "查询台站/核设施详情信息", notes = "查询台站/核设施详情信息")
|
||||
public Result findInfoApp(@RequestParam String stationId,@RequestParam String type){
|
||||
public Result findInfoApp(@RequestParam String stationId, @RequestParam String type) {
|
||||
Result result = stationOperationService.findInfo(stationId, type);
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("findTree")
|
||||
@ApiOperation(value = "查询台站树形结构", notes = "查询台站树形结构")
|
||||
public Result findTree(){
|
||||
public Result findTree() {
|
||||
Result result = stationOperationService.findTree();
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping("getHitEquList")
|
||||
@ApiOperation(value = "查询半径内核设施信息", notes = "查询半径内核设施信息")
|
||||
public Result getHitEquList(@RequestBody PointVo pointVo){
|
||||
public Result getHitEquList(@RequestBody PointVo pointVo) {
|
||||
Result result = stationOperationService.getHitEquList(pointVo);
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("getDataReceivingStatus")
|
||||
@ApiOperation(value = "查询台站监测数据信息", notes = "查询台站监测数据信息")
|
||||
public Result getDataReceivingStatus(String userId, Double cacheTime, String oneStationId){
|
||||
public Result getDataReceivingStatus(String userId, Double cacheTime, String oneStationId) {
|
||||
return stationOperationService.getDataReceivingStatus(userId, cacheTime, oneStationId);
|
||||
}
|
||||
|
||||
@GetMapping("getDataReceivingStatusApp")
|
||||
@ApiOperation(value = "查询台站监测数据信息", notes = "查询台站监测数据信息")
|
||||
public Result getDataReceivingStatusApp(@RequestParam String userId,@RequestParam Double cacheTime,@RequestParam String oneStationId){
|
||||
public Result getDataReceivingStatusApp(@RequestParam String userId, @RequestParam Double cacheTime, @RequestParam String oneStationId) {
|
||||
return stationOperationService.getDataReceivingStatus(userId, cacheTime, oneStationId);
|
||||
}
|
||||
|
||||
@GetMapping("getDataProvisionEfficiency")
|
||||
@ApiOperation(value = "查询台站数据提供率及有效率", notes = "查询台站数据提供率及有效率")
|
||||
public Result getDataProvisionEfficiency(){
|
||||
public Result getDataProvisionEfficiency() {
|
||||
return stationOperationService.getDataProvisionEfficiency();
|
||||
}
|
||||
|
||||
@GetMapping("getMapUrl")
|
||||
@ApiOperation(value = "获取地图地址", notes = "获取地图地址")
|
||||
public Result<?> getMapUrl(){
|
||||
public Result<?> getMapUrl() {
|
||||
Result<String> result = Result.OK();
|
||||
result.setResult(mapUrl);
|
||||
return result;
|
||||
|
|
Loading…
Reference in New Issue
Block a user