Browse Source

在service-iot服务模块新增产品和删除产品方法中增加调用删除产品缓存、新增设备和删除设备方法中增加调用删除设备缓存API方法逻辑

james 1 month ago
parent
commit
9292136e38

+ 5 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/DmpDeviceInfoServiceImpl.java

@@ -370,6 +370,8 @@ public class DmpDeviceInfoServiceImpl extends AbstractCrudService<DmpDeviceInfoM
             }
             this.save(dmpDeviceInfo);
 
+            remoteTransferService.deleteDeviceCache(dmpDeviceInfo.getProductCode());
+
             DmpDeviceStatus dmpDeviceStatus = new DmpDeviceStatus();
             dmpDeviceStatus.setDeviceId(dmpDeviceInfo.getDeviceId());
             dmpDeviceStatus.setProductId(dmpDeviceInfo.getProductId());
@@ -873,6 +875,9 @@ public class DmpDeviceInfoServiceImpl extends AbstractCrudService<DmpDeviceInfoM
         }
 
         dmpDeviceInfo.setDeleteFlag(1);
+
+        remoteTransferService.deleteDeviceCache(dmpDeviceInfo.getProductCode());
+
         return this.updateById(dmpDeviceInfo);
     }
 

+ 10 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/DmpProductInfoServiceImpl.java

@@ -21,6 +21,7 @@ import com.usky.iot.mapper.DmpProductInfoMapper;
 import com.usky.iot.service.*;
 import com.usky.iot.service.config.IntegerUtils;
 import com.usky.iot.service.vo.DmpProductInfoRequest;
+import com.usky.transfer.RemoteTransferService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -54,6 +55,9 @@ public class DmpProductInfoServiceImpl extends AbstractCrudService<DmpProductInf
     @Autowired
     private DmpProductAttributeService dmpProductAttributeService;
 
+    @Autowired
+    private RemoteTransferService remoteTransferService;
+
     @Override
     public void add(DmpProductInfo dmpProductInfo) {
         if (checkNameUnique(dmpProductInfo)){
@@ -81,6 +85,9 @@ public class DmpProductInfoServiceImpl extends AbstractCrudService<DmpProductInf
         dmpProductInfo.setDeleteFlag(0);
         dmpProductInfo.setTenantId(SecurityUtils.getTenantId());
         this.save(dmpProductInfo);
+
+        remoteTransferService.deleteProductCache();
+
         int productId = dmpProductInfo.getId();
         if(null != one){
             String dataField = one.getDataField();
@@ -253,6 +260,9 @@ public class DmpProductInfoServiceImpl extends AbstractCrudService<DmpProductInf
         }
 
         dmpProductInfo.setDeleteFlag(1);
+
+        remoteTransferService.deleteProductCache();
+
         return this.updateById(dmpProductInfo);
     }