|
|
@@ -105,17 +105,18 @@ public class CameraApiController {
|
|
|
productImageRecord.setMessage("未找到相机Mac地址为'"+macAddress+"'的设备信息");
|
|
|
}else{
|
|
|
productImageRecord.setEquipmentId(equipmentEntity.getId());
|
|
|
+ productImageRecord.setEqSn(equipmentEntity.getEqSn());
|
|
|
if(productCode.length()<25){
|
|
|
productImageRecord.setStatus(2);
|
|
|
productImageRecord.setMessage("产品码'"+productCode+"'小于18位");
|
|
|
}else{
|
|
|
String code = productCode.substring(8,12);
|
|
|
- ProductModelEntity productModel = productModelService.getOne(Wrappers.<ProductModelEntity>lambdaQuery().eq(ProductModelEntity::getProductSpec,code),false);
|
|
|
+ ProductModelEntity productModel = productModelService.getOne(Wrappers.<ProductModelEntity>lambdaQuery().eq(ProductModelEntity::getProductSpec,code).eq(ProductModelEntity::getFactoryId,equipmentEntity.getFactoryId()),false);
|
|
|
if(productModel==null){
|
|
|
productImageRecord.setStatus(2);
|
|
|
productImageRecord.setMessage("未找到型号码为'"+code+"'的数据");
|
|
|
}else{
|
|
|
- ProductEntity productEntity = productService.getOne(Wrappers.<ProductEntity>lambdaQuery().eq(ProductEntity::getQrCode,productCode).eq(ProductEntity::getTenantId,equipmentEntity.getTenantId()),false);
|
|
|
+ ProductEntity productEntity = productService.getOne(Wrappers.<ProductEntity>lambdaQuery().eq(ProductEntity::getQrCode,productCode).eq(ProductEntity::getFactoryId,equipmentEntity.getFactoryId()),false);
|
|
|
if(productEntity==null){
|
|
|
productEntity = new ProductEntity();
|
|
|
productEntity.setTenantId(productModel.getTenantId());
|
|
|
@@ -128,6 +129,8 @@ public class CameraApiController {
|
|
|
productEntity.setQrCode(productCode);
|
|
|
productEntity.setStatus(2);
|
|
|
productService.save(productEntity);
|
|
|
+ productImageRecord.setMessage("成功");
|
|
|
+ productImageRecord.setProductId(productEntity.getId());
|
|
|
}else{
|
|
|
if(productEntity.getStatus()==2){
|
|
|
productEntity.setFrontImg(bladeFile.getLink());
|
|
|
@@ -143,6 +146,9 @@ public class CameraApiController {
|
|
|
}
|
|
|
}
|
|
|
productImageRecordService.save(productImageRecord);
|
|
|
+ if(equipmentEntity!=null){
|
|
|
+ webSocketServer.sendToOne(equipmentEntity.getEqSn(), JSONObject.toJSONString(productImageRecord));
|
|
|
+ }
|
|
|
|
|
|
if(productImageRecord.getStatus()==2){
|
|
|
return R.fail(productImageRecord.getMessage());
|
|
|
@@ -155,7 +161,6 @@ public class CameraApiController {
|
|
|
result.put("macAddress",macAddress);
|
|
|
result.put("productCode",productCode);
|
|
|
result.put("imgUrl",fileUrl);
|
|
|
-// webSocketServer.sendToOne(macAddress, JSONObject.toJSONString(result));
|
|
|
return R.data(result);
|
|
|
|
|
|
}
|