Merge branch 'master' of http://121.40.234.130:8899/root/hl_zgbz
This commit is contained in:
@@ -411,8 +411,8 @@ public class ItemProtocol {
|
||||
list.add(new ItemDto(item_detail_labeling_qualified_qty, "当前工单明细号刻字数量", "DB600.D58"));
|
||||
list.add(new ItemDto(item_detail_labeling_qty, "当前贴标工单明细号贴标数", "DB600.D62"));
|
||||
list.add(new ItemDto(item_ready, "设备就绪", "DB600.D66"));
|
||||
list.add(new ItemDto( item_clear, "清料", "DB600.D70"));
|
||||
list.add(new ItemDto( item_pause, "暂停", "DB600.D74"));
|
||||
list.add(new ItemDto(item_clear, "清料", "DB600.D70"));
|
||||
list.add(new ItemDto(item_pause, "暂停", "DB600.D74"));
|
||||
list.add(new ItemDto(item_line_speed, "线体速度", "DB600.REAL78"));
|
||||
list.add(new ItemDto(item_feeding_mouth, "上料口", "DB600.D82"));
|
||||
list.add(new ItemDto(item_is_lettering, "是否刻字", "DB600.D86"));
|
||||
|
||||
@@ -125,6 +125,7 @@ public class LogServerImpl implements LogServer {
|
||||
String now = DateUtil.now();
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code",device_code);
|
||||
json.put("vehicle_code",vehicle_code);
|
||||
json.put("inst_code",inst_code);
|
||||
json.put("message",message);
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -36,6 +37,14 @@ public class RootLogController {
|
||||
return new ResponseEntity<>(rootLogService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/deviceLog")
|
||||
@Log("查询设备日志")
|
||||
@ApiOperation("查询设备日志")
|
||||
//@PreAuthorize("@el.check('log:list')")
|
||||
public ResponseEntity<Object> queryDeviceLog(@RequestParam Map whereJson, Pageable page) throws ParseException {
|
||||
return new ResponseEntity<>(rootLogService.queryDeviceLog(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping( "/error")
|
||||
@Log("查询异常详情")
|
||||
@ApiOperation("查询异常详情")
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.modules.log.service;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -16,6 +17,15 @@ public interface RootLogService {
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询设备日志
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String,Object> queryDeviceLog(Map whereJson, Pageable page) throws ParseException;
|
||||
|
||||
/**
|
||||
* 查询异常详情
|
||||
*
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package org.nl.modules.log.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.modules.log.service.RootLogService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
@@ -27,6 +29,8 @@ public class RootLogServiceImpl implements RootLogService {
|
||||
|
||||
private final MongoTemplate mongoTemplate;
|
||||
|
||||
private final DeviceService deviceService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page){
|
||||
String log_type = (String) whereJson.get("log_type");
|
||||
@@ -48,6 +52,8 @@ public class RootLogServiceImpl implements RootLogService {
|
||||
.lte(end_time));
|
||||
}
|
||||
|
||||
query.with(Sort.by("date"));
|
||||
|
||||
//根据条件得到的总条数
|
||||
long totalSize = mongoTemplate.count(query, Map.class, log_type);
|
||||
|
||||
@@ -61,6 +67,38 @@ public class RootLogServiceImpl implements RootLogService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryDeviceLog(Map whereJson, Pageable page){
|
||||
String device_code = (String) whereJson.get("device_code");
|
||||
String begin_time = (String) whereJson.get("begin_time");
|
||||
String end_time = (String) whereJson.get("end_time");
|
||||
|
||||
Query query = new Query().with(Sort.by("date"));
|
||||
|
||||
if (StrUtil.isEmpty(device_code)) {
|
||||
JSONArray array = deviceService.selectList();
|
||||
JSONObject json = array.getJSONObject(0);
|
||||
device_code = json.getString("device_code");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(begin_time) && StrUtil.isNotEmpty(end_time)) {
|
||||
query.addCriteria(Criteria.where("date")
|
||||
.gte(begin_time)
|
||||
.lte(end_time));
|
||||
}
|
||||
|
||||
//根据条件得到的总条数
|
||||
long totalSize = mongoTemplate.count(query, Map.class, device_code);
|
||||
|
||||
//处理分页
|
||||
query.skip(page.getPageNumber()).limit(page.getPageSize());
|
||||
List<Map> list = mongoTemplate.find(query,Map.class, device_code);
|
||||
//封装前端分页查询结果
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("content", list);
|
||||
result.put("totalElements", totalSize);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String findError(Map map) {
|
||||
String message = (String) map.get("message");
|
||||
|
||||
Reference in New Issue
Block a user