From 156e141e55a8abf486157d1fa89d25e23f4a06a3 Mon Sep 17 00:00:00 2001 From: jiangqs <jiangqs> Date: 星期五, 25 八月 2023 19:32:30 +0800 Subject: [PATCH] bug --- ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/coupon/CouponServiceImpl.java | 38 ++++++++++++++++++++++++++------------ 1 files changed, 26 insertions(+), 12 deletions(-) diff --git a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/coupon/CouponServiceImpl.java b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/coupon/CouponServiceImpl.java index 5d8ad02..9d959a4 100644 --- a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/coupon/CouponServiceImpl.java +++ b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/coupon/CouponServiceImpl.java @@ -111,6 +111,7 @@ BigDecimal discountPercent; String useLimit = ""; for(MgtCouponPageVo mgtCouponPageVo : mgtCouponPageVoList){ + useLimit = null; //处理使用限制 couponType = mgtCouponPageVo.getCouponType(); if(couponType.equals("满减")){ @@ -123,7 +124,7 @@ discountPercent = mgtCouponPageVo.getDiscountPercent(); useLimit = discountPercent.toString() + "折"; } - if(couponType.equals("抵扣")){ + if(couponType.equals("代金")){ discountMoney = mgtCouponPageVo.getDiscountMoney(); useLimit = discountMoney.toString(); } @@ -133,7 +134,7 @@ if(validTimeType==1){ validStartTime = mgtCouponPageVo.getValidStartTime(); validEndTime = mgtCouponPageVo.getValidEndTime(); - validTime = DateUtils.dateTime(validStartTime) + '-' + DateUtils.dateTime(validEndTime); + validTime = DateUtils.parseDateToStr("yyyy-MM-dd",validStartTime) + '-' + DateUtils.parseDateToStr("yyyy-MM-dd",validEndTime); }else if(validTimeType==2){ validDay = mgtCouponPageVo.getValidDay(); validTime = "领取之日起" + validDay.toString() + "天"; @@ -209,21 +210,24 @@ * @description 平台获取优惠券编辑信息 * @author jqs * @date 2023/6/13 14:29 - * @param couponId + * @param merBaseGetDto * @return MgtCouponGetVo */ @Override - public MerCouponGetVo getMerCouponVo(String couponId){ + public MerCouponGetVo getMerCouponVo(MerBaseGetDto merBaseGetDto){ MerCouponGetVo merCouponGetVo = new MerCouponGetVo(); - Coupon coupon = this.getById(couponId); + Coupon coupon = this.getById(merBaseGetDto.getId()); BeanUtils.copyProperties(coupon, merCouponGetVo); //判断优惠券是否为指定商品 if(coupon.getUseScope()==2){ String relGoodsIds = coupon.getRelGoodsIds(); if(StringUtils.isNotBlank(relGoodsIds)){ //获取指定商品列表 - List<MerGoodsPriceListVo> goodsList = remoteGoodsService.listGoodsPriceByGoodsId(relGoodsIds).getData(); - if(!goodsList.isEmpty()){ + MerGoodsPriceListDto merGoodsPriceListDto = new MerGoodsPriceListDto(); + merGoodsPriceListDto.setGoodsIds(relGoodsIds); + merGoodsPriceListDto.setShopId(merBaseGetDto.getShopId()); + List<MerGoodsPriceListVo> goodsList = remoteGoodsService.listGoodsPriceByGoodsId(merGoodsPriceListDto).getData(); + if(goodsList!=null&&!goodsList.isEmpty()){ merCouponGetVo.setRelGoodsList(goodsList); } } @@ -296,6 +300,7 @@ coupon.setRelationType(mgtCouponEditDto.getRelationType()); coupon.setRelationActivityType(mgtCouponEditDto.getRelationActivityType()); coupon.setRelationActivityId(mgtCouponEditDto.getRelationActivityId()); + coupon.setPropagandaPoster(mgtCouponEditDto.getPropagandaPoster()); //判断是否指定商品 if(coupon.getUseScope()==2&&!mgtCouponEditDto.getRelGoodsIdList().isEmpty()){ List<String> relGoodsIdList = mgtCouponEditDto.getRelGoodsIdList(); @@ -435,7 +440,7 @@ memberCoupon.setDelFlag(0); memberCoupon.setCouponId(coupon.getCouponId()); memberCoupon.setUserId(userId); - memberCoupon.setShopId(coupon.getShopId()); + //memberCoupon.setShopId(coupon.getShopId()); memberCoupon.setCouponType(coupon.getCouponType()); memberCoupon.setCouponStatus(coupon.getCouponStatus()); memberCoupon.setCouponName(coupon.getCouponName()); @@ -522,7 +527,9 @@ memberCoupon.setDelFlag(0); memberCoupon.setCouponId(coupon.getCouponId()); memberCoupon.setUserId(userId); - memberCoupon.setShopId(coupon.getShopId()); + if(coupon.getCouponFrom()==2){ + memberCoupon.setShopId(coupon.getShopId()); + } memberCoupon.setCouponType(coupon.getCouponType()); memberCoupon.setCouponStatus(coupon.getCouponStatus()); memberCoupon.setCouponName(coupon.getCouponName()); @@ -694,7 +701,7 @@ if(validTimeType==1){ validStartTime = mgtCouponAuditPageVo.getValidStartTime(); validEndTime = mgtCouponAuditPageVo.getValidEndTime(); - validTime = DateUtils.dateTime(validStartTime) + '-' + DateUtils.dateTime(validEndTime); + validTime = DateUtils.parseDateToStr("yyyy-MM-dd",validStartTime) + '-' + DateUtils.parseDateToStr("yyyy-MM-dd",validEndTime); }else if(validTimeType==2){ validDay = mgtCouponAuditPageVo.getValidDay(); validTime = "领取之日起" + validDay.toString() + "天"; @@ -798,7 +805,7 @@ coupon.setUpdateTime(new Date()); coupon.setUpdateUserId(mgtCouponAuditDto.getUserId()); //审核通过后判断是否立即发放 - if(coupon.getAuditStatus()==2&&coupon.getSendTimeType()==1){ + if(coupon.getAuditStatus()==2&&coupon.getSendType()==2&&coupon.getSendTimeType()==1){ List<CouponRelUser> couponRelUserList = couponRelUserService.list(new LambdaQueryWrapper<CouponRelUser>().eq(CouponRelUser::getDelFlag,0).eq(CouponRelUser::getCouponId,coupon.getCouponId())); List<Long> userIdList = new ArrayList<>(); if(couponRelUserList!=null&&!couponRelUserList.isEmpty()){ @@ -866,6 +873,7 @@ validTime = "领取之日起" + validDay.toString() + "天"; } merCouponPageVo.setValidTime(validTime); + merCouponPageVo.setCouponCode("https://hongruitang.oss-cn-beijing.aliyuncs.com/2023/8/3/couponCode.jpg"); } } return couponPageVoList; @@ -990,6 +998,7 @@ coupon.setUpdateTime(new Date()); coupon.setUpdateUserId(merCouponEditDto.getUserId()); coupon.setRelationType(1); + coupon.setPropagandaPoster(merCouponEditDto.getPropagandaPoster()); //判断是否指定商品 if(coupon.getUseScope()==2&&!merCouponEditDto.getRelGoodsIdList().isEmpty()){ List<String> relGoodsIdList = merCouponEditDto.getRelGoodsIdList(); @@ -1063,6 +1072,9 @@ for(BirthdayGiftSendDto birthdayGiftSendDto : giftSendDtoList){ couponId = birthdayGiftSendDto.getCouponId(); coupon = this.getById(couponId); + if(coupon==null||coupon.getCouponStatus()!=1){ + throw new ServiceException(AppErrorConstant.COUPON_GET_ERROR); + } for(int i=0;i<birthdayGiftSendDto.getCouponNumber();i++){ memberCoupon = new MemberCoupon(); memberCouponId = IdUtils.simpleUUID(); @@ -1178,7 +1190,9 @@ memberCoupon.setDelFlag(0); memberCoupon.setCouponId(couponId); memberCoupon.setUserId(userId); - memberCoupon.setShopId(shopId); + if(coupon.getCouponFrom()==2){ + memberCoupon.setShopId(shopId); + } memberCoupon.setCouponType(coupon.getCouponType()); memberCoupon.setCouponStatus(coupon.getCouponStatus()); memberCoupon.setCouponName(coupon.getCouponName()); -- Gitblit v1.7.1