礼品卡兑换记录
This commit is contained in:
parent
ce0c69be7a
commit
116141d547
@ -43,6 +43,21 @@ public class CardGiftController extends BaseController {
|
|||||||
return getSuccessResult(this.cardGiftService.select(page, cardGift));
|
return getSuccessResult(this.cardGiftService.select(page, cardGift));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询礼品卡兑换记录
|
||||||
|
* @param pageNo
|
||||||
|
* @param pageSize
|
||||||
|
* @param cardGift
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectAllRecords")
|
||||||
|
public ResponseObject selectAllRecords(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
|
||||||
|
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||||
|
@Param("cardGift") CardGift cardGift) {
|
||||||
|
Page page = new Page(pageNo, pageSize);
|
||||||
|
return getSuccessResult(this.cardGiftService.selectAllRecords(page, cardGift));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过主键查询单条数据
|
* 通过主键查询单条数据
|
||||||
*
|
*
|
||||||
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -15,6 +16,7 @@ import java.util.Date;
|
|||||||
* @since 2023-10-31 13:55:29
|
* @since 2023-10-31 13:55:29
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
|
@Data
|
||||||
public class CardGift extends Model<CardGift> {
|
public class CardGift extends Model<CardGift> {
|
||||||
//主键id
|
//主键id
|
||||||
@TableId(type = IdType.AUTO)
|
@TableId(type = IdType.AUTO)
|
||||||
@ -27,6 +29,8 @@ public class CardGift extends Model<CardGift> {
|
|||||||
private String cardPassword;
|
private String cardPassword;
|
||||||
//所属连锁店id
|
//所属连锁店id
|
||||||
private Integer chainStorId;
|
private Integer chainStorId;
|
||||||
|
//用户id
|
||||||
|
private Integer userId;
|
||||||
//所属店铺id
|
//所属店铺id
|
||||||
private Integer storeId;
|
private Integer storeId;
|
||||||
//礼品卡状态 1:在用 2:挂失 3:停用
|
//礼品卡状态 1:在用 2:挂失 3:停用
|
||||||
@ -47,148 +51,9 @@ public class CardGift extends Model<CardGift> {
|
|||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
//更新者
|
//更新者
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private String updateBy;
|
private String updateBy;
|
||||||
//更新时间
|
//更新时间
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBatchNumber() {
|
|
||||||
return batchNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBatchNumber(String batchNumber) {
|
|
||||||
this.batchNumber = batchNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNumber() {
|
|
||||||
return number;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNumber(String number) {
|
|
||||||
this.number = number;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCardPassword() {
|
|
||||||
return cardPassword;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCardPassword(String cardPassword) {
|
|
||||||
this.cardPassword = cardPassword;
|
|
||||||
}
|
|
||||||
|
|
||||||
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 getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(String status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getActivateStatus() {
|
|
||||||
return activateStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setActivateStatus(String activateStatus) {
|
|
||||||
this.activateStatus = activateStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getExchangeStatus() {
|
|
||||||
return exchangeStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setExchangeStatus(String exchangeStatus) {
|
|
||||||
this.exchangeStatus = exchangeStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getQuantity() {
|
|
||||||
return quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQuantity(Integer quantity) {
|
|
||||||
this.quantity = quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getCardAmount() {
|
|
||||||
return cardAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCardAmount(Double cardAmount) {
|
|
||||||
this.cardAmount = cardAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRemark() {
|
|
||||||
return remark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRemark(String remark) {
|
|
||||||
this.remark = remark;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,5 +44,13 @@ public interface CardGiftService extends IService<CardGift> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
CardGift exchange(CardGift cardGift);
|
CardGift exchange(CardGift cardGift);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询礼品卡兑换记录
|
||||||
|
* @param page
|
||||||
|
* @param cardGift
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IPage selectAllRecords(Page page, CardGift cardGift);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.fuint.business.marketingActivity.cardGift.service.impl;
|
package com.fuint.business.marketingActivity.cardGift.service.impl;
|
||||||
|
|
||||||
|
import com.alipay.api.domain.LoginUserDTO;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@ -13,14 +14,12 @@ import com.fuint.business.store.service.StoreService;
|
|||||||
import com.fuint.common.util.TokenUtil;
|
import com.fuint.common.util.TokenUtil;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 礼品卡(CardGift)表服务实现类
|
* 礼品卡(CardGift)表服务实现类
|
||||||
@ -139,18 +138,37 @@ public class CardGiftServiceImpl extends ServiceImpl<CardGiftMapper, CardGift> i
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public CardGift exchange(CardGift cardGift) {
|
public CardGift exchange(CardGift cardGift) {
|
||||||
|
//登录用户id
|
||||||
|
Integer userId = TokenUtil.getNowAccountInfo().getId();
|
||||||
LambdaQueryWrapper<CardGift> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CardGift> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(CardGift::getNumber,cardGift.getNumber());
|
queryWrapper.eq(CardGift::getNumber,cardGift.getNumber());
|
||||||
queryWrapper.eq(CardGift::getStatus,"1");
|
queryWrapper.eq(CardGift::getStatus,"1");
|
||||||
|
queryWrapper.eq(CardGift::getActivateStatus,"0");
|
||||||
//验证兑换卡的卡密
|
//验证兑换卡的卡密
|
||||||
CardGift one = getOne(queryWrapper);
|
CardGift one = getOne(queryWrapper);
|
||||||
if (ObjectUtils.isNotEmpty(one) && ObjectUtils.isNotEmpty(cardGift.getCardPassword()) && cardGift.getCardPassword().equals(one.getCardPassword())){
|
if (ObjectUtils.isNotEmpty(one) && ObjectUtils.isNotEmpty(cardGift.getCardPassword()) && cardGift.getCardPassword().equals(one.getCardPassword())){
|
||||||
one.setStatus("2");
|
one.setActivateStatus("1");
|
||||||
|
one.setUserId(userId);
|
||||||
updateById(one);
|
updateById(one);
|
||||||
return one;
|
return one;
|
||||||
}else {
|
}else {
|
||||||
return cardGift;
|
return cardGift;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询礼品卡兑换记录
|
||||||
|
* @param page
|
||||||
|
* @param cardGift
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IPage selectAllRecords(Page page, CardGift cardGift) {
|
||||||
|
//登录用户id
|
||||||
|
Integer userId = TokenUtil.getNowAccountInfo().getId();
|
||||||
|
LambdaQueryWrapper<CardGift> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(CardGift::getUserId,userId);
|
||||||
|
return page(page,queryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,18 +111,18 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 礼品充值 -->
|
<!-- 礼品兑换 -->
|
||||||
<view class="boxback" style="box-sizing: border-box; padding: 1px; " v-if="actinput == 2 ">
|
<view class="boxback" style="box-sizing: border-box; padding: 1px; " v-if="actinput == 2 ">
|
||||||
<view class="inputbox">
|
<view class="inputbox">
|
||||||
<view class="cadname">卡号</view>
|
<view class="cadname">卡号</view>
|
||||||
<input type="text" placeholder="请输入礼品卡卡号" />
|
<input type="text" v-model="number" placeholder="请输入礼品卡卡号" />
|
||||||
</view>
|
</view>
|
||||||
<view class="inputbox">
|
<view class="inputbox">
|
||||||
<view class="cadname">卡密</view>
|
<view class="cadname" >卡密</view>
|
||||||
<input type="text" placeholder="请输入礼品卡卡密" />
|
<input type="text" v-model="cardPassword" placeholder="请输入礼品卡卡密" />
|
||||||
</view>
|
</view>
|
||||||
<view class="bottom-box">
|
<view class="bottom-box" >
|
||||||
<view class="anniu">
|
<view class="anniu" @click="exchangeGift()">
|
||||||
<text>立即兑换</text>
|
<text>立即兑换</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="dibu">
|
<view class="dibu">
|
||||||
@ -137,25 +137,9 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 底部 -->
|
|
||||||
<!-- <view class="bottom-box">
|
|
||||||
<view class="anniu">
|
|
||||||
<text>立即充值</text>
|
|
||||||
</view>
|
|
||||||
<view class="dibu">
|
|
||||||
<view class="">充值记录</view>
|
|
||||||
<uni-icons type="right" color="#1678ff" size="14"></uni-icons>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="box-hui">
|
|
||||||
<view style="margin-bottom: 15px;">服务说明</view>
|
|
||||||
<view class="huisize">1.该服务为储蓄卡直充服务,仅限本站使用</view>
|
|
||||||
<view class="huisize">2.请确认充值类型正确后再付款,一经充值不支持退款; </view>
|
|
||||||
</view>
|
|
||||||
</view>-->
|
|
||||||
|
|
||||||
<u-picker :show="show" :columns="columns" @confirm="confirm" @cancel="cancel"></u-picker>
|
<u-picker :show="show" :columns="columns" @confirm="confirm" @cancel="cancel"></u-picker>
|
||||||
|
<u-modal :show="shows" :title="message" :content='money' @confirm="confirms()" ></u-modal>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -166,6 +150,11 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
shows:false,
|
||||||
|
money:'',
|
||||||
|
message:'',
|
||||||
|
number:'',
|
||||||
|
cardPassword:'',
|
||||||
title: '',
|
title: '',
|
||||||
actindex: 0,
|
actindex: 0,
|
||||||
actInput: 0,
|
actInput: 0,
|
||||||
@ -211,6 +200,9 @@
|
|||||||
//this.getFuelCars();
|
//this.getFuelCars();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
confirms(){
|
||||||
|
this.shows = false
|
||||||
|
},
|
||||||
confirm(e) {
|
confirm(e) {
|
||||||
this.show = false
|
this.show = false
|
||||||
},
|
},
|
||||||
@ -297,7 +289,33 @@
|
|||||||
.cardFuleList[0].incomeLitres)
|
.cardFuleList[0].incomeLitres)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
//礼品卡兑换
|
||||||
|
exchangeGift(){
|
||||||
|
request({
|
||||||
|
url:'/business/marketingActivity/cardGift/exchange?number='+this.number+"&cardPassword="+this.cardPassword,
|
||||||
|
method:'get',
|
||||||
|
}).then(res=>{
|
||||||
|
if (res.data.id == '' || res.data.id == null){
|
||||||
|
this.shows = true
|
||||||
|
this.message = '兑换失败!',
|
||||||
|
this.money = ''
|
||||||
|
}else {
|
||||||
|
this.shows = true
|
||||||
|
this.message = '兑换成功!',
|
||||||
|
this.money = res.data.cardAmount+'元'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//礼品卡兑换记录
|
||||||
|
getGiftRecords(){
|
||||||
|
request({
|
||||||
|
url:'/business/marketingActivity/cardGift/selectAllRecords',
|
||||||
|
method:'get',
|
||||||
|
}).then(res=>{
|
||||||
|
console.log(res)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user