|
@@ -55,20 +55,20 @@ public class ApiAppDeviceController {
|
|
// 此处定义的sn实际上是指的表中的imei,也就是实体类的属性imei
|
|
// 此处定义的sn实际上是指的表中的imei,也就是实体类的属性imei
|
|
String checkSnResult = VerifyUtil.checkSn(entity.getImei());
|
|
String checkSnResult = VerifyUtil.checkSn(entity.getImei());
|
|
List<AppDevice> checkDuplicatedResultOnImei = appDeviceService.findAll(
|
|
List<AppDevice> checkDuplicatedResultOnImei = appDeviceService.findAll(
|
|
- QueryParamExp.eq("imei",entity.getImei()));
|
|
|
|
- if(!checkDuplicatedResultOnImei.isEmpty()){
|
|
|
|
- return ApiDTO.error(500,"该imei已经被录入",checkDuplicatedResultOnImei);
|
|
|
|
|
|
+ QueryParamExp.eq("imei", entity.getImei()));
|
|
|
|
+ if (!checkDuplicatedResultOnImei.isEmpty()) {
|
|
|
|
+ return ApiDTO.error(500, "该imei已经被录入", checkDuplicatedResultOnImei);
|
|
}
|
|
}
|
|
List<AppDevice> checkDuplicatedResultOnSn = appDeviceService.findAll(
|
|
List<AppDevice> checkDuplicatedResultOnSn = appDeviceService.findAll(
|
|
- QueryParamExp.eq("sn",entity.getSn()));
|
|
|
|
- if(!checkDuplicatedResultOnSn.isEmpty()){
|
|
|
|
- return ApiDTO.error(500,"该sn已经被录入",checkDuplicatedResultOnSn);
|
|
|
|
|
|
+ QueryParamExp.eq("sn", entity.getSn()));
|
|
|
|
+ if (!checkDuplicatedResultOnSn.isEmpty()) {
|
|
|
|
+ return ApiDTO.error(500, "该sn已经被录入", checkDuplicatedResultOnSn);
|
|
}
|
|
}
|
|
- if(checkSnResult.equals("passed")){
|
|
|
|
|
|
+ if (checkSnResult.equals("passed")) {
|
|
AppDevice tmp = appDeviceService.save(entity);
|
|
AppDevice tmp = appDeviceService.save(entity);
|
|
- return ApiDTO.ok("保存成功",tmp);}
|
|
|
|
- else{
|
|
|
|
- return ApiDTO.error(500,checkSnResult);
|
|
|
|
|
|
+ return ApiDTO.ok("保存成功", tmp);
|
|
|
|
+ } else {
|
|
|
|
+ return ApiDTO.error(500, checkSnResult);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -77,7 +77,7 @@ public class ApiAppDeviceController {
|
|
@RequestMapping(value = "get", method = RequestMethod.POST)
|
|
@RequestMapping(value = "get", method = RequestMethod.POST)
|
|
public ApiDTO get(@RequestBody @ApiParam(name = "批次编号", required = true) IdParam param) {
|
|
public ApiDTO get(@RequestBody @ApiParam(name = "批次编号", required = true) IdParam param) {
|
|
List<AppDevice> appDevicesOnOneBatch = appDeviceService.findAll(
|
|
List<AppDevice> appDevicesOnOneBatch = appDeviceService.findAll(
|
|
- QueryParamExp.eq("batchNum",param.getId()));
|
|
|
|
|
|
+ QueryParamExp.eq("batchNum", param.getId()));
|
|
return ApiDTO.ok("查询成功!", appDevicesOnOneBatch);
|
|
return ApiDTO.ok("查询成功!", appDevicesOnOneBatch);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -120,7 +120,7 @@ public class ApiAppDeviceController {
|
|
public ApiPageDTO batchNumPageQuery(@RequestBody DeviceBathQueryParam param) {
|
|
public ApiPageDTO batchNumPageQuery(@RequestBody DeviceBathQueryParam param) {
|
|
StringBuffer sql = new StringBuffer("select t1.batch_num,t1.sn,t1.deliver_time,count(0) as total,t1.add_time,t1.deliver_addr from app_device t1");
|
|
StringBuffer sql = new StringBuffer("select t1.batch_num,t1.sn,t1.deliver_time,count(0) as total,t1.add_time,t1.deliver_addr from app_device t1");
|
|
sql.append(" group by t1.batch_num");
|
|
sql.append(" group by t1.batch_num");
|
|
- if(!StringUtils.isEmpty(param.getOrderBy())){
|
|
|
|
|
|
+ if (!StringUtils.isEmpty(param.getOrderBy())) {
|
|
sql.append(param.getOrderBy());
|
|
sql.append(param.getOrderBy());
|
|
}
|
|
}
|
|
log.info("SQL: {}", sql.toString());
|
|
log.info("SQL: {}", sql.toString());
|
|
@@ -133,8 +133,9 @@ public class ApiAppDeviceController {
|
|
DeviceAttrDTO attr = appDeviceService.sn2Attr(ObjectUtil.obj2String(p.get("sn")));
|
|
DeviceAttrDTO attr = appDeviceService.sn2Attr(ObjectUtil.obj2String(p.get("sn")));
|
|
p.put("type_title", attr.getTypeTitle());
|
|
p.put("type_title", attr.getTypeTitle());
|
|
p.put("pack_title", attr.getPackTitle());
|
|
p.put("pack_title", attr.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("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("in_storage", 0);
|
|
}
|
|
}
|
|
page.setData(list);
|
|
page.setData(list);
|
|
return page;
|
|
return page;
|