|
@ -1,11 +1,14 @@ |
|
|
package com.zc.business.service.impl; |
|
|
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.domain.AjaxResult; |
|
|
import com.ruoyi.common.core.redis.RedisCache; |
|
|
import com.ruoyi.common.core.redis.RedisCache; |
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
import com.ruoyi.common.utils.SecurityUtils; |
|
|
import com.ruoyi.common.utils.SecurityUtils; |
|
|
import com.ruoyi.common.utils.uuid.IdUtils; |
|
|
import com.ruoyi.common.utils.uuid.IdUtils; |
|
|
|
|
|
import com.ruoyi.system.service.ISysConfigService; |
|
|
import com.zc.business.domain.*; |
|
|
import com.zc.business.domain.*; |
|
|
import com.zc.business.enums.UniversalEnum; |
|
|
import com.zc.business.enums.UniversalEnum; |
|
|
import com.zc.business.enums.ValueConverter; |
|
|
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.IDcTrafficPoliceService; |
|
|
import com.zc.business.service.IDcWarningService; |
|
|
import com.zc.business.service.IDcWarningService; |
|
|
import com.zc.business.utils.StakeMarkUtils; |
|
|
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.WebSocketService; |
|
|
import com.zc.common.core.websocket.constant.WebSocketEvent; |
|
|
import com.zc.common.core.websocket.constant.WebSocketEvent; |
|
|
|
|
|
import okhttp3.Response; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.json.JSONArray; |
|
|
import org.json.JSONArray; |
|
|
import org.json.JSONObject; |
|
|
import org.json.JSONObject; |
|
@ -27,6 +34,7 @@ import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
|
|
|
import java.io.IOException; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.concurrent.ThreadLocalRandom; |
|
|
import java.util.concurrent.ThreadLocalRandom; |
|
|
import java.util.concurrent.TimeUnit; |
|
|
import java.util.concurrent.TimeUnit; |
|
@ -53,6 +61,8 @@ public class DcWarningServiceImpl implements IDcWarningService |
|
|
private IDcTrafficPoliceService dcTrafficPoliceService; |
|
|
private IDcTrafficPoliceService dcTrafficPoliceService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private DcProcessConfigMapper dcProcessConfigMapper; |
|
|
private DcProcessConfigMapper dcProcessConfigMapper; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private ISysConfigService configService; |
|
|
@Resource |
|
|
@Resource |
|
|
private RedisCache redisCache; |
|
|
private RedisCache redisCache; |
|
|
private final String HAPPEN = UniversalEnum.TAKE_PLACE.getValue(); |
|
|
private final String HAPPEN = UniversalEnum.TAKE_PLACE.getValue(); |
|
@ -516,10 +526,37 @@ public class DcWarningServiceImpl implements IDcWarningService |
|
|
} |
|
|
} |
|
|
//推送待处理数量
|
|
|
//推送待处理数量
|
|
|
dcEventService.getCountNum(); |
|
|
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()); |
|
|
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 |
|
|
@Override |
|
|
public int deleteDcWarningByStringId(DcWarning dcWarning) { |
|
|
public int deleteDcWarningByStringId(DcWarning dcWarning) { |
|
|
return dcWarningMapper.deleteDcWarningByStringId(dcWarning); |
|
|
return dcWarningMapper.deleteDcWarningByStringId(dcWarning); |
|
|