mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-07 11:29:58 +08:00
update 校验用户(管理员,普通用户),不可重复绑定同一台桩
This commit is contained in:
@@ -498,6 +498,14 @@ public class PileService {
|
|||||||
// 充电桩没有绑定任何人
|
// 充电桩没有绑定任何人
|
||||||
throw new BusinessException(ReturnCodeEnum.CODE_NO_ADMIN_FOR_PILE);
|
throw new BusinessException(ReturnCodeEnum.CODE_NO_ADMIN_FOR_PILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//校验用户(管理员,普通用户),不可重复绑定同一台桩
|
||||||
|
for (PileMemberRelation list : relationList) {
|
||||||
|
if (Objects.equals(list.getMemberId(), memberId)){
|
||||||
|
throw new BusinessException(ReturnCodeEnum.CODE_USER_HAS_BEEN_THIS_PILE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 使用stream把relationList转为map, key为type, value为List<PileMemberRelation>
|
// 使用stream把relationList转为map, key为type, value为List<PileMemberRelation>
|
||||||
Map<String, List<PileMemberRelation>> map = relationList.stream().collect(Collectors.groupingBy(PileMemberRelation::getType));
|
Map<String, List<PileMemberRelation>> map = relationList.stream().collect(Collectors.groupingBy(PileMemberRelation::getType));
|
||||||
List<PileMemberRelation> adminMemberRelationList = map.get(Constants.ONE); // 管理员列表
|
List<PileMemberRelation> adminMemberRelationList = map.get(Constants.ONE); // 管理员列表
|
||||||
|
|||||||
Reference in New Issue
Block a user