|
@@ -53,7 +53,7 @@ public class ApiAppDeviceLogController {
|
|
|
public ApiPageDTO inStorageBatchQuery(@RequestBody DeviceBatchQueryParam param) {
|
|
|
|
|
|
StringBuffer sql = new StringBuffer();
|
|
|
- sql.append("select t1.batch_num,t1.sn,t1.check_status,t1.imei,t1.deliver_time,count(0) as total,count(if(status = 1,true,null)) as in_storage,count(if(status = 2,true,null)) as transfer,");
|
|
|
+ sql.append("select t1.batch_num,t1.operate_id,t1.sn,t1.check_status,t1.imei,t1.deliver_time,count(0) as total,count(if(status = 1,true,null)) as in_storage,count(if(status = 2,true,null)) as transfer,");
|
|
|
sql.append("count(if(status = 3,true,null)) as out_storage,count(if(status = 4,true,null)) as handle,");
|
|
|
sql.append("t1.add_time,t1.received_place from app_device t1");
|
|
|
|
|
@@ -133,6 +133,7 @@ public class ApiAppDeviceLogController {
|
|
|
pTemp.put("type_title", device.getTypeTitle());
|
|
|
pTemp.put("pack_title", device.getPackTitle());
|
|
|
pTemp.put("batch_num", appDevice.getBatchNum());
|
|
|
+ pTemp.put("check_status", appDevice.getCheckStatus());
|
|
|
pTemp.put("status", appDevice.getStatus());
|
|
|
pTemp.put("received_place", appDevice.getReceivedPlace());
|
|
|
pTemp.put("deliver_time", DateUtils.toString(ObjectUtil.obj2Date(appDevice.getDeliverTime()), DateUtils.YMD));
|
|
@@ -154,14 +155,34 @@ public class ApiAppDeviceLogController {
|
|
|
}
|
|
|
@ApiOperation(value = "调回平台 ")
|
|
|
@RequestMapping(value = "transferBack", method = RequestMethod.POST)
|
|
|
- public ApiDTO transferBack(@RequestBody @ApiParam(name = "回调参数", value = "输入sn", required = true) TransferBySnQueryParam param) {
|
|
|
+ public ApiDTO transferBack(@RequestBody @ApiParam(name = "回调参数", value = "输入sn", required = true) TransferFormParam param) {
|
|
|
deviceLogService.transferBack(param);
|
|
|
return ApiDTO.ok();
|
|
|
}
|
|
|
- @ApiOperation(value = "设备调拨 搜索 & 重置")
|
|
|
+
|
|
|
+ @ApiOperation(value = "设备调拨 查看详情")
|
|
|
+ @RequestMapping(value = "transfer/detialQuery", method = RequestMethod.POST)
|
|
|
+ public ApiPageDTO transferDetialQuery(@RequestBody detialQueryParam param) {
|
|
|
+ QueryParam query = new QueryParam();
|
|
|
+
|
|
|
+ query.addParam(QueryParamExp.eq("operateID", param.getOperateID()));
|
|
|
+ query.addParam(QueryParamExp.eq("type", 2));
|
|
|
+ Page<AppDeviceLog> deviceLogPage = deviceLogService.findByParam(query);
|
|
|
+
|
|
|
+ deviceLogPage.getContent().forEach(p -> {
|
|
|
+ AppDevice device = new AppDevice();
|
|
|
+ device.setImei(p.getImei());
|
|
|
+ appDeviceService.addImeiTitle(device);
|
|
|
+ p.appendFormDevice(device);
|
|
|
+ });
|
|
|
+ return new ApiPageDTO(null, deviceLogPage);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "设备调拨 搜索 & 重置")
|
|
|
@RequestMapping(value = "transfer/pageQuery", method = RequestMethod.POST)
|
|
|
public ApiPageDTO transferPageQuery(@RequestBody LogTransferQueryParam param) {
|
|
|
- StringBuffer sql = new StringBuffer("select t.batch_num,t.add_time,count(0) as total,t.tf_event,t.tf_device_type,t.tf_used,t.tf_describe,t.out_custom_id,t.operator,t.remarks from app_device_log t where t.type = 2");
|
|
|
+ StringBuffer sql = new StringBuffer("select t.batch_num,t.operate_id, t.add_time,count(0) as total,t.tf_event,t.tf_device_type,t.tf_used,t.tf_describe,t.out_custom_id,t.operator,t.remarks from app_device_log t where t.type = 2");
|
|
|
|
|
|
// sn搜索
|
|
|
if (!StringUtils.isEmpty(param.getSn())) {
|
|
@@ -173,7 +194,7 @@ public class ApiAppDeviceLogController {
|
|
|
sql.append(StringUtils.isEmpty(param.getSn()) ? "where" : "and");
|
|
|
sql.append(" t.tf_device_type = '").append(param.getType()).append("'");
|
|
|
}
|
|
|
- sql.append(" group by t.batch_num,t.add_time,t.tf_event,t.tf_device_type,t.tf_used,t.tf_describe,t.out_custom_id,t.operator,t.remarks");
|
|
|
+ sql.append(" group by t.operate_id");
|
|
|
if (!StringUtils.isEmpty(param.getOrderBy())) {
|
|
|
sql.append(param.getOrderBy());
|
|
|
}
|
|
@@ -201,24 +222,19 @@ public class ApiAppDeviceLogController {
|
|
|
if (!StringUtils.isEmpty(param)) {
|
|
|
query.addParam(QueryParamExp.like("sn", "%".concat(param.getSn()).concat("%")));
|
|
|
}
|
|
|
- Page<AppDeviceLog> deviceLogPage = deviceLogService.findByParam(query);
|
|
|
-
|
|
|
- deviceLogPage.getContent().forEach(p -> {
|
|
|
+ Page<AppDevice> devicePage = appDeviceService.findByParam(query);
|
|
|
|
|
|
- // 查看自检状态
|
|
|
- AppDevice device = new AppDevice();
|
|
|
- device.setImei(p.getImei());
|
|
|
- appDeviceService.addImeiTitle(device);
|
|
|
- p.appendFormDevice(device);
|
|
|
+ devicePage.getContent().forEach(p -> {
|
|
|
+ appDeviceService.addImeiTitle(p);
|
|
|
});
|
|
|
- return new ApiPageDTO(null, deviceLogPage);
|
|
|
+ return new ApiPageDTO(null, devicePage);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "新增调拨 --> 选择批次 查询 & 重置")
|
|
|
@RequestMapping(value = "transfer/byBatch/pageQuery", method = RequestMethod.POST)
|
|
|
public ApiPageDTO transferByBatchPageQuery(@RequestBody DeviceBatchQueryParam param) {
|
|
|
StringBuffer sql = new StringBuffer();
|
|
|
- sql.append("select t1.batch_num,t1.sn,t1.imei,t1.deliver_time,count(0) as total,count(if(status = 1,true,null)) as in_storage,count(if(status = 2,true,null)) as transfer,");
|
|
|
+ sql.append("select t1.batch_num,t1.operate_id,t1.sn,t1.imei,t1.deliver_time,count(0) as total,count(if(status = 1,true,null)) as in_storage,count(if(status = 2,true,null)) as transfer,");
|
|
|
sql.append("count(if(status = 3,true,null)) as out_storage,count(if(status = 4,true,null)) as handle,");
|
|
|
sql.append("t1.add_time,t1.received_place from app_device t1");
|
|
|
|
|
@@ -287,10 +303,30 @@ public class ApiAppDeviceLogController {
|
|
|
return ApiDTO.ok();
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "设备出库 查看详情")
|
|
|
+ @RequestMapping(value = "outstorage/detialQuery", method = RequestMethod.POST)
|
|
|
+ public ApiPageDTO outDetialQuery(@RequestBody detialQueryParam param) {
|
|
|
+ QueryParam query = new QueryParam();
|
|
|
+
|
|
|
+ query.addParam(QueryParamExp.eq("operateID", param.getOperateID()));
|
|
|
+ query.addParam(QueryParamExp.eq("type", 3));
|
|
|
+
|
|
|
+ Page<AppDeviceLog> deviceLogPage = deviceLogService.findByParam(query);
|
|
|
+
|
|
|
+ deviceLogPage.getContent().forEach(p -> {
|
|
|
+ AppDevice device = new AppDevice();
|
|
|
+ device.setImei(p.getImei());
|
|
|
+ appDeviceService.addImeiTitle(device);
|
|
|
+ p.appendFormDevice(device);
|
|
|
+ });
|
|
|
+ return new ApiPageDTO(null, deviceLogPage);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value = "设备出库 搜索 & 重置")
|
|
|
@RequestMapping(value = "outstorage/pageQuery", method = RequestMethod.POST)
|
|
|
public ApiPageDTO outPageQuery(@RequestBody OutQueryParam param) {
|
|
|
- StringBuffer sql = new StringBuffer("select t.batch_num,t.add_time,count(0) as total,t.out_type,t.receiver_name,t.receiver_phone,t.remarks,t.out_custom_id,t.operator,t.update_time from app_device_log t where t.type = 3");
|
|
|
+ StringBuffer sql = new StringBuffer("select t.batch_num,t1.operate_id,t.add_time,count(0) as total,t.out_type,t.receiver_name,t.receiver_phone,t.remarks,t.out_custom_id,t.operator,t.update_time from app_device_log t where t.type = 3");
|
|
|
|
|
|
// sn搜索
|
|
|
if (!StringUtils.isEmpty(param.getSn())) {
|
|
@@ -302,7 +338,7 @@ public class ApiAppDeviceLogController {
|
|
|
sql.append(StringUtils.isEmpty(param.getSn()) ? "where" : "and");
|
|
|
sql.append(" t.out_type = '").append(param.getOutType()).append("'");
|
|
|
}
|
|
|
- sql.append(" group by t.batch_num,t.add_time,t.out_type,t.receiver_name,t.receiver_phone,t.remarks,t.out_custom_id,t.operator,t.update_time");
|
|
|
+ sql.append(" group by t1.operate_id");
|
|
|
if (!StringUtils.isEmpty(param.getOrderBy())) {
|
|
|
sql.append(param.getOrderBy());
|
|
|
}
|
|
@@ -340,16 +376,40 @@ public class ApiAppDeviceLogController {
|
|
|
|
|
|
@ApiOperation(value = "批次出库 搜索 & 重置")
|
|
|
@RequestMapping(value = "outstorage/byBatch/pageQuery", method = RequestMethod.POST)
|
|
|
- public ApiPageDTO outByBatchPageQuery(@RequestBody OutByBatchQueryParam param) {
|
|
|
- param.addParam(QueryParamExp.eq("type", 3));
|
|
|
- Page<AppDeviceLog> deviceLogPage = deviceLogService.findByParam(param);
|
|
|
- deviceLogPage.getContent().forEach(p -> {
|
|
|
- AppDevice device = new AppDevice();
|
|
|
- device.setImei(p.getImei());
|
|
|
- appDeviceService.addImeiTitle(device);
|
|
|
- p.appendFormDevice(device);
|
|
|
- });
|
|
|
- return new ApiPageDTO(null, deviceLogPage);
|
|
|
+ public ApiPageDTO outByBatchPageQuery(@RequestBody DeviceBatchQueryParam param) {
|
|
|
+ StringBuffer sql = new StringBuffer();
|
|
|
+ sql.append("select t1.batch_num,t1.operate_id,t1.sn,t1.imei,t1.deliver_time,count(0) as total,count(if(status = 1,true,null)) as in_storage,count(if(status = 2,true,null)) as transfer,");
|
|
|
+ sql.append("count(if(status = 3,true,null)) as out_storage,count(if(status = 4,true,null)) as handle,");
|
|
|
+ sql.append("t1.add_time,t1.received_place from app_device t1");
|
|
|
+
|
|
|
+ if (!StringUtils.isEmpty(param.getBatchNum())) {
|
|
|
+ sql.append(" where t1.batch_num like '%").append(param.getBatchNum()).append("%'");
|
|
|
+ }
|
|
|
+
|
|
|
+ sql.append(" group by t1.batch_num");
|
|
|
+ if (!StringUtils.isEmpty(param.getOrderBy())) {
|
|
|
+ sql.append(param.getOrderBy());
|
|
|
+ }
|
|
|
+ log.info("SQL: {}", sql.toString());
|
|
|
+
|
|
|
+ ApiPageDTO page = appDeviceService.getListBySQL(sql.toString(), new HashMap<>(), param);
|
|
|
+ if(null != page.getData()) {
|
|
|
+ // 组装数据
|
|
|
+ List<Map<String, Object>> list = (List<Map<String, Object>>) page.getData();
|
|
|
+ for (Map<String, Object> p : list) {
|
|
|
+ AppDevice device = new AppDevice();
|
|
|
+ device.setImei(ObjectUtil.obj2String(p.get("imei")));
|
|
|
+ appDeviceService.addImeiTitle(device);
|
|
|
+
|
|
|
+ p.put("type_title", device.getTypeTitle());
|
|
|
+ p.put("pack_title", device.getPackTitle());
|
|
|
+ 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");
|
|
|
+ }
|
|
|
+ page.setData(list);
|
|
|
+ }
|
|
|
+ return page;
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "新增处置")
|