|
|
@ -17,13 +17,11 @@ import com.zc.business.domain.*; |
|
|
|
import com.zc.business.enums.UniversalEnum; |
|
|
|
import com.zc.business.enums.ValueConverter; |
|
|
|
import com.zc.business.enums.WarningSubclassEnum; |
|
|
|
import com.zc.business.mapper.DcEventMapper; |
|
|
|
import com.zc.business.mapper.DcEventProcessMapper; |
|
|
|
import com.zc.business.mapper.DcProcessConfigMapper; |
|
|
|
import com.zc.business.mapper.DcWarningMapper; |
|
|
|
import com.zc.business.mapper.*; |
|
|
|
import com.zc.business.service.IDcEventService; |
|
|
|
import com.zc.business.service.IDcTrafficPoliceService; |
|
|
|
import com.zc.business.service.IDcWarningService; |
|
|
|
import com.zc.business.utils.QYWXUtil; |
|
|
|
import com.zc.business.utils.StakeMarkUtils; |
|
|
|
import com.zc.common.core.httpclient.OkHttp; |
|
|
|
import com.zc.common.core.httpclient.exception.HttpException; |
|
|
@ -39,6 +37,7 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.io.IOException; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.time.Duration; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDateTime; |
|
|
@ -77,6 +76,10 @@ public class DcWarningServiceImpl implements IDcWarningService { |
|
|
|
private ISysConfigService configService; |
|
|
|
@Autowired |
|
|
|
private VideoController videoController; |
|
|
|
@Autowired |
|
|
|
private QYWXUtil qywxUtil; |
|
|
|
@Autowired |
|
|
|
private DcEmployeesMapper employeesMapper; |
|
|
|
@Resource |
|
|
|
private RedisCache redisCache; |
|
|
|
private final String HAPPEN = UniversalEnum.TAKE_PLACE.getValue(); |
|
|
@ -946,6 +949,15 @@ public class DcWarningServiceImpl implements IDcWarningService { |
|
|
|
} |
|
|
|
Long dispatchId = dcDispatch.getId();//信息记录id
|
|
|
|
String context = ""; |
|
|
|
|
|
|
|
//组装企业微信消息
|
|
|
|
DcEvent dcEvent = dcEventMapper.selectDcEventById(eventId); |
|
|
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
String occurrenceTime = df.format(dcEvent.getOccurrenceTime()); |
|
|
|
String direction = dcEvent.getDirection().equals("1") ? "菏泽方向" : "济南方向"; |
|
|
|
String message = occurrenceTime + " 济菏高速" + dcEvent.getStakeMark() + direction + "发生" + |
|
|
|
dcEvent.getStringEventType() + "(" + dcEvent.getEventSubclassName() + ")事件,请路管人员"; |
|
|
|
|
|
|
|
if (employees != null) { |
|
|
|
dcDispatchResource.setResourceId(employees);//资源id
|
|
|
|
dcDispatchResource.setDispatchType(UniversalEnum.ONE.getNumber());//资源类型
|
|
|
@ -956,6 +968,7 @@ public class DcWarningServiceImpl implements IDcWarningService { |
|
|
|
} |
|
|
|
String employeesName = dcWarningMapper.employeesName(employees); |
|
|
|
context = "路管人员" + employeesName + "参与事件救援,"; |
|
|
|
message = message + employeesName; |
|
|
|
} |
|
|
|
if (vehicles != null) { |
|
|
|
// 生成一个随机索引,范围在0到列表长度减1之间
|
|
|
@ -968,6 +981,7 @@ public class DcWarningServiceImpl implements IDcWarningService { |
|
|
|
} |
|
|
|
String vehiclePlate = dcWarningMapper.vehiclesName(vehicles); |
|
|
|
context += "救援车辆" + vehiclePlate + "参与事件救援,"; |
|
|
|
message += "驾驶车辆" + vehiclePlate; |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(context)) { |
|
|
@ -979,6 +993,25 @@ public class DcWarningServiceImpl implements IDcWarningService { |
|
|
|
dcEventProcessService.insertDcEventProcess(dcEventProcess); |
|
|
|
} |
|
|
|
|
|
|
|
//给路管人员发送企业微信
|
|
|
|
message = message + "参与事件救援"; |
|
|
|
Long[] ids = new Long[]{employees}; |
|
|
|
List<DcEmployees> employeesList = employeesMapper.selectEmployeesByIds(ids); |
|
|
|
List<String> wxUserIds = new ArrayList<>(); |
|
|
|
for (DcEmployees dcEmployees : employeesList) { |
|
|
|
if (StringUtils.isNotBlank(dcEmployees.getWxUserId())){ |
|
|
|
wxUserIds.add(dcEmployees.getWxUserId()); |
|
|
|
} else { |
|
|
|
String wxUserId = qywxUtil.getUserIdByMobile(dcEmployees.getContactNumber()); |
|
|
|
if (StringUtils.isNotBlank(wxUserId)){ |
|
|
|
dcEmployees.setWxUserId(wxUserId); |
|
|
|
employeesMapper.updateDcEmployees(dcEmployees); |
|
|
|
wxUserIds.add(wxUserId); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
qywxUtil.sendMessageByWxUserId(wxUserIds,message); |
|
|
|
|
|
|
|
return AjaxResult.success(); |
|
|
|
} |
|
|
|
|
|
|
@ -1111,9 +1144,64 @@ public class DcWarningServiceImpl implements IDcWarningService { |
|
|
|
dcEventProcess.setSource(UniversalEnum.ONE.getNumber()); |
|
|
|
dcEventProcess.setContext(context); |
|
|
|
dcEventProcessService.insertDcEventProcess(dcEventProcess); |
|
|
|
|
|
|
|
//给路管人员发送企业微信
|
|
|
|
map.put("eventId",dcDispatchEventId.getEventId()); |
|
|
|
sendQYWXMessage(map); |
|
|
|
|
|
|
|
return UniversalEnum.ONE.getNumber(); |
|
|
|
} |
|
|
|
|
|
|
|
//给路管人员发送企业微信
|
|
|
|
private void sendQYWXMessage(HashMap map){ |
|
|
|
String eventId = map.get("eventId").toString(); |
|
|
|
DcEvent dcEvent = dcEventMapper.selectDcEventById(eventId); |
|
|
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
String occurrenceTime = df.format(dcEvent.getOccurrenceTime()); |
|
|
|
String direction = dcEvent.getDirection().equals("1") ? "菏泽方向" : "济南方向"; |
|
|
|
String message = occurrenceTime + " 济菏高速" + dcEvent.getStakeMark() + direction + "发生" + |
|
|
|
dcEvent.getStringEventType() + "(" + dcEvent.getEventSubclassName() + ")事件,请路管人员"; |
|
|
|
|
|
|
|
//取出人员
|
|
|
|
ArrayList<Map<String, Object>> employeesArray = (ArrayList<Map<String, Object>>) map.get("employees"); |
|
|
|
if (employeesArray != null && employeesArray.size() > UniversalEnum.ZERO.getNumber()) { |
|
|
|
for (Map<String, Object> array : employeesArray) { |
|
|
|
message = message + array.get("name").toString() + UniversalEnum.SEMICOLON.getValue(); |
|
|
|
} |
|
|
|
message = message.substring(0, message.length() - 1); |
|
|
|
} |
|
|
|
ArrayList<Map<String, Object>> vehicleArray = (ArrayList<Map<String, Object>>) map.get("vehicle"); |
|
|
|
//取出车辆
|
|
|
|
if (vehicleArray != null && vehicleArray.size() > UniversalEnum.ZERO.getNumber()) { |
|
|
|
message += "驾驶车辆"; |
|
|
|
for (Map<String, Object> array : vehicleArray) { |
|
|
|
message = message + array.get("vehiclePlate").toString() + "、"; |
|
|
|
} |
|
|
|
message = message.substring(0, message.length() - 1); |
|
|
|
} |
|
|
|
message += "参与事件救援"; |
|
|
|
|
|
|
|
Long[] ids = employeesArray.stream() |
|
|
|
.map(item -> Long.parseLong(item.get("id").toString())) |
|
|
|
.toArray(Long[]::new); |
|
|
|
//发生企业微信
|
|
|
|
List<DcEmployees> employeesList = employeesMapper.selectEmployeesByIds(ids); |
|
|
|
List<String> wxUserIds = new ArrayList<>(); |
|
|
|
for (DcEmployees dcEmployees : employeesList) { |
|
|
|
if (StringUtils.isNotBlank(dcEmployees.getWxUserId())){ |
|
|
|
wxUserIds.add(dcEmployees.getWxUserId()); |
|
|
|
} else { |
|
|
|
String wxUserId = qywxUtil.getUserIdByMobile(dcEmployees.getContactNumber()); |
|
|
|
if (StringUtils.isNotBlank(wxUserId)){ |
|
|
|
dcEmployees.setWxUserId(wxUserId); |
|
|
|
employeesMapper.updateDcEmployees(dcEmployees); |
|
|
|
wxUserIds.add(wxUserId); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
qywxUtil.sendMessageByWxUserId(wxUserIds,message); |
|
|
|
|
|
|
|
} |
|
|
|
//误报解除
|
|
|
|
@Override |
|
|
|
public Integer falseAlarmResolution(DcWarning dcWarning) { |
|
|
|