小程序端新人有礼活动

This commit is contained in:
齐天大圣 2023-12-20 14:30:37 +08:00
parent f76021b177
commit 89010cb79d
12 changed files with 607 additions and 4 deletions

View File

@ -0,0 +1,115 @@
package com.fuint.business.marketingActivity.activeNewlyweds.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.activeNewlyweds.entity.ActiveNewlyweds;
import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlywedsRecords;
import com.fuint.business.marketingActivity.activeNewlyweds.service.ActiveNewlywedsRecordsService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;
/**
* 新人有礼记录表(ActiveNewlywedsRecords)表控制层
*
* @author makejava
* @since 2023-12-20 14:12:53
*/
@RestController
@RequestMapping("business/marketingActivity/activeNewlywedsRecords")
public class ActiveNewlywedsRecordsController extends BaseController {
/**
* 服务对象
*/
@Resource
private ActiveNewlywedsRecordsService activeNewlywedsRecordsService;
/**
* 分页查询所有数据
* @param pageNo
* @param pageSize
* @param activeNewlywedsRecords
* @return
*/
@GetMapping
public ResponseObject selectAll(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("activeNewlywedsRecords") ActiveNewlywedsRecords activeNewlywedsRecords) {
Page page = new Page(pageNo, pageSize);
return getSuccessResult(this.activeNewlywedsRecordsService.page(page, new QueryWrapper<>(activeNewlywedsRecords)));
}
/**
* 判断是否已经参加过新人有礼活动接口
* @param activeNewlywedsRecords
* @return
*/
@GetMapping("applet")
public ResponseObject isJoined(@Param("activeNewlywedsRecords") ActiveNewlywedsRecords activeNewlywedsRecords) {
LambdaQueryWrapper<ActiveNewlywedsRecords> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ActiveNewlywedsRecords::getInviteeUserId,TokenUtil.getNowAccountInfo().getId());
List<ActiveNewlywedsRecords> list = this.activeNewlywedsRecordsService.list(queryWrapper);
if (list.size() == 0){
return getSuccessResult("可以参加新人活动");
}else {
return getSuccessResult("不可以参加新人活动");
}
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("{id}")
public ResponseObject selectOne(@PathVariable Serializable id) {
return getSuccessResult(this.activeNewlywedsRecordsService.getById(id));
}
/**
* 新增数据
*
* @param activeNewlywedsRecords 实体对象
* @return 新增结果
*/
@PostMapping
public ResponseObject insert(@RequestBody ActiveNewlywedsRecords activeNewlywedsRecords) {
return getSuccessResult(this.activeNewlywedsRecordsService.save(activeNewlywedsRecords));
}
/**
* 修改数据
*
* @param activeNewlywedsRecords 实体对象
* @return 修改结果
*/
@PutMapping
public ResponseObject update(@RequestBody ActiveNewlywedsRecords activeNewlywedsRecords) {
return getSuccessResult(this.activeNewlywedsRecordsService.updateById(activeNewlywedsRecords));
}
/**
* 删除数据
*
* @param idList 主键结合
* @return 删除结果
*/
@DeleteMapping
public ResponseObject delete(@RequestParam("idList") List<Long> idList) {
return getSuccessResult(this.activeNewlywedsRecordsService.removeByIds(idList));
}
}

View File

@ -0,0 +1,127 @@
package com.fuint.business.marketingActivity.activeNewlyweds.entity;
import java.util.Date;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.io.Serializable;
/**
* 新人有礼记录表(ActiveNewlywedsRecords)表实体类
*
* @author makejava
* @since 2023-12-20 14:12:54
*/
@SuppressWarnings("serial")
public class ActiveNewlywedsRecords extends Model<ActiveNewlywedsRecords> {
//主键id
private Integer id;
//活动id
private Integer activeNewlywedsId;
//所属连锁店id
private Integer chainStoreId;
//所属店铺id
private Integer storeId;
//用户id
private String userId;
//被邀请人id
private String inviteeUserId;
//创建者
private String createBy;
//创建时间
private Date createTime;
//更新者
private String updateBy;
//更新时间
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;
}
}

View File

@ -0,0 +1,15 @@
package com.fuint.business.marketingActivity.activeNewlyweds.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlywedsRecords;
/**
* 新人有礼记录表(ActiveNewlywedsRecords)表数据库访问层
*
* @author makejava
* @since 2023-12-20 14:12:53
*/
public interface ActiveNewlywedsRecordsMapper extends BaseMapper<ActiveNewlywedsRecords> {
}

View File

@ -0,0 +1,15 @@
package com.fuint.business.marketingActivity.activeNewlyweds.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlywedsRecords;
/**
* 新人有礼记录表(ActiveNewlywedsRecords)表服务接口
*
* @author makejava
* @since 2023-12-20 14:12:54
*/
public interface ActiveNewlywedsRecordsService extends IService<ActiveNewlywedsRecords> {
}

View File

@ -0,0 +1,19 @@
package com.fuint.business.marketingActivity.activeNewlyweds.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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 org.springframework.stereotype.Service;
/**
* 新人有礼记录表(ActiveNewlywedsRecords)表服务实现类
*
* @author makejava
* @since 2023-12-20 14:12:54
*/
@Service("activeNewlywedsRecordsService")
public class ActiveNewlywedsRecordsServiceImpl extends ServiceImpl<ActiveNewlywedsRecordsMapper, ActiveNewlywedsRecords> implements ActiveNewlywedsRecordsService {
}

View File

@ -0,0 +1,94 @@
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;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;
/**
* 邀请有礼记录表(ActiveRecommendRecords)表控制层
*
* @author makejava
* @since 2023-12-20 14:13:16
*/
@RestController
@RequestMapping("business/marketingActivity/activeRecommendRecords")
public class ActiveRecommendRecordsController extends BaseController {
/**
* 服务对象
*/
@Resource
private ActiveRecommendRecordsService activeRecommendRecordsService;
/**
* 分页查询所有数据
* @param pageNo
* @param pageSize
* @param activeRecommendRecords
* @return
*/
@GetMapping
public ResponseObject selectAll(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@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)));
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("{id}")
public ResponseObject selectOne(@PathVariable Serializable id) {
return getSuccessResult(this.activeRecommendRecordsService.getById(id));
}
/**
* 新增数据
*
* @param activeRecommendRecords 实体对象
* @return 新增结果
*/
@PostMapping
public ResponseObject insert(@RequestBody ActiveRecommendRecords activeRecommendRecords) {
return getSuccessResult(this.activeRecommendRecordsService.save(activeRecommendRecords));
}
/**
* 修改数据
*
* @param activeRecommendRecords 实体对象
* @return 修改结果
*/
@PutMapping
public ResponseObject update(@RequestBody ActiveRecommendRecords activeRecommendRecords) {
return getSuccessResult(this.activeRecommendRecordsService.updateById(activeRecommendRecords));
}
/**
* 删除数据
*
* @param idList 主键结合
* @return 删除结果
*/
@DeleteMapping
public ResponseObject delete(@RequestParam("idList") List<Long> idList) {
return getSuccessResult(this.activeRecommendRecordsService.removeByIds(idList));
}
}

View File

@ -0,0 +1,127 @@
package com.fuint.business.marketingActivity.activeRecommend.entity;
import java.util.Date;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.io.Serializable;
/**
* 邀请有礼记录表(ActiveRecommendRecords)表实体类
*
* @author makejava
* @since 2023-12-20 14:13:16
*/
@SuppressWarnings("serial")
public class ActiveRecommendRecords extends Model<ActiveRecommendRecords> {
//主键id
private Integer id;
//活动id
private Integer activeNewlywedsId;
//所属连锁店id
private Integer chainStoreId;
//所属店铺id
private Integer storeId;
//用户id
private String userId;
//被邀请人id
private String inviteeUserId;
//创建者
private String createBy;
//创建时间
private Date createTime;
//更新者
private String updateBy;
//更新时间
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;
}
}

View File

@ -0,0 +1,15 @@
package com.fuint.business.marketingActivity.activeRecommend.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendRecords;
/**
* 邀请有礼记录表(ActiveRecommendRecords)表数据库访问层
*
* @author makejava
* @since 2023-12-20 14:13:16
*/
public interface ActiveRecommendRecordsMapper extends BaseMapper<ActiveRecommendRecords> {
}

View File

@ -0,0 +1,15 @@
package com.fuint.business.marketingActivity.activeRecommend.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendRecords;
/**
* 邀请有礼记录表(ActiveRecommendRecords)表服务接口
*
* @author makejava
* @since 2023-12-20 14:13:16
*/
public interface ActiveRecommendRecordsService extends IService<ActiveRecommendRecords> {
}

View File

@ -0,0 +1,19 @@
package com.fuint.business.marketingActivity.activeRecommend.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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 org.springframework.stereotype.Service;
/**
* 邀请有礼记录表(ActiveRecommendRecords)表服务实现类
*
* @author makejava
* @since 2023-12-20 14:13:16
*/
@Service("activeRecommendRecordsService")
public class ActiveRecommendRecordsServiceImpl extends ServiceImpl<ActiveRecommendRecordsMapper, ActiveRecommendRecords> implements ActiveRecommendRecordsService {
}

View File

@ -74,7 +74,7 @@ public class CardValueRecordController extends BaseController {
/**
* 储值卡充值
*
* @param cardValueRecord 实体对象
* @param cardValueRecordDTO 实体对象
* @return 新增结果
*/
@PostMapping

View File

@ -26,6 +26,8 @@ import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.RocketUtil;
import com.fuint.common.util.TokenUtil;
import com.fuint.repository.mapper.MtStaffMapper;
import com.fuint.repository.model.MtStaff;
import io.lettuce.core.dynamic.annotation.Param;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -73,6 +75,8 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
@Resource
RocketUtil rocketUtil;
@Resource
private MtStaffMapper mtStaffMapper;
/**
* 储值卡充值新增
* @param cardValueRecordDTO
@ -80,9 +84,8 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
*/
@Override
public boolean insert(CardValueRecordDTO cardValueRecordDTO) {
boolean pay = false;
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
boolean pay = false;
// 添加储存充值
cardValueRecordDTO.setPayStatus("unpaid");
// 根据日期生成支付编号
@ -131,8 +134,11 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
} catch (Exception e){
e.printStackTrace();
}
// 支付 payment_type
//支付成功之后添加充值记录
pay = addCardValueRecord(cardValueRecordDTO);
// 支付 payment_type
return pay;
}
@Override
@ -416,6 +422,42 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
}
}
private boolean addCardValueRecord(CardValueRecordDTO cardValueRecordDTO){
CardValueRecord cardValueRecord = new CardValueRecord();
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer userId = nowAccountInfo.getId();
Integer storId = nowAccountInfo.getStoreId();
//用户信息
LJUserVo ljUserVo = ljUserMapper.selectAllInfoById2(userId, storId);
cardValueRecord.setName(ljUserVo.getName());
cardValueRecord.setMtUserId(userId);
cardValueRecord.setMobile(ljUserVo.getMobile());
//员工信息
Integer mtStaffId = cardValueRecordDTO.getMtStaffId();
MtStaff mtStaff = mtStaffMapper.selectById(mtStaffId);
String realName = mtStaff.getRealName();
String mobile = mtStaff.getMobile();
cardValueRecord.setMobile(mobile);
cardValueRecord.setRealName(realName);
cardValueRecord.setMtStaffId(mtStaffId);
//储值卡信息
Integer cardValueId = cardValueRecordDTO.getCardValueId();
cardValueRecord.setCardValueId(cardValueId);
//充值类型自定义金额
if (cardValueRecordDTO.getRechargeType().equals("1")){
cardValueRecord.setAmount(cardValueRecordDTO.getAmount());
//充值类型
}else if (cardValueRecordDTO.getRechargeType().equals("0")){
cardValueRecord.setAmount(cardValueRecordDTO.getBidBalance());
}
/*cardValueRecordDTO.get*/
return true;
}
}