diff --git a/zc-business/src/main/java/com/zc/business/controller/StatusController.java b/zc-business/src/main/java/com/zc/business/controller/StatusController.java index 6a1ddcc2..72758157 100644 --- a/zc-business/src/main/java/com/zc/business/controller/StatusController.java +++ b/zc-business/src/main/java/com/zc/business/controller/StatusController.java @@ -57,7 +57,8 @@ public class StatusController extends BaseController { LocalDateTime currentTime = status.getTime().truncatedTo(ChronoUnit.DAYS).plusDays(1); status.setStartTime(todayStart); status.setTime(currentTime); - List listStatus = statusService.list(status); + status.setTypes(status.getType().split(",")); + List listStatus = statusService.listStatusByTypes(status); return getDataTable(listStatus); } diff --git a/zc-business/src/main/java/com/zc/business/domain/DcEvent.java b/zc-business/src/main/java/com/zc/business/domain/DcEvent.java index cb481f77..fd84070d 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcEvent.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcEvent.java @@ -70,7 +70,7 @@ public class DcEvent { @ApiModelProperty("处理人员") private Long userId; @ApiModelProperty("事件子类") - private String eventSubclas; + private String eventSubclassName; /** * 开始时间 diff --git a/zc-business/src/main/java/com/zc/business/domain/Status.java b/zc-business/src/main/java/com/zc/business/domain/Status.java index f2f788f2..01e6fd81 100644 --- a/zc-business/src/main/java/com/zc/business/domain/Status.java +++ b/zc-business/src/main/java/com/zc/business/domain/Status.java @@ -232,6 +232,7 @@ public class Status { //@Excel(name = "类型") private String type; + private String[] types; private String orderByField; private String orderDirection; @@ -267,4 +268,12 @@ public class Status { public void setOrderByField(String orderByField) { this.orderByField = orderByField; } + + public String[] getTypes() { + return types; + } + + public void setTypes(String[] types) { + this.types = types; + } } diff --git a/zc-business/src/main/java/com/zc/business/interfaces/OperationLogAspect.java b/zc-business/src/main/java/com/zc/business/interfaces/OperationLogAspect.java index be5d0d17..bfd79d80 100644 --- a/zc-business/src/main/java/com/zc/business/interfaces/OperationLogAspect.java +++ b/zc-business/src/main/java/com/zc/business/interfaces/OperationLogAspect.java @@ -109,7 +109,6 @@ public class OperationLogAspect { public void around(ProceedingJoinPoint joinPoint, OperationLog operationLog, String state, Object jsonResult, Exception exception) throws Throwable { ISysDeptService deptService = SpringUtils.getBean(ISysDeptService.class); - IDcOperLogService dcOperLogService = SpringUtils.getBean(IDcOperLogService.class); IDcDeviceService dcDeviceService = SpringUtils.getBean(IDcDeviceService.class); IDcPublishManageService dcPublishManageService = SpringUtils.getBean(IDcPublishManageService.class); @@ -142,7 +141,7 @@ public class OperationLogAspect { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String date = df.format(new Date()); String sta = ""; - if (Objects.equals(state, "0") && Objects.equals(String.valueOf(((AjaxResult) jsonResult).get("code")), "200") && !Objects.equals(String.valueOf(((AjaxResult) jsonResult).get("msg")), "500") ) { + if (Objects.equals(state, "0") && Objects.equals(String.valueOf(((AjaxResult) jsonResult).get("code")), "200") && !Objects.equals(String.valueOf(((AjaxResult) jsonResult).get("msg")), "500")) { operLog.setStatus(0); sta = "成功"; } else { @@ -207,15 +206,14 @@ public class OperationLogAspect { } - - if (Objects.equals(function.getString("functionId"), "13")&&Objects.equals(deviceType,"2")){ + if (Objects.equals(function.getString("functionId"), "13") && Objects.equals(deviceType, "2")) { JSONArray parameters = function.getJSONObject("params").getJSONArray("parameters"); - List content = parameters.stream().map(item->((JSONObject)item).getString("CONTENT")).collect(Collectors.toList()); + List content = parameters.stream().map(item -> ((JSONObject) item).getString("CONTENT")).collect(Collectors.toList()); contentDetails = content.toString().replace("[", "").replace("]", ""); } - if (Objects.equals(deviceType,"5")){ + if (Objects.equals(deviceType, "5")) { contentDetails = function.getJSONObject("params").getString("text"); } } @@ -235,20 +233,13 @@ public class OperationLogAspect { operLog.setOperLocation(loginUser.getLoginLocation()); operLog.setOperType("2"); } else { + operLog.setOperName("服务器"); + operLog.setDeptName("服务器"); + operLog.setOperLocation("服务器"); operLog.setOperType("1"); } - JSONArray jsonArray = (JSONArray) JSON.toJSON(pointArgs); - - operLog.setOperParam(String.valueOf(jsonArray)); - operLog.setDcDeviceId(deviceIds.toString()); - operLog.setDcDeviceName(deviceNames.toString()); - operLog.setOperIp(IpUtils.getIpAddr(request)); - operLog.setOperTime(new Date()); - operLog.setDcDeviceType(deviceType); - operLog.setRemark(remark.toString()); - operLog.setJsonResult(jsonResult.toString()); - dcOperLogService.save(operLog); + saveOperLog(jsonResult, operLog, pointArgs, request, deviceIds, deviceNames, deviceType, remark); if ((Objects.equals(deviceType, "2") || Objects.equals(deviceType, "5")) && Objects.nonNull(operLog.getId())) { @@ -312,17 +303,7 @@ public class OperationLogAspect { operLog.setOperType("1"); } - JSONArray jsonArray = (JSONArray) JSON.toJSON(pointArgs); - - operLog.setOperParam(String.valueOf(jsonArray)); - operLog.setDcDeviceId(deviceIds.toString()); - operLog.setDcDeviceName(deviceNames.toString()); - operLog.setOperIp(IpUtils.getIpAddr(request)); - operLog.setOperTime(new Date()); - operLog.setDcDeviceType(deviceType); - operLog.setRemark(remark.toString()); - operLog.setJsonResult(jsonResult.toString()); - dcOperLogService.save(operLog); + saveOperLog(jsonResult, operLog, pointArgs, request, deviceIds, deviceNames, deviceType, remark); //if ((Objects.equals(deviceType, "2") || Objects.equals(deviceType, "5")) && Objects.nonNull(operLog.getId())) { @@ -360,4 +341,19 @@ public class OperationLogAspect { throw e; } } + + private void saveOperLog(Object jsonResult, DcOperLog operLog, Object[] pointArgs, HttpServletRequest request, ArrayList deviceIds, ArrayList deviceNames, String deviceType, StringBuilder remark) { + IDcOperLogService dcOperLogService = SpringUtils.getBean(IDcOperLogService.class); + JSONArray jsonArray = (JSONArray) JSON.toJSON(pointArgs); + + operLog.setOperParam(String.valueOf(jsonArray)); + operLog.setDcDeviceId(deviceIds.toString()); + operLog.setDcDeviceName(deviceNames.toString()); + operLog.setOperIp(IpUtils.getIpAddr(request)); + operLog.setOperTime(new Date()); + operLog.setDcDeviceType(deviceType); + operLog.setRemark(remark.toString()); + operLog.setJsonResult(jsonResult.toString()); + dcOperLogService.save(operLog); + } } diff --git a/zc-business/src/main/java/com/zc/business/mapper/StatusMapper.java b/zc-business/src/main/java/com/zc/business/mapper/StatusMapper.java index 0c7838e1..69ecce04 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/StatusMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/StatusMapper.java @@ -20,5 +20,6 @@ public interface StatusMapper { List listStatusBySection(@Param("status")Status status); List export(@Param("status")Status status); List deviceStatusListById(@Param("status")Status status); + List listStatusByTypes(@Param("status")Status status); } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/StatusService.java b/zc-business/src/main/java/com/zc/business/service/impl/StatusService.java index 41b01bf9..312687f9 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/StatusService.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/StatusService.java @@ -41,4 +41,8 @@ public class StatusService { public List deviceStatusListById(Status status) { return statusMapper.deviceStatusListById(status); } + public List listStatusByTypes(Status status) { + List list = statusMapper.listStatusByTypes(status); + return list; + } } diff --git a/zc-business/src/main/resources/mapper/business/StatusMapper.xml b/zc-business/src/main/resources/mapper/business/StatusMapper.xml index 2f35802a..e2f7e464 100644 --- a/zc-business/src/main/resources/mapper/business/StatusMapper.xml +++ b/zc-business/src/main/resources/mapper/business/StatusMapper.xml @@ -152,6 +152,41 @@ + + +