Commit bedb72be authored by shiyu's avatar shiyu

团购商品详情页

parent 58c6e1b9
......@@ -57,6 +57,11 @@ public interface CommConsts {
*/
public static final Long SYSTEM_SELLER = 291997L;
/**
* 商品售卖规则图片
*/
public static final String APPEND_IMAGE_URL = "https://cdn.wanwudezhi.com/static/web-static/image/45c68b2b5b142d3f02981cd8ee41d754_1308x200.png";
/**
* 系统默认用户头像URL
*/
......@@ -119,7 +124,7 @@ public interface CommConsts {
/**
* 消息跳转团购商品详情
*/
public final static String ITEM_OF_GROUPPURCHASE_URL = "/pages/saleAuctionDetail/index";
public final static String ITEM_OF_GROUPPURCHASE_URL = "/pages/saleGroupDetail/index";
/**
......
......@@ -14,6 +14,7 @@ public class DisposableSubscribeRecordEnum {
ITEM_PRE_END(3, "XhEvunfXdO0j5JSpCVKKYlLuQbF7Yux8QfVEz5_L9xQ", "拍品即将结束"),
GROUPPURASE_SURPLUS_AMOUNT_PAY(4, "e6-VlkWBST_sN3PQ2Yx3iuPkxQL5Hf6cfMia3MDNinc", "尾款支付提醒"),
GROUPPURASE_CLOSER_TO_SUCCESS(5, "ekZ3s3OL6ZlWnORvvMOONfWNZsbm6DTlMNyv_2j2ijk", "拼团待成团提醒"),
GROUPPURASE_RATE(6, "nmpPtwVrFo261tcRbMvCK8NeAztDnrUubwh-04J4_Ow", "拼团进度提醒"),
;
private int type;
......
......@@ -37,6 +37,11 @@ public class GroupPurchaseNoticeMsg implements Entity {
private String itemName;
/**
* 进度
*/
private String rate;
/**
* 商品数量
*/
......@@ -97,4 +102,9 @@ public class GroupPurchaseNoticeMsg implements Entity {
* 拼团剩余时间
*/
private String surplusTime;
/**
* 团购结束时间
*/
private String endTime;
}
......@@ -841,6 +841,47 @@ public class SendMsgServiceImpl implements SendMsgService {
return Result.success();
}
@Override
public Result sendGroupPurchaseRateMsg(GroupPurchaseNoticeMsg groupPurchaseNoticeMsg) {
String openId = groupPurchaseNoticeMsg.getOpenId();
String token = wxAppletApi.getAppletAccessToken();
String url = SEND_SUBSCRIBE_MSG_URL + "?access_token=" + token;
OkHttpUtil okHttpUtil = OkHttpUtil.builder().url(url);
Map<String, Object> map = new HashMap<>();
map.put("touser", openId);
map.put("template_id", DisposableSubscribeRecordEnum.TypeEnum.GROUPPURASE_RATE.getTemplateId());
Map<String, Object> miniprogramMap = new HashMap<>();
miniprogramMap.put("appid", APPLET_APPID);
StringBuffer stringBuffer = new StringBuffer(CommConsts.ITEM_OF_GROUPPURCHASE_URL);
stringBuffer.append("?itemId=" + groupPurchaseNoticeMsg.getItemId());
map.put("page", stringBuffer.toString());
Map<String, Object> paramMap = new LinkedHashMap<>();
paramMap.put("thing1", new HashMap() {{
put("value", groupPurchaseNoticeMsg.getItemName());
}});
paramMap.put("thing2", new HashMap() {{
put("value", groupPurchaseNoticeMsg.getRate());
}});
paramMap.put("date8", new HashMap() {{
put("value", groupPurchaseNoticeMsg.getEndTime());
}});
map.put("data", paramMap);
logger.info("============ 拼团进度提醒订阅消息内容 : {}", JsonUtils.fromMap(map));
okHttpUtil.addParams(map);
okHttpUtil.post(true);
String responseStr = okHttpUtil.async();
logger.info("openid : {}, 发送拼团进度提醒订阅消息内容 response :{}", openId, responseStr);
String errorCode = JsonUtils.getValueByPath(responseStr, "errcode");
String errmsg = JsonUtils.getValueByPath(responseStr, "errmsg");
if (!"0".equals(errorCode)) {
logger.error("openid : {}, 发送拼团进度提醒订阅消息内容, errorCode : {}, errmsg : {} ", openId, errorCode, errmsg);
return Result.failed(responseStr);
}
logger.info("============= 发送拼团进度提醒订阅消息内容成功 ===========");
return Result.success();
}
@Override
public Result followNoticeMsg(FollowFansMsg followFansMsg) {
try {
......
......@@ -110,4 +110,13 @@ public interface SendMsgService {
* @return
*/
Result sendGroupPurchasecloserToSuccessMsg(GroupPurchaseNoticeMsg groupPurchaseNoticeMsg);
/**
* 拼团进度提醒
* 结束前2小时发送
* @param groupPurchaseNoticeMsg
* @return
*/
Result sendGroupPurchaseRateMsg(GroupPurchaseNoticeMsg groupPurchaseNoticeMsg);
}
......@@ -43,6 +43,21 @@ public class GroupPurchaseItemVo implements Entity {
*/
private String videos;
/**
* 页面插图
*/
private String appendImageUrl;
/**
* 分享提示
*/
private String shareTip;
/**
* 介绍人佣金
*/
private String introduceCost;
/**
* 简介
*/
......
......@@ -177,6 +177,9 @@ public class GroupPurchaseServiceImpl implements GroupPurchaseService {
groupPurchaseItemVo.setDescription(supplierItem.getDescription());
//众筹规则的图片url
groupPurchaseItemVo.setRuleUrl("https://cdn.wanwudezhi.com/quanku/802de83c450f4b15b518496cabc5079c_720x722.jpg");
groupPurchaseItemVo.setAppendImageUrl(CommConsts.APPEND_IMAGE_URL);
User user = cacheUtil.appletUserInfoCache.get(supplierItem.getCreatorId()).get();
groupPurchaseItemVo.setCreatorName(user.getNickname());
groupPurchaseItemVo.setCreatorId(supplierItem.getCreatorId());
......@@ -204,6 +207,12 @@ public class GroupPurchaseServiceImpl implements GroupPurchaseService {
groupPurchaseItemVo.setBuyLimitNum(groupPurchaseConfig.getLimitNum());
groupPurchaseConfig.setWxQrcode(groupPurchaseConfig.getWxQrcode());
groupPurchaseItemVo.setIsSubscribedOfCloseToSuccess(disposableSubscribeRecordDao.isSubscribed(dto.getUserId(), itemId, DisposableSubscribeRecordEnum.TypeEnum.GROUPPURASE_CLOSER_TO_SUCCESS.getType()));
//估算介绍佣金
double rebate = 0.03;
double introduceCost = groupPurchaseConfig.getPrice().doubleValue() * rebate;
groupPurchaseItemVo.setIntroduceCost(PriceUtil.convertDoubleToString(introduceCost));
String shareTip = "分享商品,成交最高可得3%(" + PriceUtil.convertDoubleToString(introduceCost ) + ")的介绍佣金";
groupPurchaseItemVo.setShareTip(shareTip);
return Result.success(groupPurchaseItemVo);
} catch (Exception e) {
logger.error("查询团购商品详情失败 error : {}", e);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment