diff --git a/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/goods/ProductMapper.xml b/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/goods/ProductMapper.xml index e7a86ae89..e0cfee95b 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/goods/ProductMapper.xml +++ b/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/goods/ProductMapper.xml @@ -80,7 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN oms_order o ON oi.order_id = o.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 p.tenant_id = #{tenantId} + WHERE 1=1 AND p.name LIKE CONCAT('%', #{query.nameLike}, '%') diff --git a/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/goods/SkuMapper.xml b/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/goods/SkuMapper.xml index d5936fdfd..36ddb8588 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/goods/SkuMapper.xml +++ b/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/goods/SkuMapper.xml @@ -46,7 +46,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/wzj/soopin/order/service/impl/VerificationCodeServiceImpl.java b/ruoyi-modules/ruoyi-order/src/main/java/com/wzj/soopin/order/service/impl/VerificationCodeServiceImpl.java index 57349c61c..5b3dbb303 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/wzj/soopin/order/service/impl/VerificationCodeServiceImpl.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/wzj/soopin/order/service/impl/VerificationCodeServiceImpl.java @@ -222,14 +222,14 @@ public class VerificationCodeServiceImpl extends ServiceImpl resultMap = codeMapper.getProduvtNameAndMemberId(code); - String productName = (String) resultMap.get("productName"); +// String productName = (String) resultMap.get("productName"); Long memberId = (Long) resultMap.get("memberId"); LocalDateTime verificationTime = codeMapper.verificationTime(code); String formattedTime = verificationTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); // 核销成功模板ID // 改为新版模板类型调用 Map params = new HashMap<>(); - params.put("productName", productName); +// params.put("productName", productName); params.put("verificationTime", formattedTime); SysMessageBo messageBo = new SysMessageBo(); // 核销成功类型编号 @@ -245,13 +245,13 @@ public class VerificationCodeServiceImpl extends ServiceImpl resultMap = codeMapper.getProduvtNameAndMemberId(code); - String productName = (String) resultMap.get("productName"); +// String productName = (String) resultMap.get("productName"); Long memberId = (Long) resultMap.get("memberId"); String reason = codeMapper.getReason(code); // 核销失败模板ID // 改为新版模板类型调用 Map params = new HashMap<>(); - params.put("productName", productName); +// params.put("productName", productName); params.put("reason", reason); SysMessageBo messageBo = new SysMessageBo(); // 核销失败类型编号 diff --git a/ruoyi-modules/ruoyi-order/src/main/resources/mapper/AftersaleMapper.xml b/ruoyi-modules/ruoyi-order/src/main/resources/mapper/AftersaleMapper.xml index 182ef0a85..d4e3442f4 100644 --- a/ruoyi-modules/ruoyi-order/src/main/resources/mapper/AftersaleMapper.xml +++ b/ruoyi-modules/ruoyi-order/src/main/resources/mapper/AftersaleMapper.xml @@ -108,18 +108,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/ruoyi-modules/ruoyi-order/src/main/resources/mapper/OrderMapper.xml b/ruoyi-modules/ruoyi-order/src/main/resources/mapper/OrderMapper.xml index f56abe7fb..731f256e5 100644 --- a/ruoyi-modules/ruoyi-order/src/main/resources/mapper/OrderMapper.xml +++ b/ruoyi-modules/ruoyi-order/src/main/resources/mapper/OrderMapper.xml @@ -264,7 +264,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysTenantExtend.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysTenantExtend.java index 7cb678775..be7f479fa 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysTenantExtend.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysTenantExtend.java @@ -84,7 +84,7 @@ public class SysTenantExtend extends BaseAudit { @Schema(description = "签约附件") private String contractAttachment; - @Schema(description = "签约状态") + @Schema(description = "签约状态(0.待审核1.有效 2.无效 3.编辑 4.过期)") private String signStatus; @Schema(description = "收款方名称") diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/bo/SysTenantExtendBo.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/bo/SysTenantExtendBo.java index 8219e8fbe..2cbb656af 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/bo/SysTenantExtendBo.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/bo/SysTenantExtendBo.java @@ -138,7 +138,7 @@ public class SysTenantExtendBo { @Schema(description = "签约附件") private String contractAttachment; - @Schema(description = "签约状态") + @Schema(description = "签约状态(0.待审核1.有效 2.无效 3.编辑 4.过期)") private String signStatus; @Schema(description = "签约日期(模糊查询)") diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/dto/TenantDTO.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/dto/TenantDTO.java index c15bab57d..3f172caf4 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/dto/TenantDTO.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/dto/TenantDTO.java @@ -143,7 +143,7 @@ public class TenantDTO { @Schema(description = "签约附件") private String contractAttachment; - @Schema(description = "签约状态") + @Schema(description = "签约状态(0.待审核1.有效 2.无效 3.编辑 4.过期)") private String signStatus; @Schema(description = "邀请人名称") diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/vo/SysTenantExtendVo.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/vo/SysTenantExtendVo.java index a902fcd2a..db97f6fc3 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/vo/SysTenantExtendVo.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/vo/SysTenantExtendVo.java @@ -136,7 +136,7 @@ public class SysTenantExtendVo { @Schema(description = "签约附件") private String contractAttachment; - @Schema(description = "签约状态") + @Schema(description = "签约状态(0.待审核1.有效 2.无效 3.编辑 4.过期)") private String signStatus; } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/vo/SysTenantVo.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/vo/SysTenantVo.java index ece9a111e..447897044 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/vo/SysTenantVo.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/vo/SysTenantVo.java @@ -154,7 +154,7 @@ public class SysTenantVo implements Serializable { @Schema(description = "签约附件") private String contractAttachment; - @Schema(description = "签约状态") + @Schema(description = "签约状态(0.待审核1.有效 2.无效 3.编辑 4.过期)") private String signStatus; /** diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysTenantServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysTenantServiceImpl.java index 08f425b9b..ae57f5aa7 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysTenantServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysTenantServiceImpl.java @@ -8,6 +8,7 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.RandomUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.RequiredArgsConstructor; @@ -54,6 +55,7 @@ public class SysTenantServiceImpl implements ISysTenantService { private final SysTenantMapper baseMapper; private final SysTenantExtendMapper tenantExtendMapper; private final SysTenantPackageMapper tenantPackageMapper; + private final SysTenantAccountMapper tenantAccountMapper;; private final SysUserMapper userMapper; private final SysDeptMapper deptMapper; private final SysRoleMapper roleMapper; @@ -125,26 +127,37 @@ public class SysTenantServiceImpl implements ISysTenantService { @Transactional(rollbackFor = Exception.class) public Boolean insertByBo(SysTenantExtendBo bo) { + if (bo.getType() == null){ + throw new ServiceException("租户类型不能为空"); + } // 处理sys_tenant表数据 SysTenant tenant = new SysTenant(); Long belongId = Long.valueOf(LoginHelper.getTenantId()); - SysTenant sysTenant = baseMapper.selectByBelongId(belongId); - if (bo.getExpiryDate() != null && sysTenant.getType() != 1){ - - } if (bo.getExpiryDate() != null) { - + SysTenant sysTenant = baseMapper.selectByBelongId(belongId); if (sysTenant != null) { Integer type = sysTenant.getType(); - if (type != 1) { + if (type != 1 && type != 3) { throw new RuntimeException("只有代理能添加推广人"); } } else { - throw new RuntimeException("未查询到对应 belongId 的租户信息"); + throw new RuntimeException("未查询到对应的租户信息"); + } + } + + if (bo.getStoreName() != null) { + SysTenant sysTenant = baseMapper.selectByBelongId(belongId); + if (sysTenant != null) { + Integer type = sysTenant.getType(); + if (type != 2 && type != 3) { + throw new RuntimeException("只有推广人能添加店铺"); + } + } else { + throw new RuntimeException("未查询到对应的租户信息"); } } @@ -234,7 +247,9 @@ public class SysTenantServiceImpl implements ISysTenantService { tenantExtend.setSigner(bo.getSigner()); tenantExtend.setContractYear(bo.getContractYear()); tenantExtend.setContractAttachment(bo.getContractAttachment()); - tenantExtend.setSignStatus(bo.getSignStatus()); + if (bo.getSignStatus() == null) { + tenantExtend.setSignStatus("0"); + } tenantExtend.setPayeeName(bo.getPayeeName()); tenantExtend.setEmergencyContact(bo.getEmergencyContact()); tenantExtend.setEmergencyContactPhone(bo.getEmergencyContactPhone()); @@ -263,6 +278,7 @@ public class SysTenantServiceImpl implements ISysTenantService { tenantAccount.setMoneyBalance(BigDecimal.ZERO); tenantAccount.setWallet(BigDecimal.ZERO); tenantAccount.setRevenue(BigDecimal.ZERO); + tenantAccountMapper.insert(tenantAccount); // 创建部门 @@ -287,6 +303,7 @@ public class SysTenantServiceImpl implements ISysTenantService { user.setNickName(bo.getUsername()); user.setPassword(BCrypt.hashpw(bo.getPassword())); user.setDeptId(deptId); + user.setPhonenumber(bo.getContactPhone()); userMapper.insert(user); // 设置部门负责人 @@ -746,9 +763,23 @@ public class SysTenantServiceImpl implements ISysTenantService { @Override @Transactional(rollbackFor = Exception.class) public Boolean batchRemoveByIds(List ids) { - for (Long id : ids) { - if (TenantConstants.SUPER_ADMIN_ROLE_KEY.equals(id.toString())) { - throw new ServiceException("超级管理员租户不能删除"); + if (CollectionUtils.isEmpty(ids)) { + throw new ServiceException("删除ID列表不能为空"); + } + + // 查询所有待删除租户的tenant_id + List tenants = baseMapper.selectBatchIds(ids); + if (CollectionUtils.isEmpty(tenants)) { + throw new ServiceException("未找到对应的租户信息"); + } + + // 检查是否存在不允许删除的租户 + for (SysTenant tenant : tenants) { + if (TenantConstants.DEFAULT_TENANT_ID.equals(tenant.getTenantId())) { + throw new ServiceException("超级管理员租户(" + tenant.getTenantId() + ")不能删除"); + } + if (TenantConstants.SUPER_ADMIN_ROLE_KEY.equals(tenant.getId().toString())) { + throw new ServiceException("超级管理员租户(" + tenant.getId() + ")不能删除"); } } diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysTenantMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysTenantMapper.xml index f4b2b1831..29bfa3dea 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysTenantMapper.xml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysTenantMapper.xml @@ -20,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN commission_template ct ON e.split_ratio = ct.id LEFT JOIN - sys_tenant agency ON t.agency_id = agency.id + sys_tenant agency ON t.agency_tenant_id = agency.tenant_id AND t.tenant_id LIKE CONCAT('%', #{query.tenantId}, '%')