|
|
@@ -1,5 +1,6 @@
|
|
|
package com.zhongshu.card.server.core.service.school;
|
|
|
|
|
|
+import com.github.microservice.auth.security.type.AuthType;
|
|
|
import com.github.microservice.components.data.base.util.PageEntityUtil;
|
|
|
import com.zhongshu.card.client.model.school.*;
|
|
|
import com.zhongshu.card.client.ret.ResultContent;
|
|
|
@@ -17,6 +18,7 @@ import com.zhongshu.card.server.core.service.base.SuperService;
|
|
|
import com.zhongshu.card.server.core.service.org.DeviceInfoServiceImpl;
|
|
|
import com.zhongshu.card.server.core.service.org.OrganizationServiceImpl;
|
|
|
import com.zhongshu.card.server.core.util.BeanUtils;
|
|
|
+import com.zhongshu.card.server.core.util.CommonUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
@@ -26,6 +28,10 @@ import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.Assert;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
/**
|
|
|
* @author TRX
|
|
|
* @date 2024/7/2
|
|
|
@@ -159,8 +165,29 @@ public class DeviceBindServiceImpl extends SuperService implements DeviceBindSer
|
|
|
*/
|
|
|
@Override
|
|
|
public ResultContent<Page<DeviceBindModel>> page(DeviceBindSearch param, Pageable pageable) {
|
|
|
- initOidSearchParam(param);
|
|
|
+ // 找出用户所有商户oid集合
|
|
|
+ List<String> shopOids = new ArrayList<String>();
|
|
|
+ if (CommonUtil.booleanIsTrue(param.getIsAllBusinessMain())) {
|
|
|
+ // 查询当前用户所有的商户信息
|
|
|
+ List<Organization> orgs = organizationService.getUserAllOrgs(getCurrentUserId(), AuthType.BusinessMain);
|
|
|
+ if (ObjectUtils.isNotEmpty(orgs)) {
|
|
|
+ shopOids = orgs.stream().map(it -> it.getOid()).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isNotEmpty(param.getShopInfoOid())) {
|
|
|
+ shopOids.add(param.getShopInfoOid());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isEmpty(shopOids)) {
|
|
|
+ return ResultContent.buildFail("请选择查询商户或所有的");
|
|
|
+ }
|
|
|
+ Page<DeviceBind> page = deviceBindDao.page(pageable, param);
|
|
|
+ return ResultContent.buildSuccess(PageEntityUtil.concurrent2PageModel(page, this::toModel));
|
|
|
+ }
|
|
|
|
|
|
+ @Override
|
|
|
+ public ResultContent<Page<DeviceBindModel>> busDevicePage(DeviceBindSearch param, Pageable pageable) {
|
|
|
+ initOidSearchParam(param);
|
|
|
Page<DeviceBind> page = deviceBindDao.page(pageable, param);
|
|
|
return ResultContent.buildSuccess(PageEntityUtil.concurrent2PageModel(page, this::toModel));
|
|
|
}
|