From 0d93550e4361b0934f89635213fb6666d7f2c5ef Mon Sep 17 00:00:00 2001 From: sj <1304317391@qq.com> Date: Wed, 9 Nov 2022 18:21:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8B=BC=E5=9B=A2=E5=8F=8A?= =?UTF-8?q?=E7=A0=8D=E4=BB=B7=E6=B4=BB=E5=8A=A8=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-local.yaml | 2 +- .../rest/AppStoreSeckillController.java | 2 +- .../co/yixiang/constant/ShopConstants.java | 5 ++ .../java/co/yixiang/event/TemplateBean.java | 6 ++ .../co/yixiang/event/TemplateListenEnum.java | 4 +- .../impl/YxStoreBargainServiceImpl.java | 26 ++++++-- .../service/impl/YxStorePinkServiceImpl.java | 32 ++++++++- .../modules/mp/enums/WechatTempateEnum.java | 4 +- .../modules/mp/listener/TemplateListener.java | 8 ++- .../mp/service/WeiXinSubscribeService.java | 65 +++++++++++++++++++ 10 files changed, 144 insertions(+), 10 deletions(-) diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index 30b9b3f0..78e1d187 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -244,7 +244,7 @@ dubbo: bxg: shop: # API_URL: http://192.168.10.113:48080/bxgApp - API_URL: https://9783-27-19-79-200.jp.ngrok.io + API_URL: https://25eb-27-19-79-7.jp.ngrok.io SITE_URL: http://192.168.10.113:48080/bxgApp UNI_SITE_URL: http://192.168.10.113:48080/bxgApp ADMIN_API_URL: http://192.168.10.113:48080/bxg diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreSeckillController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreSeckillController.java index 2f96a114..6c1d9f48 100644 --- a/zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreSeckillController.java +++ b/zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreSeckillController.java @@ -117,7 +117,7 @@ public class AppStoreSeckillController { yxSystemGroupDataList.forEach(i -> { String jsonStr = i.getValue(); JSONObject jsonObject = JSON.parseObject(jsonStr); - int time = Integer.valueOf(jsonObject.get("time").toString());//时间 5 + int time = Integer.valueOf(jsonObject.get("time").toString());//开启时间(几点) 5 int continued = Integer.valueOf(jsonObject.get("continued").toString());//活动持续事件 3 String rule=""; if (jsonObject.get("rule")!=null){ diff --git a/zsw-bxg/src/main/java/co/yixiang/constant/ShopConstants.java b/zsw-bxg/src/main/java/co/yixiang/constant/ShopConstants.java index a716a81e..f1c198a0 100644 --- a/zsw-bxg/src/main/java/co/yixiang/constant/ShopConstants.java +++ b/zsw-bxg/src/main/java/co/yixiang/constant/ShopConstants.java @@ -190,6 +190,11 @@ public interface ShopConstants { String SHOP_WECHAT_NEAR_COUPON = "您领取的券即将到期,请尽快使用"; + String SHOP_WECHAT_BARGAIN_RESULT_SUCCESS = "恭喜您,本次砍价活动成功,快去最低价购买吧"; + String SHOP_WECHAT_BARGAIN_RESULT_FAIL = "很遗憾,本次砍价活动失败"; + + String SHOP_WECHAT_COMBINATION_RESULT_SUCCESS = "恭喜您,本次拼团活动成功,商品将安排配送"; + String SHOP_WECHAT_COMBINATION_RESULT_FAIL = "很遗憾,本次拼团活动失败"; String DEFAULT_UNI_H5_URL = "https://www.lotus-wallet.com"; String ZSW_MINI_SESSION_KET = "zsw:session_key:"; diff --git a/zsw-bxg/src/main/java/co/yixiang/event/TemplateBean.java b/zsw-bxg/src/main/java/co/yixiang/event/TemplateBean.java index b24d96cf..916591ba 100644 --- a/zsw-bxg/src/main/java/co/yixiang/event/TemplateBean.java +++ b/zsw-bxg/src/main/java/co/yixiang/event/TemplateBean.java @@ -6,6 +6,8 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import java.math.BigDecimal; + /** * @ClassName TemplateBean * @Author hupeng <610796224@qq.com> @@ -24,7 +26,11 @@ public class TemplateBean { private String deliveryName; private String deliveryId; private String payType; + private Long productId; //商品名字 + private Boolean result; private Long uid; + private BigDecimal payPrice; //拼团活动实付金额 + private BigDecimal refundPrice; //拼团活动退款金额 /** * 提现申请ID */ diff --git a/zsw-bxg/src/main/java/co/yixiang/event/TemplateListenEnum.java b/zsw-bxg/src/main/java/co/yixiang/event/TemplateListenEnum.java index fecad185..5af11347 100644 --- a/zsw-bxg/src/main/java/co/yixiang/event/TemplateListenEnum.java +++ b/zsw-bxg/src/main/java/co/yixiang/event/TemplateListenEnum.java @@ -24,7 +24,9 @@ public enum TemplateListenEnum { TYPE_8("8","用户提现通知"), TYPE_9("9","退款申请通知"), TYPE_10("10","用户获得优惠券后发送订阅通知"), - TYPE_11("11","用户优惠券将过期发送推送"); + TYPE_11("11","用户优惠券将过期发送推送"), + TYPE_12("12","用户发起砍价活动结果通知"), + TYPE_13("13","用户参加拼团活动结果通知"); private String value; private String desc; diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreBargainServiceImpl.java b/zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreBargainServiceImpl.java index 214eb489..327e376f 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreBargainServiceImpl.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreBargainServiceImpl.java @@ -8,6 +8,7 @@ */ package co.yixiang.modules.activity.service.impl; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; @@ -18,6 +19,9 @@ import co.yixiang.common.utils.QueryHelpPlus; import co.yixiang.dozer.service.IGenerator; import co.yixiang.enums.OrderInfoEnum; import co.yixiang.enums.ShopCommonEnum; +import co.yixiang.event.TemplateBean; +import co.yixiang.event.TemplateEvent; +import co.yixiang.event.TemplateListenEnum; import co.yixiang.exception.BadRequestException; import co.yixiang.modules.activity.domain.YxStoreBargain; import co.yixiang.modules.activity.domain.YxStoreBargainUser; @@ -32,8 +36,10 @@ import co.yixiang.modules.activity.vo.BargainCountVo; import co.yixiang.modules.activity.vo.BargainVo; import co.yixiang.modules.activity.vo.TopCountVo; import co.yixiang.modules.activity.vo.YxStoreBargainQueryVo; +import co.yixiang.modules.hotList.domain.YxStoreHotList; import co.yixiang.modules.order.domain.YxStoreOrder; import co.yixiang.modules.order.service.YxStoreOrderService; +import co.yixiang.modules.product.service.YxStoreProductService; import co.yixiang.modules.product.service.mapper.StoreProductMapper; import co.yixiang.modules.shop.service.YxSystemConfigService; import co.yixiang.modules.template.domain.YxShippingTemplates; @@ -46,6 +52,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.github.pagehelper.PageInfo; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationEventPublisher; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; @@ -71,7 +78,8 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl implements YxStorePinkService { + @Autowired + private ApplicationEventPublisher publisher; @Autowired private IGenerator generator; @Autowired @@ -95,7 +102,6 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl 0){ //其他成员入团 + //如果该用户已经在团内 if(this.getIsPinkUid(order.getPinkId(),order.getUid())) { return; } @@ -330,6 +337,19 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl map = new HashMap<>(); + map.put("first","砍价活动结果提醒:"); + map.put("thing4",productName); //商品名称 + if (result){ + map.put("phrase1","成功"); //成功或失败 + map.put("thing3", ShopConstants.SHOP_WECHAT_BARGAIN_RESULT_SUCCESS); + }else { + map.put("phrase1","失败"); //成功或失败 + map.put("thing3", ShopConstants.SHOP_WECHAT_BARGAIN_RESULT_FAIL); + } + String tempId = this.getTempId(WechatTempateEnum.BARGAIN_RESULT.getValue()); + if(StrUtil.isNotBlank(tempId)) { + this.sendSubscribeMsg( openid, tempId,"pages/Loading/index",map); + } + } + + /** + * 砍价活动结果通知 + * @param productId 拼团商品id + * @param time 开团时间 + * @param result true成功false失败 + * @param payPrice 实付金额 + * @param refundPrice 退款金额 + * @param uid uid + */ + public void combinationResult(Long productId, Boolean result, Long uid, String time, BigDecimal payPrice,BigDecimal refundPrice){ + String openid = this.getUserOpenid(uid); + String productName=yxStoreProductService.getById(productId).getStoreName(); + if(StrUtil.isBlank(openid)) { + return; + } + Map map = new HashMap<>(); + map.put("first","拼团活动结果提醒:"); + map.put("thing1",productName); //商品名称 + map.put("thing2",time); //开团时间 + if (result){ + map.put("thing3","成功"); //成功 + map.put("remark", ShopConstants.SHOP_WECHAT_COMBINATION_RESULT_SUCCESS); + }else { + map.put("thing3","失败"); //失败 + map.put("remark", ShopConstants.SHOP_WECHAT_COMBINATION_RESULT_FAIL); + } + map.put("amount4", String.valueOf(payPrice)); //实付金额 + map.put("amount5", String.valueOf(refundPrice)); //退款金额 + String tempId = this.getTempId(WechatTempateEnum.COMBINATION_RESULT.getValue()); + if(StrUtil.isNotBlank(tempId)) { + this.sendSubscribeMsg( openid, tempId,"pages/Loading/index",map); + } + } /** * 优惠券将要过期通知 * @param couponId 获得优惠券的id