|
@@ -49,6 +49,15 @@ public class ApiAppDeviceLogController {
|
|
|
return ApiDTO.ok();
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "设备自检")
|
|
|
+ @RequestMapping(value = "selfcheck", method = RequestMethod.POST)
|
|
|
+ public ApiDTO selfCheck(@RequestBody @ApiParam(name = "入库参数", value = "指定sn", required = true) LibraryInFormParam param) {
|
|
|
+ AppDevice device = appDeviceService.getOne(QueryParamExp.eq("sn", param.getSn()));
|
|
|
+ device.setCheckStatus(1);
|
|
|
+ appDeviceService.save(device);
|
|
|
+ return ApiDTO.ok();
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value = "批次入库 搜索 & 重置")
|
|
|
@RequestMapping(value = "instorage/batch/Query", method = RequestMethod.POST)
|
|
|
public ApiPageDTO inStorageBatchQuery(@RequestBody DeviceBatchQueryParam param) {
|
|
@@ -109,15 +118,16 @@ public class ApiAppDeviceLogController {
|
|
|
public ApiPageDTO inStoragePageQuery(@RequestBody LibraryInQueryParam param) {
|
|
|
|
|
|
StringBuffer sql = new StringBuffer();
|
|
|
- if (CollectionUtils.isEmpty(param.getCheckStatus())) {
|
|
|
+ if (StringUtils.isEmpty(param.getCheckStatus())) {
|
|
|
sql.append("SELECT * FROM app_device_log WHERE type=1");
|
|
|
} else {
|
|
|
sql.append("SELECT * FROM app_device_log WHERE type=1 AND sn IN(SELECT sn FROM app_device WHERE check_status=" +
|
|
|
- param.getCheckStatus().get(0).toString() + ")");
|
|
|
+ param.getCheckStatus().toString() + ")");
|
|
|
}
|
|
|
|
|
|
log.info("SQL: {}", sql.toString());
|
|
|
|
|
|
+ param.addParam(QueryParamExp.like("sn", "%".concat(param.getSn()).concat("%")));
|
|
|
ApiPageDTO page = appDeviceService.getListBySQL(sql.toString(), new HashMap<>(), param);
|
|
|
if (null != page.getData()) {
|
|
|
// 组装数据
|
|
@@ -170,8 +180,7 @@ public class ApiAppDeviceLogController {
|
|
|
Page<AppDeviceLog> deviceLogPage = deviceLogService.findByParam(param);
|
|
|
|
|
|
deviceLogPage.getContent().forEach(p -> {
|
|
|
- AppDevice device = new AppDevice();
|
|
|
- device.setImei(p.getImei());
|
|
|
+ AppDevice device = appDeviceService.getOne(QueryParamExp.eq("sn", p.getSn()));
|
|
|
appDeviceService.addImeiTitle(device);
|
|
|
p.appendFormDevice(device);
|
|
|
p.appendInTime(device);
|
|
@@ -250,7 +259,7 @@ public class ApiAppDeviceLogController {
|
|
|
sql.append(" where t1.batch_num like '%").append(param.getBatchNum()).append("%'");
|
|
|
}
|
|
|
|
|
|
- sql.append(" group by t1.batch_num");
|
|
|
+ sql.append(" group by t1.operate_id");
|
|
|
if (!StringUtils.isEmpty(param.getOrderBy())) {
|
|
|
sql.append(param.getOrderBy());
|
|
|
}
|
|
@@ -390,7 +399,7 @@ public class ApiAppDeviceLogController {
|
|
|
sql.append(" where t1.batch_num like '%").append(param.getBatchNum()).append("%'");
|
|
|
}
|
|
|
|
|
|
- sql.append(" group by t1.batch_num");
|
|
|
+ sql.append(" group by t1.operate_id");
|
|
|
if (!StringUtils.isEmpty(param.getOrderBy())) {
|
|
|
sql.append(param.getOrderBy());
|
|
|
}
|
|
@@ -401,7 +410,7 @@ public class ApiAppDeviceLogController {
|
|
|
// 组装数据
|
|
|
List<Map<String, Object>> list = (List<Map<String, Object>>) page.getData();
|
|
|
for (Map<String, Object> p : list) {
|
|
|
- AppDevice device = new AppDevice();
|
|
|
+ AppDevice device = appDeviceService.getOne(QueryParamExp.eq("sn",p.get("sn")));
|
|
|
device.setImei(ObjectUtil.obj2String(p.get("imei")));
|
|
|
appDeviceService.addImeiTitle(device);
|
|
|
|
|
@@ -410,6 +419,7 @@ public class ApiAppDeviceLogController {
|
|
|
p.put("deliver_time", DateUtils.toString(ObjectUtil.obj2Date(p.get("deliver_time")), DateUtils.YMD));
|
|
|
p.put("add_time", DateUtils.toString(ObjectUtil.obj2Date(p.get("add_time")), DateUtils.YMDHMS));
|
|
|
p.put("operator", "admin");
|
|
|
+ p.put("instorageTime", device.getInstorageTime());
|
|
|
}
|
|
|
page.setData(list);
|
|
|
}
|