消费累计
This commit is contained in:
parent
092c85673d
commit
cf01577f43
|
|
@ -9,6 +9,7 @@ import com.czg.account.dto.shopuser.*;
|
|||
import com.czg.account.entity.*;
|
||||
import com.czg.account.service.*;
|
||||
import com.czg.config.RedisCst;
|
||||
import com.czg.enums.ShopUserFlowBizEnum;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.czg.order.entity.OrderDetail;
|
||||
import com.czg.order.entity.OrderInfo;
|
||||
|
|
@ -107,10 +108,10 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
|||
ShopUserFlow userFlow = new ShopUserFlow();
|
||||
int flag;
|
||||
if (shopUserEditDTO.getType() == 0) {
|
||||
if(shopUserEditDTO.getMoney().compareTo(userInfo.getAmount()) > 0){
|
||||
if (shopUserEditDTO.getMoney().compareTo(userInfo.getAmount()) > 0) {
|
||||
//如果超额退款 则退为0
|
||||
flag = mapper.decrAccount(shopId, shopUserEditDTO.getId(), DateUtil.date().toLocalDateTime(), userInfo.getAmount());
|
||||
}else {
|
||||
} else {
|
||||
flag = mapper.decrAccount(shopId, shopUserEditDTO.getId(), DateUtil.date().toLocalDateTime(), shopUserEditDTO.getMoney());
|
||||
}
|
||||
} else {
|
||||
|
|
@ -132,6 +133,13 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
|||
userFlow.setRelationId(shopUserEditDTO.getRelationId());
|
||||
userFlow.setRechargeId(shopUserEditDTO.getRechargeId());
|
||||
shopUserFlowService.save(userFlow);
|
||||
//次数
|
||||
if (shopUserEditDTO.getType() == 0 && shopUserEditDTO.getBizEnum().equals(ShopUserFlowBizEnum.ORDER_PAY)) {
|
||||
ShopUser shopUser = new ShopUser();
|
||||
shopUser.setConsumeCount(userInfo.getConsumeCount() + 1);
|
||||
shopUser.setConsumeAmount(userInfo.getConsumeAmount().add(shopUserEditDTO.getMoney()));
|
||||
updateById(shopUser);
|
||||
}
|
||||
return userFlow.getId();
|
||||
}
|
||||
|
||||
|
|
@ -245,7 +253,6 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean join(Long shopId, Long userId, ShopUserAddDTO shopUserAddDTO) {
|
||||
|
|
@ -309,7 +316,7 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
|||
shopUser.setUserId(userId);
|
||||
save(shopUser);
|
||||
shopUser = getById(shopUser.getId());
|
||||
}else {
|
||||
} else {
|
||||
couponNum = shopActivateCouponRecordService.count(new QueryWrapper().eq(ShopActivateCouponRecord::getShopUserId, shopUser.getId()).eq(ShopActivateCouponRecord::getStatus, 0));
|
||||
}
|
||||
ShopUserDetailDTO shopUserDetailDTO = BeanUtil.copyProperties(shopUser, ShopUserDetailDTO.class);
|
||||
|
|
|
|||
Loading…
Reference in New Issue