Browse Source

设备控制,插入公众服务统计记录表

develop
Mr.Wang 5 months ago
parent
commit
3e0efd10d0
  1. 41
      zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java

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

@ -74,6 +74,9 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
@Resource
private ISysDeptService iSysDeptService;
@Resource
private IDcPublishManageService dcPublishManageService;
/**
* 查询事件预案
@ -764,6 +767,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
try {
// 根据不通设备类型,执行不通的功能操作
invokedFunction(
id,
dcEventAnDcEmergencyPlans.getOperationType(),
dcDevices,
otherConfig,
@ -816,7 +820,8 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
/**
* 根据不通设备类型执行不通的功能操作
*/
public void invokedFunction(Integer operationType,
public void invokedFunction(String eventId,
Integer operationType,
List<DcDevice> dcDevices,
JSONObject otherConfig,
JSONArray resultArray) {
@ -983,7 +988,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
result.put("deviceName", device.getDeviceName());
result.put("content", params.get("text"));
processingDeviceParameters("A1", functionList, props);
processingDeviceParameters("A1", functionList, params);
JSONObject returnResult = broadcastController.nearCamListDistance(params);
result.put("result", returnResult);
@ -1035,7 +1040,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
}
proDevice.put("functions", functionList);
propsList.add(proDevice);
insertEquipmentControlRecordTable(device, propsList, resultArray, status, remark.toString());
insertEquipmentControlRecordTable(device, propsList, resultArray, status, remark.toString(),eventId);
} catch (HttpException | IOException e) {
log.error(e.toString());
throw new RuntimeException(e);
@ -1148,11 +1153,13 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
/**
* 设备控制记录表插入
*/
@Transactional(rollbackFor = Exception.class)
public void insertEquipmentControlRecordTable(DcDevice dcDevice,
List<HashMap<String, List<Map<String, Object>>>> propsList,
JSONArray resultList,
Integer status,
String remark) {
String remark,
String eventId) {
DcOperLog dcOperLog = new DcOperLog();
List<String> deviceIds = new ArrayList<>();
@ -1177,6 +1184,32 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
dcOperLog.setOperTime(new Date());
dcOperLog.setRemark(remark);
iDcOperLogService.addDcOperLog(dcOperLog);
// 插入公众服务统计记录表
if (Objects.equals(dcDevice.getDeviceType(), "2") || Objects.equals(dcDevice.getDeviceType(), "5")) {
DcPublishManage dcPublishManage = new DcPublishManage();
if (Objects.equals(status, 0)) {
dcPublishManage.setPublishStatus(1);//发布状态1-成功2-失败
} else {
dcPublishManage.setPublishStatus(2);//发布状态1-成功2-失败
}
dcPublishManage.setEventId(eventId);
dcPublishManage.setPublisher(loginUser.getUsername());//发布人
dcPublishManage.setPublishTime(new Date());//发布时间
dcPublishManage.setCreateTime(new Date());//创建时间
if (StringUtils.isNotEmpty(dcOperLog.getId())) {
dcPublishManage.setLogId(Long.valueOf(dcOperLog.getId()));//发布的如果的情报板传对应id
}
if (Objects.equals(dcDevice.getDeviceType(), "2")) {
dcPublishManage.setPublishChannels(4);
} else {
dcPublishManage.setPublishChannels(7);
}
dcPublishManage.setContentDetails(JSON.toJSONString(propsList));
dcPublishManageService.insertDcPublishManage(dcPublishManage);
}
}

Loading…
Cancel
Save