This commit is contained in:
齐天大圣 2024-03-11 10:45:22 +08:00
parent 7f990d9b34
commit 8e6cb5413b
7 changed files with 574 additions and 533 deletions

View File

@ -33,4 +33,10 @@ public class ActiveDiscountPayVO implements Serializable {
private BigDecimal cardFavorableAmount; private BigDecimal cardFavorableAmount;
//优惠券信息 //优惠券信息
private String cardFavorableInfo; private String cardFavorableInfo;
//会员日类型 1 2
private String memberDayType;
//每周的会员日
private String weekDay;
//每月的会员日
private String monthDay;
} }

View File

@ -41,7 +41,7 @@ public interface ActiveNewlywedsService extends IService<ActiveNewlyweds> {
* @return * @return
*/ */
ActiveNewlywedsVO getOneById(Serializable id); ActiveNewlywedsVO getOneById(Serializable id);
ActiveNewlywedsVO getOneByStoreId(Serializable id); List<ActiveNewlywedsVO> getOneByStoreId(Serializable id);
List<ActiveNewlywedsVO> getOneByIdApplet(ActiveConsumption activeConsumption); List<ActiveNewlywedsVO> getOneByIdApplet(ActiveConsumption activeConsumption);
/** /**

View File

@ -62,54 +62,57 @@ public class ActiveNewlywedsRecordsServiceImpl extends ServiceImpl<ActiveNewlywe
Integer userId = nowAccountInfo.getId(); Integer userId = nowAccountInfo.getId();
LJUserVo ljUserVo = userService.selectUserById(userId,activeNewlywedsRecords.getStoreId()); LJUserVo ljUserVo = userService.selectUserById(userId,activeNewlywedsRecords.getStoreId());
//保存新人有礼记录 //保存新人有礼记录
ActiveNewlywedsVO activeNewlyweds = activeNewlywedsService.getOneByStoreId(activeNewlywedsRecords.getStoreId()); List<ActiveNewlywedsVO> activeNewlywedsVOList = activeNewlywedsService.getOneByStoreId(activeNewlywedsRecords.getStoreId());
activeNewlywedsRecords.setActiveNewlywedsId(activeNewlyweds.getId()); for (ActiveNewlywedsVO activeNewlyweds : activeNewlywedsVOList) {
activeNewlywedsRecords.setChainStoreId(nowAccountInfo.getChainStoreId()); activeNewlywedsRecords.setActiveNewlywedsId(activeNewlyweds.getId());
activeNewlywedsRecords.setStoreId(nowAccountInfo.getStoreId()); activeNewlywedsRecords.setChainStoreId(nowAccountInfo.getChainStoreId());
activeNewlywedsRecords.setUserId(userId); activeNewlywedsRecords.setStoreId(nowAccountInfo.getStoreId());
save = save(activeNewlywedsRecords); activeNewlywedsRecords.setUserId(userId);
//优惠券 save = save(activeNewlywedsRecords);
List<ActiveNewlywedsChild> activeNewlywedsChildList = activeNewlyweds.getActiveNewlywedsChildList(); //优惠券
if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){ List<ActiveNewlywedsChild> activeNewlywedsChildList = activeNewlyweds.getActiveNewlywedsChildList();
for (ActiveNewlywedsChild activeNewlywedsChild : activeNewlywedsChildList) { if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){
if (activeNewlywedsChild.getActiveGift().equals("1")){ for (ActiveNewlywedsChild activeNewlywedsChild : activeNewlywedsChildList) {
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord(); if (activeNewlywedsChild.getActiveGift().equals("1")){
cardFavorableRecord.setCardFavorableId(activeNewlywedsChild.getVouchersId()); CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();
cardFavorableRecord.setStoreId(nowAccountInfo.getStoreId()); cardFavorableRecord.setCardFavorableId(activeNewlywedsChild.getVouchersId());
cardFavorableRecord.setMtUserId(ljUserVo.getId()); cardFavorableRecord.setStoreId(nowAccountInfo.getStoreId());
cardFavorableRecord.setName(ljUserVo.getName()); cardFavorableRecord.setMtUserId(ljUserVo.getId());
cardFavorableRecord.setMobile(ljUserVo.getMobile()); cardFavorableRecord.setName(ljUserVo.getName());
cardFavorableRecord.setStatus("0"); cardFavorableRecord.setMobile(ljUserVo.getMobile());
cardFavorableRecord.setExchangeFrom("新人有礼"); cardFavorableRecord.setStatus("0");
cardFavorableRecord.setActiveId(activeNewlywedsChild.getActiveNewlywedsId()); cardFavorableRecord.setExchangeFrom("新人有礼");
save = cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord); cardFavorableRecord.setActiveId(activeNewlywedsChild.getActiveNewlywedsId());
}else { save = cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord);
//兑换券 }else {
CardExchangeRecord cardExchangeRecord = new CardExchangeRecord(); //兑换券
cardExchangeRecord.setCardExchangeId(activeNewlywedsChild.getVouchersId()); CardExchangeRecord cardExchangeRecord = new CardExchangeRecord();
cardExchangeRecord.setStoreId(nowAccountInfo.getStoreId()); cardExchangeRecord.setCardExchangeId(activeNewlywedsChild.getVouchersId());
cardExchangeRecord.setMtUserId(ljUserVo.getId()); cardExchangeRecord.setStoreId(nowAccountInfo.getStoreId());
cardExchangeRecord.setName(ljUserVo.getName()); cardExchangeRecord.setMtUserId(ljUserVo.getId());
cardExchangeRecord.setMobile(ljUserVo.getMobile()); cardExchangeRecord.setName(ljUserVo.getName());
cardExchangeRecord.setPhoto(ljUserVo.getAvatar()); cardExchangeRecord.setMobile(ljUserVo.getMobile());
cardExchangeRecord.setStatus("0"); cardExchangeRecord.setPhoto(ljUserVo.getAvatar());
cardExchangeRecord.setExchangeFrom("新人有礼"); cardExchangeRecord.setStatus("0");
cardExchangeRecord.setActiveId(activeNewlywedsChild.getActiveNewlywedsId()); cardExchangeRecord.setExchangeFrom("新人有礼");
save = cardExchangeRecordService.addCardExchangeRecord(cardExchangeRecord); cardExchangeRecord.setActiveId(activeNewlywedsChild.getActiveNewlywedsId());
save = cardExchangeRecordService.addCardExchangeRecord(cardExchangeRecord);
}
} }
//用户余额
UserBalance userBalance = userBalanceService.selectUserBalance(userId,nowAccountInfo.getChainStoreId());
//积分
if (ObjectUtils.isNotEmpty(userBalance.getPoints()) && ObjectUtils.isNotEmpty(activeNewlyweds.getPoints())){
userBalance.setPoints(userBalance.getPoints() + activeNewlyweds.getPoints());
}
//成长值
if (ObjectUtils.isNotEmpty(userBalance.getGrowthValue()) && ObjectUtils.isNotEmpty(activeNewlyweds.getGrowthValue())){
userBalance.setGrowthValue(userBalance.getGrowthValue() + activeNewlyweds.getGrowthValue());
}
userBalanceService.updateUserBalance(userBalance);
} }
//用户余额
UserBalance userBalance = userBalanceService.selectUserBalance(userId,nowAccountInfo.getChainStoreId());
//积分
if (ObjectUtils.isNotEmpty(userBalance.getPoints()) && ObjectUtils.isNotEmpty(activeNewlyweds.getPoints())){
userBalance.setPoints(userBalance.getPoints() + activeNewlyweds.getPoints());
}
//成长值
if (ObjectUtils.isNotEmpty(userBalance.getGrowthValue()) && ObjectUtils.isNotEmpty(activeNewlyweds.getGrowthValue())){
userBalance.setGrowthValue(userBalance.getGrowthValue() + activeNewlyweds.getGrowthValue());
}
userBalanceService.updateUserBalance(userBalance);
} }
return save; return save;
} }
} }

View File

@ -358,35 +358,41 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl<ActiveNewlywedsMappe
* @return * @return
*/ */
@Override @Override
public ActiveNewlywedsVO getOneByStoreId(Serializable id) { public List<ActiveNewlywedsVO> getOneByStoreId(Serializable id) {
ActiveNewlywedsVO activeNewlywedsVO = new ActiveNewlywedsVO();
activeNewlywedsVO.setCourtesyReward(new String[0]); ArrayList<ActiveNewlywedsVO> arrayList = new ArrayList<>();
if (ObjectUtils.isNotEmpty(id)){ if (ObjectUtils.isNotEmpty(id)){
//获取新人有礼活动信息 //获取新人有礼活动信息
LambdaQueryWrapper<ActiveNewlyweds> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ActiveNewlyweds> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ActiveNewlyweds::getStoreId,id); lambdaQueryWrapper.eq(ActiveNewlyweds::getStoreId,id).eq(ActiveNewlyweds::getIsonline,0);
ActiveNewlyweds activeNewlyweds = getOne(lambdaQueryWrapper); //ActiveNewlyweds activeNewlyweds = getOne(lambdaQueryWrapper);
//获取兑换物品信息 List<ActiveNewlyweds> newlywedsList = list(lambdaQueryWrapper);
if (ObjectUtils.isNotEmpty(activeNewlyweds)){ for (ActiveNewlyweds activeNewlyweds : newlywedsList) {
LambdaQueryWrapper<ActiveNewlywedsChild> queryWrapper = new LambdaQueryWrapper<>(); ActiveNewlywedsVO activeNewlywedsVO = new ActiveNewlywedsVO();
queryWrapper.eq(ActiveNewlywedsChild::getActiveNewlywedsId,activeNewlyweds.getId()); activeNewlywedsVO.setCourtesyReward(new String[0]);
queryWrapper.orderByDesc(ActiveNewlywedsChild::getCreateTime); //获取兑换物品信息
List<ActiveNewlywedsChild> activeNewlywedsChildList = activeNewlywedsChildService.list(queryWrapper); if (ObjectUtils.isNotEmpty(activeNewlyweds)){
BeanUtils.copyProperties(activeNewlyweds,activeNewlywedsVO); LambdaQueryWrapper<ActiveNewlywedsChild> queryWrapper = new LambdaQueryWrapper<>();
//封装VO返回 queryWrapper.eq(ActiveNewlywedsChild::getActiveNewlywedsId,activeNewlyweds.getId());
activeNewlywedsVO.setCourtesyReward(activeNewlyweds.getCourtesyReward().split(",")); queryWrapper.orderByDesc(ActiveNewlywedsChild::getCreateTime);
if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){ List<ActiveNewlywedsChild> activeNewlywedsChildList = activeNewlywedsChildService.list(queryWrapper);
activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildList); BeanUtils.copyProperties(activeNewlyweds,activeNewlywedsVO);
//封装VO返回
activeNewlywedsVO.setCourtesyReward(activeNewlyweds.getCourtesyReward().split(","));
if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){
activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildList);
}else {
ArrayList<ActiveNewlywedsChild> activeNewlywedsChildLists = new ArrayList<>();
activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildLists);
}
}else { }else {
ArrayList<ActiveNewlywedsChild> activeNewlywedsChildLists = new ArrayList<>(); ArrayList<ActiveNewlywedsChild> activeNewlywedsChildList = new ArrayList<>();
activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildLists); activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildList);
} }
}else { arrayList.add(activeNewlywedsVO);
ArrayList<ActiveNewlywedsChild> activeNewlywedsChildList = new ArrayList<>();
activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildList);
} }
} }
return activeNewlywedsVO; return arrayList;
} }
/** /**

View File

@ -130,6 +130,9 @@ public class CardExchangeRecordController extends BaseController {
CardExchangeRecord byId = cardExchangeRecordService.getById(cardExchangeRecord.getId()); CardExchangeRecord byId = cardExchangeRecordService.getById(cardExchangeRecord.getId());
Integer cardExchangeId = byId.getCardExchangeId(); Integer cardExchangeId = byId.getCardExchangeId();
CardExchange cardExchange = cardExchangeService.getById(cardExchangeId); CardExchange cardExchange = cardExchangeService.getById(cardExchangeId);
if (cardExchange.getType().equals("1")){
return getSuccessResult(this.cardExchangeRecordService.updateById(cardExchangeRecord));
}
Integer giftId = cardExchange.getGiftId(); Integer giftId = cardExchange.getGiftId();
LJOrder ljOrder = new LJOrder(); LJOrder ljOrder = new LJOrder();
ljOrder.setTerminal("pc"); ljOrder.setTerminal("pc");

View File

@ -118,9 +118,7 @@
WHERE WHERE
cer.mt_user_id = #{cardFavorableDTOS.id} cer.mt_user_id = #{cardFavorableDTOS.id}
and ce.type = 0 and ce.type = 0
<if test="cardFavorableDTOS.useStatus!=null and cardFavorableDTOS.useStatus != ''">
and cer.status = #{cardFavorableDTOS.useStatus} and cer.status = #{cardFavorableDTOS.useStatus}
</if>
and cer.store_id = #{cardFavorableDTOS.storeId} UNION ALL and cer.store_id = #{cardFavorableDTOS.storeId} UNION ALL
SELECT SELECT
'洗车券' AS couponType, '洗车券' AS couponType,
@ -132,9 +130,7 @@
WHERE WHERE
cer.mt_user_id = #{cardFavorableDTOS.id} cer.mt_user_id = #{cardFavorableDTOS.id}
and ce.type = 1 and ce.type = 1
<if test="cardFavorableDTOS.useStatus!=null and cardFavorableDTOS.useStatus != ''">
and cer.status = #{cardFavorableDTOS.useStatus} and cer.status = #{cardFavorableDTOS.useStatus}
</if>
and cer.store_id = #{cardFavorableDTOS.storeId} UNION ALL and cer.store_id = #{cardFavorableDTOS.storeId} UNION ALL
SELECT SELECT
'洗车卡' AS couponType, '洗车卡' AS couponType,