Commit cb17765d by 程裕兵

feat:get user ids

parent 88319d66
...@@ -68,6 +68,7 @@ import com.xiaomai.event.EventAgent; ...@@ -68,6 +68,7 @@ import com.xiaomai.event.EventAgent;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -495,18 +496,32 @@ public class PayServiceImpl implements PayService { ...@@ -495,18 +496,32 @@ public class PayServiceImpl implements PayService {
return req; return req;
} }
private List<Long> getAdminIds(Long studioId) {
List<Long> userIds = this.getUserIds(studioId);
if (CollectionUtil.isEmpty(userIds)) {
return Lists.newArrayList();
}
return studioRpcService.listAdminIdsByUserIds(studioId, Lists.newArrayList(userIds));
}
private List<Long> getUserIds(Long studioId) {
// 有乐动收银查看和操作权限的账户
Set<Long> seeUserIds = permissionRpcService.getUserIdByCode(AuthDomainEnum.FITNESS_ADMIN.getCode(),
TenantTypeEnum.STUDIO.buildKey(studioId), "FitSeeXmPay", false);
Set<Long> operatorUserIds = permissionRpcService.getUserIdByCode(AuthDomainEnum.FITNESS_ADMIN.getCode(),
TenantTypeEnum.STUDIO.buildKey(studioId), "FitManageXmPay", false);
return seeUserIds.stream().filter(operatorUserIds::contains).collect(toList());
}
private void sendPaySuccessMessage(PayEvent e) { private void sendPaySuccessMessage(PayEvent e) {
Long studioId = e.getExtra().getLong("studioId"); Long studioId = e.getExtra().getLong("studioId");
String buyerName = e.getExtra().getString("buyerName"); String buyerName = e.getExtra().getString("buyerName");
// 有乐动收银权限的账户 List<Long> targetIds = this.getAdminIds(studioId);
Set<Long> userIds = permissionRpcService.getUserIdByCode(AuthDomainEnum.FITNESS_ADMIN.getCode(), if (CollectionUtil.isEmpty(targetIds)) {
TenantTypeEnum.STUDIO.buildKey(studioId), "FitXmPay", false);
if (CollectionUtil.isEmpty(userIds)) {
return; return;
} }
List<Long> targetIds = studioRpcService.listAdminIdsByUserIds(studioId, Lists.newArrayList(userIds));
List<Map<String, Object>> paramList = targetIds.stream().map(targetId -> { List<Map<String, Object>> paramList = targetIds.stream().map(targetId -> {
Map<String, Object> paramMap = new HashMap<>(1); Map<String, Object> paramMap = new HashMap<>(1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment