修改bug
This commit is contained in:
parent
18eaab3435
commit
2deb719e4b
@ -3,6 +3,7 @@ package com.fuint.business.marketingActivity.activeDiscount.vo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class ActiveDiscountPayVO implements Serializable {
|
||||
@ -11,9 +12,9 @@ public class ActiveDiscountPayVO implements Serializable {
|
||||
//活动名称
|
||||
private String activeName;
|
||||
//满足金额
|
||||
private double amount;
|
||||
private BigDecimal amount;
|
||||
//折扣
|
||||
private double discount;
|
||||
private BigDecimal discount;
|
||||
//可用油品
|
||||
private String oilId;
|
||||
//适用会员
|
||||
|
@ -3,13 +3,14 @@ package com.fuint.business.marketingActivity.activeExchange.dto;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class PaymentActiveDTO implements Serializable {
|
||||
//支付类型 0:储值卡 1:囤油卡 2:现金
|
||||
private String type;
|
||||
//支付金额
|
||||
private double amount;
|
||||
private BigDecimal amount;
|
||||
//可用油品Id
|
||||
private Integer oilId;
|
||||
//店铺id
|
||||
|
@ -56,6 +56,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -409,19 +410,21 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
|
||||
public PaymentActiveVO paymentActive(PaymentActiveDTO paymentActiveDTO) {
|
||||
PaymentActiveVO paymentActiveVO = new PaymentActiveVO();
|
||||
Integer storeId = paymentActiveDTO.getStoreId();
|
||||
double amount = 0.0;
|
||||
double fullAmount = 0.0;
|
||||
BigDecimal amount = new BigDecimal(0.00);
|
||||
BigDecimal fullAmount = new BigDecimal(0.00);
|
||||
BigDecimal a = new BigDecimal(0.1);
|
||||
BigDecimal b = new BigDecimal(10);
|
||||
//折扣
|
||||
List<ActiveDiscountPayVO> activeDiscountVOList = oilOrderMapper.selectActiveDiscount(storeId,paymentActiveDTO.getAmount());
|
||||
if (CollectionUtils.isNotEmpty(activeDiscountVOList)){
|
||||
for (ActiveDiscountPayVO activeDiscountPayVO : activeDiscountVOList) {
|
||||
if (activeDiscountPayVO.getOilId().contains(paymentActiveDTO.getOilId().toString()) &&
|
||||
activeDiscountPayVO.getAdaptUser().contains(paymentActiveDTO.getMtUserLevel().toString())){
|
||||
if (activeDiscountPayVO.getDiscount() * activeDiscountPayVO.getAmount() > amount){
|
||||
amount = paymentActiveDTO.getAmount() - ((10-activeDiscountPayVO.getDiscount()) * activeDiscountPayVO.getAmount() * 0.1);
|
||||
if (activeDiscountPayVO.getAmount().multiply(activeDiscountPayVO.getDiscount()).compareTo(amount) > 0){
|
||||
amount = paymentActiveDTO.getAmount().subtract(((b.subtract(activeDiscountPayVO.getDiscount())).multiply(activeDiscountPayVO.getAmount()).multiply(a)));
|
||||
paymentActiveVO.setActiveId(activeDiscountPayVO.getActiveId());
|
||||
paymentActiveVO.setAmount(amount);
|
||||
paymentActiveVO.setFavorableAmount((10-activeDiscountPayVO.getDiscount()) * activeDiscountPayVO.getAmount() * 0.1);
|
||||
paymentActiveVO.setFavorableAmount((b.subtract(activeDiscountPayVO.getDiscount())).multiply(activeDiscountPayVO.getAmount()).multiply(a));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -433,13 +436,13 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
|
||||
if (activeDiscountPayVO.getOilId().contains(paymentActiveDTO.getOilId().toString()) &&
|
||||
activeDiscountPayVO.getAdaptUser().contains(paymentActiveDTO.getMtUserLevel().toString())){
|
||||
//如果满足条件
|
||||
if (paymentActiveDTO.getAmount() >= activeDiscountPayVO.getAmount()){
|
||||
fullAmount = paymentActiveDTO.getAmount() - activeDiscountPayVO.getDiscount();
|
||||
if (amount > fullAmount){
|
||||
amount = paymentActiveDTO.getAmount() - fullAmount;
|
||||
if ((paymentActiveDTO.getAmount()).compareTo(activeDiscountPayVO.getAmount()) >= 0){
|
||||
fullAmount = paymentActiveDTO.getAmount().subtract(activeDiscountPayVO.getDiscount());
|
||||
if (amount.compareTo(fullAmount) > 0){
|
||||
amount = paymentActiveDTO.getAmount().subtract(fullAmount);
|
||||
paymentActiveVO.setActiveId(activeDiscountPayVO.getActiveId());
|
||||
paymentActiveVO.setAmount(amount);
|
||||
paymentActiveVO.setFavorableAmount(paymentActiveDTO.getAmount() - activeDiscountPayVO.getDiscount());
|
||||
paymentActiveVO.setFavorableAmount(paymentActiveDTO.getAmount().subtract(activeDiscountPayVO.getDiscount()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -448,7 +451,8 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
|
||||
//消费有礼
|
||||
List<ActiveConsumptionVO> activeConsumptionVOS = oilOrderMapper.selectActiveConsumption(storeId, paymentActiveDTO.getAmount());
|
||||
//连锁店信息
|
||||
LJUser ljUserVo = userService.selectUserByUserId();
|
||||
LJUser ljUserVo = userService.queryUserByUserId(TokenUtil.getNowAccountInfo().getId());
|
||||
String accountName = TokenUtil.getNowAccountInfo().getAccountName();
|
||||
Integer storeId1 = paymentActiveDTO.getStoreId();
|
||||
Integer chainStoreId = iljStoreService.selectStoreByStoreId(storeId1).getChainStoreId();
|
||||
//用户余额
|
||||
|
@ -3,13 +3,14 @@ package com.fuint.business.marketingActivity.activeExchange.vo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class PaymentActiveVO implements Serializable {
|
||||
//活动id
|
||||
private Integer activeId;
|
||||
//应付金额
|
||||
private double amount;
|
||||
private BigDecimal amount;
|
||||
//优惠金额
|
||||
private double favorableAmount;
|
||||
private BigDecimal favorableAmount;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.fuint.business.marketingActivity.activeRecommend.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.marketingActivity.activeRecommend.dto.ActiveRecommendRecordsDTO;
|
||||
import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendRecords;
|
||||
import com.fuint.business.marketingActivity.activeRecommend.service.ActiveRecommendRecordsService;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
@ -49,8 +50,8 @@ public class ActiveRecommendRecordsController extends BaseController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("selectAllAmount")
|
||||
public ResponseObject selectAllAmount() {
|
||||
return getSuccessResult(this.activeRecommendRecordsService.selectAllAmount());
|
||||
public ResponseObject selectAllAmount(@Param("activeRecommendRecords") ActiveRecommendRecords activeRecommendRecords) {
|
||||
return getSuccessResult(this.activeRecommendRecordsService.selectAllAmount(activeRecommendRecords));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -66,12 +67,12 @@ public class ActiveRecommendRecordsController extends BaseController {
|
||||
|
||||
/**
|
||||
* 新增邀请记录接口
|
||||
* @param activeRecommendRecords 实体对象
|
||||
* @param activeRecommendRecordsDTO 实体对象
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseObject insert(@RequestBody ActiveRecommendRecords activeRecommendRecords) {
|
||||
return getSuccessResult(this.activeRecommendRecordsService.add(activeRecommendRecords));
|
||||
public ResponseObject insert(@RequestBody ActiveRecommendRecordsDTO activeRecommendRecordsDTO) {
|
||||
return getSuccessResult(this.activeRecommendRecordsService.add(activeRecommendRecordsDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,12 @@
|
||||
package com.fuint.business.marketingActivity.activeRecommend.dto;
|
||||
|
||||
import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendRecords;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ActiveRecommendRecordsDTO extends ActiveRecommendRecords implements Serializable {
|
||||
private Integer storeId;
|
||||
private String type;
|
||||
}
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ -16,6 +17,7 @@ import java.io.Serializable;
|
||||
* @since 2023-11-13 15:09:50
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@Data
|
||||
public class ActiveRecommend extends Model<ActiveRecommend> {
|
||||
//主键id
|
||||
@TableId(type = IdType.AUTO)
|
||||
@ -58,167 +60,5 @@ public class ActiveRecommend extends Model<ActiveRecommend> {
|
||||
//更新时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
public String getTitleUrl() {
|
||||
return titleUrl;
|
||||
}
|
||||
|
||||
public void setTitleUrl(String titleUrl) {
|
||||
this.titleUrl = titleUrl;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getChainStoreId() {
|
||||
return chainStoreId;
|
||||
}
|
||||
|
||||
public void setChainStoreId(Integer chainStoreId) {
|
||||
this.chainStoreId = chainStoreId;
|
||||
}
|
||||
|
||||
public Integer getStoreId() {
|
||||
return storeId;
|
||||
}
|
||||
|
||||
public void setStoreId(Integer storeId) {
|
||||
this.storeId = storeId;
|
||||
}
|
||||
|
||||
public String getActivePictureUrl() {
|
||||
return activePictureUrl;
|
||||
}
|
||||
|
||||
public void setActivePictureUrl(String activePictureUrl) {
|
||||
this.activePictureUrl = activePictureUrl;
|
||||
}
|
||||
|
||||
public String getInviterGiftType() {
|
||||
return inviterGiftType;
|
||||
}
|
||||
|
||||
public void setInviterGiftType(String inviterGiftType) {
|
||||
this.inviterGiftType = inviterGiftType;
|
||||
}
|
||||
|
||||
public Integer getPoints() {
|
||||
return points;
|
||||
}
|
||||
|
||||
public void setPoints(Integer points) {
|
||||
this.points = points;
|
||||
}
|
||||
|
||||
public Integer getGrowthValue() {
|
||||
return growthValue;
|
||||
}
|
||||
|
||||
public void setGrowthValue(Integer growthValue) {
|
||||
this.growthValue = growthValue;
|
||||
}
|
||||
|
||||
public String getNewuserGiftType() {
|
||||
return newuserGiftType;
|
||||
}
|
||||
|
||||
public void setNewuserGiftType(String newuserGiftType) {
|
||||
this.newuserGiftType = newuserGiftType;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getInvitationCodeType() {
|
||||
return invitationCodeType;
|
||||
}
|
||||
|
||||
public void setInvitationCodeType(String invitationCodeType) {
|
||||
this.invitationCodeType = invitationCodeType;
|
||||
}
|
||||
|
||||
public String getRewardDisplay() {
|
||||
return rewardDisplay;
|
||||
}
|
||||
|
||||
public void setRewardDisplay(String rewardDisplay) {
|
||||
this.rewardDisplay = rewardDisplay;
|
||||
}
|
||||
|
||||
public String getActiveRule() {
|
||||
return activeRule;
|
||||
}
|
||||
|
||||
public void setActiveRule(String activeRule) {
|
||||
this.activeRule = activeRule;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getIsonline() {
|
||||
return isonline;
|
||||
}
|
||||
|
||||
public void setIsonline(String isonline) {
|
||||
this.isonline = isonline;
|
||||
}
|
||||
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateBy(String updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主键值
|
||||
*
|
||||
* @return 主键值
|
||||
*/
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ public class ActiveRecommendRecords extends Model<ActiveRecommendRecords> {
|
||||
private Integer chainStoreId;
|
||||
//所属店铺id
|
||||
private Integer storeId;
|
||||
//用户id
|
||||
//邀请人id
|
||||
private String userId;
|
||||
//被邀请人id
|
||||
private String inviteeUserId;
|
||||
|
@ -3,6 +3,7 @@ package com.fuint.business.marketingActivity.activeRecommend.service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.business.marketingActivity.activeRecommend.dto.ActiveRecommendRecordsDTO;
|
||||
import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendRecords;
|
||||
|
||||
/**
|
||||
@ -25,13 +26,13 @@ public interface ActiveRecommendRecordsService extends IService<ActiveRecommendR
|
||||
* 小程序端查询券总额
|
||||
* @return
|
||||
*/
|
||||
double selectAllAmount();
|
||||
double selectAllAmount(ActiveRecommendRecords activeRecommendRecords);
|
||||
|
||||
/**
|
||||
* 新增邀请记录接口
|
||||
* @param activeRecommendRecords
|
||||
* @param activeRecommendRecordsDTO
|
||||
* @return
|
||||
*/
|
||||
boolean add(ActiveRecommendRecords activeRecommendRecords);
|
||||
boolean add(ActiveRecommendRecordsDTO activeRecommendRecordsDTO);
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumption;
|
||||
import com.fuint.business.marketingActivity.activeRecommend.dto.ActiveRecommendRecordsDTO;
|
||||
import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommend;
|
||||
import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendChild;
|
||||
import com.fuint.business.marketingActivity.activeRecommend.mapper.ActiveRecommendRecordsMapper;
|
||||
import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendRecords;
|
||||
@ -12,11 +15,23 @@ import com.fuint.business.marketingActivity.activeRecommend.service.ActiveRecomm
|
||||
import com.fuint.business.marketingActivity.activeRecommend.service.ActiveRecommendService;
|
||||
import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendRecordsVO;
|
||||
import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendVO;
|
||||
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord;
|
||||
import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeRecordService;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService;
|
||||
import com.fuint.business.storeInformation.service.ILJStoreService;
|
||||
import com.fuint.business.userManager.entity.LJUser;
|
||||
import com.fuint.business.userManager.entity.UserBalance;
|
||||
import com.fuint.business.userManager.mapper.UserBalanceMapper;
|
||||
import com.fuint.business.userManager.service.LJUserService;
|
||||
import com.fuint.business.userManager.service.UserBalanceService;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
@ -35,6 +50,16 @@ public class ActiveRecommendRecordsServiceImpl extends ServiceImpl<ActiveRecomme
|
||||
private ActiveRecommendService activeRecommendService;
|
||||
@Resource
|
||||
private CardFavorableService cardFavorableService;
|
||||
@Resource
|
||||
private LJUserService ljUserService;
|
||||
@Resource
|
||||
private UserBalanceService userBalanceService;
|
||||
@Resource
|
||||
private CardFavorableRecordService cardFavorableRecordService;
|
||||
@Resource
|
||||
private CardExchangeRecordService cardExchangeRecordService;
|
||||
@Resource
|
||||
private ILJStoreService iljStoreService;
|
||||
/**
|
||||
* 小程序端查询邀请记录
|
||||
* @param page
|
||||
@ -45,7 +70,7 @@ public class ActiveRecommendRecordsServiceImpl extends ServiceImpl<ActiveRecomme
|
||||
public IPage select(Page page, ActiveRecommendRecords activeRecommendRecords) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer userId = nowAccountInfo.getId();
|
||||
Integer storeId = nowAccountInfo.getStoreId();
|
||||
Integer storeId = activeRecommendRecords.getStoreId();
|
||||
LambdaQueryWrapper<ActiveRecommendRecords> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActiveRecommendRecords::getUserId,userId);
|
||||
queryWrapper.eq(ActiveRecommendRecords::getStoreId,storeId);
|
||||
@ -83,12 +108,12 @@ public class ActiveRecommendRecordsServiceImpl extends ServiceImpl<ActiveRecomme
|
||||
}
|
||||
|
||||
@Override
|
||||
public double selectAllAmount() {
|
||||
public double selectAllAmount(ActiveRecommendRecords activeRecommendRecords) {
|
||||
//券总额
|
||||
double discountAmount = 0.0;
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer userId = nowAccountInfo.getId();
|
||||
Integer storeId = nowAccountInfo.getStoreId();
|
||||
Integer storeId = activeRecommendRecords.getStoreId();
|
||||
LambdaQueryWrapper<ActiveRecommendRecords> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActiveRecommendRecords::getUserId,userId);
|
||||
queryWrapper.eq(ActiveRecommendRecords::getStoreId,storeId);
|
||||
@ -97,7 +122,9 @@ public class ActiveRecommendRecordsServiceImpl extends ServiceImpl<ActiveRecomme
|
||||
//邀请人数
|
||||
int size = list.size();
|
||||
//推荐有礼活动
|
||||
ActiveRecommendVO activeRecommendVO = activeRecommendService.getOneById(1);
|
||||
ActiveConsumption activeConsumption = new ActiveConsumption();
|
||||
activeConsumption.setStoreId(storeId);
|
||||
ActiveRecommendVO activeRecommendVO = activeRecommendService.getOneByIdApplet(activeConsumption);
|
||||
//活动所送推荐人的优惠券
|
||||
List<ActiveRecommendChild> activeRecommendChildList = activeRecommendVO.getActiveRecommendChildList();
|
||||
if(CollectionUtils.isNotEmpty(activeRecommendChildList)){
|
||||
@ -118,21 +145,83 @@ public class ActiveRecommendRecordsServiceImpl extends ServiceImpl<ActiveRecomme
|
||||
|
||||
/**
|
||||
* 新增邀请记录接口
|
||||
* @param activeRecommendRecords
|
||||
* @param activeRecommendRecordsDTO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean add(ActiveRecommendRecords activeRecommendRecords) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer userId = nowAccountInfo.getId();
|
||||
Integer storeId = nowAccountInfo.getStoreId();
|
||||
//邀请人id TODO
|
||||
activeRecommendRecords.setUserId(userId.toString());
|
||||
activeRecommendRecords.setStoreId(storeId);
|
||||
//被邀请人id
|
||||
activeRecommendRecords.setInviteeUserId(userId.toString());
|
||||
activeRecommendRecords.setInviteeUserName(nowAccountInfo.getRealName());
|
||||
return save(activeRecommendRecords);
|
||||
@Transactional
|
||||
public boolean add(ActiveRecommendRecordsDTO activeRecommendRecordsDTO) {
|
||||
if (ObjectUtils.isNotEmpty(activeRecommendRecordsDTO) && activeRecommendRecordsDTO.getType().equals("yaoqingyouli")){
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer userId = nowAccountInfo.getId();
|
||||
ActiveRecommendRecords activeRecommendRecords = new ActiveRecommendRecords();
|
||||
BeanUtils.copyProperties(activeRecommendRecordsDTO,activeRecommendRecords);
|
||||
//邀请人
|
||||
LJUser ljUser1 = ljUserService.queryUserByUserId(Integer.parseInt(activeRecommendRecordsDTO.getUserId()));
|
||||
//被邀请人
|
||||
LJUser ljUser = ljUserService.queryUserByUserId(userId);
|
||||
ActiveConsumption activeConsumption = new ActiveConsumption();
|
||||
activeConsumption.setStoreId(activeRecommendRecordsDTO.getStoreId());
|
||||
ActiveRecommendVO activeRecommendVO = activeRecommendService.getOneByIdApplet(activeConsumption);
|
||||
UserBalance userBalance = userBalanceService.selectUserBalance(Integer.parseInt(activeRecommendRecordsDTO.getUserId()),iljStoreService.selectStoreByStoreId(activeRecommendRecordsDTO.getStoreId()).getChainStoreId());
|
||||
//积分
|
||||
if (ObjectUtils.isNotEmpty(activeRecommendVO.getPoints())){
|
||||
userBalance.setPoints(userBalance.getPoints() + activeRecommendVO.getPoints());
|
||||
}
|
||||
//成长值
|
||||
if (ObjectUtils.isNotEmpty(activeRecommendVO.getGrowthValue())){
|
||||
userBalance.setGrowthValue(userBalance.getGrowthValue() + activeRecommendVO.getGrowthValue());
|
||||
}
|
||||
//卡券
|
||||
List<ActiveRecommendChild> activeRecommendChildList = activeRecommendVO.getActiveRecommendChildList();
|
||||
if(CollectionUtils.isNotEmpty(activeRecommendChildList)){
|
||||
for (ActiveRecommendChild activeRecommendChild : activeRecommendChildList) {
|
||||
//优惠券
|
||||
if (activeRecommendChild.getGiftUserType().equals("0") && activeRecommendChild.getActiveGift().equals("1")){
|
||||
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();
|
||||
cardFavorableRecord.setCardFavorableId(activeRecommendChild.getVouchersId());
|
||||
cardFavorableRecord.setStoreId(activeRecommendRecordsDTO.getStoreId());
|
||||
cardFavorableRecord.setMtUserId(ljUser1.getId());
|
||||
cardFavorableRecord.setName(ljUser1.getName());
|
||||
cardFavorableRecord.setMobile(ljUser1.getMobile());
|
||||
cardFavorableRecord.setStatus("0");
|
||||
cardFavorableRecord.setExchangeFrom("邀请新人送券");
|
||||
cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord);
|
||||
}
|
||||
//兑换券
|
||||
if (activeRecommendChild.getGiftUserType().equals("0") && activeRecommendChild.getActiveGift().equals("2")){
|
||||
CardExchangeRecord cardExchangeRecord = new CardExchangeRecord();
|
||||
cardExchangeRecord.setCardExchangeId(activeRecommendChild.getVouchersId());
|
||||
cardExchangeRecord.setStoreId(activeRecommendRecordsDTO.getStoreId());
|
||||
cardExchangeRecord.setMtUserId(ljUser1.getId());
|
||||
cardExchangeRecord.setName(ljUser1.getName());
|
||||
cardExchangeRecord.setMobile(ljUser1.getMobile());
|
||||
cardExchangeRecord.setPhoto(ljUser1.getAvatar());
|
||||
cardExchangeRecord.setStatus("0");
|
||||
cardExchangeRecord.setExchangeFrom("邀请新人送券");
|
||||
cardExchangeRecordService.addCardExchangeRecord(cardExchangeRecord);
|
||||
}
|
||||
//被邀请人优惠券
|
||||
if (activeRecommendChild.getGiftUserType().equals("1") && activeRecommendChild.getActiveGift().equals("1")){
|
||||
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();
|
||||
cardFavorableRecord.setCardFavorableId(activeRecommendChild.getVouchersId());
|
||||
cardFavorableRecord.setStoreId(activeRecommendRecordsDTO.getStoreId());
|
||||
cardFavorableRecord.setMtUserId(ljUser.getId());
|
||||
cardFavorableRecord.setName(ljUser.getName());
|
||||
cardFavorableRecord.setMobile(ljUser.getMobile());
|
||||
cardFavorableRecord.setStatus("0");
|
||||
cardFavorableRecord.setExchangeFrom("新人送券");
|
||||
cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
userBalanceService.updateById(userBalance);
|
||||
//被邀请人
|
||||
activeRecommendRecords.setInviteeUserId(userId.toString());
|
||||
activeRecommendRecords.setInviteeUserName(ljUser.getName());
|
||||
return save(activeRecommendRecords);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package com.fuint.business.marketingActivity.activeRecommend.vo;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendChild;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
@ -15,6 +16,7 @@ import java.util.List;
|
||||
* @since 2023-11-13 15:09:50
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@Data
|
||||
public class ActiveRecommendVO extends Model<ActiveRecommendVO> {
|
||||
//主键id
|
||||
private Integer id;
|
||||
@ -58,175 +60,5 @@ public class ActiveRecommendVO extends Model<ActiveRecommendVO> {
|
||||
//更新时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
public String getTitleUrl() {
|
||||
return titleUrl;
|
||||
}
|
||||
|
||||
public void setTitleUrl(String titleUrl) {
|
||||
this.titleUrl = titleUrl;
|
||||
}
|
||||
|
||||
public String[] getInviterGiftType() {
|
||||
return inviterGiftType;
|
||||
}
|
||||
|
||||
public void setInviterGiftType(String[] inviterGiftType) {
|
||||
this.inviterGiftType = inviterGiftType;
|
||||
}
|
||||
|
||||
public List<ActiveRecommendChild> getActiveRecommendChildList() {
|
||||
return activeRecommendChildList;
|
||||
}
|
||||
|
||||
public void setActiveRecommendChildList(List<ActiveRecommendChild> activeRecommendChildList) {
|
||||
this.activeRecommendChildList = activeRecommendChildList;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getChainStoreId() {
|
||||
return chainStoreId;
|
||||
}
|
||||
|
||||
public void setChainStoreId(Integer chainStoreId) {
|
||||
this.chainStoreId = chainStoreId;
|
||||
}
|
||||
|
||||
public Integer getStoreId() {
|
||||
return storeId;
|
||||
}
|
||||
|
||||
public void setStoreId(Integer storeId) {
|
||||
this.storeId = storeId;
|
||||
}
|
||||
|
||||
public String getActivePictureUrl() {
|
||||
return activePictureUrl;
|
||||
}
|
||||
|
||||
public void setActivePictureUrl(String activePictureUrl) {
|
||||
this.activePictureUrl = activePictureUrl;
|
||||
}
|
||||
|
||||
public Integer getPoints() {
|
||||
return points;
|
||||
}
|
||||
|
||||
public void setPoints(Integer points) {
|
||||
this.points = points;
|
||||
}
|
||||
|
||||
public Integer getGrowthValue() {
|
||||
return growthValue;
|
||||
}
|
||||
|
||||
public void setGrowthValue(Integer growthValue) {
|
||||
this.growthValue = growthValue;
|
||||
}
|
||||
|
||||
public String getNewuserGiftType() {
|
||||
return newuserGiftType;
|
||||
}
|
||||
|
||||
public void setNewuserGiftType(String newuserGiftType) {
|
||||
this.newuserGiftType = newuserGiftType;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getInvitationCodeType() {
|
||||
return invitationCodeType;
|
||||
}
|
||||
|
||||
public void setInvitationCodeType(String invitationCodeType) {
|
||||
this.invitationCodeType = invitationCodeType;
|
||||
}
|
||||
|
||||
public String getRewardDisplay() {
|
||||
return rewardDisplay;
|
||||
}
|
||||
|
||||
public void setRewardDisplay(String rewardDisplay) {
|
||||
this.rewardDisplay = rewardDisplay;
|
||||
}
|
||||
|
||||
public String getActiveRule() {
|
||||
return activeRule;
|
||||
}
|
||||
|
||||
public void setActiveRule(String activeRule) {
|
||||
this.activeRule = activeRule;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getIsonline() {
|
||||
return isonline;
|
||||
}
|
||||
|
||||
public void setIsonline(String isonline) {
|
||||
this.isonline = isonline;
|
||||
}
|
||||
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateBy(String updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主键值
|
||||
*
|
||||
* @return 主键值
|
||||
*/
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ import com.fuint.business.order.vo.OilOrderVo;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilNumber;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -82,7 +83,7 @@ public interface OilOrderMapper extends BaseMapper<OilOrder> {
|
||||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
List<ActiveDiscountPayVO> selectActiveDiscount(@Param("storeId") Integer storeId, @Param("amount")double amount);
|
||||
List<ActiveDiscountPayVO> selectActiveDiscount(@Param("storeId") Integer storeId, @Param("amount") BigDecimal amount);
|
||||
|
||||
/**
|
||||
* 满减
|
||||
@ -90,7 +91,7 @@ public interface OilOrderMapper extends BaseMapper<OilOrder> {
|
||||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
List<ActiveDiscountPayVO> selectActiveFule(@Param("storeId") Integer storeId, @Param("amount")double amount);
|
||||
List<ActiveDiscountPayVO> selectActiveFule(@Param("storeId") Integer storeId, @Param("amount")BigDecimal amount);
|
||||
|
||||
/**
|
||||
* 消费有礼
|
||||
@ -98,5 +99,5 @@ public interface OilOrderMapper extends BaseMapper<OilOrder> {
|
||||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
List<ActiveConsumptionVO> selectActiveConsumption(@Param("storeId") Integer storeId, @Param("amount")double amount);
|
||||
List<ActiveConsumptionVO> selectActiveConsumption(@Param("storeId") Integer storeId, @Param("amount")BigDecimal amount);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user