Merge remote-tracking branch 'origin/master'

This commit is contained in:
@QQNZX 2023-11-16 18:39:16 +08:00
commit 859a05407f
11 changed files with 812 additions and 11 deletions

View File

@ -283,7 +283,7 @@ export default {
//
total: 0,
//
userList: null,
userList: [],
//
title: "",
//
@ -355,8 +355,9 @@ export default {
getList() {
this.loading = true;
getAccountList(this.queryParams).then(response => {
this.userList = response.data.content;
this.total = response.data.totalElements;
console.log(response);
this.userList = response.data.records;
this.total = response.data.total;
this.loading = false;
}
);

View File

@ -145,6 +145,7 @@ public class ActiveDiscountServiceImpl extends ServiceImpl<ActiveDiscountMapper,
activeDiscountVO.setDieselUserLevel(activeDiscount.getDieselUserLevel().split(","));
activeDiscountVO.setGasolineUserLevel(activeDiscount.getGasolineUserLevel().split(","));
activeDiscountVO.setNaturalUserLevel(activeDiscount.getNaturalUserLevel().split(","));
activeDiscountVO.setAdaptOil(activeDiscount.getAdaptOil().split(","));
activeDiscountVO.setActiveDiscountChildList(activeDiscountChildList);
}
}

View File

@ -0,0 +1,57 @@
package com.fuint.business.marketingActivity.activeExchange.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.activeExchange.dto.ActiveExchangeRecordDTO;
import com.fuint.business.marketingActivity.activeExchange.service.ActiveExchangeService;
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord;
import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeRecordService;
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;
/**
* 活动兑换控制层
*
* @author makejava
* @since 2023-11-16 14:14:17
*/
@RestController
@RequestMapping("business/marketingActivity/activeExchange")
public class ActiveExchangeController extends BaseController {
/**
* 服务对象
*/
@Resource
private ActiveExchangeService activeExchangeService;
/**
* 分页查询所有数据
* @param pageNo
* @param pageSize
* @param cardExchangeRecord
* @return
*/
@GetMapping
public ResponseObject selectAll(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelDiesel") CardExchangeRecord cardExchangeRecord) {
return getSuccessResult(this.activeExchangeService.select(pageNo,pageSize, cardExchangeRecord));
}
/**
* 核销优惠券兑换券接口
*
* @param activeExchangeRecordDTO 实体对象
* @return 修改结果
*/
@PutMapping
public ResponseObject update(@RequestBody ActiveExchangeRecordDTO activeExchangeRecordDTO) {
return getSuccessResult(this.activeExchangeService.updateOneById(activeExchangeRecordDTO));
}
}

View File

@ -0,0 +1,297 @@
package com.fuint.business.marketingActivity.activeExchange.dto;
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 java.io.Serializable;
import java.util.Date;
/**
* 兑换券领取记录表(CardExchangeRecord)表实体类
*
* @author makejava
* @since 2023-11-06 14:15:07
*/
@SuppressWarnings("serial")
public class ActiveExchangeRecordDTO extends Model<ActiveExchangeRecordDTO> {
//主键id
@TableId(type = IdType.AUTO)
private Integer id;
//券id
private Integer cardExchangeId;
//所属连锁店id
private Integer chainStorId;
//所属店铺id
private Integer storeId;
//券类型(0:优惠券 1兑换券)
private String cardType;
//员工id
private Integer mtStaffId;
//员工姓名
private String realName;
//员工手机号码
private String staffMobile;
//会员id
private Integer mtUserId;
//会员手机号码
private String mobile;
//会员名字
private String name;
//会员头像
private String photo;
//券名称
private String exchangeName;
//券详情
private String giftName;
//描述
private String description;
//券码
private String ticketCode;
//券来源
private String exchangeFrom;
//使用状态 0 未使用 1已使用
private String status;
//创建者
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;
//到期时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date outTime;
//核销时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date cancelTime;
//开始时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
//结束时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
public String getCardType() {
return cardType;
}
public void setCardType(String cardType) {
this.cardType = cardType;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCardExchangeId() {
return cardExchangeId;
}
public void setCardExchangeId(Integer cardExchangeId) {
this.cardExchangeId = cardExchangeId;
}
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 getGiftName() {
return giftName;
}
public void setGiftName(String giftName) {
this.giftName = giftName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Integer getMtStaffId() {
return mtStaffId;
}
public void setMtStaffId(Integer mtStaffId) {
this.mtStaffId = mtStaffId;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
public String getStaffMobile() {
return staffMobile;
}
public void setStaffMobile(String staffMobile) {
this.staffMobile = staffMobile;
}
public Integer getMtUserId() {
return mtUserId;
}
public void setMtUserId(Integer mtUserId) {
this.mtUserId = mtUserId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
public String getExchangeName() {
return exchangeName;
}
public void setExchangeName(String exchangeName) {
this.exchangeName = exchangeName;
}
public String getTicketCode() {
return ticketCode;
}
public void setTicketCode(String ticketCode) {
this.ticketCode = ticketCode;
}
public String getExchangeFrom() {
return exchangeFrom;
}
public void setExchangeFrom(String exchangeFrom) {
this.exchangeFrom = exchangeFrom;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
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;
}
public Date getOutTime() {
return outTime;
}
public void setOutTime(Date outTime) {
this.outTime = outTime;
}
public Date getCancelTime() {
return cancelTime;
}
public void setCancelTime(Date cancelTime) {
this.cancelTime = cancelTime;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
/**
* 获取主键值
*
* @return 主键值
*/
@Override
protected Serializable pkVal() {
return this.id;
}
}

View File

@ -0,0 +1,26 @@
package com.fuint.business.marketingActivity.activeExchange.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.activeExchange.dto.ActiveExchangeRecordDTO;
import com.fuint.business.marketingActivity.activeExchange.vo.ActiveExchangeRecordVO;
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord;
import java.util.List;
public interface ActiveExchangeService {
/**
* 分页查询所有数据
* @param page
* @param cardExchangeRecord
* @return
*/
List<ActiveExchangeRecordVO> select(Integer pageNo, Integer pageSize, CardExchangeRecord cardExchangeRecord);
/**
* 修改数据
* @param activeExchangeRecordDTO
* @return
*/
boolean updateOneById(ActiveExchangeRecordDTO activeExchangeRecordDTO);
}

View File

@ -0,0 +1,122 @@
package com.fuint.business.marketingActivity.activeExchange.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.activeExchange.dto.ActiveExchangeRecordDTO;
import com.fuint.business.marketingActivity.activeExchange.service.ActiveExchangeService;
import com.fuint.business.marketingActivity.activeExchange.vo.ActiveExchangeRecordVO;
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 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.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Service
public class ActiveExchangeServiceImpl implements ActiveExchangeService {
@Resource
private CardExchangeRecordService cardExchangeRecordService;
@Resource
private CardFavorableRecordService cardFavorableRecordService;
/**
* 分页查询所有
* @param page
* @param cardExchangeRecord
* @return
*/
@Override
public List<ActiveExchangeRecordVO> select(Integer pageNo,Integer pageSize, CardExchangeRecord cardExchangeRecord) {
//兑换券
LambdaQueryWrapper<CardExchangeRecord> exchangeRecordLambdaQueryWrapper = new LambdaQueryWrapper<>();
if (ObjectUtils.isNotEmpty(cardExchangeRecord.getMobile())){
exchangeRecordLambdaQueryWrapper.eq(CardExchangeRecord::getMobile,cardExchangeRecord.getMobile());
}
if (ObjectUtils.isNotEmpty(cardExchangeRecord.getTicketCode())){
exchangeRecordLambdaQueryWrapper.eq(CardExchangeRecord::getTicketCode,cardExchangeRecord.getTicketCode());
}
List<CardExchangeRecord> cardExchangeRecordList = cardExchangeRecordService.list(exchangeRecordLambdaQueryWrapper);
//封装兑换券vo
List<ActiveExchangeRecordVO> activeExchangeRecordVOList = cardExchangeRecordList.stream().map(s->{
ActiveExchangeRecordVO activeExchangeRecordVO = new ActiveExchangeRecordVO();
BeanUtils.copyProperties(s,activeExchangeRecordVO);
activeExchangeRecordVO.setCardType("1");
return activeExchangeRecordVO;
}).collect(Collectors.toList());
//优惠券
LambdaQueryWrapper<CardFavorableRecord> cardFavorableRecordLambdaQueryWrapper = new LambdaQueryWrapper<>();
if (ObjectUtils.isNotEmpty(cardExchangeRecord.getMobile())){
cardFavorableRecordLambdaQueryWrapper.eq(CardFavorableRecord::getMobile,cardExchangeRecord.getMobile());
}
if (ObjectUtils.isNotEmpty(cardExchangeRecord.getTicketCode())){
cardFavorableRecordLambdaQueryWrapper.eq(CardFavorableRecord::getTicketCode,cardExchangeRecord.getTicketCode());
}
List<CardFavorableRecord> cardFavorableRecordList = cardFavorableRecordService.list(cardFavorableRecordLambdaQueryWrapper);
//封装兑换券vo
List<ActiveExchangeRecordVO> activeExchangeRecordVOList1 = cardFavorableRecordList.stream().map(s->{
ActiveExchangeRecordVO activeExchangeRecordVO1 = new ActiveExchangeRecordVO();
BeanUtils.copyProperties(s,activeExchangeRecordVO1);
activeExchangeRecordVO1.setCardType("0");
return activeExchangeRecordVO1;
}).collect(Collectors.toList());
//封装优惠券兑换券
List<ActiveExchangeRecordVO> collect = Stream.concat(activeExchangeRecordVOList.stream(), activeExchangeRecordVOList1.stream())
.collect(Collectors.toList());
//自定义分页
Integer count = collect.size(); // 记录总数
Integer pageCount = 0; // 页数
if (count % pageSize == 0) {
pageCount = count / pageSize;
} else {
pageCount = count / pageSize + 1;
}
int fromIndex = 0; // 开始索引
int toIndex = 0; // 结束索引
if (pageNo != pageCount.intValue()) {
fromIndex = (pageNo - 1) * pageSize;
toIndex = fromIndex + pageSize;
} else {
fromIndex = (pageNo - 1) * pageSize;
toIndex = count;
}
List<ActiveExchangeRecordVO> collect1 = collect.stream().skip(fromIndex).limit(pageSize).collect(Collectors.toList());
return collect1;
}
/**
* 核销卡券
* @param activeExchangeRecordDTO
* @return
*/
@Override
@Transactional
public boolean updateOneById(ActiveExchangeRecordDTO activeExchangeRecordDTO) {
boolean update = false;
//核销优惠券
if (ObjectUtils.isNotEmpty(activeExchangeRecordDTO) && activeExchangeRecordDTO.getCardType().equals("0")){
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();
BeanUtils.copyProperties(activeExchangeRecordDTO,cardFavorableRecord);
update = cardFavorableRecordService.updateById(cardFavorableRecord);
}else {
//核销兑换券
CardExchangeRecord cardExchangeRecord = new CardExchangeRecord();
BeanUtils.copyProperties(activeExchangeRecordDTO,cardExchangeRecord);
update = cardExchangeRecordService.updateById(cardExchangeRecord);
}
return update;
}
}

View File

@ -0,0 +1,297 @@
package com.fuint.business.marketingActivity.activeExchange.vo;
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 java.io.Serializable;
import java.util.Date;
/**
* 兑换券领取记录表(CardExchangeRecord)表实体类
*
* @author makejava
* @since 2023-11-06 14:15:07
*/
@SuppressWarnings("serial")
public class ActiveExchangeRecordVO extends Model<ActiveExchangeRecordVO> {
//主键id
@TableId(type = IdType.AUTO)
private Integer id;
//券id
private Integer cardExchangeId;
//所属连锁店id
private Integer chainStorId;
//所属店铺id
private Integer storeId;
//券类型(0:优惠券 1兑换券)
private String cardType;
//员工id
private Integer mtStaffId;
//员工姓名
private String realName;
//员工手机号码
private String staffMobile;
//会员id
private Integer mtUserId;
//会员手机号码
private String mobile;
//会员名字
private String name;
//会员头像
private String photo;
//券名称
private String exchangeName;
//券详情
private String giftName;
//描述
private String description;
//券码
private String ticketCode;
//券来源
private String exchangeFrom;
//使用状态 0 未使用 1已使用
private String status;
//创建者
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;
//到期时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date outTime;
//核销时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date cancelTime;
//开始时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
//结束时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
public String getCardType() {
return cardType;
}
public void setCardType(String cardType) {
this.cardType = cardType;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCardExchangeId() {
return cardExchangeId;
}
public void setCardExchangeId(Integer cardExchangeId) {
this.cardExchangeId = cardExchangeId;
}
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 getGiftName() {
return giftName;
}
public void setGiftName(String giftName) {
this.giftName = giftName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Integer getMtStaffId() {
return mtStaffId;
}
public void setMtStaffId(Integer mtStaffId) {
this.mtStaffId = mtStaffId;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
public String getStaffMobile() {
return staffMobile;
}
public void setStaffMobile(String staffMobile) {
this.staffMobile = staffMobile;
}
public Integer getMtUserId() {
return mtUserId;
}
public void setMtUserId(Integer mtUserId) {
this.mtUserId = mtUserId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
public String getExchangeName() {
return exchangeName;
}
public void setExchangeName(String exchangeName) {
this.exchangeName = exchangeName;
}
public String getTicketCode() {
return ticketCode;
}
public void setTicketCode(String ticketCode) {
this.ticketCode = ticketCode;
}
public String getExchangeFrom() {
return exchangeFrom;
}
public void setExchangeFrom(String exchangeFrom) {
this.exchangeFrom = exchangeFrom;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
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;
}
public Date getOutTime() {
return outTime;
}
public void setOutTime(Date outTime) {
this.outTime = outTime;
}
public Date getCancelTime() {
return cancelTime;
}
public void setCancelTime(Date cancelTime) {
this.cancelTime = cancelTime;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
/**
* 获取主键值
*
* @return 主键值
*/
@Override
protected Serializable pkVal() {
return this.id;
}
}

View File

@ -63,13 +63,11 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl<ActiveNewlywedsMappe
}
//新增兑换物品
List<ActiveNewlywedsChild> list = activeNewlywedsDTO.getActiveNewlywedsChildList();
if (CollectionUtils.isNotEmpty(list)){
list.stream().map(s ->{
s.setActiveNewlywedsId(activeNewlyweds.getId());
return s;
}).collect(Collectors.toList());
save = activeNewlywedsChildService.saveBatch(list);
}
return save;
}

View File

@ -18,7 +18,6 @@ import java.io.Serializable;
@SuppressWarnings("serial")
public class ActiveRecommend extends Model<ActiveRecommend> {
//主键id
@TableId(type = IdType.AUTO)
private Integer id;
//所属连锁店id
private Integer chainStoreId;

View File

@ -50,8 +50,8 @@ public class ActiveRecommendServiceImpl extends ServiceImpl<ActiveRecommendMappe
boolean save = false;
//根据id查询
ActiveRecommendVO activeRecommendVO = getOneById(activeRecommendDTO.getId());
if (ObjectUtils.isNotEmpty(activeRecommendVO)){
save = this.updateOneById(activeRecommendDTO);
if (ObjectUtils.isNotEmpty(activeRecommendVO.getId())){
save = updateOneById(activeRecommendDTO);
}else {
//获取当前店铺的id和连锁店id
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
@ -86,7 +86,9 @@ public class ActiveRecommendServiceImpl extends ServiceImpl<ActiveRecommendMappe
*/
@Override
public ActiveRecommendVO getOneById(Serializable id) {
ActiveRecommendVO activeRecommendVO = new ActiveRecommendVO();
activeRecommendVO.setInviterGiftType(new String[0]);
if (ObjectUtils.isNotEmpty(id)){
//获取新人有礼活动信息
ActiveRecommend activeRecommend = getById(id);
@ -96,8 +98,10 @@ public class ActiveRecommendServiceImpl extends ServiceImpl<ActiveRecommendMappe
queryWrapper.orderByDesc(ActiveRecommendChild::getCreateTime);
List<ActiveRecommendChild> activeRecommendChildList = activeRecommendChildService.list(queryWrapper);
//封装VO返回
BeanUtils.copyProperties(activeRecommend,activeRecommendVO);
activeRecommendVO.setInviterGiftType(activeRecommend.getInviterGiftType().split(","));
if (ObjectUtils.isNotEmpty(activeRecommend)){
BeanUtils.copyProperties(activeRecommend,activeRecommendVO);
activeRecommendVO.setInviterGiftType(activeRecommend.getInviterGiftType().split(","));
}
activeRecommendVO.setActiveRecommendChildList(activeRecommendChildList);
}
return activeRecommendVO;

View File

@ -2,7 +2,6 @@ package com.fuint.business.marketingActivity.cardExchange.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchange;
import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeService;