luodangjia
2024-11-04 e0fc8f7e2230b51e3bbe8dea43790cf11b7170e9
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileNotificationServiceImpl.java
@@ -15,6 +15,8 @@
import com.ruoyi.other.api.feignClient.UserSiteClient;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysUserClient;
import com.ruoyi.system.api.feignClient.SysUserRoleClient;
import com.ruoyi.system.api.model.SysUserRoleVo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -44,6 +46,9 @@
   
   @Resource
   private RoleSiteClient roleSiteClient;
   @Resource
   private SysUserRoleClient sysUserRoleClient;
   
   
   
@@ -71,13 +76,15 @@
            //非管理员需要根据角色和用户配置查询允许的站点数据
            if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){
               List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData();
               List<Integer> data1 = roleSiteClient.getSiteIds(sysUser.getRoleId()).getData();
               List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData();
               List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData();
               data.addAll(data1);
               siteIds = new HashSet<>(data);
            }
         }
      }else{
         siteIds = new HashSet<>(siteId);
         siteIds = new HashSet<>();
         siteIds.add(siteId);
      }
      PageInfo<TChargingPileNotification> pageInfo = new PageInfo<>(basePage.getPageCurr(), basePage.getPageSize());
      List<TChargingPileNotification> list = this.baseMapper.chargingPileNotificationPageList(pageInfo, siteIds);
@@ -88,20 +95,11 @@
   @Override
   public void saveData(Integer type,Integer siteId,Integer chargingPileId, String phone, String data) {
      TChargingPileNotification notification = new TChargingPileNotification();
      switch (type){
         case 1:
            // 验证码
            notification.setPhone(phone);
            notification.setContent(data);
            break;
         default:
            // 停车占位
            notification.setSiteId(siteId);
            notification.setChargingPileId(chargingPileId);
            notification.setPhone(phone);
            notification.setContent(data);
            break;
      }
      notification.setSiteId(siteId);
      notification.setChargingPileId(chargingPileId);
      notification.setPhone(phone);
      notification.setContent(data);
      this.save(notification);
   }
}