Browse Source

Merge remote-tracking branch 'origin/develop' into develop

develop
wangsixiang 4 months ago
parent
commit
6e35fbd2bc
  1. 2
      ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
  2. 2
      zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java
  3. 30
      zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java
  4. 37
      zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java

2
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

@ -140,6 +140,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/captcha/get", "/captcha/check", "/captchaConfig").anonymous()
// license
.antMatchers("/license/identityCode", "/license/authentication").anonymous()
// 扫码报警
.antMatchers( "/codeScanningAlarm/event").anonymous()
// 第三方、小程序、APP
//.antMatchers("/api/**").anonymous()

2
zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java

@ -79,7 +79,7 @@ public class CodeScanningAlarmController extends BaseController {
dcWarning.setWarningSubclass(UniversalEnum.TEN_THREE.getValue());
break;
}
String warningTitle = "济荷高速:" + (Objects.equals(roadCode, UniversalEnum.ONE.getValue()) ? UniversalEnum.DIRECTION_OF_JINAN.getValue() : UniversalEnum.DIRECTION_OF_HEZE.getValue()) + "发生" + (Integer.parseInt(accidentType) >= 4 ? UniversalEnum.TRAFFIC_ACCIDENT_EVENT.getValue() : UniversalEnum.VEHICLE_BREAKDOWN_EVENT.getValue());
String warningTitle = "G35济菏高速" + dcWarning.getStakeMark() + (Objects.equals(roadCode, UniversalEnum.ONE.getValue()) ? UniversalEnum.DIRECTION_OF_JINAN.getValue() : UniversalEnum.DIRECTION_OF_HEZE.getValue()) + "发生" + (Integer.parseInt(accidentType) >= 4 ? UniversalEnum.TRAFFIC_ACCIDENT_EVENT.getValue() : UniversalEnum.VEHICLE_BREAKDOWN_EVENT.getValue());
dcWarning.setWarningTitle(warningTitle);
dcWarning.setWarningSource(UniversalEnum.FIVE.getNumber());
dcWarning.setWarningState(UniversalEnum.ONE.getNumber());

30
zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java

@ -1,6 +1,7 @@
package com.zc.business.message.device.handler;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.thread.NamedThreadFactory;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@ -300,24 +301,19 @@ public class DeviceMessageHandler {
Integer relatedLaneNo = data.getInteger("relatedLaneNo");
String stakeMarkDescription = data.getString("stakeMarkDescription");
String direction = UniversalEnum.EMPTY_STRING.getValue();
String[] arr = stakeMarkDescription.split(UniversalEnum.BLANK_SPACE.getValue());
String direction ;
//方向
if (arr[UniversalEnum.TWO.getNumber()] != null) {
if (arr[UniversalEnum.TWO.getNumber()].equals(UniversalEnum.Up.getValue())) {
direction = arr[UniversalEnum.ZERO.getNumber()] + UniversalEnum.BLANK_SPACE.getValue() + arr[UniversalEnum.ONE.getNumber()] + UniversalEnum.BLANK_SPACE.getValue() + UniversalEnum.DIRECTION_OF_HEZE.getValue() + UniversalEnum.BLANK_SPACE.getValue();
if (warningSubclass.equals(UniversalEnum.FOUR_SEVEN.getValue())) {
if (relatedLaneNo == UniversalEnum.FIVE.getNumber()) {
relatedLaneNo = UniversalEnum.ZERO.getNumber();
}
}
}
if (arr[UniversalEnum.TWO.getNumber()].equals(UniversalEnum.GO_DOWN.getValue())) {
direction = arr[UniversalEnum.ZERO.getNumber()] + UniversalEnum.BLANK_SPACE.getValue() + arr[UniversalEnum.ONE.getNumber()] + UniversalEnum.BLANK_SPACE.getValue() + UniversalEnum.DIRECTION_OF_JINAN.getValue() + UniversalEnum.BLANK_SPACE.getValue();
if (warningSubclass.equals(UniversalEnum.FOUR_SEVEN.getValue())) {
relatedLaneNo = data.getInteger("relatedLaneNo") - UniversalEnum.ONE.getNumber();
}
}
int string = Integer.parseInt(data.getString("direction"));
if (string==UniversalEnum.ONE.getNumber()){
direction=UniversalEnum.DIRECTION_OF_HEZE.getValue();
}else {
direction=UniversalEnum.DIRECTION_OF_JINAN.getValue();
}
if(relatedLaneNo==UniversalEnum.ONE.getNumber() || relatedLaneNo==UniversalEnum.SIX.getNumber()){
relatedLaneNo=UniversalEnum.ZERO.getNumber();
}
dcWarning.setLane(String.valueOf(relatedLaneNo));

37
zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java

@ -1,11 +1,14 @@
package com.zc.business.service.impl;
import com.alibaba.fastjson.JSON;
import com.google.gson.JsonObject;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.system.service.ISysConfigService;
import com.zc.business.domain.*;
import com.zc.business.enums.UniversalEnum;
import com.zc.business.enums.ValueConverter;
@ -17,8 +20,12 @@ import com.zc.business.service.IDcEventService;
import com.zc.business.service.IDcTrafficPoliceService;
import com.zc.business.service.IDcWarningService;
import com.zc.business.utils.StakeMarkUtils;
import com.zc.common.core.httpclient.OkHttp;
import com.zc.common.core.httpclient.exception.HttpException;
import com.zc.common.core.httpclient.request.RequestParams;
import com.zc.common.core.websocket.WebSocketService;
import com.zc.common.core.websocket.constant.WebSocketEvent;
import okhttp3.Response;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -27,6 +34,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
@ -53,6 +61,8 @@ public class DcWarningServiceImpl implements IDcWarningService
private IDcTrafficPoliceService dcTrafficPoliceService;
@Autowired
private DcProcessConfigMapper dcProcessConfigMapper;
@Autowired
private ISysConfigService configService;
@Resource
private RedisCache redisCache;
private final String HAPPEN = UniversalEnum.TAKE_PLACE.getValue();
@ -516,10 +526,37 @@ public class DcWarningServiceImpl implements IDcWarningService
}
//推送待处理数量
dcEventService.getCountNum();
//扫码报警小程序
if(dcWarning.getWarningSource() == 5){
HashMap<String, Object> warningInfo = dcWarningMapper.selectDcWarningById(dcWarning.getId());
com.alibaba.fastjson.JSONObject otherConfig = com.alibaba.fastjson.JSONObject.parseObject(warningInfo.get("otherConfig").toString());
String alarmId = otherConfig.getString("id");
if (StringUtils.isNotBlank(alarmId)) {
try {
AjaxResult alarmResult = dealWarning(alarmId);
System.out.println(alarmResult);
} catch (IOException | HttpException e) {
e.printStackTrace();
}
}
}
return AjaxResult.success(UniversalEnum.SUCCESSFUL_OPERATION.getValue());
}
public AjaxResult dealWarning(String alarmId) throws IOException, HttpException {
String url = configService.selectConfigByKey("alarmCode");
url = url + "/warning/dealWarning/" + alarmId;
OkHttp okHttp = new OkHttp();
Response response // 请求响应
= okHttp
.headers(new HashMap<>())
.url(url) // 请求地址
.put(); // 请求方法
return JSON.parseObject(response.body().string(), AjaxResult.class);
}
@Override
public int deleteDcWarningByStringId(DcWarning dcWarning) {
return dcWarningMapper.deleteDcWarningByStringId(dcWarning);

Loading…
Cancel
Save