|
@ -10,11 +10,15 @@ import com.zc.business.domain.DcOperLog; |
|
|
import com.zc.business.service.IDcOperLogService; |
|
|
import com.zc.business.service.IDcOperLogService; |
|
|
import io.swagger.annotations.Api; |
|
|
import io.swagger.annotations.Api; |
|
|
import io.swagger.annotations.ApiOperation; |
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
|
import jdk.nashorn.internal.objects.NativeUint8Array; |
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
import org.json.JSONArray; |
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
import javax.validation.Valid; |
|
|
import javax.validation.Valid; |
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.Date; |
|
|
import java.util.Date; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
@ -51,7 +55,35 @@ public class DcOperLogController extends BaseController { |
|
|
// @PreAuthorize("@ss.hasPermi('iot:facility:list')")
|
|
|
// @PreAuthorize("@ss.hasPermi('iot:facility:list')")
|
|
|
@GetMapping("list") |
|
|
@GetMapping("list") |
|
|
public TableDataInfo listFacility(DcOperLog dcOperLog, @RequestParam(value = "endTime", required = false) Date endTime, @RequestParam(value = "startTime", required = false) Date startTime) { |
|
|
public TableDataInfo listFacility(DcOperLog dcOperLog, @RequestParam(value = "endTime", required = false) Date endTime, @RequestParam(value = "startTime", required = false) Date startTime) { |
|
|
return getDataTable(dcOperLogService.pageDcOperLog(dcOperLog, endTime, startTime)); |
|
|
List<DcOperLog> dcOperLogs = dcOperLogService.pageDcOperLog(dcOperLog, endTime, startTime); |
|
|
|
|
|
ArrayList<DcOperLog> operLogArrayList = new ArrayList<>(); |
|
|
|
|
|
if (dcOperLogs==null||dcOperLogs.size()==0){ |
|
|
|
|
|
return getDataTable(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)){ |
|
|
|
|
|
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()); |
|
|
|
|
|
} |
|
|
|
|
|
operLogArrayList.add(log); |
|
|
|
|
|
} |
|
|
|
|
|
return getDataTable(operLogArrayList); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|