Browse Source

优化魔法值修改定时间隔

develop
zhaoxianglong 9 months ago
parent
commit
c6c606fd7b
  1. 4
      zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java
  2. 28
      zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java

4
zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java

@ -66,7 +66,7 @@ public class WeatherForecastController extends BaseController {
/***
* 定时查询气象预警信息并上报
*/
@Scheduled(cron = "0 0/5 * * * ?")
@Scheduled(cron = "0 0/15 * * * ?")
public void updateDeviceState() {
HashMap<String, Object> hashMap = new HashMap<>();
@ -80,6 +80,7 @@ public class WeatherForecastController extends BaseController {
return;
}
JSONArray data = (JSONArray) JSON.toJSON(ajaxResult.get("data"));
List<DcNoStakeWarningTable> dcNoStakeWarningTables = noStakeWarningTableService.listDcNoStakeWarningTable(new DcNoStakeWarningTable(),null,null);
data.forEach(item -> {
JSONObject jsonObject = (JSONObject) JSON.toJSON(item);
String earlyWorningSignal = jsonObject.getString("earlyWorningSignal");
@ -188,7 +189,6 @@ public class WeatherForecastController extends BaseController {
// !Objects.equals(ite.getString("earlyWorningIssueDate"), jsonObject.getString("earlyWorningIssueDate"))
// && !Objects.equals(ite.getString("earlyWorningTitle"), jsonObject.getString("earlyWorningTitle"))
// && !Objects.equals(ite.getString("stationName"), jsonObject.getString("stationName"))).collect(Collectors.toList());
List<DcNoStakeWarningTable> dcNoStakeWarningTables = noStakeWarningTableService.listDcNoStakeWarningTable(new DcNoStakeWarningTable(),null,null);
List<DcNoStakeWarningTable> collect = dcNoStakeWarningTables.stream().filter(ite ->
Objects.equals(ite.getWarningTime(), jsonObject.getDate("earlyWorningIssueDate"))
&& Objects.equals(ite.getWarningDescription(), jsonObject.getString("earlyWorningContent"))

28
zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java

@ -782,7 +782,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
.map(String::valueOf)
.collect(Collectors.joining(UniversalEnum.COMMA.getValue()));
// 存储设备id 到 deviceIds 中
deviceIds.append(UniversalEnum.COLON.getNumber());
deviceIds.append(UniversalEnum.COLON.getValue());
deviceIds.append(deviceId);
} catch (Exception e) {
e.printStackTrace();
@ -875,7 +875,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
SimpleDateFormat dateFormat = new SimpleDateFormat(UniversalEnum.TIME_FORMAT_ALL.getValue());
Calendar calendar = Calendar.getInstance();
remark.append(dateFormat.format(calendar.getTime()));
remark.append(UniversalEnum.INVOKE.getNumber());
remark.append(UniversalEnum.INVOKE.getValue());
remark.append(device.getDeviceName());
try {
if (device.getDeviceType().equals(DeviceTypeConstants.DRIVING_GUIDANCE.toString())) {
@ -909,10 +909,10 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
if (ajaxResult.get("code").equals(UniversalEnum.TWO_HUNDRED.getNumber())) {
status = UniversalEnum.ZERO.getNumber();
remark.append(UniversalEnum.SUCCESSFUL.getNumber());
remark.append(UniversalEnum.SUCCESSFUL.getValue());
} else {
status = UniversalEnum.ONE.getNumber();
remark.append(UniversalEnum.LOSE.getNumber());
remark.append(UniversalEnum.LOSE.getValue());
}
result.put("result", ajaxResult);
resultArray.add(result);
@ -935,10 +935,10 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
resultArray.add(result);
if (ajaxResult1B.get("code").equals(UniversalEnum.TWO_HUNDRED.getNumber())) {
status = UniversalEnum.ZERO.getNumber();
remark.append(UniversalEnum.SUCCESSFUL.getNumber());
remark.append(UniversalEnum.SUCCESSFUL.getValue());
} else {
status = UniversalEnum.ONE.getNumber();
remark.append(UniversalEnum.LOSE.getNumber());
remark.append(UniversalEnum.LOSE.getValue());
}
} else {
// 情报板发布全流程
@ -958,18 +958,18 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
JSONObject result = new JSONObject();
result.put("result",errorResult);
result.put("code",UniversalEnum.FIVE_HUNDRED.getNumber());
result.put("msg",UniversalEnum.OPERATION_FAILURE.getNumber());
result.put("msg",UniversalEnum.OPERATION_FAILURE.getValue());
resultArray.add(result);
status = UniversalEnum.ONE.getNumber();
remark.append(UniversalEnum.LOSE.getNumber());
remark.append(UniversalEnum.LOSE.getValue());
} else {
JSONObject jsonObject = new JSONObject();
jsonObject.put("dcInfoBoardTemplate", foundContent);
status = boardReleaseProcess(props, iotDeviceId, jsonObject, device, resultArray, functionList);
if (status.equals(UniversalEnum.ZERO.getNumber())) {
remark.append(UniversalEnum.SUCCESSFUL.getNumber());
remark.append(UniversalEnum.SUCCESSFUL.getValue());
} else {
remark.append(UniversalEnum.LOSE.getNumber());
remark.append(UniversalEnum.LOSE.getValue());
}
}
@ -1021,10 +1021,10 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
resultArray.add(result);
if (Objects.equals(returnResult.getString("retCode"), UniversalEnum.ZERO.getValue())) {
status = UniversalEnum.ZERO.getNumber();
remark.append(UniversalEnum.SUCCESSFUL.getNumber());
remark.append(UniversalEnum.SUCCESSFUL.getValue());
} else {
status = UniversalEnum.ONE.getNumber();
remark.append(UniversalEnum.LOSE.getNumber());
remark.append(UniversalEnum.LOSE.getValue());
}
@ -1057,10 +1057,10 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
if (ajaxResultState.get("code").equals(UniversalEnum.TWO_HUNDRED.getNumber()) && ajaxResult.get("code").equals(UniversalEnum.TWO_HUNDRED.getNumber())) {
status = UniversalEnum.ZERO.getNumber();
remark.append(UniversalEnum.SUCCESSFUL.getNumber());
remark.append(UniversalEnum.SUCCESSFUL.getValue());
} else {
status = UniversalEnum.ONE.getNumber();
remark.append(UniversalEnum.LOSE.getNumber());
remark.append(UniversalEnum.LOSE.getValue());
}
}

Loading…
Cancel
Save