小程序端推荐有礼
This commit is contained in:
parent
b5696f8dec
commit
cc69c78e3e
@ -59,12 +59,12 @@ public class ActiveNewlywedsRecordsController extends BaseController {
|
||||
@GetMapping("applet")
|
||||
public ResponseObject isJoined(@Param("activeNewlywedsRecords") ActiveNewlywedsRecords activeNewlywedsRecords) {
|
||||
LambdaQueryWrapper<ActiveNewlywedsRecords> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActiveNewlywedsRecords::getInviteeUserId,TokenUtil.getNowAccountInfo().getId());
|
||||
queryWrapper.eq(ActiveNewlywedsRecords::getUserId,TokenUtil.getNowAccountInfo().getId());
|
||||
List<ActiveNewlywedsRecords> list = this.activeNewlywedsRecordsService.list(queryWrapper);
|
||||
if (list.size() == 0){
|
||||
return getSuccessResult("可以参加新人活动");
|
||||
return getSuccessResult("1");
|
||||
}else {
|
||||
return getSuccessResult("不可以参加新人活动");
|
||||
return getSuccessResult("0");
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ public class ActiveNewlywedsRecordsController extends BaseController {
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseObject insert(@RequestBody ActiveNewlywedsRecords activeNewlywedsRecords) {
|
||||
return getSuccessResult(this.activeNewlywedsRecordsService.save(activeNewlywedsRecords));
|
||||
return getSuccessResult(this.activeNewlywedsRecordsService.add(activeNewlywedsRecords));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,13 @@
|
||||
package com.fuint.business.marketingActivity.activeNewlyweds.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
@ -11,8 +17,10 @@ import java.io.Serializable;
|
||||
* @since 2023-12-20 14:12:54
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@Data
|
||||
public class ActiveNewlywedsRecords extends Model<ActiveNewlywedsRecords> {
|
||||
//主键id
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
//活动id
|
||||
private Integer activeNewlywedsId;
|
||||
@ -21,107 +29,16 @@ public class ActiveNewlywedsRecords extends Model<ActiveNewlywedsRecords> {
|
||||
//所属店铺id
|
||||
private Integer storeId;
|
||||
//用户id
|
||||
private String userId;
|
||||
//被邀请人id
|
||||
private String inviteeUserId;
|
||||
private Integer userId;
|
||||
//创建者
|
||||
private String createBy;
|
||||
//创建时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
//更新者
|
||||
private String updateBy;
|
||||
//更新时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getActiveNewlywedsId() {
|
||||
return activeNewlywedsId;
|
||||
}
|
||||
|
||||
public void setActiveNewlywedsId(Integer activeNewlywedsId) {
|
||||
this.activeNewlywedsId = activeNewlywedsId;
|
||||
}
|
||||
|
||||
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 getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getInviteeUserId() {
|
||||
return inviteeUserId;
|
||||
}
|
||||
|
||||
public void setInviteeUserId(String inviteeUserId) {
|
||||
this.inviteeUserId = inviteeUserId;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,5 +11,11 @@ import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlywe
|
||||
*/
|
||||
public interface ActiveNewlywedsRecordsService extends IService<ActiveNewlywedsRecords> {
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
* @param activeNewlywedsRecords
|
||||
* @return
|
||||
*/
|
||||
boolean add(ActiveNewlywedsRecords activeNewlywedsRecords);
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,30 @@
|
||||
package com.fuint.business.marketingActivity.activeNewlyweds.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.marketingActivity.activeNewlyweds.controller.vo.ActiveNewlywedsVO;
|
||||
import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlyweds;
|
||||
import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlywedsChild;
|
||||
import com.fuint.business.marketingActivity.activeNewlyweds.mapper.ActiveNewlywedsRecordsMapper;
|
||||
import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlywedsRecords;
|
||||
import com.fuint.business.marketingActivity.activeNewlyweds.service.ActiveNewlywedsRecordsService;
|
||||
import com.fuint.business.marketingActivity.activeNewlyweds.service.ActiveNewlywedsService;
|
||||
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.mapper.CardFavorableRecordMapper;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
|
||||
import com.fuint.business.userManager.service.LJUserService;
|
||||
import com.fuint.business.userManager.vo.LJUserVo;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import com.sun.xml.bind.v2.TODO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 新人有礼记录表(ActiveNewlywedsRecords)表服务实现类
|
||||
@ -15,5 +35,71 @@ import org.springframework.stereotype.Service;
|
||||
@Service("activeNewlywedsRecordsService")
|
||||
public class ActiveNewlywedsRecordsServiceImpl extends ServiceImpl<ActiveNewlywedsRecordsMapper, ActiveNewlywedsRecords> implements ActiveNewlywedsRecordsService {
|
||||
|
||||
@Resource
|
||||
private ActiveNewlywedsService activeNewlywedsService;
|
||||
@Resource
|
||||
private CardFavorableRecordService cardFavorableRecordService;
|
||||
@Resource
|
||||
private CardExchangeRecordService cardExchangeRecordService;
|
||||
@Resource
|
||||
private LJUserService userService;
|
||||
/**
|
||||
* 新增数据
|
||||
* @param activeNewlywedsRecords
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean add(ActiveNewlywedsRecords activeNewlywedsRecords) {
|
||||
boolean save = false;
|
||||
//用户信息
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer userId = nowAccountInfo.getId();
|
||||
LJUserVo ljUserVo = userService.selectUserById(userId);
|
||||
//保存新人有礼记录
|
||||
ActiveNewlywedsVO activeNewlyweds = activeNewlywedsService.getOneById(1);
|
||||
activeNewlywedsRecords.setActiveNewlywedsId(activeNewlyweds.getId());
|
||||
activeNewlywedsRecords.setChainStoreId(nowAccountInfo.getChainStoreId());
|
||||
activeNewlywedsRecords.setStoreId(nowAccountInfo.getStoreId());
|
||||
activeNewlywedsRecords.setUserId(userId);
|
||||
save = save(activeNewlywedsRecords);
|
||||
//优惠券
|
||||
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();
|
||||
List<ActiveNewlywedsChild> activeNewlywedsChildList = activeNewlyweds.getActiveNewlywedsChildList();
|
||||
if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){
|
||||
for (ActiveNewlywedsChild activeNewlywedsChild : activeNewlywedsChildList) {
|
||||
if (activeNewlywedsChild.getActiveGift().equals("1")){
|
||||
cardFavorableRecord.setCardFavorableId(activeNewlywedsChild.getActiveNewlywedsId());
|
||||
cardFavorableRecord.setChainStorId(nowAccountInfo.getChainStoreId());
|
||||
cardFavorableRecord.setStoreId(nowAccountInfo.getStoreId());
|
||||
cardFavorableRecord.setMtUserId(userId);
|
||||
cardFavorableRecord.setName(ljUserVo.getName());
|
||||
cardFavorableRecord.setMobile(ljUserVo.getMobile());
|
||||
cardFavorableRecord.setName(nowAccountInfo.getRealName());
|
||||
cardFavorableRecord.setExchangeFrom("新人发券");
|
||||
save = cardFavorableRecordService.save(cardFavorableRecord);
|
||||
}else {
|
||||
//兑换券
|
||||
CardExchangeRecord cardExchangeRecord = new CardExchangeRecord();
|
||||
cardExchangeRecord.setCardExchangeId(activeNewlywedsChild.getActiveNewlywedsId());
|
||||
cardExchangeRecord.setChainStorId(nowAccountInfo.getChainStoreId());
|
||||
cardExchangeRecord.setStoreId(nowAccountInfo.getStoreId());
|
||||
cardExchangeRecord.setMtUserId(userId);
|
||||
cardExchangeRecord.setName(ljUserVo.getName());
|
||||
cardExchangeRecord.setMobile(ljUserVo.getMobile());
|
||||
cardExchangeRecord.setExchangeName(activeNewlywedsChild.getGiftCardName());
|
||||
cardExchangeRecord.setExchangeFrom("新人领券");
|
||||
cardExchangeRecord.setGiftName(activeNewlywedsChild.getGiftCardName());
|
||||
cardExchangeRecord.setDescription(activeNewlywedsChild.getGiftCardDetail());
|
||||
save = cardExchangeRecordService.save(cardExchangeRecord);
|
||||
}
|
||||
}
|
||||
//积分
|
||||
//成长值 TODO
|
||||
}
|
||||
//
|
||||
|
||||
return save;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,9 +2,6 @@ package com.fuint.business.marketingActivity.activeRecommend.controller;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.api.ApiController;
|
||||
import com.baomidou.mybatisplus.extension.api.R;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendRecords;
|
||||
import com.fuint.business.marketingActivity.activeRecommend.service.ActiveRecommendRecordsService;
|
||||
@ -33,7 +30,7 @@ public class ActiveRecommendRecordsController extends BaseController {
|
||||
private ActiveRecommendRecordsService activeRecommendRecordsService;
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
* 小程序端查询邀请记录
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param activeRecommendRecords
|
||||
@ -44,7 +41,16 @@ public class ActiveRecommendRecordsController extends BaseController {
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||
@Param("activeRecommendRecords") ActiveRecommendRecords activeRecommendRecords) {
|
||||
Page page = new Page(pageNo, pageSize);
|
||||
return getSuccessResult(this.activeRecommendRecordsService.page(page, new QueryWrapper<>(activeRecommendRecords)));
|
||||
return getSuccessResult(this.activeRecommendRecordsService.select(page, activeRecommendRecords));
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序端查询券总额
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("selectAllAmount")
|
||||
public ResponseObject selectAllAmount() {
|
||||
return getSuccessResult(this.activeRecommendRecordsService.selectAllAmount());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,14 +65,13 @@ public class ActiveRecommendRecordsController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* 新增邀请记录接口
|
||||
* @param activeRecommendRecords 实体对象
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseObject insert(@RequestBody ActiveRecommendRecords activeRecommendRecords) {
|
||||
return getSuccessResult(this.activeRecommendRecordsService.save(activeRecommendRecords));
|
||||
return getSuccessResult(this.activeRecommendRecordsService.add(activeRecommendRecords));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,13 @@
|
||||
package com.fuint.business.marketingActivity.activeRecommend.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
@ -11,8 +17,10 @@ import java.io.Serializable;
|
||||
* @since 2023-12-20 14:13:16
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@Data
|
||||
public class ActiveRecommendRecords extends Model<ActiveRecommendRecords> {
|
||||
//主键id
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
//活动id
|
||||
private Integer activeNewlywedsId;
|
||||
@ -24,13 +32,17 @@ public class ActiveRecommendRecords extends Model<ActiveRecommendRecords> {
|
||||
private String userId;
|
||||
//被邀请人id
|
||||
private String inviteeUserId;
|
||||
//被邀请人姓名
|
||||
private String inviteeUserName;
|
||||
//创建者
|
||||
private String createBy;
|
||||
//创建时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd ")
|
||||
private Date createTime;
|
||||
//更新者
|
||||
private String updateBy;
|
||||
//更新时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
|
@ -1,5 +1,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.entity.ActiveRecommendRecords;
|
||||
|
||||
@ -11,5 +13,25 @@ import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecomme
|
||||
*/
|
||||
public interface ActiveRecommendRecordsService extends IService<ActiveRecommendRecords> {
|
||||
|
||||
/**
|
||||
* 小程序端查询邀请记录
|
||||
* @param page
|
||||
* @param activeRecommendRecords
|
||||
* @return
|
||||
*/
|
||||
IPage select(Page page, ActiveRecommendRecords activeRecommendRecords);
|
||||
|
||||
/**
|
||||
* 小程序端查询券总额
|
||||
* @return
|
||||
*/
|
||||
double selectAllAmount();
|
||||
|
||||
/**
|
||||
* 新增邀请记录接口
|
||||
* @param activeRecommendRecords
|
||||
* @return
|
||||
*/
|
||||
boolean add(ActiveRecommendRecords activeRecommendRecords);
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,27 @@
|
||||
package com.fuint.business.marketingActivity.activeRecommend.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.activeRecommend.entity.ActiveRecommendChild;
|
||||
import com.fuint.business.marketingActivity.activeRecommend.mapper.ActiveRecommendRecordsMapper;
|
||||
import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendRecords;
|
||||
import com.fuint.business.marketingActivity.activeRecommend.service.ActiveRecommendRecordsService;
|
||||
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.cardFavorable.service.CardFavorableService;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 邀请有礼记录表(ActiveRecommendRecords)表服务实现类
|
||||
*
|
||||
@ -15,5 +31,108 @@ import org.springframework.stereotype.Service;
|
||||
@Service("activeRecommendRecordsService")
|
||||
public class ActiveRecommendRecordsServiceImpl extends ServiceImpl<ActiveRecommendRecordsMapper, ActiveRecommendRecords> implements ActiveRecommendRecordsService {
|
||||
|
||||
@Resource
|
||||
private ActiveRecommendService activeRecommendService;
|
||||
@Resource
|
||||
private CardFavorableService cardFavorableService;
|
||||
/**
|
||||
* 小程序端查询邀请记录
|
||||
* @param page
|
||||
* @param activeRecommendRecords
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage select(Page page, ActiveRecommendRecords activeRecommendRecords) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer userId = nowAccountInfo.getId();
|
||||
Integer storeId = nowAccountInfo.getStoreId();
|
||||
LambdaQueryWrapper<ActiveRecommendRecords> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActiveRecommendRecords::getUserId,userId);
|
||||
queryWrapper.eq(ActiveRecommendRecords::getStoreId,storeId);
|
||||
/*IPage page1 = page(page, queryWrapper);
|
||||
List<ActiveRecommendRecords> records = page1.getRecords();
|
||||
List<ActiveRecommendRecordsVO> collect = records.stream().map(s -> {
|
||||
ActiveRecommendRecordsVO activeRecommendRecordsVO = new ActiveRecommendRecordsVO();
|
||||
|
||||
s.getActiveNewlywedsId()
|
||||
BeanUtils.copyProperties(s, activeRecommendRecordsVO);
|
||||
return activeRecommendRecordsVO;
|
||||
}).collect(Collectors.toList());
|
||||
page1.setRecords(collect);*/
|
||||
/*//券总额
|
||||
double discountAmount = 0.0;
|
||||
//推荐有礼活动
|
||||
ActiveRecommendVO activeRecommendVO = activeRecommendService.getOneById(1);
|
||||
//活动所送推荐人的优惠券
|
||||
List<ActiveRecommendChild> activeRecommendChildList = activeRecommendVO.getActiveRecommendChildList();
|
||||
if(CollectionUtils.isNotEmpty(activeRecommendChildList)){
|
||||
for (ActiveRecommendChild activeRecommendChild : activeRecommendChildList) {
|
||||
if (activeRecommendChild.getActiveGift().equals("0")){
|
||||
//券数量
|
||||
Integer giftCardTotal = activeRecommendChild.getGiftCardTotal();
|
||||
//券id
|
||||
Integer vouchersId = activeRecommendChild.getVouchersId();
|
||||
//券总额
|
||||
discountAmount += (cardFavorableService.getById(vouchersId).getDiscountAmount() * giftCardTotal);
|
||||
}
|
||||
}
|
||||
}
|
||||
IPage page1 = page(page, queryWrapper);
|
||||
List<ActiveRecommendRecords> records = page1.getRecords();*/
|
||||
return page(page, queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double selectAllAmount() {
|
||||
//券总额
|
||||
double discountAmount = 0.0;
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer userId = nowAccountInfo.getId();
|
||||
Integer storeId = nowAccountInfo.getStoreId();
|
||||
LambdaQueryWrapper<ActiveRecommendRecords> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActiveRecommendRecords::getUserId,userId);
|
||||
queryWrapper.eq(ActiveRecommendRecords::getStoreId,storeId);
|
||||
List<ActiveRecommendRecords> list = list(queryWrapper);
|
||||
if (CollectionUtils.isNotEmpty(list)){
|
||||
//邀请人数
|
||||
int size = list.size();
|
||||
//推荐有礼活动
|
||||
ActiveRecommendVO activeRecommendVO = activeRecommendService.getOneById(1);
|
||||
//活动所送推荐人的优惠券
|
||||
List<ActiveRecommendChild> activeRecommendChildList = activeRecommendVO.getActiveRecommendChildList();
|
||||
if(CollectionUtils.isNotEmpty(activeRecommendChildList)){
|
||||
for (ActiveRecommendChild activeRecommendChild : activeRecommendChildList) {
|
||||
if (activeRecommendChild.getActiveGift().equals("1")){
|
||||
//券数量
|
||||
Integer giftCardTotal = activeRecommendChild.getGiftCardTotal();
|
||||
//券id
|
||||
Integer vouchersId = activeRecommendChild.getVouchersId();
|
||||
//券总额
|
||||
discountAmount += (cardFavorableService.getById(vouchersId).getDiscountAmount() * giftCardTotal * size);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return discountAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增邀请记录接口
|
||||
* @param activeRecommendRecords
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,9 +197,13 @@ public class ActiveRecommendServiceImpl extends ServiceImpl<ActiveRecommendMappe
|
||||
//活动时间
|
||||
activeRecommendAppletVO.setTime("永久有效");
|
||||
//积分
|
||||
activeRecommendAppletVO.setPoint(activeRecommendVO.getPoints().toString());
|
||||
if (ObjectUtils.isNotEmpty(activeRecommendVO.getPoints())){
|
||||
activeRecommendAppletVO.setPoint(activeRecommendVO.getPoints().toString());
|
||||
}
|
||||
//成长值
|
||||
activeRecommendAppletVO.setGrowValue(activeRecommendVO.getGrowthValue().toString());
|
||||
if (ObjectUtils.isNotEmpty(activeRecommendVO.getGrowthValue())){
|
||||
activeRecommendAppletVO.setGrowValue(activeRecommendVO.getGrowthValue().toString());
|
||||
}
|
||||
activeRecommendAppletVO.setRecommendActiveDescribeIn("欢迎各位亲朋好友来参加本店的推荐有礼活动,对于邀请人,参加即送:优惠券:"+cardi1+"兑换券:"+cardo1);
|
||||
//被邀请人的券
|
||||
activeRecommendAppletVO.setRecommendActiveDescribeOut("对于被邀请人,参加即送:优惠券:"+cardi2);
|
||||
|
@ -0,0 +1,11 @@
|
||||
package com.fuint.business.marketingActivity.activeRecommend.vo;
|
||||
|
||||
import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommend;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@Data
|
||||
public class ActiveRecommendRecordsVO extends ActiveRecommend implements Serializable {
|
||||
//优惠券总额
|
||||
private Integer allAmout;
|
||||
}
|
@ -90,12 +90,26 @@ public class CardFavorableController extends BaseController {
|
||||
return getSuccessResult(this.cardFavorableService.removeByIds(idList));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*查询优惠券接口(小程序端)
|
||||
*查询本店优惠券接口(小程序端)
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param cardFavorable
|
||||
* @param cardFavorableDTO
|
||||
* @return
|
||||
@GetMapping("OwnApplet")
|
||||
public ResponseObject selectAllOwnStore(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||
@Param("cardFuelDiesel") CardFavorableDTO cardFavorableDTO) {
|
||||
Page page = new Page(pageNo, pageSize);
|
||||
return getSuccessResult(this.cardFavorableService.selectAllOwnStore(page,cardFavorableDTO));
|
||||
}*/
|
||||
|
||||
|
||||
/**
|
||||
*查询我的优惠券接口(小程序端)
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param cardFavorableDTOS
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("applet")
|
||||
|
@ -83,6 +83,26 @@ public class CardFavorableRecordController extends BaseController {
|
||||
return getSuccessResult(this.cardFavorableRecordService.save(cardFavorableRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序端优惠券领取接口
|
||||
*
|
||||
* @param idList 优惠券ids
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping("drawDown")
|
||||
public ResponseObject drawDown(@RequestParam("idList") List<Integer> idList) {
|
||||
return getSuccessResult(this.cardFavorableRecordService.drawDown(idList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序端判断是否领取优惠券
|
||||
* @return 新增结果
|
||||
*/
|
||||
@GetMapping("isDrawDown")
|
||||
public ResponseObject isDrawDown() {
|
||||
return getSuccessResult(this.cardFavorableRecordService.isDrawDown());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
|
@ -7,6 +7,7 @@ import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRe
|
||||
import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableRecordVO;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -34,5 +35,17 @@ public interface CardFavorableRecordService extends IService<CardFavorableRecord
|
||||
*/
|
||||
Map<String,Integer> selectCount(CardFavorableRecord cardFavorableRecord);
|
||||
|
||||
/**
|
||||
* 小程序端优惠券领取接口
|
||||
* @param idList
|
||||
* @return
|
||||
*/
|
||||
boolean drawDown(List<Integer> idList);
|
||||
|
||||
/**
|
||||
* 小程序端判断是否领取优惠券
|
||||
* @return
|
||||
*/
|
||||
boolean isDrawDown();
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package com.fuint.business.marketingActivity.cardFavorable.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.cardFavorable.entity.CardFavorable;
|
||||
@ -9,6 +10,9 @@ import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableRe
|
||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableRecordVO;
|
||||
import com.fuint.business.userManager.service.LJUserService;
|
||||
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.stereotype.Service;
|
||||
@ -30,6 +34,8 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
|
||||
|
||||
@Resource
|
||||
private CardFavorableRecordMapper cardFavorableRecordMapper;
|
||||
@Resource
|
||||
private LJUserService userService;
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
* @param page
|
||||
@ -73,12 +79,9 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
|
||||
return cardFavorableRecordMapper.getCardFavorableList(page,cardFavorableRecord);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 统计优惠券使用数量
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* 统计优惠券使用数量
|
||||
* @param cardFavorableRecord
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@ -86,5 +89,52 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
|
||||
Integer storeId = TokenUtil.getNowAccountInfo().getStoreId();
|
||||
return cardFavorableRecordMapper.selectTotal(storeId,cardFavorableRecord.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序端优惠券领取接口
|
||||
* @param idList
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean drawDown(List<Integer> idList) {
|
||||
boolean save = false;
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer userId = nowAccountInfo.getId();
|
||||
LJUserVo ljUserVo = userService.selectUserById(userId);
|
||||
//优惠券
|
||||
for (Integer id : idList) {
|
||||
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();
|
||||
cardFavorableRecord.setCardFavorableId(id);
|
||||
cardFavorableRecord.setChainStorId(nowAccountInfo.getChainStoreId());
|
||||
cardFavorableRecord.setStoreId(nowAccountInfo.getStoreId());
|
||||
cardFavorableRecord.setMtUserId(userId);
|
||||
cardFavorableRecord.setName(ljUserVo.getName());
|
||||
cardFavorableRecord.setMobile(ljUserVo.getMobile());
|
||||
cardFavorableRecord.setName(nowAccountInfo.getRealName());
|
||||
cardFavorableRecord.setExchangeFrom("店铺发券");
|
||||
save = save(cardFavorableRecord);
|
||||
}
|
||||
return save;
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序端判断是否领取优惠券
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean isDrawDown() {
|
||||
boolean isDrawDown = false;
|
||||
//登录用户信息
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
LambdaQueryWrapper<CardFavorableRecord> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CardFavorableRecord::getMtUserId,nowAccountInfo.getId());
|
||||
queryWrapper.eq(CardFavorableRecord::getStoreId,nowAccountInfo.getStoreId());
|
||||
//如果领过券 就不让领了
|
||||
List<CardFavorableRecord> list = list(queryWrapper);
|
||||
if (CollectionUtils.isNotEmpty(list) && list.size() == 0){
|
||||
isDrawDown = true;
|
||||
}
|
||||
return isDrawDown;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@
|
||||
<image src="../../static/imgs/zzxryl.png"
|
||||
style="width: 280px; height: 350px; margin: 20px auto; margin-top: 200px; ">
|
||||
</image>
|
||||
<view class="anniuprp" @click="onOverlay()">
|
||||
<view class="anniuprp" @click="drawDown()">
|
||||
<text>立即领取</text>
|
||||
</view>
|
||||
</u-overlay>
|
||||
@ -122,9 +122,10 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
joinmsg: '',
|
||||
msg: "1",
|
||||
show: false,
|
||||
shows: true,
|
||||
shows: '',
|
||||
title: '',
|
||||
oilTypeList: '',
|
||||
columns: [
|
||||
@ -184,12 +185,66 @@
|
||||
this.getOilType();
|
||||
},
|
||||
onShow() {
|
||||
this.isJoined()
|
||||
// this.isExistStoreId();
|
||||
},
|
||||
components: {
|
||||
tabbar
|
||||
},
|
||||
methods: {
|
||||
//判断是否是新人
|
||||
isJoined() {
|
||||
request({
|
||||
url: 'business/marketingActivity/activeNewlywedsRecords/applet',
|
||||
method: 'get',
|
||||
}).then(res => {
|
||||
console.log("11111" + res)
|
||||
if (res.code == 200 && res.data == 1) {
|
||||
this.shows = true
|
||||
} else {
|
||||
this.shows = false
|
||||
}
|
||||
})
|
||||
},
|
||||
//立即领取
|
||||
drawDown() {
|
||||
/* this.shows = false */
|
||||
request({
|
||||
url: 'business/marketingActivity/activeNewlywedsRecords',
|
||||
method: 'post',
|
||||
data: {
|
||||
|
||||
}
|
||||
}).then(res => {
|
||||
console.log("11111" + res)
|
||||
if (res.code == 200 && res.data == true) {
|
||||
this.shows = false
|
||||
uni.showToast({
|
||||
title: '领取成功!'
|
||||
})
|
||||
} else {
|
||||
this.shows = false
|
||||
uni.showToast({
|
||||
title: '领取失败!'
|
||||
})
|
||||
}
|
||||
|
||||
/* if (res.code == 200 && res.data == 1) {
|
||||
this.shows = true
|
||||
} else {
|
||||
this.shows = false
|
||||
} */
|
||||
})
|
||||
},
|
||||
//查询新人有礼礼品
|
||||
selectActiveNewlyweds() {
|
||||
request({
|
||||
url: 'business/marketingActivity/activeNewlyweds/applet',
|
||||
method: 'get',
|
||||
}).then(res => {
|
||||
console.log("11111" + res)
|
||||
})
|
||||
},
|
||||
isExistStoreId() {
|
||||
if (uni.getStorageSync("storeId") != "") {
|
||||
this.getStore(uni.getStorageSync("storeId"));
|
||||
@ -243,7 +298,8 @@
|
||||
_this.welfare.push(response.data.welfare)
|
||||
}
|
||||
}
|
||||
if (response.data.doorstepPhoto != undefined && response.data.doorstepPhoto != null && response.data.doorstepPhoto != ""){
|
||||
if (response.data.doorstepPhoto != undefined && response.data
|
||||
.doorstepPhoto != null && response.data.doorstepPhoto != "") {
|
||||
let list = JSON.parse(response.data.doorstepPhoto)
|
||||
_this.list3 = [];
|
||||
list.forEach(item => {
|
||||
@ -275,14 +331,18 @@
|
||||
"lat": res.latitude
|
||||
},
|
||||
}).then((response) => {
|
||||
_this.distance = (Math.ceil(response.data.distance)).toFixed(1)
|
||||
_this.distance = (Math.ceil(response.data.distance))
|
||||
.toFixed(1)
|
||||
_this.store = response.data.store
|
||||
uni.setStorageSync("storeId", response.data.store.id)
|
||||
uni.setStorageSync("chainStoreId", response.data.store.chainStoreId)
|
||||
uni.setStorageSync("chainStoreId", response.data.store
|
||||
.chainStoreId)
|
||||
let welfare = response.data.store.welfare
|
||||
if (welfare != undefined && welfare != null && welfare != "") {
|
||||
if (welfare != undefined && welfare != null &&
|
||||
welfare != "") {
|
||||
if (welfare.includes(",")) {
|
||||
_this.welfare = response.data.store.welfare.split(",")
|
||||
_this.welfare = response.data.store.welfare
|
||||
.split(",")
|
||||
} else {
|
||||
_this.welfare.push(response.data.store.welfare)
|
||||
}
|
||||
@ -349,12 +409,13 @@
|
||||
cancel() {
|
||||
this.show = false
|
||||
},
|
||||
onOverlay() {
|
||||
/* onOverlay() {
|
||||
this.drawDown();
|
||||
this.shows = false
|
||||
uni.showToast({
|
||||
title: '领取成功'
|
||||
})
|
||||
},
|
||||
}, */
|
||||
goActivity() {
|
||||
// 去活动页
|
||||
uni.navigateTo({
|
||||
@ -674,4 +735,4 @@
|
||||
color: white;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
</style>
|
@ -266,9 +266,10 @@
|
||||
// console.log(res,111222)
|
||||
if (res.code == 200) {
|
||||
this.cardBalance = res.data.cardBalance,
|
||||
if (res.data.refuelMoney!=null && res.data.refuelMoney!=""){
|
||||
/* if (res.data.refuelMoney!=null && res.data.refuelMoney!=""){
|
||||
this.refuelMoney = JSON.parse(res.data.refuelMoney);
|
||||
} */
|
||||
this.refuelMoney = JSON.parse(res.data.refuelMoney);
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -293,7 +294,7 @@
|
||||
chainStoreId: this.chainStoreId
|
||||
}
|
||||
}).then((res) => {
|
||||
if (res.code == 200 && res.data!=null) {
|
||||
if (res.code == 200 && res.data != null) {
|
||||
this.myPoints = res.data.points
|
||||
}
|
||||
})
|
||||
|
@ -158,7 +158,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="anniu">
|
||||
<view class="anniu" @click="goTopup()">
|
||||
去参与
|
||||
</view>
|
||||
<!-- <view class="g-box" v-for="(item,index) in datas" :key="index" v-if="title == '消费有礼活动'">
|
||||
@ -205,6 +205,11 @@
|
||||
this.getData(option.name);
|
||||
},
|
||||
methods: {
|
||||
goTopup() {
|
||||
uni.navigateTo({
|
||||
url: '/pagesHome/oilRecharge/oilRecharge'
|
||||
})
|
||||
},
|
||||
getData(name) {
|
||||
uni.showLoading({
|
||||
//title: '加载中'
|
||||
@ -416,4 +421,4 @@
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
</style>
|
||||
</style>
|
@ -35,17 +35,17 @@
|
||||
<u-overlay :show="shows">
|
||||
|
||||
<view class="boxck">
|
||||
<view class="coupbox" v-for="(item,index) in 3" :key="index">
|
||||
<view class="left_coup">¥188</view>
|
||||
<view class="coupbox" v-for="(item,index) in cardFavorableList" :key="index">
|
||||
<view class="left_coup">¥{{item.discountAmount}}</view>
|
||||
<view class="right_liu">
|
||||
<view class="">
|
||||
<view class="c_name">优惠券名称</view>
|
||||
<view class="c_time">有效期:2023/12/03</view>
|
||||
<view class="c_name">{{item.name}}</view>
|
||||
<view class="c_time">2023/12/03</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="_anniuprp" @click="onCoupons()">立即领取</view>
|
||||
<view class="_anniuprp" @click="drawDownCardFavorables()">立即领取</view>
|
||||
</view>
|
||||
|
||||
</u-overlay>
|
||||
@ -60,6 +60,8 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
idList: [18, 19],
|
||||
cardFavorableList: [],
|
||||
cardsList: [],
|
||||
shows: true,
|
||||
query: {
|
||||
@ -99,9 +101,59 @@
|
||||
|
||||
},
|
||||
onShow() {
|
||||
this.getGiftRecords()
|
||||
this.getGiftRecords();
|
||||
this.getAllCardFavorables();
|
||||
this.isDrawDown();
|
||||
},
|
||||
methods: {
|
||||
getAllCardFavorables() {
|
||||
request({
|
||||
url: 'business/marketingActivity/cardFavorable',
|
||||
method: 'get',
|
||||
params: this.query
|
||||
}).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.cardFavorableList = res.data.records;
|
||||
console.log("555" + this.cardFavorableList)
|
||||
/* this.cardFavorableList.forEach(item => this.idList.push(item.id));
|
||||
console.log("333" + idList) */
|
||||
}
|
||||
})
|
||||
},
|
||||
drawDownCardFavorables() {
|
||||
request({
|
||||
url: 'business/marketingActivity/cardFavorableRecord/drawDown',
|
||||
method: 'post',
|
||||
/* data: {
|
||||
idList: [18, 19]
|
||||
} */
|
||||
}).then(res => {
|
||||
console.log("222" + res)
|
||||
if (res.code == 200 && res.data == true) {
|
||||
this.shows = false
|
||||
uni.showToast({
|
||||
title: '领取成功!'
|
||||
})
|
||||
} else {
|
||||
this.shows = false
|
||||
uni.showToast({
|
||||
title: '领取失败!'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
isDrawDown() {
|
||||
request({
|
||||
url: 'business/marketingActivity/cardFavorableRecord/isDrawDown',
|
||||
method: 'get',
|
||||
}).then(res => {
|
||||
if (res.code == 200 && res.data == true) {
|
||||
this.shows = true
|
||||
} else {
|
||||
this.shows = false
|
||||
}
|
||||
})
|
||||
},
|
||||
goRecharge() {
|
||||
uni.navigateTo({
|
||||
url: '/pagesHome/oilRecharge/oilRecharge'
|
||||
@ -130,12 +182,12 @@
|
||||
|
||||
|
||||
},
|
||||
onCoupons() {
|
||||
/* onCoupons() {
|
||||
this.shows = false
|
||||
uni.showToast({
|
||||
title: '领取成功'
|
||||
})
|
||||
},
|
||||
}, */
|
||||
goback() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
@ -362,4 +414,4 @@
|
||||
font-weight: bold;
|
||||
color: #7D592C;
|
||||
}
|
||||
</style>
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user