修改bug
This commit is contained in:
parent
c67c0333dc
commit
bf724adf18
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ -17,6 +18,7 @@ import java.io.Serializable;
|
||||
* @since 2023-11-10 10:44:58
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@Data
|
||||
@TableName("active_consumption")
|
||||
public class ActiveConsumption extends Model<ActiveConsumption> {
|
||||
//主键id
|
||||
@ -29,7 +31,7 @@ public class ActiveConsumption extends Model<ActiveConsumption> {
|
||||
//活动名称
|
||||
private String name;
|
||||
//满足金额
|
||||
private String participationConditionMoney;
|
||||
private Double participationConditionMoney;
|
||||
//活动开始时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date activeStartTime;
|
||||
@ -74,215 +76,5 @@ public class ActiveConsumption extends Model<ActiveConsumption> {
|
||||
//更新时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
public String getParticipationConditionMoney() {
|
||||
return participationConditionMoney;
|
||||
}
|
||||
|
||||
public void setParticipationConditionMoney(String participationConditionMoney) {
|
||||
this.participationConditionMoney = participationConditionMoney;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getChainStorId() {
|
||||
return chainStorId;
|
||||
}
|
||||
|
||||
public void setChainStorId(Integer chainStorId) {
|
||||
this.chainStorId = chainStorId;
|
||||
}
|
||||
|
||||
public Integer getStoreId() {
|
||||
return storeId;
|
||||
}
|
||||
|
||||
public void setStoreId(Integer storeId) {
|
||||
this.storeId = storeId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Date getActiveStartTime() {
|
||||
return activeStartTime;
|
||||
}
|
||||
|
||||
public void setActiveStartTime(Date activeStartTime) {
|
||||
this.activeStartTime = activeStartTime;
|
||||
}
|
||||
|
||||
public Date getActiveEndTime() {
|
||||
return activeEndTime;
|
||||
}
|
||||
|
||||
public void setActiveEndTime(Date activeEndTime) {
|
||||
this.activeEndTime = activeEndTime;
|
||||
}
|
||||
|
||||
public String getAdaptOil() {
|
||||
return adaptOil;
|
||||
}
|
||||
|
||||
public void setAdaptOil(String adaptOil) {
|
||||
this.adaptOil = adaptOil;
|
||||
}
|
||||
|
||||
public String getMember_type() {
|
||||
return member_type;
|
||||
}
|
||||
|
||||
public void setMember_type(String member_type) {
|
||||
this.member_type = member_type;
|
||||
}
|
||||
|
||||
public String getAdaptUserType() {
|
||||
return adaptUserType;
|
||||
}
|
||||
|
||||
public void setAdaptUserType(String adaptUserType) {
|
||||
this.adaptUserType = adaptUserType;
|
||||
}
|
||||
|
||||
public String getDieselUserLevel() {
|
||||
return dieselUserLevel;
|
||||
}
|
||||
|
||||
public void setDieselUserLevel(String dieselUserLevel) {
|
||||
this.dieselUserLevel = dieselUserLevel;
|
||||
}
|
||||
|
||||
public String getGasolineUserLevel() {
|
||||
return gasolineUserLevel;
|
||||
}
|
||||
|
||||
public void setGasolineUserLevel(String gasolineUserLevel) {
|
||||
this.gasolineUserLevel = gasolineUserLevel;
|
||||
}
|
||||
|
||||
public String getNaturalUserLevel() {
|
||||
return naturalUserLevel;
|
||||
}
|
||||
|
||||
public void setNaturalUserLevel(String naturalUserLevel) {
|
||||
this.naturalUserLevel = naturalUserLevel;
|
||||
}
|
||||
|
||||
public String getPaymentType() {
|
||||
return paymentType;
|
||||
}
|
||||
|
||||
public void setPaymentType(String paymentType) {
|
||||
this.paymentType = paymentType;
|
||||
}
|
||||
|
||||
public String getParticipationCondition() {
|
||||
return participationCondition;
|
||||
}
|
||||
|
||||
public void setParticipationCondition(String participationCondition) {
|
||||
this.participationCondition = participationCondition;
|
||||
}
|
||||
|
||||
public String getParticipationAcount() {
|
||||
return participationAcount;
|
||||
}
|
||||
|
||||
public void setParticipationAcount(String participationAcount) {
|
||||
this.participationAcount = participationAcount;
|
||||
}
|
||||
|
||||
public Integer getLimitAcount() {
|
||||
return limitAcount;
|
||||
}
|
||||
|
||||
public void setLimitAcount(Integer limitAcount) {
|
||||
this.limitAcount = limitAcount;
|
||||
}
|
||||
|
||||
public String getActiveGift() {
|
||||
return activeGift;
|
||||
}
|
||||
|
||||
public void setActiveGift(String activeGift) {
|
||||
this.activeGift = activeGift;
|
||||
}
|
||||
|
||||
public Integer getPoints() {
|
||||
return points;
|
||||
}
|
||||
|
||||
public void setPoints(Integer points) {
|
||||
this.points = points;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,26 @@
|
||||
package com.fuint.business.marketingActivity.activeDiscount.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ActiveConsumptionVO implements Serializable {
|
||||
|
||||
//活动id
|
||||
private Integer activeId;
|
||||
//活动名称
|
||||
private String activeName;
|
||||
//适用会员
|
||||
private String adaptUser;
|
||||
//可用油品
|
||||
private String oilId;
|
||||
//积分
|
||||
private Integer points;
|
||||
//满足金额
|
||||
private double amount;
|
||||
//折扣
|
||||
private String activeGift;
|
||||
//券id
|
||||
private Integer vouchersId;
|
||||
}
|
@ -11,6 +11,7 @@ import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscount
|
||||
import com.fuint.business.marketingActivity.activeDiscount.mapper.ActiveDiscountMapper;
|
||||
import com.fuint.business.marketingActivity.activeDiscount.service.ActiveDiscountChildService;
|
||||
import com.fuint.business.marketingActivity.activeDiscount.service.ActiveDiscountService;
|
||||
import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveConsumptionVO;
|
||||
import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountAppletVO;
|
||||
import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountPayVO;
|
||||
import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountVO;
|
||||
@ -38,11 +39,19 @@ import com.fuint.business.marketingActivity.cardValue.vo.CardValueAppletVO;
|
||||
import com.fuint.business.order.mapper.OilOrderMapper;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilName;
|
||||
import com.fuint.business.petrolStationManagement.service.OilNameService;
|
||||
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.LJUserMapper;
|
||||
import com.fuint.business.userManager.service.LJUserGradeService;
|
||||
import com.fuint.business.userManager.service.LJUserService;
|
||||
import com.fuint.business.userManager.service.UserBalanceService;
|
||||
import com.fuint.business.userManager.vo.LJUserVo;
|
||||
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.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -79,9 +88,15 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
|
||||
@Resource
|
||||
private CardValueService cardValueService;
|
||||
@Resource
|
||||
private ActiveDiscountMapper activeDiscountMapper;
|
||||
@Resource
|
||||
private OilOrderMapper oilOrderMapper;
|
||||
@Resource
|
||||
private LJUserMapper ljUserMapper;
|
||||
@Resource
|
||||
private UserBalanceService userBalanceService;
|
||||
@Resource
|
||||
private ILJStoreService iljStoreService;
|
||||
@Autowired
|
||||
private LJUserService userService;
|
||||
/**
|
||||
* 分页查询所有
|
||||
* @param
|
||||
@ -430,6 +445,63 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
|
||||
}
|
||||
}
|
||||
}
|
||||
//消费有礼
|
||||
List<ActiveConsumptionVO> activeConsumptionVOS = oilOrderMapper.selectActiveConsumption(storeId, paymentActiveDTO.getAmount());
|
||||
//连锁店信息
|
||||
LJUser ljUserVo = userService.selectUserByUserId();
|
||||
Integer storeId1 = paymentActiveDTO.getStoreId();
|
||||
Integer chainStoreId = iljStoreService.selectStoreByStoreId(storeId1).getChainStoreId();
|
||||
//用户余额
|
||||
UserBalance userBalance = userBalanceService.selectUserBalance(TokenUtil.getNowAccountInfo().getId(),chainStoreId);
|
||||
UserBalance userBalance1 = new UserBalance();
|
||||
if (CollectionUtils.isNotEmpty(activeConsumptionVOS)){
|
||||
for (ActiveConsumptionVO activeConsumptionVO : activeConsumptionVOS) {
|
||||
if (activeConsumptionVO.getOilId().contains(paymentActiveDTO.getOilId().toString()) &&
|
||||
activeConsumptionVO.getAdaptUser().contains(paymentActiveDTO.getMtUserLevel().toString())){
|
||||
//如果满足条件/给当前用户加积分
|
||||
//用户 (新用户新建 老用户叠加)
|
||||
if (ObjectUtils.isNotEmpty(userBalance)){
|
||||
//积分
|
||||
if (ObjectUtils.isNotEmpty(userBalance.getPoints()) && ObjectUtils.isNotEmpty(activeConsumptionVO.getPoints())){
|
||||
userBalance.setPoints(userBalance.getPoints() + activeConsumptionVO.getPoints());
|
||||
}
|
||||
userBalanceService.updateUserBalance(userBalance);
|
||||
}else {
|
||||
userBalance1.setMtUserId(TokenUtil.getNowAccountInfo().getId());
|
||||
userBalance1.setChainStoreId(chainStoreId);
|
||||
//积分
|
||||
if (ObjectUtils.isNotEmpty(activeConsumptionVO.getPoints())){
|
||||
userBalance1.setPoints(activeConsumptionVO.getPoints());
|
||||
}
|
||||
userBalanceService.save(userBalance1);
|
||||
}
|
||||
//优惠券
|
||||
if (activeConsumptionVO.getActiveGift().equals("1")){
|
||||
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();
|
||||
cardFavorableRecord.setCardFavorableId(activeConsumptionVO.getVouchersId());
|
||||
cardFavorableRecord.setStoreId(storeId1);
|
||||
cardFavorableRecord.setMtUserId(TokenUtil.getNowAccountInfo().getId());
|
||||
cardFavorableRecord.setName(ljUserVo.getName());
|
||||
cardFavorableRecord.setMobile(ljUserVo.getMobile());
|
||||
cardFavorableRecord.setStatus("0");
|
||||
cardFavorableRecord.setExchangeFrom("充值送券");
|
||||
cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord);
|
||||
//兑换券
|
||||
}else if (activeConsumptionVO.getActiveGift().equals("2")){
|
||||
CardExchangeRecord cardExchangeRecord = new CardExchangeRecord();
|
||||
cardExchangeRecord.setCardExchangeId(activeConsumptionVO.getVouchersId());
|
||||
cardExchangeRecord.setStoreId(storeId1);
|
||||
cardExchangeRecord.setMtUserId(ljUserVo.getId());
|
||||
cardExchangeRecord.setName(ljUserVo.getName());
|
||||
cardExchangeRecord.setMobile(ljUserVo.getMobile());
|
||||
cardExchangeRecord.setPhoto(ljUserVo.getAvatar());
|
||||
cardExchangeRecord.setStatus("0");
|
||||
cardExchangeRecord.setExchangeFrom("充值送券");
|
||||
cardExchangeRecordService.addCardExchangeRecord(cardExchangeRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return paymentActiveVO;
|
||||
}
|
||||
}
|
||||
|
@ -177,10 +177,10 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
|
||||
//订单金额
|
||||
cardValueOrders.setAmount(cardValue.getRechargeBalance());
|
||||
//支付金额
|
||||
//cardValueOrders.setPayAmount(cardValue.getRechargeBalance() - cardValue.getGiftBalance() - cardFavorableValue);
|
||||
cardValueOrders.setPayAmount(cardValue.getRechargeBalance() - cardValue.getGiftBalance() - cardFavorableValue);
|
||||
}
|
||||
//支付金额
|
||||
cardValueOrders.setPayAmount(0.01);
|
||||
//cardValueOrders.setPayAmount(0.01);
|
||||
//优惠券id
|
||||
if (ObjectUtils.isNotEmpty(cardValueRecordDTO.getCardFavorableId())){
|
||||
cardValueOrders.setCardFavorableId(cardValueRecordDTO.getCardFavorableId());
|
||||
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.largeSscreen.vo.OilOrderVO;
|
||||
import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveConsumptionVO;
|
||||
import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountPayVO;
|
||||
import com.fuint.business.order.entity.OilOrder;
|
||||
import com.fuint.business.order.vo.Excel.OilOrderExcel;
|
||||
@ -90,4 +91,12 @@ public interface OilOrderMapper extends BaseMapper<OilOrder> {
|
||||
* @return
|
||||
*/
|
||||
List<ActiveDiscountPayVO> selectActiveFule(@Param("storeId") Integer storeId, @Param("amount")double amount);
|
||||
|
||||
/**
|
||||
* 消费有礼
|
||||
* @param storeId
|
||||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
List<ActiveConsumptionVO> selectActiveConsumption(@Param("storeId") Integer storeId, @Param("amount")double amount);
|
||||
}
|
||||
|
@ -371,4 +371,21 @@
|
||||
and adc.amount <= #{amount}
|
||||
</select>
|
||||
|
||||
<select id="selectActiveConsumption" resultType="com.fuint.business.marketingActivity.activeDiscount.vo.ActiveConsumptionVO">
|
||||
SELECT
|
||||
ac.id activeId,
|
||||
ac.NAME activeName,
|
||||
ac.diesel_user_level adaptUser,
|
||||
ac.adapt_oil oilId,
|
||||
ac.points points,
|
||||
ac.participation_condition_money amount,
|
||||
acc.active_gift activeGift,
|
||||
acc.vouchers_id vouchersId
|
||||
FROM
|
||||
active_consumption ac
|
||||
LEFT JOIN active_consumption_child acc ON ac.id = acc.active_consumption_id
|
||||
where ac.store_id = #{storeId}
|
||||
and ac.participation_condition_money <= #{amount}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user