Parcourir la source

fix:设备关注,人员与设备再分配,需要调整关注设备权限状态

wangbo il y a 2 ans
Parent
commit
2295712129

+ 1 - 1
smsb-customer-manager-app/src/main/java/com/inspur/customer/service/keycloak/KeycloakServiceImpl.java

@@ -54,7 +54,7 @@ public class KeycloakServiceImpl implements KeycloakService {
         log.info("users map cache clear:{}",LocalDateTime.now() );
     }
 
-    @Scheduled(cron = "* * 0/10 * * ?")
+    @Scheduled(cron = "* 0/10 * * * ?")
     public void expiredCache(){
         // 每隔10小时,清除缓存数据初始化一次
         this.clearUserMapCache();

+ 7 - 2
smsb-customer-manager-app/src/main/java/com/inspur/customer/service/org/SmsbDepartmentServiceImpl.java

@@ -16,6 +16,7 @@ import com.inspur.customer.infrastructure.convertor.SmsbDepartmentConvertor;
 import com.inspur.customer.infrastructure.mapper.org.SmsbDepartmentMapper;
 import com.inspur.customer.infrastructure.object.org.SmsbDepartmentDO;
 import com.inspur.customer.object.org.*;
+import com.inspur.device.client.core.manage.SmsbUsersDeviceAttentionService;
 import com.inspur.device.client.core.relation.DeviceAllocateService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -47,6 +48,8 @@ public class SmsbDepartmentServiceImpl extends ServiceImpl<SmsbDepartmentMapper
     private SmsbDepartmentUserService userService;
     @DubboReference
     private DeviceAllocateService deviceAllocateService;
+    @DubboReference
+    private SmsbUsersDeviceAttentionService attentionService;
 
     @Override
     public Response addDepartment(String userId , SmsbDepartmentAdd smsbDepartmentAdd) {
@@ -290,8 +293,10 @@ public class SmsbDepartmentServiceImpl extends ServiceImpl<SmsbDepartmentMapper
             path = smsbRegrouping.getTenant();
             result = departmentUserService.updateRelation(smsbRegrouping.getUserId(), null ,null);
         }
-        // 2、更新attribute
-        if(result){
+        // 2、关注设备权限判断
+        Response attentionResul = attentionService.userRegroupHandle(smsbRegrouping.getUserId(), path);
+        // 3、更新attribute
+        if(result && attentionResul.isSuccess()){
             service.addAttributesByUserId(smsbRegrouping.getUserId() , "org" ,
                 Collections.singletonList(path));
             return Response.buildSuccess();