update 电单车协议

This commit is contained in:
Guoqs
2024-09-18 17:05:49 +08:00
parent c0e981cdb8
commit b0da86ca70
3 changed files with 53 additions and 36 deletions

View File

@@ -16,9 +16,9 @@ import com.jsowell.pile.service.PileStationInfoService;
import com.jsowell.pile.vo.base.LoginUserDetailVO;
import com.jsowell.pile.vo.base.MerchantInfoVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Objects;
@@ -33,7 +33,6 @@ import java.util.stream.Collectors;
public class UserUtils {
// 2.注入想引用的对象的静态实例
private static MemberBasicInfoService memberBasicInfoService;
private static PileMerchantInfoService pileMerchantInfoService;
@@ -43,7 +42,6 @@ public class UserUtils {
@Autowired
public UserUtils(MemberBasicInfoService memberBasicInfoService, PileMerchantInfoService pileMerchantInfoService,
PileStationInfoService pileStationInfoService) {
UserUtils.memberBasicInfoService = memberBasicInfoService;
UserUtils.pileMerchantInfoService = pileMerchantInfoService;
UserUtils.pileStationInfoService = pileStationInfoService;
}
@@ -195,4 +193,21 @@ public class UserUtils {
LoginUserDetailVO loginUserDetail = UserUtils.getLoginUserDetail();
return loginUserDetail.getFirstMerchantIdList();
}
/**
* 校验当前登录用户是否有操作站点权限
* @param stationId 站点id
* @return boolean true:有权限false:无权限
*/
public static boolean checkStationAuth(String stationId) {
AuthorizedDeptVO authorizedMap = UserUtils.getAuthorizedMap();
if (authorizedMap == null) {
return false;
}
if (CollectionUtils.isEmpty(authorizedMap.getStationDeptIds())) {
return false;
}
List<String> list = pileStationInfoService.queryByStationDeptIds(authorizedMap.getStationDeptIds());
return list.contains(stationId);
}
}