From add86a49cc69b6882500c95dd67a2ac826c35526 Mon Sep 17 00:00:00 2001 From: jiangqs <jiangqs> Date: 星期三, 26 七月 2023 20:16:51 +0800 Subject: [PATCH] bug --- ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/birthday/BirthdayCardServiceImpl.java | 82 +++++++++++++++++++++++++++++++++------- 1 files changed, 67 insertions(+), 15 deletions(-) diff --git a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/birthday/BirthdayCardServiceImpl.java b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/birthday/BirthdayCardServiceImpl.java index 5a04222..db216c4 100644 --- a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/birthday/BirthdayCardServiceImpl.java +++ b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/birthday/BirthdayCardServiceImpl.java @@ -1,6 +1,7 @@ package com.ruoyi.member.service.impl.birthday; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.core.utils.bean.BeanUtils; import com.ruoyi.common.core.utils.uuid.IdUtils; @@ -10,15 +11,15 @@ import com.ruoyi.member.domain.dto.MgtBirthdayGiftDto; import com.ruoyi.member.domain.pojo.birthday.BirthdayCard; import com.ruoyi.member.domain.pojo.birthday.BirthdayGift; -import com.ruoyi.system.api.domain.poji.member.MemberGiftRecord; import com.ruoyi.member.domain.vo.*; import com.ruoyi.member.mapper.birthday.BirthdayCardMapper; import com.ruoyi.member.service.birthday.BirthdayCardService; import com.ruoyi.member.service.birthday.BirthdayGiftService; import com.ruoyi.member.service.member.MemberGiftRecordService; import com.ruoyi.system.api.domain.dto.BirthdayGiftSendDto; -import com.ruoyi.system.api.service.RemoteCouponService; -import com.ruoyi.system.api.service.RemoteOrderService; +import com.ruoyi.system.api.domain.dto.MgtBaseBathDto; +import com.ruoyi.system.api.domain.poji.member.MemberGiftRecord; +import com.ruoyi.system.api.domain.vo.MgtSimpleShopVo; import com.ruoyi.system.api.service.RemoteShopService; import org.springframework.stereotype.Service; @@ -26,6 +27,7 @@ import java.math.BigDecimal; import java.time.LocalDate; import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; /** @@ -51,11 +53,6 @@ @Resource private MemberGiftRecordService memberGiftRecordService; - @Resource - private RemoteCouponService remoteCouponService; - - @Resource - private RemoteOrderService remoteOrderService; /** * @description 平台编辑生日卡 @@ -91,7 +88,11 @@ // 创建新的生日卡 BirthdayCard birthdayCard = new BirthdayCard(); birthdayCard.setDelFlag(0); - birthdayCard.setShopId(0L); + if(mgtBirthdayEditDto.getShopId()!=null){ + birthdayCard.setShopId(mgtBirthdayEditDto.getShopId()); + }else{ + birthdayCard.setShopId(0L); + } birthdayCard.setCardStatus(mgtBirthdayEditDto.getCardStatus()); // 根据卡状态设置开启或关闭时间 if(mgtBirthdayEditDto.getCardStatus()==1){ @@ -101,16 +102,16 @@ } // 设置创建时间 birthdayCard.setCreateTime(new Date()); - // 如果店铺ID不为空,则进行相关设置 - if(mgtBirthdayEditDto.getShopId()!=null){ + // 如果店铺ID为空,则进行相关设置 + if(mgtBirthdayEditDto.getShopId()==null){ birthdayCard.setAreaFlag(mgtBirthdayEditDto.getAreaFlag()); - if(mgtBirthdayEditDto.getAreaFlag()==2){ + if(mgtBirthdayEditDto.getAreaFlag()!=null&&mgtBirthdayEditDto.getAreaFlag()==2){ birthdayCard.setDesignatedArea(mgtBirthdayEditDto.getDesignatedArea()); }else{ birthdayCard.setDesignatedArea(null); } birthdayCard.setShopFlag(mgtBirthdayEditDto.getShopFlag()); - if(mgtBirthdayEditDto.getShopFlag()==2){ + if(mgtBirthdayEditDto.getShopFlag()!=null&&mgtBirthdayEditDto.getShopFlag()==2){ birthdayCard.setApplicableShop(mgtBirthdayEditDto.getApplicableShop()); }else{ birthdayCard.setApplicableShop(null); @@ -124,7 +125,7 @@ List<MgtBirthdayGiftDto> mgtBirthdayGiftDtoList = mgtBirthdayEditDto.getMgtBirthdayGiftDtoList(); List<BirthdayGift> birthdayGiftList = new ArrayList<>(); // 如果生日礼物列表不为空,则进行相关设置 - if(!mgtBirthdayGiftDtoList.isEmpty()) { + if(mgtBirthdayGiftDtoList!=null&&!mgtBirthdayGiftDtoList.isEmpty()) { mgtBirthdayGiftDtoList.forEach(dto -> { BirthdayGift birthdayGift = new BirthdayGift(); birthdayGift.setDelFlag(0); @@ -230,6 +231,7 @@ giftDesc = giftSj.toString(); birthdayGetVo.setGiftDesc(giftDesc); } + birthdayGetVo.setCardStatus(birthdayCard.getCardStatus()); }else{ birthdayGetVo.setCardStatus(2); } @@ -346,7 +348,7 @@ // 创建新的生日卡 BirthdayCard birthdayCard = new BirthdayCard(); birthdayCard.setDelFlag(0); - birthdayCard.setShopId(0L); + birthdayCard.setShopId(merBirthdayEditDto.getShopId()); birthdayCard.setCardStatus(merBirthdayEditDto.getCardStatus()); // 根据卡状态设置开启或关闭时间 if(merBirthdayEditDto.getCardStatus()==1){ @@ -520,6 +522,9 @@ birthdayGiftSendDto.setCouponId(birthdayGift.getCouponId()); birthdayGiftSendDto.setCouponNumber(birthdayGift.getCouponNumber()); sendGoodsList.add(birthdayGiftSendDto); + memberGiftRecord.setCouponId(birthdayGift.getCouponId()); + memberGiftRecord.setCouponName(birthdayGift.getCouponName()); + memberGiftRecord.setCouponNumber(birthdayGift.getCouponNumber()); break; case 2: // 礼物类型为2,即商品 @@ -528,16 +533,22 @@ birthdayGiftSendDto.setGoodsId(birthdayGift.getGoodsId()); birthdayGiftSendDto.setCouponNumber(birthdayGift.getGoodsNumber()); sendCouponList.add(birthdayGiftSendDto); + memberGiftRecord.setGoodsId(birthdayGift.getGoodsId()); + memberGiftRecord.setGoodsName(birthdayGift.getGoodsName()); + memberGiftRecord.setGoodsNumber(birthdayGift.getGoodsNumber()); break; case 3: // 礼物类型为3,即现金 appBirthdayGiftVo.setGiftName("现金"); appBirthdayGiftVo.setGiftNumber(memberGiftRecord.getMoney().doubleValue()); + memberGiftRecord.setMoney(birthdayGift.getMoney()); break; case 4: // 礼物类型为4,即礼品 appBirthdayGiftVo.setGiftName(birthdayGift.getCouponName()); appBirthdayGiftVo.setGiftNumber(birthdayGift.getCouponNumber()); + memberGiftRecord.setGiftName(birthdayGift.getGiftName()); + memberGiftRecord.setGiftNumber(birthdayGift.getGiftNumber()); break; default: break; @@ -591,6 +602,9 @@ birthdayGiftSendDto.setCouponId(birthdayGift.getCouponId()); birthdayGiftSendDto.setCouponNumber(birthdayGift.getCouponNumber()); sendGoodsList.add(birthdayGiftSendDto); + memberGiftRecord.setCouponId(birthdayGift.getCouponId()); + memberGiftRecord.setCouponName(birthdayGift.getCouponName()); + memberGiftRecord.setCouponNumber(birthdayGift.getCouponNumber()); break; case 2: // 礼物类型为2,即商品 @@ -599,16 +613,22 @@ birthdayGiftSendDto.setGoodsId(birthdayGift.getGoodsId()); birthdayGiftSendDto.setCouponNumber(birthdayGift.getGoodsNumber()); sendCouponList.add(birthdayGiftSendDto); + memberGiftRecord.setGoodsId(birthdayGift.getGoodsId()); + memberGiftRecord.setGoodsName(birthdayGift.getGoodsName()); + memberGiftRecord.setGoodsNumber(birthdayGift.getGoodsNumber()); break; case 3: // 礼物类型为3,即现金 appBirthdayGiftVo.setGiftName("现金"); appBirthdayGiftVo.setGiftNumber(memberGiftRecord.getMoney().doubleValue()); + memberGiftRecord.setMoney(birthdayGift.getMoney()); break; case 4: // 礼物类型为4,即礼品 appBirthdayGiftVo.setGiftName(birthdayGift.getCouponName()); appBirthdayGiftVo.setGiftNumber(birthdayGift.getCouponNumber()); + memberGiftRecord.setGiftName(birthdayGift.getGiftName()); + memberGiftRecord.setGiftNumber(birthdayGift.getGiftNumber()); break; default: break; @@ -625,4 +645,36 @@ appBirthdayCardVo.setBirthdayGiftVoList(birthdayGiftVoList); return appBirthdayCardVo; } + + /** + * @description + * @author jqs + * @date 2023/7/11 18:02 + * @param page + * @param userId + * @return List<AppMemberPrizePageVo> + */ + @Override + public List<AppMemberPrizePageVo> pageAppMemberPrize(Page page, Long userId){ + List<AppMemberPrizePageVo> memberPrizePageVoList = birthdayCardMapper.pageAppMemberPrize(page, userId); + if(memberPrizePageVoList!=null&&!memberPrizePageVoList.isEmpty()){ + HashSet<Long> shopIdSet = new HashSet<>(); + for(AppMemberPrizePageVo appMemberPrizePageVo : memberPrizePageVoList){ + appMemberPrizePageVo.setVerifyCode("3-"+appMemberPrizePageVo.getPrizeId()); + if(appMemberPrizePageVo.getShopId()!=null){ + shopIdSet.add(appMemberPrizePageVo.getShopId()); + } + } + String shopJoinedString = String.join(",", shopIdSet.stream().map(Object::toString).collect(Collectors.toList())); + MgtBaseBathDto mgtBaseBathDto = new MgtBaseBathDto(); + mgtBaseBathDto.setIds(shopJoinedString); + List<MgtSimpleShopVo> simpleShopVoList = remoteShopService.listShopSimpleVoByIds(mgtBaseBathDto).getData(); + Map<Long, MgtSimpleShopVo> shopMap = simpleShopVoList.stream() + .collect(Collectors.toMap(MgtSimpleShopVo::getShopId, Function.identity())); + for(AppMemberPrizePageVo appMemberPrizePageVo : memberPrizePageVoList){ + appMemberPrizePageVo.setVerifyShopName(shopMap.get(appMemberPrizePageVo.getShopId().toString()).getShopName()); + } + } + return memberPrizePageVoList; + } } -- Gitblit v1.7.1