一键发券

This commit is contained in:
齐天大圣 2024-01-29 14:11:02 +08:00
parent f325084e07
commit acf41325ef
17 changed files with 168 additions and 13 deletions

View File

@ -147,9 +147,9 @@
<el-radio label="2">禁用</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="卡描述" >
<!-- <el-form-item label="卡描述" >
<el-input type="textarea" v-model="ruleForm.remark"></el-input>
</el-form-item>
</el-form-item>-->
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="centerDialogVisible = false"> </el-button>

View File

@ -20,6 +20,7 @@ import com.fuint.business.userManager.entity.LJUserGrade;
import com.fuint.business.userManager.service.LJUserGradeService;
import com.fuint.common.util.TokenUtil;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -263,8 +264,12 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM
activeConsumptionAppletVO.setOilName(oilNameList);
activeConsumptionAppletVO.setPoints(s.getPoints());
activeConsumptionAppletVO.setAdaptUserType(adaptUserType);
String goodss = "";
if (ObjectUtils.isNotEmpty(goods)){
goodss = " 赠送物品:"+goods;
}
activeConsumptionAppletVO.setActiveDescribe(s.getName() + ""+"本活动消费需满"+
s.getParticipationConditionMoney()+"元,赠送券:"+card+" 赠送物品:"+goods+"");
s.getParticipationConditionMoney()+"元,赠送券:"+card+goodss+"");
return activeConsumptionAppletVO;
}).collect(Collectors.toList());
return appletVOList;

View File

@ -108,6 +108,22 @@ public class CardFavorableRecordController extends BaseController {
return getSuccessResult(this.cardFavorableRecordService.issueCardFavorable(cardFavorableAdnUserDTO));
}
/**
* 查询一键发券接口
*
* @param pageNo
* @param pageSize
* @param cardFavorableRecord
* @return
*/
@GetMapping("getCardFavorableLists")
public ResponseObject getCardFavorableLists(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFavorableRecord") CardFavorableRecord cardFavorableRecord) {
Page page = new Page(pageNo, pageSize);
return getSuccessResult(this.cardFavorableRecordService.getCardFavorableLists(page,cardFavorableRecord));
}
/**
* 小程序端判断是否领取优惠券
* @return 新增结果

View File

@ -9,5 +9,10 @@ import java.util.List;
public class CardFavorableAdnUserDTO extends CardFavorable {
//会员列表
private List<Integer> userIds;
//优惠券ids
private List<Integer> cardFavorableIds;
//等级ID
private List<Integer> gradeIds;
//天数
private Integer days;
}

View File

@ -29,6 +29,7 @@ public interface CardFavorableRecordMapper extends BaseMapper<CardFavorableRecor
IPage<CardFavorableRecordVO> getCardFavorableList(@Param("page")Page page,@Param("cardFavorableRecord") CardFavorableRecord cardFavorableRecord);
IPage<CardFavorableRecordVO> getCardFavorableLists(@Param("page")Page page,@Param("cardFavorableRecord") CardFavorableRecord cardFavorableRecord);
/**
* 查询优惠券接口(小程序)

View File

@ -55,6 +55,33 @@
order by cfr.create_time DESC
</select>
<select id="getCardFavorableLists"
resultType="com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableRecordVO">
select
cfr.name name,
cfr.mobile mobile,
cfr.status status,
cf.name cardFavorableName,
cf.discount_type discountType
FROM
card_favorable_record cfr
left join card_favorable cf ON cfr.card_favorable_id = cf.id
left join mt_store ms on ms.id = cfr.store_id
<where>
cfr.exchange_from = "店铺一键送券"
<if test="cardFavorableRecord.storeId != null">
and cf.store_id = #{cardFavorableRecord.storeId}
</if>
<if test="cardFavorableRecord.mtUserId != null">
and cfr.mt_user_id = #{cardFavorableRecord.mtUserId}
</if>
<if test="cardFavorableRecord.status != null and cardFavorableRecord.status != ''">
and cfr.status = #{cardFavorableRecord.status}
</if>
</where>
order by cfr.create_time DESC
</select>
<select id="selectAllByCondition" resultType="com.fuint.business.marketingActivity.cardFavorable.vo.CouponVO">
SELECT
card_favorables.couponType,

View File

@ -31,6 +31,7 @@ public interface CardFavorableRecordService extends IService<CardFavorableRecord
IPage<CardFavorableRecordVO> getCardFavorableList(Page page, CardFavorableRecord cardFavorableRecord);
IPage<CardFavorableRecordVO> getCardFavorableLists(Page page, CardFavorableRecord cardFavorableRecord);
/**
* 统计优惠券数量

View File

@ -39,6 +39,7 @@ import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -125,6 +126,14 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
return cardFavorableList;
}
@Override
public IPage<CardFavorableRecordVO> getCardFavorableLists(Page page, CardFavorableRecord cardFavorableRecord) {
Integer storeId = TokenUtil.getNowAccountInfo().getStoreId();
cardFavorableRecord.setStoreId(storeId);
IPage<CardFavorableRecordVO> cardFavorableList = cardFavorableRecordMapper.getCardFavorableLists(page, cardFavorableRecord);
return cardFavorableList;
}
/**
* 统计优惠券使用数量
* @param cardFavorableRecord
@ -310,18 +319,29 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
*/
@Override
public boolean issueCardFavorable(CardFavorableAdnUserDTO cardFavorableAdnUserDTO) {
//查询用户列表
ArrayList<LJUserVo> ljUserVosList = new ArrayList<>();
List<Integer> gradeIds = cardFavorableAdnUserDTO.getGradeIds();
for (Integer gradeId : gradeIds) {
LJUserVo ljUserVo = new LJUserVo();
ljUserVo.setGradeId(gradeId);
ljUserVo.setDays(cardFavorableAdnUserDTO.getDays());
List<LJUserVo> userLists = userService.getUserLists(ljUserVo);
ljUserVosList.addAll(userLists);
}
boolean flag = false;
//油站信息
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
//会员ids
List<Integer> userIds = cardFavorableAdnUserDTO.getUserIds();
//List<Integer> userIds = cardFavorableAdnUserDTO.getUserIds();
//优惠券ids
List<Integer> cardIds = cardFavorableAdnUserDTO.getCardFavorableIds();
for (Integer cardId : cardIds) {
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();
if (CollectionUtils.isNotEmpty(userIds)){
for (Integer userId : userIds) {
LJUser userInfo = userService.queryUserByUserId(userId);
if (CollectionUtils.isNotEmpty(ljUserVosList)){
for (LJUserVo ljUserVo : ljUserVosList) {
LJUser userInfo = userService.queryUserByUserId(ljUserVo.getId());
cardFavorableRecord.setCardFavorableId(cardId);
cardFavorableRecord.setStoreId(nowAccountInfo.getStoreId());
cardFavorableRecord.setChainStorId(nowAccountInfo.getChainStoreId());

View File

@ -44,4 +44,6 @@ public class CardFavorableRecordVO extends CardFavorableRecord {
private String discountType;
//满足金额
private double satisfiedAmount;
//优惠券描述信息
}

View File

@ -14,6 +14,7 @@ import com.fuint.business.store.entity.MtStore;
import com.fuint.business.store.service.StoreService;
import com.fuint.business.userManager.entity.UserBalance;
import com.fuint.business.userManager.mapper.LJUserMapper;
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.util.TokenUtil;
@ -48,7 +49,7 @@ public class CardGiftServiceImpl extends ServiceImpl<CardGiftMapper, CardGift> i
@Resource
private UserBalanceService userBalanceService;
@Resource
private LJUserMapper ljUserMapper;
private LJUserService ljUserService;
/**
* 新增数据
@ -163,6 +164,7 @@ public class CardGiftServiceImpl extends ServiceImpl<CardGiftMapper, CardGift> i
public CardGift exchange(CardGift cardGift) {
//登录用户id
Integer userId = TokenUtil.getNowAccountInfo().getId();
LJUserVo ljUserVo = ljUserService.selectUserById(userId, TokenUtil.getNowAccountInfo().getStoreId());
LambdaQueryWrapper<CardGift> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CardGift::getNumber,cardGift.getNumber());
queryWrapper.eq(CardGift::getStatus,"1");
@ -172,6 +174,9 @@ public class CardGiftServiceImpl extends ServiceImpl<CardGiftMapper, CardGift> i
if (ObjectUtils.isNotEmpty(one) && ObjectUtils.isNotEmpty(cardGift.getCardPassword()) && cardGift.getCardPassword().equals(one.getCardPassword())){
one.setActivateStatus("1");
one.setUserId(userId);
String name = ljUserVo.getName();
String mobile = ljUserVo.getMobile();
one.setRemark("姓名:"+name+",手机号:"+mobile);
updateById(one);
//更新用户余额
Double cardAmount = one.getCardAmount();

View File

@ -816,9 +816,10 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
//用户余额变化记录
cardBalanceChange.setUserId(cardValueOrders.getMtUserId());
cardBalanceChange.setStoreId(cardValueOrders.getStoreId());
cardBalanceChange.setChainStoreId(cardValueOrders.getChainStoreId());
cardBalanceChange.setChangeType("1");
cardBalanceChange.setFromType("储值卡充值");
cardBalanceChange.setBalance(cardValueOrders.getBidBalance());
cardBalanceChange.setBalance(cardValueOrders.getAmount());
cardBalanceChange.setAfterTheChange(afterBalance);
cardBalanceChange.setOrderNo(cardValueOrders.getOrderNo());
cardBalanceChangeService.save(cardBalanceChange);

View File

@ -5,7 +5,6 @@
<select id="getCardRecordList" resultType="com.fuint.business.order.vo.CardBalanceChangeVo">
select
ms.name storeName,
cbc.change_type changeType,
cbc.from_type fromType,
cbc.after_the_change afterTheChange,
@ -36,6 +35,6 @@
and date_format(cbc.create_time,'%y%m%d') &lt;= date_format(#{cardBalanceChange.params.endTime},'%y%m%d')
</if>
</where>
order by cbc.id DESC
order by cbc.id DESC
</select>
</mapper>
</mapper>

View File

@ -20,6 +20,7 @@ public interface LJUserMapper extends BaseMapper<LJUser> {
*/
public IPage<LJUserVo> selectUserList(Page page, @Param("user") LJUserVo user);
public IPage<LJUserVo> getUserList(Page page, @Param("user") LJUserVo user);
public List<LJUserVo> getUserLists(@Param("user") LJUserVo user);
/**
* 根据店铺id查询所有会员信息

View File

@ -31,7 +31,62 @@
LEFT JOIN mt_user_balance mub ON mu.id = mub.mt_user_id
left join oil_order oo on mu.id = oo.user_id
<where>
oo.create_time &lt;= DATE_SUB(NOW(), INTERVAL 14 DAY)
oo.create_time &lt;= DATE_SUB(NOW(), INTERVAL #{days} DAY)
<if test="user.chainStoreId != null and user.chainStoreId != ''">
and mub.chain_store_id = #{user.chainStoreId}
</if>
<if test="user.storeId != null and user.storeId != ''">
and mub.store_id = #{user.storeId}
</if>
<if test="user.mobile != null and user.mobile != ''">
and mu.mobile like concat('%', #{user.mobile}, '%')
</if>
<if test="user.userNo != null and user.userNo != ''">
and mu.user_no like concat('%', #{user.userNo}, '%')
</if>
<if test="user.name != null and user.name != ''">
and mu.name like concat('%', #{user.name}, '%')
</if>
<if test="user.gradeId != null and user.gradeId != ''">
and mub.grade_id = #{user.gradeId}
</if>
<if test="user.official != null and user.official != ''">
and mu.official = #{user.official}
</if>
<if test="user.cardBalance != null and user.cardBalance != '' and user.cardBalance == 2">
and mub.card_balance = 0
</if>
<if test="user.cardBalance != null and user.cardBalance != '' and user.cardBalance == 1">
and mub.card_balance != 0
</if>
<if test="user.params.beginTime != null and user.params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(mu.create_time,'%y%m%d') &gt;= date_format(#{user.params.beginTime},'%y%m%d')
</if>
<if test="user.params.endTime != null and user.params.endTime != ''"><!-- 结束时间检索 -->
and date_format(mu.create_time,'%y%m%d') &lt;= date_format(#{user.params.endTime},'%y%m%d')
</if>
</where>
GROUP BY mu.id
ORDER BY oo.create_time desc
</select>
<select id="getUserLists" resultType="com.fuint.business.userManager.vo.LJUserVo">
SELECT
mu.*,
mub.grade_id,
mub.card_balance,
mub.points,
mub.consume_num,
mub.growth_value,
mub.refuel_money,
mub.second_card,
mub.fixing_level
FROM
mt_user mu
LEFT JOIN mt_user_balance mub ON mu.id = mub.mt_user_id
left join oil_order oo on mu.id = oo.user_id
<where>
oo.create_time &lt;= DATE_SUB(NOW(), INTERVAL #{days} DAY)
<if test="user.chainStoreId != null and user.chainStoreId != ''">
and mub.chain_store_id = #{user.chainStoreId}
</if>

View File

@ -19,6 +19,7 @@ public interface LJUserService extends IService<LJUser> {
*/
public IPage<LJUserVo> selectUserList(Page page, LJUserVo user);
public IPage<LJUserVo> getUserList(Page page, LJUserVo user);
public List<LJUserVo> getUserLists(LJUserVo user);
Integer userNum(Integer storeId);

View File

@ -66,6 +66,21 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
return ljUserIPage;
}
/**
* 根据条件分页查询会员信息
* @param page
* @param user
* @return
*/
@Override
public List<LJUserVo> getUserLists(LJUserVo user) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
LJStore store = storeService.selectStoreByStoreId(nowAccountInfo.getStoreId());
user.setChainStoreId(store.getChainStoreId());
List<LJUserVo> userLists = baseMapper.getUserLists(user);
return userLists;
}
@Override
public Integer userNum(Integer storeId) {
// 构建查询条件

View File

@ -113,4 +113,5 @@ public class LJUserVo extends BaseEntity {
* 连锁店id
*/
private Integer chainStoreId;
private Integer days;
}