分销分钱具体逻辑

This commit is contained in:
张松
2025-10-27 16:00:58 +08:00
parent 39984116d0
commit bf083f698e
14 changed files with 387 additions and 14 deletions

View File

@@ -5,7 +5,9 @@ import com.czg.account.dto.shopinfo.ShopInfoSubVO;
import com.czg.account.entity.ShopInfo;
import com.mybatisflex.core.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import java.math.BigDecimal;
import java.util.List;
/**
@@ -17,4 +19,7 @@ import java.util.List;
public interface ShopInfoMapper extends BaseMapper<ShopInfo> {
List<ShopInfoSubVO> getSubList(@Param("lng") String lng, @Param("lat") String lat, @Param("distance") float distance);
@Update("update tb_shop_info set amount = amount + #{amount} where id = #{id} and amount + #{amount} >= 0")
boolean updateAmount(@Param("id") Long id, @Param("amount") BigDecimal amount);
}

View File

@@ -453,9 +453,11 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
if (shopInfo.getAmount() == null) {
shopInfo.setAmount(BigDecimal.ZERO);
}
shopInfo.setAmount(shopInfo.getAmount().add(amount));
updateById(shopInfo);
return shopInfo.getAmount();
boolean flag = mapper.updateAmount(id, amount);
if (!flag) {
throw new CzgException("更新失败");
}
return shopInfo.getAmount().add(amount);
}