This commit is contained in:
xyc 2025-06-18 17:46:57 +08:00
parent 09d46e1b02
commit 79ee3cc2b7
8 changed files with 43 additions and 19 deletions

View File

@ -152,7 +152,7 @@ public class AppSwiperController extends BaseController {
Set<Long> userRoleIdListByUserId = permissionService.getUserRoleIdListByUserId(user.getId());
List<RoleDO> roleList = roleService.getRoleList(userRoleIdListByUserId);
List<String> roles = roleList.stream().map(RoleDO::getCode).collect(Collectors.toList());
if (roles.contains("jcshop") || roles.contains("jiance")) {
if (roles.contains("jcshop") || roles.contains("jiance") || roles.contains("tenant_admin")) {
map.put("shop", true);
} else {
map.put("shop", false);

View File

@ -83,8 +83,8 @@ public class ShopInspectionGoodsController extends BaseController {
public CommonResult listPartnerGoods(ShopInspectionGoods shopInspectionGoods,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) throws Exception {
ShopMallPartners one = appInspectionPartnerService.shopInfoByUserId();
shopInspectionGoods.setPartnerId(one.getPartnerId().intValue());
// ShopMallPartners one = appInspectionPartnerService.shopInfoByUserId();
// shopInspectionGoods.setPartnerId(one.getPartnerId().intValue());
Page<ShopInspectionGoods> page = new Page<>(pageNum, pageSize);
IPage<ShopInspectionGoods> list = shopInspectionGoodsService.listPartnerGoods(page, shopInspectionGoods);
return success(list);

View File

@ -1024,10 +1024,10 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
@Transactional(rollbackFor = Exception.class)
public void addGoods(ShopInspectionGoods goods) throws Exception {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
ShopMallPartners partners = baseMapper.selectById(goods.getPartnerId());
if (!partners.getUserId().equals(user.getId())) {
return;
}
// ShopMallPartners partners = baseMapper.selectById(goods.getPartnerId());
// if (!partners.getUserId().equals(user.getId())) {
// return;
// }
//判断当前分类 是否已经存在商品
LambdaQueryWrapper<ShopInspectionGoods> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ShopInspectionGoods::getGoodsCategoryId, goods.getGoodsCategoryId()).eq(ShopInspectionGoods::getPartnerId, goods.getPartnerId());

View File

@ -268,8 +268,8 @@ public class ShopInspectionGoodsServiceImpl extends ServiceImpl<ShopInspectionGo
@Override
public List<ShopInspectionCategory> categoryList() throws Exception {
ShopMallPartners one = appInspectionPartnerService.shopInfoByUserId();
List<ShopInspectionCategory> shopInspectionCategories = appInspectionPartnerService.categoryList(one.getPartnerId());
// ShopMallPartners one = appInspectionPartnerService.shopInfoByUserId();
List<ShopInspectionCategory> shopInspectionCategories = appInspectionPartnerService.categoryList(null);
if (CollectionUtil.isNotEmpty(shopInspectionCategories)) {
for (ShopInspectionCategory shopInspectionCategory : shopInspectionCategories) {
LambdaQueryWrapper<InspectionCategoryTemplate> templateLambdaQueryWrapper = new LambdaQueryWrapper<>();
@ -286,11 +286,11 @@ public class ShopInspectionGoodsServiceImpl extends ServiceImpl<ShopInspectionGo
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
LambdaQueryWrapper<ShopMallPartners> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.eq(ShopMallPartners::getUserId,loginUser.getId()).eq(ShopMallPartners::getType,"jc").last("limit 1");
ShopMallPartners one = partnersService.getOne(queryWrapper);
if (ObjectUtils.isEmpty(one)){
throw new Exception("您不是商户");
}
shopInspectionGoods.setPartnerId(one.getPartnerId().intValue());
// ShopMallPartners one = partnersService.getOne(queryWrapper);
// if (ObjectUtils.isEmpty(one)){
// throw new Exception("您不是商户");
// }
// shopInspectionGoods.setPartnerId(one.getPartnerId().intValue());
appInspectionPartnerService.addGoods(shopInspectionGoods);
}

View File

@ -45,17 +45,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="listPartnerGoods" parameterType="cn.iocoder.yudao.module.inspection.entity.ShopInspectionGoods" resultType="cn.iocoder.yudao.module.inspection.entity.ShopInspectionGoods">
SELECT
sig.* ,smp.partner_name,sic.category_name
sig.* ,sic.category_name
FROM
shop_inspection_goods sig
INNER JOIN shop_mall_partners smp ON smp.partner_id = sig.partner_id AND smp.is_banned = '0'
INNER JOIN shop_inspection_category sic ON sic.id = sig.goods_category_id
<where>
and sig.deleted = '0' and smp.deleted = '0' and sic.deleted = '0'
and sig.deleted = '0' and sic.deleted = '0'
<if test="vo.id != null "> and sig.id = #{vo.id}</if>
<if test="vo.title != null and vo.title != ''"> and sig.title like concat('%', #{vo.title}, '%')</if>
<if test="vo.goodsCategoryId!= null "> and sig.goods_category_id = #{vo.goodsCategoryId}</if>
<if test="vo.partnerName!= null "> and smp.partner_name like concat('%',#{vo.partnerName},'%')</if>
<if test="vo.partnerId!= null "> and sig.partner_id = #{vo.partnerId}</if>
<if test="vo.isListing != null and vo.isListing != ''">and sig.is_listing = #{vo.isListing}</if>
</where>

View File

@ -180,7 +180,7 @@ public class SysLoginController {
* @return 结果
*/
@PostMapping("/loginJcApp")
@TenantIgnore
// @TenantIgnore
public CommonResult loginJcApp(@RequestBody LoginBody loginBody) throws Exception {
String userName = loginBody.getUsername();
AdminUserDO user = userService.getUserByUsername(userName);

View File

@ -20,6 +20,7 @@ import cn.iocoder.yudao.module.system.convert.auth.AuthConvert;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
import cn.iocoder.yudao.module.system.dal.dataobject.service.ServicePackageDO;
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.enums.logger.LoginLogTypeEnum;
import cn.iocoder.yudao.module.system.service.auth.AdminAuthService;
@ -28,6 +29,7 @@ import cn.iocoder.yudao.module.system.service.permission.PermissionService;
import cn.iocoder.yudao.module.system.service.permission.RoleService;
import cn.iocoder.yudao.module.system.service.service.ServicePackageService;
import cn.iocoder.yudao.module.system.service.social.SocialClientService;
import cn.iocoder.yudao.module.system.service.tenant.TenantService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@ -82,6 +84,9 @@ public class AuthController {
@Resource
private ServicePackageService servicePackageService;
@Resource
private TenantService tenantService;
@PostMapping("/login")
@PermitAll
@ -273,4 +278,23 @@ public class AuthController {
return success(authService.socialLogin(reqVO));
}
/**
* 根据用户手机号查询所在的所有租户--员工登录
* @author vinjor-M
* @date 14:51 2024/10/16
* @param phone 手机号
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/
@GetMapping("/getListByPhone")
@PermitAll
@Operation(summary = "根据用户手机号查询所在的所有租户--员工登录", description = "根据用户手机号查询所在的所有租户--员工登录")
public CommonResult<?> getListByPhone(@RequestParam("phone") String phone) {
List<AdminUserDO> list = userService.selectListByPhoneStaff(phone);
List<TenantDO> tenants = new ArrayList<>();
if(!list.isEmpty()){
tenants = tenantService.listByIds(list.stream().map(AdminUserDO::getTenantId).collect(Collectors.toList()));
}
return success(tenants);
}
}

View File

@ -130,6 +130,8 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, TenantDO> imple
// 创建租户
TenantDO tenant = BeanUtils.toBean(createReqVO, TenantDO.class);
tenantMapper.insert(tenant);
// 设置本次请求的租户id
TenantUtils.execute(tenant.getId(), () -> {});
// 创建租户的管理员
TenantUtils.execute(tenant.getId(), () -> {
// 创建角色