Browse Source

优化管控记录存储内容以及数据格式

develop
zhaoxianglong 5 months ago
parent
commit
6e9e441780
  1. 3
      zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java
  2. 8
      zc-business/src/main/java/com/zc/business/interfaces/OperationLogAspect.java

3
zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java

@ -546,7 +546,7 @@ public class DcDeviceController extends BaseController {
if (Objects.equals(device.getString("deviceType"), UniversalEnum.FIFTEEN.getValue())) { if (Objects.equals(device.getString("deviceType"), UniversalEnum.FIFTEEN.getValue())) {
return AjaxResult.error(UniversalEnum.TWO_HUNDRED.getNumber(), UniversalEnum.FIVE_HUNDRED.getValue()); return AjaxResult.error(UniversalEnum.TWO_HUNDRED.getNumber(), UniversalEnum.FIVE_HUNDRED.getValue());
} else { } else {
return AjaxResult.error(); //return AjaxResult.success(resultArray);
} }
} }
} }
@ -559,6 +559,7 @@ public class DcDeviceController extends BaseController {
}); });
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
result.put("device", device.getString("id")); result.put("device", device.getString("id"));
result.put("deviceType", device.getInteger("deviceType"));
result.put("functionId", functionId); result.put("functionId", functionId);
if (device.getInteger("deviceType").equals(DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING)) { if (device.getInteger("deviceType").equals(DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING)) {
JSONObject value = broadcastController.nearCamListDistance(jsonObject); JSONObject value = broadcastController.nearCamListDistance(jsonObject);

8
zc-business/src/main/java/com/zc/business/interfaces/OperationLogAspect.java

@ -263,7 +263,7 @@ public class OperationLogAspect {
// return; // return;
//} //}
saveOperLog(jsonResult, operLog, pointArgs, request, deviceIds, deviceNames, deviceType, remark); saveOperLog(((JSONObject) JSON.toJSON(jsonResult)).getJSONArray("data"), operLog, pointArgs, request, deviceIds, deviceNames, deviceType, remark);
if ((Objects.equals(deviceType, UniversalEnum.TWO.getValue()) || Objects.equals(deviceType, UniversalEnum.FIVE.getValue())) && Objects.nonNull(operLog.getId())) { if ((Objects.equals(deviceType, UniversalEnum.TWO.getValue()) || Objects.equals(deviceType, UniversalEnum.FIVE.getValue())) && Objects.nonNull(operLog.getId())) {
@ -346,7 +346,7 @@ public class OperationLogAspect {
operLog.setOperType(UniversalEnum.ONE.getValue()); operLog.setOperType(UniversalEnum.ONE.getValue());
} }
saveOperLog(jsonResult, operLog, pointArgs, request, deviceIds, deviceNames, deviceType, remark); saveOperLog(((JSONObject) JSON.toJSON(jsonResult)).getJSONArray("data"), operLog, pointArgs, request, deviceIds, deviceNames, deviceType, remark);
//if ((Objects.equals(deviceType, "2") || Objects.equals(deviceType, "5")) && Objects.nonNull(operLog.getId())) { //if ((Objects.equals(deviceType, "2") || Objects.equals(deviceType, "5")) && Objects.nonNull(operLog.getId())) {
@ -385,7 +385,7 @@ public class OperationLogAspect {
} }
} }
private void saveOperLog(Object jsonResult, DcOperLog operLog, Object[] pointArgs, HttpServletRequest request, ArrayList<String> deviceIds, ArrayList<String> deviceNames, String deviceType, StringBuilder remark) { private void saveOperLog(JSONArray jsonResult, DcOperLog operLog, Object[] pointArgs, HttpServletRequest request, ArrayList<String> deviceIds, ArrayList<String> deviceNames, String deviceType, StringBuilder remark) {
IDcOperLogService dcOperLogService = SpringUtils.getBean(IDcOperLogService.class); IDcOperLogService dcOperLogService = SpringUtils.getBean(IDcOperLogService.class);
JSONArray jsonArray = (JSONArray) JSON.toJSON(pointArgs); JSONArray jsonArray = (JSONArray) JSON.toJSON(pointArgs);
@ -396,7 +396,7 @@ public class OperationLogAspect {
operLog.setOperTime(new Date()); operLog.setOperTime(new Date());
operLog.setDcDeviceType(deviceType); operLog.setDcDeviceType(deviceType);
operLog.setRemark(remark.toString()); operLog.setRemark(remark.toString());
operLog.setJsonResult(jsonResult.toString()); operLog.setJsonResult(jsonResult.toJSONString());
dcOperLogService.save(operLog); dcOperLogService.save(operLog);
} }
} }

Loading…
Cancel
Save