From a68b481a4f8d2077b83c5ea3212b08b369c141d7 Mon Sep 17 00:00:00 2001 From: "Mr.Wang" Date: Tue, 9 Jul 2024 12:41:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A2=84=E6=A1=88-=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E6=8E=A7=E5=88=B6=E8=AE=B0=E5=BD=95=E5=AD=98=E5=82=A8?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DcEmergencyPlansServiceImpl.java | 54 +++++++++++-------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java index 4124a9a4..38c4fbfa 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java @@ -842,6 +842,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { errorResult.put("code",UniversalEnum.FIVE_HUNDRED.getNumber()); errorResult.put("msg",UniversalEnum.OPERATION_FAILURE.getValue()); result.put("deviceName", deviceTypeName); + result.put("deviceType", deviceType); result.put("content", UniversalEnum.NO_DEVICE_FOUND.getValue()); result.put("result", errorResult); resultArray.add(result); @@ -871,12 +872,8 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { // functions List> functionList = new ArrayList<>(); - remark.append("在"); - SimpleDateFormat dateFormat = new SimpleDateFormat(UniversalEnum.TIME_FORMAT_ALL.getValue()); - Calendar calendar = Calendar.getInstance(); - remark.append(dateFormat.format(calendar.getTime())); - remark.append(UniversalEnum.INVOKE.getValue()); remark.append(device.getDeviceName()); + remark.append(UniversalEnum.INVOKE.getValue()); try { if (device.getDeviceType().equals(DeviceTypeConstants.DRIVING_GUIDANCE.toString())) { // 行车诱导 @@ -901,6 +898,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { } result.put("device", device.getId()); result.put("deviceName", device.getDeviceName()); + result.put("deviceType", deviceType); processingDeviceParameters(functionId, functionList, props); @@ -909,11 +907,10 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { if (ajaxResult.get("code").equals(UniversalEnum.TWO_HUNDRED.getNumber())) { status = UniversalEnum.ZERO.getNumber(); - remark.append(UniversalEnum.SUCCESSFUL.getValue()); } else { status = UniversalEnum.ONE.getNumber(); - remark.append(UniversalEnum.LOSE.getValue()); } + remark.append(UniversalEnum.DEVICE_CONTROL_MODE.getValue()); result.put("result", ajaxResult); resultArray.add(result); @@ -930,16 +927,16 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { JSONObject result = new JSONObject(); result.put("device", device.getId()); result.put("deviceName", device.getDeviceName()); + result.put("deviceType", deviceType); result.put("content", UniversalEnum.RESTORE_LAST_TIME.getValue()); result.put("result", ajaxResult1B); resultArray.add(result); if (ajaxResult1B.get("code").equals(UniversalEnum.TWO_HUNDRED.getNumber())) { status = UniversalEnum.ZERO.getNumber(); - remark.append(UniversalEnum.SUCCESSFUL.getValue()); } else { status = UniversalEnum.ONE.getNumber(); - remark.append(UniversalEnum.LOSE.getValue()); } + remark.append(UniversalEnum.RESTORE_LAST_TIME.getValue()); } else { // 情报板发布全流程 JSONArray contentList = JSON.parseArray(otherConfig.get("contentList").toString()); @@ -949,28 +946,28 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { jsonObject.get("dcDeviceId").toString().equals(device.getId().toString())) .findFirst() .orElse(null); + remark.append(UniversalEnum.FILE_NAME_SENDING.getValue()); + remark.append("、"); + remark.append(UniversalEnum.FILE_SENDING.getValue()); + remark.append("、"); + remark.append(UniversalEnum.SPECIFIES_THE_LIST_THAT_CURRENTLY_NEEDS_TO_BE_PLAYED.getValue()); if (foundContent == null) { // 说明没有匹配到设备 JSONObject errorResult = new JSONObject(); errorResult.put("device", device.getId()); errorResult.put("content", UniversalEnum.THE_CORRESPONDING_TEMPLATE_CONTENT_IS_NOT_MATCHED.getValue()); errorResult.put("deviceName", device.getDeviceName()); + errorResult.put("deviceType", deviceType); JSONObject result = new JSONObject(); result.put("result",errorResult); result.put("code",UniversalEnum.FIVE_HUNDRED.getNumber()); result.put("msg",UniversalEnum.OPERATION_FAILURE.getValue()); resultArray.add(result); status = UniversalEnum.ONE.getNumber(); - remark.append(UniversalEnum.LOSE.getValue()); } else { JSONObject jsonObject = new JSONObject(); jsonObject.put("dcInfoBoardTemplate", foundContent); status = boardReleaseProcess(props, iotDeviceId, jsonObject, device, resultArray, functionList); - if (status.equals(UniversalEnum.ZERO.getNumber())) { - remark.append(UniversalEnum.SUCCESSFUL.getValue()); - } else { - remark.append(UniversalEnum.LOSE.getValue()); - } } } @@ -994,6 +991,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { JSONObject errorResult = new JSONObject(); errorResult.put("device", device.getId()); errorResult.put("deviceName", device.getDeviceName()); + errorResult.put("deviceType", deviceType); errorResult.put("content", UniversalEnum.NO_BROADCAST_CONTENT_IS_MATCHED_PROCEDURE.getValue()); resultArray.add(errorResult); } @@ -1012,20 +1010,23 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { JSONObject result = new JSONObject(); result.put("device", device.getId()); result.put("deviceName", device.getDeviceName()); + result.put("deviceType", deviceType); result.put("content", params.get("text")); + remark.append(UniversalEnum.RELEASE_VOICE_BROADCAST.getValue()); + processingDeviceParameters(UniversalEnum.A_ONE.getValue(), functionList, params); JSONObject returnResult = broadcastController.nearCamListDistance(params); - result.put("result", returnResult); - resultArray.add(result); if (Objects.equals(returnResult.getString("retCode"), UniversalEnum.ZERO.getValue())) { status = UniversalEnum.ZERO.getNumber(); - remark.append(UniversalEnum.SUCCESSFUL.getValue()); + returnResult.put("code", UniversalEnum.TWO_HUNDRED.getNumber()); } else { status = UniversalEnum.ONE.getNumber(); - remark.append(UniversalEnum.LOSE.getValue()); + returnResult.put("code", UniversalEnum.FIVE_HUNDRED.getNumber()); } + result.put("result", returnResult); + resultArray.add(result); } else if (device.getDeviceType().equals(DeviceTypeConstants.LASER_FATIGUE_AWAKENING.toString())) { @@ -1035,6 +1036,11 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { JSONObject resultTime = new JSONObject(); resultTime.put("device", device.getId()); resultTime.put("deviceName", device.getDeviceName()); + resultTime.put("deviceType", device.getDeviceType()); + + remark.append(UniversalEnum.MODE_SETTING_COMMAND.getValue()); + remark.append("、"); + remark.append(UniversalEnum.WORK_TIME_SETTING_COMMAND.getValue()); processingDeviceParameters(UniversalEnum.SETMD.getValue(), functionList, map); @@ -1057,10 +1063,8 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { if (ajaxResultState.get("code").equals(UniversalEnum.TWO_HUNDRED.getNumber()) && ajaxResult.get("code").equals(UniversalEnum.TWO_HUNDRED.getNumber())) { status = UniversalEnum.ZERO.getNumber(); - remark.append(UniversalEnum.SUCCESSFUL.getValue()); } else { status = UniversalEnum.ONE.getNumber(); - remark.append(UniversalEnum.LOSE.getValue()); } } @@ -1153,6 +1157,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { JSONObject result = new JSONObject(); result.put("device", device.getId()); result.put("deviceName", device.getDeviceName()); + result.put("deviceType", device.getDeviceType()); if (ajaxResult13.get("code").equals(UniversalEnum.TWO_HUNDRED.getNumber())) { HashMap props1B = new HashMap<>(); // 3: 执行1B功能码 @@ -1179,6 +1184,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { JSONObject error = new JSONObject(); error.put("result",ajaxResult11); error.put("deviceName",device.getDeviceName()); + error.put("deviceType",device.getDeviceType()); error.put("device",device.getId()); error.put("content",dcInfoBoardTemplate.getContent()); resultArray.add(error); @@ -1216,7 +1222,11 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { dcOperLog.setOperIp(IpUtils.getIpAddr(ServletUtils.getRequest())); dcOperLog.setOperLocation(SecurityUtils.getLoginUser().getLoginLocation()); dcOperLog.setOperParam(JSON.toJSONString(propsList)); - dcOperLog.setJsonResult(String.valueOf(resultList)); + List filterResult = resultList.stream() + .map(o -> JSON.parseObject(o.toString())) + .filter(jsonObject -> jsonObject.getString("device").equals(dcDevice.getId().toString())) + .collect(Collectors.toList()); + dcOperLog.setJsonResult(String.valueOf(filterResult)); dcOperLog.setStatus(status); dcOperLog.setOperTime(new Date()); dcOperLog.setRemark(remark);