|
|
@ -1,9 +1,11 @@ |
|
|
|
package com.zc.business.service.impl; |
|
|
|
|
|
|
|
import cn.hutool.json.JSONArray; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.ruoyi.common.utils.PageUtils; |
|
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
|
import com.zc.business.domain.DcOperLog; |
|
|
|
import com.zc.business.enums.DeviceTypeEnum; |
|
|
|
import com.zc.business.enums.UniversalEnum; |
|
|
@ -11,10 +13,7 @@ import com.zc.business.mapper.DcOperLogMapper; |
|
|
|
import com.zc.business.service.IDcOperLogService; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
/** |
|
|
|
* 调用功能记录Service业务层处理 |
|
|
@ -43,8 +42,36 @@ public class DcOperLogServiceImpl extends ServiceImpl<DcOperLogMapper, DcOperLog |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<DcOperLog> pageDcOperLog(DcOperLog dcOperLog, Date endTime, Date startTime) { |
|
|
|
|
|
|
|
|
|
|
|
PageUtils.startPage(); |
|
|
|
return list(getDcOperLogLambdaQueryWrapper(dcOperLog, endTime, startTime)); |
|
|
|
List<DcOperLog> dcOperLogs = list(getDcOperLogLambdaQueryWrapper(dcOperLog, endTime, startTime)); |
|
|
|
if (dcOperLogs==null||dcOperLogs.size()==0){ |
|
|
|
return dcOperLogs ; |
|
|
|
} |
|
|
|
String content=""; |
|
|
|
for (DcOperLog log:dcOperLogs){ |
|
|
|
String dcDeviceType = log.getDcDeviceType(); |
|
|
|
if ("5".equals(dcDeviceType)){ |
|
|
|
content="语音广播"; |
|
|
|
}else if ("2".equals(dcDeviceType)){ |
|
|
|
content="情报板"; |
|
|
|
} |
|
|
|
String jsonResult = log.getJsonResult(); |
|
|
|
if (("[]".equals(jsonResult)|| StringUtils.isBlank(jsonResult))&&("5".equals(dcDeviceType)||"2".equals(dcDeviceType))){ |
|
|
|
String jsonResults = String.format( |
|
|
|
"[{\"deviceType\":%s,\"deviceName\":%s,\"result\":{\"code\":500,\"content\":\"{%s数据异常\"}}]", |
|
|
|
log.getDcDeviceType(), log.getDcDeviceName(), content |
|
|
|
); |
|
|
|
JSONArray objects = new JSONArray(jsonResults); |
|
|
|
log.setJsonResult(objects.toString()); |
|
|
|
log.setRemark(content+"数据异常"); |
|
|
|
String devices = String.format("[{\"devices\":[{\"deviceType\":%s}]}]", log.getDcDeviceType()); |
|
|
|
JSONArray devicesJson = new JSONArray(devices); |
|
|
|
log.setOperParam(devicesJson.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
return dcOperLogs ; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|