fix (farm): 首页,生产计划,微信登录
- 网箱编号规则 重构 - 微信登录,租户列表返回套餐信息
This commit is contained in:
@@ -30,5 +30,9 @@ public class TenantTokenRespVO {
|
||||
@Schema(description = "手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "套餐ID")
|
||||
private Long packageId;
|
||||
@Schema(description = "套餐名称")
|
||||
private String packageName;
|
||||
|
||||
}
|
||||
|
||||
@@ -560,7 +560,25 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
res.stream().forEach(e -> e.setMobile(phoneNumber));
|
||||
// set package info
|
||||
List<Long> tenantIds = res.stream()
|
||||
.map(vo -> Long.valueOf(vo.getTenantId()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Map<Long,Map<Long,String>> pMap = tenantService.getPackageMapByTenantId(tenantIds);
|
||||
for (TenantTokenRespVO e : res) {
|
||||
e.setMobile(phoneNumber);
|
||||
|
||||
if (!pMap.containsKey(Long.valueOf(e.getTenantId()))) {
|
||||
continue;
|
||||
}
|
||||
Map<Long, String> packageMap = pMap.get(Long.valueOf(e.getTenantId()));
|
||||
for (Map.Entry<Long, String> en : packageMap.entrySet()) {
|
||||
e.setPackageId(en.getKey());
|
||||
e.setPackageName(en.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -587,12 +605,8 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
*/
|
||||
private List<TenantTokenRespVO> getTenantList(String phoneNumber) {
|
||||
List<TenantRespVO> tList = tenantService.getTenantListByMobile(phoneNumber);
|
||||
// tList = tList.stream()
|
||||
// .filter(tenant -> ObjectUtils.notEqual(tenantId, tenant.getTenantId()))
|
||||
// .collect(Collectors.toList());
|
||||
|
||||
return tList.stream().map(e ->
|
||||
new TenantTokenRespVO(String.valueOf(e.getTenantId()), e.getTenantName(), "1", "", "", 0,phoneNumber)
|
||||
new TenantTokenRespVO(String.valueOf(e.getTenantId()), e.getTenantName(), "1", "", "", 0,phoneNumber,0L,"")
|
||||
).toList();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.system.service.tenant.handler.TenantMenuHandler;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -147,4 +148,6 @@ public interface TenantService {
|
||||
List<TenantRespVO> loginForTenantList(LoginForTenantReqVO reqVO);
|
||||
|
||||
List<TenantRespVO> getTenantListByMobile(String mobileNumber);
|
||||
|
||||
Map<Long, Map<Long, String>> getPackageMapByTenantId(List<Long> tenantIds);
|
||||
}
|
||||
|
||||
@@ -41,10 +41,7 @@ import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
@@ -135,6 +132,22 @@ public class TenantServiceImpl implements TenantService {
|
||||
pMap.getOrDefault(t.getPackageId(), ""))).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Long, Map<Long, String>> getPackageMapByTenantId(List<Long> tenantIds) {
|
||||
|
||||
List<TenantPackageDO> pList = tenantPackageService.getTenantPackageListByStatus(0);
|
||||
Map<Long, String> pMap = pList.stream().collect(Collectors.toMap(TenantPackageDO::getId, TenantPackageDO::getName, (v1, v2) -> v1));
|
||||
|
||||
List<TenantDO> tList = tenantMapper.selectList(TenantDO::getId,tenantIds);
|
||||
Map<Long, Map<Long, String>> res = new HashMap<>();
|
||||
for (TenantDO t : tList) {
|
||||
Map<Long, String> map = new HashMap<>();
|
||||
map.put(t.getPackageId(), pMap.get(t.getPackageId()));
|
||||
res.put(t.getId(), map);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
@DSTransactional // 多数据源,使用 @DSTransactional 保证本地事务,以及数据源的切换
|
||||
@DataPermission(enable = false) // 参见 https://gitee.com/zhijiantianya/ruoyi-vue-pro/pulls/1154 说明
|
||||
|
||||
Reference in New Issue
Block a user