|
|
@ -129,34 +129,13 @@ public class OperationLogAspect { |
|
|
|
request = null; |
|
|
|
} |
|
|
|
|
|
|
|
AjaxResult proceed = (AjaxResult) joinPoint.proceed(pointArgs); |
|
|
|
//String jsonResultString = "";
|
|
|
|
//JSONArray jsonArray = (JSONArray) proceed;
|
|
|
|
//for (Object o : jsonArray) {
|
|
|
|
// JSONObject jsonObject = (JSONObject) o;
|
|
|
|
// if (Objects.equals(jsonObject.getString("code"), "200")) {
|
|
|
|
// JSONArray data = jsonObject.getJSONArray("data");
|
|
|
|
// for (Object datum : data) {
|
|
|
|
// JSONObject results = (JSONObject) datum;
|
|
|
|
// JSONObject result = results.getJSONObject("result");
|
|
|
|
// if (Objects.equals(result.getString("code"), "200")) {
|
|
|
|
// jsonResultString = "设备"+d+"";
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
|
|
|
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(proceed.get("code")), "200")) { |
|
|
|
//if (Objects.equals(String.valueOf(proceed.get("code")), "200")) {
|
|
|
|
operLog.setStatus(0); |
|
|
|
sta = "成功"; |
|
|
|
//} else {
|
|
|
|
// operLog.setStatus(1);
|
|
|
|
// sta = "失败";
|
|
|
|
//}
|
|
|
|
if (Objects.equals(state, "0") && Objects.equals(String.valueOf(((AjaxResult)jsonResult).get("code")), "200")) { |
|
|
|
operLog.setStatus(0); |
|
|
|
sta = "成功"; |
|
|
|
} else { |
|
|
|
operLog.setStatus(1); |
|
|
|
sta = "失败"; |
|
|
@ -164,26 +143,18 @@ public class OperationLogAspect { |
|
|
|
|
|
|
|
ArrayList<String> deviceIds = new ArrayList<>(); |
|
|
|
ArrayList<String> deviceNames = new ArrayList<>(); |
|
|
|
//ArrayList<String> functionIds = new ArrayList<>();
|
|
|
|
String deviceType = ""; |
|
|
|
StringBuilder remark = new StringBuilder("在" + date + "调用"); |
|
|
|
if (operUrl.contains("batchFunctions")) { |
|
|
|
//批量调用
|
|
|
|
JSONObject pointArg = null; |
|
|
|
if (pointArgs[0] instanceof JSONObject){ |
|
|
|
pointArg = (JSONObject) pointArgs[0]; |
|
|
|
}else { |
|
|
|
pointArg = (JSONObject) JSON.toJSON(pointArgs[0]); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//if (loginUser != null) {
|
|
|
|
// SysDept sysDept = deptService.selectDeptById(loginUser.getDeptId());
|
|
|
|
//
|
|
|
|
// dcOperLog.setOperName(loginUser.getUsername());
|
|
|
|
// dcOperLog.setDeptName(sysDept.getDeptName());
|
|
|
|
// dcOperLog.setOperLocation(loginUser.getLoginLocation());
|
|
|
|
// dcOperLog.setOperType("2");
|
|
|
|
//} else {
|
|
|
|
// dcOperLog.setOperType("1");
|
|
|
|
//}
|
|
|
|
//dcOperLog.setOperIp(IpUtils.getIpAddr(request));
|
|
|
|
//dcOperLog.setOperTime(new Date());
|
|
|
|
|
|
|
|
JSONObject pointArg = (JSONObject) pointArgs[0]; |
|
|
|
JSONArray devices = pointArg.getJSONArray("devices"); |
|
|
|
JSONArray functions = pointArg.getJSONArray("functions"); |
|
|
|
|
|
|
@ -230,7 +201,6 @@ public class OperationLogAspect { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (loginUser != null) { |
|
|
|
SysDept sysDept = deptService.selectDeptById(loginUser.getDeptId()); |
|
|
|
|
|
|
@ -241,21 +211,26 @@ public class OperationLogAspect { |
|
|
|
} else { |
|
|
|
operLog.setOperType("1"); |
|
|
|
} |
|
|
|
operLog.setOperParam((Arrays.toString(pointArgs))); |
|
|
|
|
|
|
|
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(String.valueOf(proceed)); |
|
|
|
operLog.setJsonResult(jsonResult.toString()); |
|
|
|
dcOperLogService.addDcOperLog(operLog); |
|
|
|
|
|
|
|
|
|
|
|
} else if (operUrl.contains("functions")) { |
|
|
|
|
|
|
|
LambdaQueryWrapper<DcDevice> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
lambdaQueryWrapper.eq(DcDevice::getIotDeviceId, pointArgs[0]); |
|
|
|
DcDevice dcDevice = dcDeviceService.getById(Long.valueOf(String.valueOf(pointArgs[0]))); |
|
|
|
List<DcDevice> list = dcDeviceService.list(lambdaQueryWrapper); |
|
|
|
DcDevice dcDevice = list.get(0); |
|
|
|
|
|
|
|
if (!Objects.isNull(dcDevice)) { |
|
|
|
|
|
|
|
Long deviceId = dcDevice.getId(); |
|
|
@ -271,7 +246,6 @@ public class OperationLogAspect { |
|
|
|
|
|
|
|
remark.append(deviceName).append("的").append(hashMap).append("功能并且调用").append(sta).append("了"); |
|
|
|
|
|
|
|
|
|
|
|
if (loginUser != null) { |
|
|
|
SysDept sysDept = deptService.selectDeptById(loginUser.getDeptId()); |
|
|
|
operLog.setOperName(loginUser.getUsername()); |
|
|
@ -281,7 +255,10 @@ public class OperationLogAspect { |
|
|
|
} else { |
|
|
|
operLog.setOperType("1"); |
|
|
|
} |
|
|
|
operLog.setOperParam((Arrays.toString(pointArgs))); |
|
|
|
|
|
|
|
JSONObject pointArg = (JSONObject) JSON.toJSON(pointArgs); |
|
|
|
|
|
|
|
operLog.setOperParam(String.valueOf(pointArg)); |
|
|
|
operLog.setDcDeviceId(deviceIds.toString()); |
|
|
|
operLog.setDcDeviceName(deviceNames.toString()); |
|
|
|
operLog.setOperIp(IpUtils.getIpAddr(request)); |
|
|
@ -290,55 +267,6 @@ public class OperationLogAspect { |
|
|
|
operLog.setJsonResult(remark.toString()); |
|
|
|
dcOperLogService.addDcOperLog(operLog); |
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
////DcDevice dcDevice = list.get(0);
|
|
|
|
//operLog.setDcDeviceId(String.valueOf(dcDevice.getId()));
|
|
|
|
//operLog.setDcDeviceName(dcDevice.getDeviceName());
|
|
|
|
//deviceType = dcDevice.getDeviceType();
|
|
|
|
//operLog.setDcDeviceType(deviceType);
|
|
|
|
//if (loginUser != null) {
|
|
|
|
// SysDept sysDept = deptService.selectDeptById(loginUser.getDeptId());
|
|
|
|
//
|
|
|
|
// dcOperLog.setOperName(loginUser.getUsername());
|
|
|
|
// dcOperLog.setDeptName(sysDept.getDeptName());
|
|
|
|
// dcOperLog.setOperLocation(loginUser.getLoginLocation());
|
|
|
|
// dcOperLog.setOperType("0");
|
|
|
|
//} else {
|
|
|
|
// dcOperLog.setOperType("1");
|
|
|
|
//}
|
|
|
|
//dcOperLog.setOperIp(IpUtils.getIpAddr(request));
|
|
|
|
//dcOperLog.setOperParam(Arrays.toString(pointArgs));
|
|
|
|
//dcOperLog.setJsonResult("设备" + dcDevice.getDeviceName() + "在" + date + "调用了" + hashMap + "功能并且调用" + sta + "了");
|
|
|
|
////dcOperLog.setJsonResult(dcDevice.getDeviceName() + "设备在" + date + "调用" + sta + "ID为" + dcDevice.getId() + "的设备功能标识为" + pointArgs[1].toString() + "的方法");
|
|
|
|
//dcOperLog.setOperTime(new Date());
|
|
|
|
//dcOperLogService.addDcOperLog(dcOperLog);
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//String remark = "设备在" + date + "调用" + sta + "ID为" + deviceIds + "的设备功能标识为" + functionIds + "的方法";
|
|
|
|
//System.out.println(remark);
|
|
|
|
//System.out.println(deviceIds.toString());
|
|
|
|
//System.out.println(functionIds.toString());
|
|
|
|
//DcOperLog operLog = new DcOperLog();
|
|
|
|
//SysDept sysDept = deptService.selectDeptById(loginUser.getDeptId());
|
|
|
|
//operLog.setOperParam((Arrays.toString(pointArgs)));
|
|
|
|
//operLog.setOperLocation(loginUser.getLoginLocation());
|
|
|
|
//operLog.setOperName(loginUser.getUsername());
|
|
|
|
//operLog.setDeptName(sysDept.getDeptName());
|
|
|
|
//operLog.setDcDeviceId(deviceIds.toString());
|
|
|
|
//operLog.setOperType("2");
|
|
|
|
//operLog.setOperIp(IpUtils.getIpAddr(request));
|
|
|
|
//operLog.setOperTime(new Date());
|
|
|
|
//operLog.setDcDeviceType(deviceType);
|
|
|
|
//operLog.setJsonResult(remark);
|
|
|
|
//if (Objects.equals(state, "0")) {
|
|
|
|
// operLog.setStatus(0);
|
|
|
|
//} else {
|
|
|
|
// operLog.setStatus(1);
|
|
|
|
//}
|
|
|
|
//dcOperLogService.addDcOperLog(operLog);
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|