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 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
*/
ActiveNewlywedsVO getOneById(Serializable id);
ActiveNewlywedsVO getOneByStoreId(Serializable id);
List<ActiveNewlywedsVO> getOneByStoreId(Serializable id);
List<ActiveNewlywedsVO> getOneByIdApplet(ActiveConsumption activeConsumption);
/**

View File

@ -62,54 +62,57 @@ public class ActiveNewlywedsRecordsServiceImpl extends ServiceImpl<ActiveNewlywe
Integer userId = nowAccountInfo.getId();
LJUserVo ljUserVo = userService.selectUserById(userId,activeNewlywedsRecords.getStoreId());
//保存新人有礼记录
ActiveNewlywedsVO activeNewlyweds = activeNewlywedsService.getOneByStoreId(activeNewlywedsRecords.getStoreId());
activeNewlywedsRecords.setActiveNewlywedsId(activeNewlyweds.getId());
activeNewlywedsRecords.setChainStoreId(nowAccountInfo.getChainStoreId());
activeNewlywedsRecords.setStoreId(nowAccountInfo.getStoreId());
activeNewlywedsRecords.setUserId(userId);
save = save(activeNewlywedsRecords);
//优惠券
List<ActiveNewlywedsChild> activeNewlywedsChildList = activeNewlyweds.getActiveNewlywedsChildList();
if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){
for (ActiveNewlywedsChild activeNewlywedsChild : activeNewlywedsChildList) {
if (activeNewlywedsChild.getActiveGift().equals("1")){
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();
cardFavorableRecord.setCardFavorableId(activeNewlywedsChild.getVouchersId());
cardFavorableRecord.setStoreId(nowAccountInfo.getStoreId());
cardFavorableRecord.setMtUserId(ljUserVo.getId());
cardFavorableRecord.setName(ljUserVo.getName());
cardFavorableRecord.setMobile(ljUserVo.getMobile());
cardFavorableRecord.setStatus("0");
cardFavorableRecord.setExchangeFrom("新人有礼");
cardFavorableRecord.setActiveId(activeNewlywedsChild.getActiveNewlywedsId());
save = cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord);
}else {
//兑换券
CardExchangeRecord cardExchangeRecord = new CardExchangeRecord();
cardExchangeRecord.setCardExchangeId(activeNewlywedsChild.getVouchersId());
cardExchangeRecord.setStoreId(nowAccountInfo.getStoreId());
cardExchangeRecord.setMtUserId(ljUserVo.getId());
cardExchangeRecord.setName(ljUserVo.getName());
cardExchangeRecord.setMobile(ljUserVo.getMobile());
cardExchangeRecord.setPhoto(ljUserVo.getAvatar());
cardExchangeRecord.setStatus("0");
cardExchangeRecord.setExchangeFrom("新人有礼");
cardExchangeRecord.setActiveId(activeNewlywedsChild.getActiveNewlywedsId());
save = cardExchangeRecordService.addCardExchangeRecord(cardExchangeRecord);
List<ActiveNewlywedsVO> activeNewlywedsVOList = activeNewlywedsService.getOneByStoreId(activeNewlywedsRecords.getStoreId());
for (ActiveNewlywedsVO activeNewlyweds : activeNewlywedsVOList) {
activeNewlywedsRecords.setActiveNewlywedsId(activeNewlyweds.getId());
activeNewlywedsRecords.setChainStoreId(nowAccountInfo.getChainStoreId());
activeNewlywedsRecords.setStoreId(nowAccountInfo.getStoreId());
activeNewlywedsRecords.setUserId(userId);
save = save(activeNewlywedsRecords);
//优惠券
List<ActiveNewlywedsChild> activeNewlywedsChildList = activeNewlyweds.getActiveNewlywedsChildList();
if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){
for (ActiveNewlywedsChild activeNewlywedsChild : activeNewlywedsChildList) {
if (activeNewlywedsChild.getActiveGift().equals("1")){
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();
cardFavorableRecord.setCardFavorableId(activeNewlywedsChild.getVouchersId());
cardFavorableRecord.setStoreId(nowAccountInfo.getStoreId());
cardFavorableRecord.setMtUserId(ljUserVo.getId());
cardFavorableRecord.setName(ljUserVo.getName());
cardFavorableRecord.setMobile(ljUserVo.getMobile());
cardFavorableRecord.setStatus("0");
cardFavorableRecord.setExchangeFrom("新人有礼");
cardFavorableRecord.setActiveId(activeNewlywedsChild.getActiveNewlywedsId());
save = cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord);
}else {
//兑换券
CardExchangeRecord cardExchangeRecord = new CardExchangeRecord();
cardExchangeRecord.setCardExchangeId(activeNewlywedsChild.getVouchersId());
cardExchangeRecord.setStoreId(nowAccountInfo.getStoreId());
cardExchangeRecord.setMtUserId(ljUserVo.getId());
cardExchangeRecord.setName(ljUserVo.getName());
cardExchangeRecord.setMobile(ljUserVo.getMobile());
cardExchangeRecord.setPhoto(ljUserVo.getAvatar());
cardExchangeRecord.setStatus("0");
cardExchangeRecord.setExchangeFrom("新人有礼");
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;
}
}

View File

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

View File

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

View File

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