Compare commits
No commits in common. "d751de05c20fca82a3c34e1f16c06b9b68ea5837" and "910da9cdff8f4bfeabf800940cf6f7e722da2344" have entirely different histories.
d751de05c2
...
910da9cdff
@ -16,7 +16,6 @@ import me.zhyd.oauth.utils.AuthStateUtils;
|
||||
import org.dromara.common.core.constant.SystemConstants;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.domain.model.LoginBody;
|
||||
import org.dromara.common.core.domain.model.LoginUser;
|
||||
import org.dromara.common.core.domain.model.RegisterBody;
|
||||
import org.dromara.common.core.domain.model.SocialLoginBody;
|
||||
import org.dromara.common.core.utils.*;
|
||||
@ -29,7 +28,6 @@ import org.dromara.common.social.utils.SocialUtils;
|
||||
import org.dromara.common.sse.dto.SseMessageDto;
|
||||
import org.dromara.common.sse.utils.SseMessageUtils;
|
||||
import org.dromara.common.tenant.helper.TenantHelper;
|
||||
import org.dromara.system.domain.SysTenant;
|
||||
import org.dromara.system.domain.bo.SysTenantBo;
|
||||
import org.dromara.system.domain.vo.SysClientVo;
|
||||
import org.dromara.system.domain.vo.SysTenantVo;
|
||||
@ -192,9 +190,6 @@ public class AuthController {
|
||||
|
||||
/**
|
||||
* 登录页面租户下拉框
|
||||
* 超级管理员可查看所有租户
|
||||
* 代理租户管理员可查自己租户和parentIds中包含自己的租户
|
||||
* 店铺租户和达人租户只可查看自己的租户
|
||||
*
|
||||
* @return 租户列表
|
||||
*/
|
||||
@ -208,27 +203,31 @@ public class AuthController {
|
||||
if (!enable) {
|
||||
return R.ok(result);
|
||||
}
|
||||
SysTenantVo sysTenantVo = tenantService.queryByTenantId(LoginHelper.getTenantId());
|
||||
List<SysTenantVo> sysTenantList = tenantService.getByParentId(sysTenantVo.getId());
|
||||
List<TenantListVo> voList = MapstructUtils.convert(sysTenantList, TenantListVo.class);
|
||||
if (voList != null) {
|
||||
voList.add(TenantListVo.builder().tenantId(sysTenantVo.getTenantId()).companyName(sysTenantVo.getCompanyName()).domain(sysTenantVo.getDomain()).build());
|
||||
}
|
||||
result.setVoList(voList);
|
||||
|
||||
// 获取域名 --- 暂时不需要
|
||||
// String host;
|
||||
// String referer = request.getHeader("referer");
|
||||
// if (StringUtils.isNotBlank(referer)) {
|
||||
// // 这里从referer中取值是为了本地使用hosts添加虚拟域名,方便本地环境调试
|
||||
// host = referer.split("//")[1].split("/")[0];
|
||||
// } else {
|
||||
// host = new URL(request.getRequestURL().toString()).getHost();
|
||||
// }
|
||||
// // 根据域名进行筛选
|
||||
// List<TenantListVo> list = StreamUtils.filter(voList, vo ->
|
||||
// StringUtils.equalsIgnoreCase(vo.getDomain(), host));
|
||||
// result.setVoList(CollUtil.isNotEmpty(list) ? list : voList);
|
||||
List<SysTenantVo> tenantList = tenantService.queryList(new SysTenantBo());
|
||||
List<TenantListVo> voList = MapstructUtils.convert(tenantList, TenantListVo.class);
|
||||
try {
|
||||
// 如果只超管返回所有租户
|
||||
if (LoginHelper.isSuperAdmin()) {
|
||||
result.setVoList(voList);
|
||||
return R.ok(result);
|
||||
}
|
||||
} catch (NotLoginException ignored) {
|
||||
}
|
||||
|
||||
// 获取域名
|
||||
String host;
|
||||
String referer = request.getHeader("referer");
|
||||
if (StringUtils.isNotBlank(referer)) {
|
||||
// 这里从referer中取值是为了本地使用hosts添加虚拟域名,方便本地环境调试
|
||||
host = referer.split("//")[1].split("/")[0];
|
||||
} else {
|
||||
host = new URL(request.getRequestURL().toString()).getHost();
|
||||
}
|
||||
// 根据域名进行筛选
|
||||
List<TenantListVo> list = StreamUtils.filter(voList, vo ->
|
||||
StringUtils.equalsIgnoreCase(vo.getDomain(), host));
|
||||
result.setVoList(CollUtil.isNotEmpty(list) ? list : voList);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,5 @@
|
||||
package org.dromara.web.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.dromara.system.domain.vo.SysTenantVo;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
@ -14,9 +11,6 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
@AutoMapper(target = SysTenantVo.class)
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TenantListVo {
|
||||
|
||||
/**
|
||||
|
@ -91,8 +91,8 @@ public class PlusDataPermissionHandler {
|
||||
currentUser = LoginHelper.getLoginUser();
|
||||
DataPermissionHelper.setVariable("user", currentUser);
|
||||
}
|
||||
// 如果是超级管理员,则不过滤数据
|
||||
if (LoginHelper.isSuperAdmin()) {
|
||||
// 如果是超级管理员或租户管理员,则不过滤数据
|
||||
if (LoginHelper.isSuperAdmin() || LoginHelper.isTenantAdmin()) {
|
||||
return where;
|
||||
}
|
||||
// 构造数据过滤条件的 SQL 片段
|
||||
|
@ -15,7 +15,6 @@ import com.wzj.soopin.goods.service.SkuService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.common.tenant.helper.TenantHelper;
|
||||
import org.dromara.common.web.core.BusinessImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -48,7 +47,7 @@ public class ProductBusinessImpl extends BusinessImpl<ProductService, ProductCon
|
||||
Product product = converter.toPo(bo);
|
||||
product.setType(1);
|
||||
product.setSales("0");
|
||||
product.setTenantId(TenantHelper.getTenantId());
|
||||
product.setTenantId(LoginHelper.getTenantId());
|
||||
productService.saveOrUpdate(product);
|
||||
//清理掉旧的SKU
|
||||
skuService.remove(new LambdaQueryWrapper<Sku>().eq(Sku::getProductId, product.getId()));
|
||||
@ -58,7 +57,7 @@ public class ProductBusinessImpl extends BusinessImpl<ProductService, ProductCon
|
||||
.map(skuBO -> {
|
||||
Sku sku = skuConvert.toPo(skuBO);
|
||||
sku.setProductId(product.getId());
|
||||
sku.setTenantId(TenantHelper.getTenantId());
|
||||
sku.setTenantId(LoginHelper.getTenantId());
|
||||
return sku;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
@ -35,7 +35,7 @@ public class ProductController extends BaseController {
|
||||
|
||||
@Tag(name ="查询商品信息列表")
|
||||
@PostMapping("list")
|
||||
public R<IPage<ProductVO>> list(@RequestBody ProductBo bo) {
|
||||
public R<IPage<ProductVO>> list(@RequestBody ProductBo bo,@RequestBody Page<Product> page) {
|
||||
return R.ok(business.page(bo));
|
||||
}
|
||||
|
||||
|
@ -23,9 +23,6 @@ public class ProductBo extends BaseBO<Product> {
|
||||
@Schema(description = "CATEGORY_ID 精确匹配")
|
||||
private Long categoryId;
|
||||
|
||||
@Schema(description = "查询分类及子分类id", hidden = true)
|
||||
private List<Long> categoryIds;
|
||||
|
||||
@Schema(description = "商品编码 精确匹配")
|
||||
private String outProductId;
|
||||
|
||||
|
@ -33,16 +33,12 @@ public class SkuBo {
|
||||
@Schema(description = "库存")
|
||||
private Integer stock;
|
||||
|
||||
@Schema(description = "租户id")
|
||||
private String tenantId;
|
||||
|
||||
public Wrapper<Sku> toWrapper() {
|
||||
return new LambdaQueryWrapper<Sku>()
|
||||
.eq(productId != null, Sku::getProductId, productId)
|
||||
.eq(outSkuId != null && !outSkuId.isEmpty(), Sku::getOutSkuId, outSkuId)
|
||||
.eq(price != null, Sku::getPrice, price)
|
||||
.eq(pic != null && !pic.isEmpty(), Sku::getPic, pic)
|
||||
.eq(tenantId != null && !tenantId.isEmpty(), Sku::getTenantId, tenantId)
|
||||
.eq(spData != null && !spData.isEmpty(), Sku::getSpData, spData);
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,6 @@ package com.wzj.soopin.goods.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.wzj.soopin.goods.domain.entity.ProductCategory;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -12,7 +10,6 @@ import java.util.List;
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProductCategoryMapper extends BaseMapper<ProductCategory> {
|
||||
/**
|
||||
* 查询商品分类列表
|
||||
@ -21,13 +18,4 @@ public interface ProductCategoryMapper extends BaseMapper<ProductCategory> {
|
||||
* @return 商品分类集合
|
||||
*/
|
||||
List<ProductCategory> selectByEntity(ProductCategory productCategory);
|
||||
|
||||
/**
|
||||
* 查询所有子分类
|
||||
*
|
||||
* @param categoryId
|
||||
* @return
|
||||
*/
|
||||
@Select("select * from pms_product_category where parent_id = #{categoryId}")
|
||||
List<ProductCategory> selectByParentId(Long categoryId);
|
||||
}
|
||||
|
@ -32,7 +32,8 @@ public interface ProductMapper extends BaseMapper<Product> {
|
||||
List<Product> selectByEntity(Product product);
|
||||
|
||||
|
||||
Page<ProductVO> getlist(@Param("page") Page<Product> page, @Param("query") ProductBo query);
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
Page<ProductVO> getlist(@Param("page") Page<Product> page, @Param("query") ProductBo query, @Param("tenantIds") List<String> tenantIds);
|
||||
|
||||
|
||||
|
||||
|
@ -30,7 +30,7 @@ public interface SkuMapper extends BaseMapper<Sku> {
|
||||
|
||||
int updateStockById(@Param("skuId")Long skuId, @Param("optDate")LocalDateTime optDate, @Param("quantity")Integer quantity);
|
||||
|
||||
IPage<SkuVO> getlist(@Param("page") Page<Sku> page,@Param("query") SkuBo query);
|
||||
IPage<SkuVO> getlist(@Param("page") Page<Sku> page,@Param("query") SkuBo query, @Param("tenantId") Long tenantId);
|
||||
|
||||
|
||||
SkuVO selectSkuByid(@Param("id") Long id);
|
||||
|
@ -2,19 +2,23 @@ package com.wzj.soopin.goods.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.wzj.soopin.goods.domain.bo.ProductBo;
|
||||
import com.wzj.soopin.goods.domain.entity.Product;
|
||||
import com.wzj.soopin.goods.domain.entity.ProductCategory;
|
||||
import com.wzj.soopin.goods.domain.vo.ProductVO;
|
||||
import com.wzj.soopin.goods.mapper.ProductCategoryMapper;
|
||||
import com.wzj.soopin.goods.mapper.ProductMapper;
|
||||
import com.wzj.soopin.goods.mapper.SkuMapper;
|
||||
import com.wzj.soopin.goods.service.ProductService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.enums.TenantType;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.common.tenant.helper.TenantHelper;
|
||||
import org.dromara.system.domain.SysDept;
|
||||
import org.dromara.system.domain.SysTenant;
|
||||
import org.dromara.system.domain.vo.SysUserTenantVO;
|
||||
import org.dromara.system.mapper.SysDeptMapper;
|
||||
import org.dromara.system.mapper.SysTenantMapper;
|
||||
import org.dromara.system.mapper.SysUserTenantMapper;
|
||||
@ -36,7 +40,6 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
|
||||
|
||||
private final ProductMapper productMapper;
|
||||
private final ProductCategoryMapper productCategoryMapper;
|
||||
private final SkuMapper skuMapper;
|
||||
private final SysTenantMapper sysTenantMapper;
|
||||
private final SysDeptMapper sysDeptMapper;
|
||||
@ -44,7 +47,25 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
|
||||
@Override
|
||||
public Page<ProductVO> getList(ProductBo query, Page<Product> page) {
|
||||
return productMapper.getlist(page, query);
|
||||
String tenantId = LoginHelper.getTenantId();
|
||||
List<String> tenantIds = CollUtil.newArrayList(tenantId);
|
||||
if(LoginHelper.isTenantAdmin()){
|
||||
SysTenant sysTenant = sysTenantMapper.selectOne(Wrappers.lambdaQuery(SysTenant.class).eq(SysTenant::getTenantId, tenantId));
|
||||
if(sysTenant.getType() != TenantType.MERCHANT.getType()){
|
||||
// 非商铺管理员则查看其所属租户创建的全部商铺
|
||||
List<Long> deptIdList = sysDeptMapper.selectList().stream().map(SysDept::getDeptId).toList();
|
||||
tenantIds = sysTenantMapper.selectByTenantTypeAndCreateDept(TenantType.MERCHANT.getType(), deptIdList).stream().map(SysTenant::getTenantId).toList();
|
||||
}
|
||||
}
|
||||
// 获取当前登录人被分配的,可管理的商铺租户id
|
||||
List<String> list = sysUserTenantMapper.getUserTenantList(LoginHelper.getUserId(), TenantType.MERCHANT.getType())
|
||||
.stream().map(SysUserTenantVO::getTenantId).toList();
|
||||
if(CollUtil.isNotEmpty(list)){
|
||||
tenantIds = new ArrayList<>(tenantIds);
|
||||
tenantIds.addAll(list);
|
||||
}
|
||||
List<String> finalTenantIds = tenantIds;
|
||||
return TenantHelper.ignore(() -> productMapper.getlist(page, query, finalTenantIds));
|
||||
}
|
||||
|
||||
|
||||
@ -52,9 +73,9 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
public IPage<ProductVO> getRecommendPage( Page<Product> page) {
|
||||
|
||||
//推荐商品要根据算法获取
|
||||
List<String> tenantIds = new ArrayList<>();
|
||||
|
||||
|
||||
return productMapper.getlist(page,new ProductBo());
|
||||
return productMapper.getlist(page,new ProductBo(), tenantIds);
|
||||
}
|
||||
|
||||
|
||||
@ -78,12 +99,6 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
* @return
|
||||
*/
|
||||
public IPage<ProductVO> getProduct(Page<Product> page, ProductBo query) {
|
||||
if(query.getCategoryId() != null){
|
||||
ArrayList<Long> categoryIds = CollUtil.newArrayList(query.getCategoryId());
|
||||
categoryIds.addAll(productCategoryMapper.selectByParentId(query.getCategoryId())
|
||||
.stream().map(ProductCategory::getId).toList());
|
||||
query.setCategoryIds(categoryIds);
|
||||
}
|
||||
return TenantHelper.ignore(() -> productMapper.getProduct(page, query));
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,6 @@ import com.wzj.soopin.goods.service.SkuService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.common.tenant.helper.TenantHelper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@ -33,8 +32,8 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements SkuSe
|
||||
private final ProductMapper productMapper;
|
||||
|
||||
public IPage<SkuVO> getList(SkuBo query, Page<Sku> page) {
|
||||
query.setTenantId(TenantHelper.getTenantId());
|
||||
return skuMapper.getlist(page,query);
|
||||
Long tenantId = Long.valueOf(LoginHelper.getTenantId());
|
||||
return skuMapper.getlist(page,query,tenantId);
|
||||
}
|
||||
|
||||
public SkuVO selectSkuByid(Long id) {
|
||||
|
@ -66,8 +66,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
pc.name AS productCategoryName,
|
||||
s.id AS sku_id,
|
||||
s.out_sku_id,
|
||||
s.price AS skuPrice,
|
||||
s.pic AS skuPic,
|
||||
s.price,
|
||||
s.pic,
|
||||
s.stock,
|
||||
s.sp_data,
|
||||
s.product_id
|
||||
@ -77,26 +77,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
LEFT JOIN sys_tenant t ON p.tenant_id = t.tenant_id
|
||||
LEFT JOIN pms_product_category pc ON p.category_id = pc.id
|
||||
LEFT JOIN pms_sku s ON p.id = s.product_id
|
||||
<where>
|
||||
<if test="query.nameLike != null and query.nameLike != ''">
|
||||
AND p.name LIKE CONCAT('%', #{query.nameLike}, '%')
|
||||
</if>
|
||||
<if test="query.outProductId != null and query.outProductId != ''">
|
||||
AND p.out_product_id = #{query.outProductId}
|
||||
</if>
|
||||
<if test="query.brandId != null">
|
||||
AND p.brand_id = #{query.brandId}
|
||||
</if>
|
||||
<if test="query.publishStatus != null">
|
||||
AND p.publish_status = #{query.publishStatus}
|
||||
</if>
|
||||
<if test="query.authFlag != null">
|
||||
AND p.auth_flag = #{query.authFlag}
|
||||
</if>
|
||||
<if test="query.categoryId != null">
|
||||
AND p.category_id = #{query.categoryId}
|
||||
</if>
|
||||
</where>
|
||||
WHERE 1=1
|
||||
<if test="query.nameLike != null and query.nameLike != ''">
|
||||
AND p.name LIKE CONCAT('%', #{query.nameLike}, '%')
|
||||
</if>
|
||||
<if test="query.outProductId != null">
|
||||
AND p.out_product_id = #{query.outProductId}
|
||||
</if>
|
||||
<if test="query.brandId != null">
|
||||
AND p.brand_id = #{query.brandId}
|
||||
</if>
|
||||
<if test="query.publishStatus != null">
|
||||
AND p.publish_status = #{query.publishStatus}
|
||||
</if>
|
||||
<if test="query.authFlag != null">
|
||||
AND p.auth_flag = #{query.authFlag}
|
||||
</if>
|
||||
<if test="query.categoryId != null">
|
||||
AND p.category_id = #{query.categoryId}
|
||||
</if>
|
||||
<if test="tenantIds != null and tenantIds.size() > 0">
|
||||
AND p.tenant_id IN
|
||||
<foreach collection="tenantIds" item="tenantId" open="(" separator="," close=")">
|
||||
#{tenantId}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
ORDER BY
|
||||
p.sales DESC,
|
||||
@ -138,14 +143,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="query.nameLike != null and query.nameLike != ''">
|
||||
AND p.name LIKE CONCAT('%', #{query.nameLike}, '%')
|
||||
</if>
|
||||
<!-- <if test="query.categoryId != null">-->
|
||||
<!-- AND p.category_id = #{query.categoryId}-->
|
||||
<!-- </if>-->
|
||||
<if test="query.categoryIds != null and query.categoryIds.size() > 0">
|
||||
AND p.category_id IN
|
||||
<foreach collection="query.categoryIds" item="categoryId" open="(" separator="," close=")">
|
||||
#{categoryId}
|
||||
</foreach>
|
||||
<if test="query.categoryId != null">
|
||||
AND p.category_id = #{query.categoryId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
@ -47,45 +47,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="getlist" resultType="com.wzj.soopin.goods.domain.vo.SkuVO">
|
||||
SELECT
|
||||
s.id,
|
||||
s.product_id,
|
||||
s.out_sku_id,
|
||||
s.price,
|
||||
s.pic,
|
||||
s.sp_data,
|
||||
s.stock,
|
||||
s.create_by,
|
||||
s.create_time,
|
||||
s.update_by,
|
||||
s.update_time,
|
||||
p.name AS productName
|
||||
s.*,
|
||||
p.name AS productName
|
||||
FROM
|
||||
pms_sku s
|
||||
pms_sku s
|
||||
LEFT JOIN
|
||||
pms_product p ON s.product_id = p.id
|
||||
<where>
|
||||
<if test="query.productName != null and query.productName != ''">
|
||||
AND p.name LIKE CONCAT('%', #{query.productName}, '%')
|
||||
</if>
|
||||
<if test="query.productId != null">
|
||||
AND p.id = #{query.productId}
|
||||
</if>
|
||||
<if test="query.outSkuId != null and query.outSkuId != ''">
|
||||
AND s.out_sku_id LIKE CONCAT('%', #{query.outSkuId}, '%')
|
||||
</if>
|
||||
<if test="query.price != null">
|
||||
AND s.price = #{query.price}
|
||||
</if>
|
||||
<if test="query.pic != null and query.pic != ''">
|
||||
AND s.pic LIKE CONCAT('%', #{query.pic}, '%')
|
||||
</if>
|
||||
<if test="query.tenantId != null and query.tenantId != ''">
|
||||
AND s.tenant_id = #{query.tenantId}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
pms_product p ON s.product_id = p.id
|
||||
WHERE 1=1
|
||||
<if test="tenantId != '000000'">
|
||||
AND s.tenant_id = #{tenantId}
|
||||
</if>
|
||||
<if test="query.productName != null and query.productName != ''">
|
||||
AND p.name LIKE CONCAT('%', #{query.productName}, '%')
|
||||
</if>
|
||||
<if test="query.productId != null and query.productId != ''">
|
||||
AND p.id = #{query.productId}
|
||||
</if>
|
||||
<if test="query.outSkuId != null and query.outSkuId != ''">
|
||||
AND s.out_sku_id LIKE CONCAT('%', #{query.outSkuId}, '%')
|
||||
</if>
|
||||
<if test="query.price != null and query.price != ''">
|
||||
AND s.price LIKE CONCAT('%', #{query.price}, '%')
|
||||
</if>
|
||||
<if test="query.pic != null and query.pic != ''">
|
||||
AND s.pic LIKE CONCAT('%', #{query.pic}, '%')
|
||||
</if>
|
||||
ORDER BY
|
||||
s.create_time DESC
|
||||
s.create_time DESC
|
||||
</select>
|
||||
|
||||
|
||||
|
@ -110,12 +110,10 @@ public class SysUserController extends BaseController {
|
||||
public R<UserInfoVo> getInfo() {
|
||||
UserInfoVo userInfoVo = new UserInfoVo();
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
// if (TenantHelper.isEnable() && LoginHelper.isSuperAdmin()) {
|
||||
// // 超级管理员 如果重新加载用户信息需清除动态租户
|
||||
// TenantHelper.clearDynamic();
|
||||
// }
|
||||
|
||||
TenantHelper.clearDynamic();
|
||||
if (TenantHelper.isEnable() && LoginHelper.isSuperAdmin()) {
|
||||
// 超级管理员 如果重新加载用户信息需清除动态租户
|
||||
TenantHelper.clearDynamic();
|
||||
}
|
||||
SysUserVo user = userService.selectUserById(loginUser.getUserId());
|
||||
if (ObjectUtil.isNull(user)) {
|
||||
return R.fail("没有权限访问用户数据!");
|
||||
|
@ -1,7 +1,5 @@
|
||||
package org.dromara.system.domain.bo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.system.domain.SysTenant;
|
||||
@ -23,7 +21,6 @@ import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = SysTenant.class, reverseConvertGenerate = false)
|
||||
@Builder
|
||||
public class SysTenantBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
@ -32,9 +29,6 @@ public class SysTenantBo extends BaseEntity {
|
||||
@NotNull(message = "id不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "某个父级id")
|
||||
private Long oneParentId;
|
||||
|
||||
/**
|
||||
* 租户编号
|
||||
*/
|
||||
|
@ -17,9 +17,6 @@ public class SysTenantExtendBo {
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "其中一个父级id")
|
||||
private Long oneParentId;
|
||||
|
||||
@Schema(description = "租户编号")
|
||||
private String tenantId;
|
||||
|
||||
|
@ -45,6 +45,10 @@ public interface SysTenantMapper extends BaseMapperPlus<SysTenant, SysTenantVo>
|
||||
"LIMIT 20")
|
||||
List<Map<String, Object>> getTop20Stores();
|
||||
|
||||
@DataPermission({
|
||||
@DataColumn(key = "deptName", value = "t.create_dept"),
|
||||
@DataColumn(key = "userName", value = "t.create_by")
|
||||
})
|
||||
IPage<TenantDTO> getlist(@Param("page") Page<SysTenant> page, @Param("query") SysTenantExtendBo query);
|
||||
|
||||
@Select(" SELECT " +
|
||||
|
@ -120,12 +120,4 @@ public interface ISysTenantService {
|
||||
void confirmedSign(String tenantId);
|
||||
|
||||
SysTenant queryByDeptId(Long deptId);
|
||||
|
||||
/**
|
||||
* 根据id查询其所有子级租户
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<SysTenantVo> getByParentId(Long id);
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ import org.dromara.common.core.utils.StreamUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.enums.DataScopeType;
|
||||
import org.dromara.common.redis.utils.CacheUtils;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
@ -112,7 +111,6 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
||||
private LambdaQueryWrapper<SysTenant> buildQueryWrapper(SysTenantBo bo) {
|
||||
LambdaQueryWrapper<SysTenant> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getTenantId()), SysTenant::getTenantId, bo.getTenantId());
|
||||
lqw.like(bo.getOneParentId() != null, SysTenant::getParentIds, String.valueOf(bo.getOneParentId()));
|
||||
lqw.like(StringUtils.isNotBlank(bo.getContactUserName()), SysTenant::getContactUserName, bo.getContactUserName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getContactPhone()), SysTenant::getContactPhone, bo.getContactPhone());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getCompanyName()), SysTenant::getCompanyName, bo.getCompanyName());
|
||||
@ -124,7 +122,7 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
||||
lqw.eq(bo.getExpireTime() != null, SysTenant::getExpireTime, bo.getExpireTime());
|
||||
lqw.eq(bo.getAccountCount() != null, SysTenant::getAccountCount, bo.getAccountCount());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysTenant::getStatus, bo.getStatus());
|
||||
lqw.orderByAsc(SysTenant::getType);
|
||||
lqw.orderByAsc(SysTenant::getId);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@ -137,7 +135,8 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
||||
|
||||
// 处理sys_tenant表数据
|
||||
SysTenant tenant = new SysTenant();
|
||||
String currentTenantId = TenantHelper.getTenantId();
|
||||
|
||||
String currentTenantId = LoginHelper.getTenantId();
|
||||
SysTenantVo currentTenant = this.queryByTenantId(currentTenantId);
|
||||
Assert.isTrue(TenantType.allowCreateByType(currentTenant.getType(), bo.getType()), () -> new ServiceException("您无权限创建此类型的租户"));
|
||||
|
||||
@ -388,7 +387,6 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
||||
role.setRoleKey(TenantConstants.TENANT_ADMIN_ROLE_KEY);
|
||||
role.setRoleSort(1);
|
||||
role.setStatus(SystemConstants.NORMAL);
|
||||
role.setDataScope(DataScopeType.DEPT_AND_CHILD_OR_SELF.getCode());
|
||||
roleMapper.insert(role);
|
||||
Long roleId = role.getRoleId();
|
||||
|
||||
@ -728,8 +726,6 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
||||
|
||||
@Override
|
||||
public IPage<TenantDTO> getlist(Page<SysTenant> page, SysTenantExtendBo query) {
|
||||
SysTenantVo sysTenantVo = queryByTenantId(TenantHelper.getTenantId());
|
||||
query.setOneParentId(sysTenantVo.getId());
|
||||
IPage<TenantDTO> resultPage = baseMapper.getlist(page,query);
|
||||
return resultPage;
|
||||
}
|
||||
@ -819,10 +815,5 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
||||
return baseMapper.queryByDeptId(deptId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysTenantVo> getByParentId(Long id) {
|
||||
return this.queryList(SysTenantBo.builder().oneParentId(id).status("0").build());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -25,9 +25,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="query.tenantId != null and query.tenantId != ''">
|
||||
AND t.tenant_id LIKE CONCAT('%', #{query.tenantId}, '%')
|
||||
</if>
|
||||
<if test="query.oneParentId != null ">
|
||||
AND t.parent_ids LIKE CONCAT('%', #{query.oneParentId}, '%')
|
||||
</if>
|
||||
<if test="query.personName != null and query.personName != ''">
|
||||
AND e.person_name LIKE CONCAT('%', #{query.personName}, '%')
|
||||
</if>
|
||||
|
@ -10,32 +10,16 @@ import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 分账单状态,(处理中、成功、失败、已退款)
|
||||
* 0 -> 交易成功
|
||||
* 1 -> 交易部分成功
|
||||
* X -> 交易失败
|
||||
* 9 -> 支付中,具体状态未知
|
||||
* A -> 已撤销
|
||||
* C -> 已关闭
|
||||
* R -> 已退款
|
||||
* E -> 已冲正
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* 已撤销
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum SepaStatus {
|
||||
|
||||
SUCCESS("0", "成功"),
|
||||
PARTIALLY_SUCCESS("1", "交易部分成功"),
|
||||
FAIL("X", "失败"),
|
||||
PENDING("9", "处理中"),
|
||||
A("A", "已撤销"),
|
||||
C("C", "已关闭"),
|
||||
R("R", "已退款"),
|
||||
E("E", "已冲正");
|
||||
FAIL("FAIL", "失败"),
|
||||
PENDING("PENDING", "处理中"),
|
||||
PROCESSING("PROCESSING", "处理中"),
|
||||
REFUNDED("REFUNDED", "已退款");
|
||||
|
||||
|
||||
/**
|
||||
|
@ -777,9 +777,11 @@ public class EasypayServiceImpl implements IEasypayService {
|
||||
divideDetail.setFee(BigDecimal.valueOf(separateRespInfo.getSepaPlatStlmAmount() - separateRespInfo.getSepaStlmAmount()));
|
||||
SepaStatus sepaStatus = SepaStatus.getByValue(separateRespInfo.getSepaStatus());
|
||||
switch (sepaStatus) {
|
||||
case SUCCESS, PARTIALLY_SUCCESS -> divideDetail.setStatus(DivideStatus.SUCCESS.getCode());
|
||||
case FAIL, A, C, R, E -> divideDetail.setStatus(DivideStatus.FAIL.getCode());
|
||||
case SUCCESS -> divideDetail.setStatus(DivideStatus.SUCCESS.getCode());
|
||||
case FAIL -> divideDetail.setStatus(DivideStatus.FAIL.getCode());
|
||||
case PENDING -> divideDetail.setStatus(DivideStatus.PENDING.getCode());
|
||||
case REFUNDED -> divideDetail.setStatus(DivideStatus.REFUNDED.getCode());
|
||||
case PROCESSING -> divideDetail.setStatus(DivideStatus.PROCESSING.getCode());
|
||||
default -> divideDetail.setStatus(DivideStatus.PROCESSING.getCode());
|
||||
}
|
||||
updateDetailList.add(divideDetail);
|
||||
|
Loading…
x
Reference in New Issue
Block a user