修改bug

This commit is contained in:
fxh 2025-08-12 15:40:38 +08:00
parent ad580e3f99
commit a3e8881ba5
15 changed files with 102 additions and 27 deletions

View File

@ -56,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="getlist" resultType="com.wzj.soopin.goods.domain.vo.ProductVO">
<select id="getlist" resultMap="ProductWithSkusResultMap">
SELECT
p.*,
b.name AS brandName,
@ -64,7 +64,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t.store_name AS contactUserName,
t.contact_phone AS contactPhone,
o.distribution AS distribution,
pc.name AS productCategoryName
pc.name AS productCategoryName,
s.id AS sku_id,
s.out_sku_id,
s.price,
s.pic,
s.stock,
s.sp_data,
s.product_id
FROM
pms_product p
LEFT JOIN pms_brand b ON p.brand_id = b.id
@ -72,6 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN oms_order_item oi ON p.id = oi.product_id
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}
<if test="query.nameLike != null and query.nameLike != ''">
AND p.name LIKE CONCAT('%', #{query.nameLike}, '%')

View File

@ -27,6 +27,7 @@ public class MemberAccountChangeRecord extends BaseAudit {
@Schema(description ="会员id")
private Long memberId;
@Schema(description = "账户id")
private Long accountId;

View File

@ -208,7 +208,7 @@ public class RedPacketServiceImpl extends ServiceImpl<RedPacketMapper, RedPacket
// 记录金额变动
MemberAccountChangeRecord record = MemberAccountChangeRecord.builder()
.moneyBalance(beforeBalance)
.memberId(senderId)
.accountId(senderId)
.beforeBalance(beforeBalance)
.afterBalance(afterBalance)
.changeAmount(redPacket.getTotalAmount())
@ -270,7 +270,7 @@ public class RedPacketServiceImpl extends ServiceImpl<RedPacketMapper, RedPacket
// 记录金额变动
MemberAccountChangeRecord record = MemberAccountChangeRecord.builder()
.memberId(senderId)
.accountId(senderId)
.beforeBalance(beforeBalance)
.afterBalance(afterBalance)
.changeAmount(remainingAmount)
@ -341,7 +341,7 @@ public class RedPacketServiceImpl extends ServiceImpl<RedPacketMapper, RedPacket
// 记录金额变动
MemberAccountChangeRecord record = MemberAccountChangeRecord.builder()
.memberId(memberId)
.accountId(memberId)
.beforeBalance(beforeBalance)
.afterBalance(afterBalance)
.changeAmount(amount)

View File

@ -27,12 +27,6 @@ public class SysVersionController {
private final ISysVerisonService sysVerisonService;
@Tag(name ="查询app版本号")
@GetMapping ("page")
public R<IPage<VersionDTO>> page(Page<SysVersion> page) {
return R.ok(sysVerisonService.getPage(page));
}
@Tag(name ="查询app版本管理")
@PostMapping("/list")
@ -40,11 +34,14 @@ public class SysVersionController {
return R.ok(sysVerisonService.getList(page,query));
}
@Tag(name = "新增app版本管理")
@Log(title = "新增app版本管理", businessType = BusinessType.INSERT)
@Tag(name = "新增版本")
@Log(title = "版本管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
public R add(@RequestBody SysVersion sysVersion) {
return R.ok(sysVerisonService.save(sysVersion));
public R<Void> add(@Validated @RequestBody SysVersion sysVersion) {
if (!sysVerisonService.add(sysVersion)) {
return R.fail("新增版本失败");
}
return R.ok("新增成功");
}
@Tag(name ="修改状态")

View File

@ -127,8 +127,11 @@ public class SysTenant extends BaseEntity {
@Schema(description = "类型(0.店铺 1.代理 2.推广人)")
private Integer type;
@Schema(description = "代理商")
private Long agencyId;
@Schema(description = "所属代理商")
private Long agencyTenantId;
@Schema(description = "所属推广人")
private Long promoterTenantId;
}

View File

@ -18,12 +18,12 @@ public class SysTenantAccount extends BaseAudit {
private BigDecimal moneyBalance;
@Schema(description = "钱包余额")
private BigDecimal wallet;
@Schema(description = "累计收益")
@Schema(description = "营收")
private BigDecimal revenue;
@Schema(description = "创建人")
private Long createBy;
@Schema(description = "更新人")
private Long updateBy;
@Schema(description = "账户类型 1商家 2代理 3平台")
@Schema(description = "账户类型(0.店铺 1.代理 2.推广人)")
private Integer type;
}

View File

@ -14,4 +14,7 @@ public class SysVersionBo {
@Schema(description = "版本名称")
private String versionName;
@Schema(description = "状态")
private Integer status;
}

View File

@ -208,4 +208,10 @@ public class TenantDTO {
@Schema(description = "代理名称")
private String agencyContactUserName;
@Schema(description = "所属代理商")
private Long agencyTenantId;
@Schema(description = "所属推广人")
private Long promoterTenantId;
}

View File

@ -73,4 +73,7 @@ public interface SysTenantMapper extends BaseMapperPlus<SysTenant, SysTenantVo>
int batchDeleteTenantExtendByStoreIds(List<Long> ids);
int batchDeleteTenantByIds(List<Long> ids);
@Select("SELECT * FROM sys_tenant WHERE tenant_id = #{tenantId}")
SysTenant selectByBelongId(Long belongId);
}

View File

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.dromara.system.domain.SysVersion;
import org.dromara.system.domain.bo.SysVersionBo;
import org.dromara.system.domain.dto.VersionDTO;
@ -16,6 +17,14 @@ public interface SysVerisonMapper extends BaseMapper<SysVersion> {
IPage<SysVersionVo> getList(@Param("page") Page<SysVersion> page, @Param("query") SysVersionBo query);
@Select("SELECT v.version_code,v.download_url FROM sys_version as v")
Page<VersionDTO> getPage(Page<SysVersion> page);
@Update("UPDATE sys_version SET status = 0 WHERE platform_type = #{platformType} AND status = 1")
void disableOtherVersions(String platformType);
@Update("UPDATE sys_version SET status = 0 " +
"WHERE platform_type = #{platformType} " +
"AND status = 1 " +
"AND id != #{currentId}") // 排除当前正在修改的版本
void disableOtherVersion(@Param("platformType") String platformType,
@Param("currentId") Long currentId);
}

View File

@ -14,5 +14,6 @@ public interface ISysVerisonService extends IService<SysVersion> {
SysVersion updateStatus(Long id, Integer status);
Page<VersionDTO> getPage(Page<SysVersion> page);
boolean add(SysVersion sysVersion);
}

View File

@ -124,10 +124,30 @@ public class SysTenantServiceImpl implements ISysTenantService {
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean insertByBo(SysTenantExtendBo bo) {
// 处理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) {
if (sysTenant != null) {
Integer type = sysTenant.getType();
if (type != 1) {
throw new RuntimeException("只有代理能添加推广人");
}
} else {
throw new RuntimeException("未查询到对应 belongId 的租户信息");
}
}
// 生成租户ID
List<String> tenantIds = baseMapper.selectObjs(
@ -164,7 +184,10 @@ public class SysTenantServiceImpl implements ISysTenantService {
tenant.setQualification(bo.getQualification());
tenant.setType(bo.getType());
if (bo.getType() == 2){
tenant.setAgencyId(bo.getId());
tenant.setAgencyTenantId(belongId);
}
if (bo.getType() == 0){
tenant.setPromoterTenantId(belongId);
}
// 插入sys_tenant表

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.system.domain.SysVersion;
import org.dromara.system.domain.bo.SysVersionBo;
import org.dromara.system.domain.dto.VersionDTO;
@ -12,6 +13,7 @@ import org.dromara.system.domain.vo.SysVersionVo;
import org.dromara.system.mapper.SysVerisonMapper;
import org.dromara.system.service.ISysVerisonService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Slf4j
@RequiredArgsConstructor
@ -26,18 +28,34 @@ public class SysVerisonServiceImpl extends ServiceImpl<SysVerisonMapper, SysVers
}
@Override
@Transactional(rollbackFor = Exception.class)
public SysVersion updateStatus(Long id, Integer status) {
// 查询当前版本
SysVersion sysVersion = sysVerisonMapper.selectById(id);
if (sysVersion == null) {
throw new RuntimeException("版本不存在");
throw new ServiceException("版本不存在");
}
if (status == 1) {
// 禁用同平台其他所有版本
sysVerisonMapper.disableOtherVersion(sysVersion.getPlatformType(), id);
}
// 更新当前版本状态
sysVersion.setStatus(status);
sysVerisonMapper.updateById(sysVersion);
return sysVersion;
}
@Override
public Page<VersionDTO> getPage(Page<SysVersion> page) {
return sysVerisonMapper.getPage(page);
public boolean add(SysVersion sysVersion) {
// 检查是否设置启用状态
if (sysVersion.getStatus() == 1) {
// 禁用其他版本
sysVerisonMapper.disableOtherVersions(sysVersion.getPlatformType());
}
return super.save(sysVersion);
}
}

View File

@ -18,6 +18,9 @@
<if test="query.platformType != null and query.platformType != ''">
AND v.platform_type LIKE CONCAT('%', #{query.platformType}, '%')
</if>
<if test="query.status != null">
AND v.status = #{query.status}
</if>
</where>
ORDER BY v.version_code asc

View File

@ -107,7 +107,7 @@ public class WithdrawServiceImpl extends ServiceImpl<WithdrawMapper, Withdraw> i
memberAccountService.updateById(memberAccount.toBuilder().wallet(balance.subtract(finalBalance)).build());
//生成账户变动记录bh
MemberAccountChangeRecord memberAccountChangeRecord = MemberAccountChangeRecord.builder()
.memberId(withdraw.getMemberId())
.accountId(withdraw.getMemberId())
.moneyBalance(finalBalance)
.beforeBalance(balance)
.afterBalance(yishengAccountVO.getBalance())