From 3e236d3f70dc55de0357b5ae19e1e3dd1682374f Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 08 一月 2020 14:01:43 +0800
Subject: [PATCH] 小程序动态修改
---
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java | 110 +++++++++++++++++++++++++++++++++++-------------------
1 files changed, 71 insertions(+), 39 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java
index cb4fa27..d782e60 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java
@@ -158,21 +158,29 @@
private UserTaoLiJinRecordService userTaoLiJinRecordService;
/**
- * 鑾峰彇娣樺疂鐨勫垎浜摼鎺�
*
* @param acceptData
* @param uid
* -鐢ㄦ埛ID
- * @param auctionId-鍟嗗搧ID
+ * @param goodsId-鍟嗗搧ID
+ * @param source
+ * @param totalNum
+ * @param goodsType
+ * @param needGoods
+ * -鏄惁闇�瑕佸晢鍝佷俊鎭�
+ * @param request
* @param out
*/
@RequestMapping(value = "createShareInfo")
public void createShareInfo(AcceptData acceptData, Long uid, Long goodsId, String source, Integer totalNum,
- Integer goodsType, HttpServletRequest request, PrintWriter out) {
+ Integer goodsType, Boolean needGoods, HttpServletRequest request, PrintWriter out) {
if (uid == null || uid <= 0) {
out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛ID涓嶈兘涓虹┖"));
return;
}
+
+ if (needGoods == null)
+ needGoods = false;
try {
// 鏃ュ織璁板綍
String info = String.format("type=share&uid=%s&goodsId=%s&source=%s&goodsType=%s", uid, goodsId, source,
@@ -194,36 +202,25 @@
// 娣樺疂
if (goodsType == null || goodsType == Constant.SOURCE_TYPE_TAOBAO) {
- createTaoBaoShare(acceptData, uid, goodsId, totalNum, source, request, out);
+ createTaoBaoShare(acceptData, uid, goodsId, totalNum, source, needGoods, request, out);
return;
}
// 浜笢
if (goodsType == Constant.SOURCE_TYPE_JD) {
- createJDShare(acceptData, uid, goodsId, source, out);
+ createJDShare(acceptData, uid, goodsId, source, needGoods, out);
return;
}
// 鎷煎澶�
if (goodsType == Constant.SOURCE_TYPE_PDD) {
- createPDDShare(acceptData, uid, goodsId, source, out);
+ createPDDShare(acceptData, uid, goodsId, source, needGoods, out);
return;
}
}
- public static String getERCodeContent(TaoBaoGoodsBrief goods, String token) {
- String content = String.format("銆�%s銆�%s鍏�", goods.getUserType() == 1 ? "T鐚环" : "T瀹濅环",
- MoneyBigDecimalUtil.getWithNoZera(goods.getZkPrice()) + "");
- content += "\n\r";
-
- if (!StringUtil.isNullOrEmpty(goods.getCouponInfo())) {
- content += String.format("銆愬埜鍚庝环銆�%s鍏�", TaoBaoUtil.getAfterUseCouplePrice(goods) + "");
- content += "\n\r";
- }
- content += "------------";
- content += "\n\r";
- content += "寰╁埗杩欐潯" + token + "锛岄�插叆Tao瀹濆嵆鍙喘涔�";
- return content;
+ public static String getERCodeContent(String template, TaoBaoGoodsBrief goods, String token) {
+ return template.replace("[娣樺彛浠", token);
}
/**
@@ -238,13 +235,20 @@
* @param out
*/
public void createTaoBaoShare(AcceptData acceptData, Long uid, Long goodsId, Integer totalNum, String source,
- HttpServletRequest request, PrintWriter out) {
+ Boolean needGoods, HttpServletRequest request, PrintWriter out) {
+ if (needGoods == null)
+ needGoods = false;
+
UserExtraTaoBaoInfo extraInfo = userExtraTaoBaoInfoService.getByUid(uid);
UserInfoExtra userExtraInfo = userInfoExtraService.getUserInfoExtra(uid);
String inviteCode = null;
- if (userExtraInfo != null)
- inviteCode = userExtraInfo.getInviteCode();
-
+ if (userExtraInfo != null) {
+ if (!StringUtil.isNullOrEmpty(userExtraInfo.getInviteCodeVip())) {
+ inviteCode = userExtraInfo.getInviteCodeVip();
+ } else {
+ inviteCode = userExtraInfo.getInviteCode();
+ }
+ }
String relationId = null;
if (extraInfo != null && extraInfo.getRelationId() != null && extraInfo.getRelationValid() != null
&& extraInfo.getRelationValid() == true)
@@ -267,6 +271,14 @@
// 娴嬭瘯
TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, goodsId, relationId);
+
+ if (taoBaoLink != null && taoBaoLink.getGoods() != null && needGoods) {
+ ConfigParamsDTO dto = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
+ acceptData.getVersion());
+
+ GoodsDetailVO goodsInfo = GoodsDetailVOFactory.convertTaoBao(taoBaoLink.getGoods(), dto);
+ shareInfo.setGoodsInfo(goodsInfo);
+ }
String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(),
Constant.systemCommonConfig.getShareGoodsPagePath(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY),
@@ -340,9 +352,11 @@
// 娴嬭瘯
// 2.0.2涔嬪墠
if (!VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), acceptData.getVersion()))
- shareInfo.setClickUrl(getERCodeContent(taoBaoLink.getGoods(), shareInfo.getToken()));
+ shareInfo.setClickUrl(getERCodeContent(configService.get("taobao_share_qrcode_text"),
+ taoBaoLink.getGoods(), shareInfo.getToken()));
- shareInfo.setWxErCode(getERCodeContent(taoBaoLink.getGoods(), shareInfo.getToken()));
+ shareInfo.setWxErCode(getERCodeContent(configService.get("taobao_share_qrcode_text"), taoBaoLink.getGoods(),
+ shareInfo.getToken()));
// 鎻愮ず鍥炬枃鍐呭
String imgs = configService.get("goods_share_notify_imgs");
@@ -371,7 +385,8 @@
}
}
- out.print(JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(shareInfo)));
+ out.print(JsonUtil.loadTrueResult(
+ JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create().toJson(shareInfo)));
final TaoBaoLink taobaoLink = taoBaoLink;
// 寮傛鎿嶄綔
@@ -389,7 +404,7 @@
history.setQuanLink(taobaoLink.getCouponLink());
history.setGoodsId(taobaoLink.getGoods().getAuctionId());
history.setPostPicture(taobaoLink.getGoods().getPictUrl());
-
+ history.setShareImg(taobaoLink.getClickUrl());
List<String> imgList = taobaoLink.getGoods().getImgList();
if (imgList == null) {
imgList = new ArrayList<>();
@@ -570,7 +585,7 @@
history.setQuanLink(taobaoLink.getCouponLink());
history.setGoodsId(finalGoods.getAuctionId());
history.setPostPicture(finalGoods.getPictUrl());
-
+ history.setShareImg(taobaoLink.getClickUrl());
List<String> imgList = finalGoods.getImgList();
if (imgList == null) {
imgList = new ArrayList<>();
@@ -598,7 +613,8 @@
* @param request
* @param out
*/
- public void createJDShare(AcceptData acceptData, Long uid, Long goodsId, String source, PrintWriter out) {
+ public void createJDShare(AcceptData acceptData, Long uid, Long goodsId, String source, boolean needGoods,
+ PrintWriter out) {
JDGoods jdGoods = jdGoodsCacheUtil.getGoodsInfo(goodsId);
if (jdGoods == null) {
out.print(JsonUtil.loadFalseResult(1, "璇ュ晢鍝佸凡涓嬫灦"));
@@ -617,7 +633,8 @@
couponUrl = couponInfo.getLink();
}
String materialId = "https://item.jd.com/" + goodsId + ".html";
- String jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "", uid + "");
+ String jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "",
+ uid + "");
ShareInfoVO shareInfo = new ShareInfoVO();
shareInfo.setClickUrl(jumpLink);
@@ -625,6 +642,10 @@
shareInfo.setRule(configService.get("share_rule_link_jd"));
shareInfo.setPictUrl(jdGoods.getPicUrl());
shareInfo.setCommentTexts(new ArrayList<>());
+
+ if (needGoods)
+ shareInfo.setGoodsInfo(GoodsDetailVOFactory.convertJDGoods(jdGoods,
+ hongBaoManageService.getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion())));
String shareText = "";
boolean hasCoupon = false;
@@ -678,7 +699,8 @@
e1.printStackTrace();
}
}
- out.print(JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(shareInfo)));
+ out.print(JsonUtil.loadTrueResult(
+ JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create().toJson(shareInfo)));
// 寮傛鎿嶄綔
final JDGoods goods = jdGoods;
@@ -696,7 +718,8 @@
history.setQuanLink(null);
history.setGoodsId(goodsId);
history.setPostPicture(goods.getPicUrl());
-
+ history.setShareImg(jumpLink);
+
List<String> imgList = goods.getImageList();
if (imgList == null) {
imgList = new ArrayList<>();
@@ -716,7 +739,8 @@
* @param source
* @param out
*/
- public void createPDDShare(AcceptData acceptData, Long uid, Long goodsId, String source, PrintWriter out) {
+ public void createPDDShare(AcceptData acceptData, Long uid, Long goodsId, String source, boolean needGoods,
+ PrintWriter out) {
PDDGoodsDetail goods = pinDuoDuoCacheUtil.getGoodsInfo(goodsId);
if (goods == null) {
out.print(JsonUtil.loadFalseResult(1, "璇ュ晢鍝佸凡涓嬫灦"));
@@ -737,6 +761,13 @@
shareInfo.setCommentTexts(new ArrayList<>());
shareInfo.setRule(configService.get("share_rule_link_pdd"));
shareInfo.setPictUrl(goods.getGoodsImageUrl());
+ if (needGoods) {
+ shareInfo
+ .setGoodsInfo(GoodsDetailVOFactory.convertPDDGoods(goods,
+ new ConfigParamsDTO(hongBaoManageService.getFanLiRate(),
+ hongBaoManageService.getShareRate(), Constant.MAX_REWARD_RATE,
+ hongBaoManageService.getVIPFanLiRate())));
+ }
String template = "";
boolean hasCoupon = false;
@@ -795,7 +826,8 @@
e1.printStackTrace();
}
}
- out.print(JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(shareInfo)));
+ out.print(JsonUtil.loadTrueResult(
+ JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create().toJson(shareInfo)));
// 寮傛鎿嶄綔
com.yeshi.fanli.util.ThreadUtil.run(new Runnable() {
@@ -812,7 +844,7 @@
history.setQuanLink(null);
history.setGoodsId(goodsId);
history.setPostPicture(goods.getGoodsImageUrl());
-
+ history.setShareImg(jumpLink);
List<String> imgList = null;
String[] goodsGalleryUrls = goods.getGoodsGalleryUrls();
if (goodsGalleryUrls != null) {
@@ -1020,7 +1052,8 @@
couponUrl = couponInfo.getLink();
}
String materialId = "https://item.jd.com/" + goodsId + ".html";
- String shortLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "", uid + "");
+ String shortLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "",
+ uid + "");
String content = shareGoodsTextTemplateService.createContentByTemplateJD(template, uid, goods, shortLink,
hasCoupon);
@@ -1383,9 +1416,8 @@
}
}
- BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
- BigDecimal shareRate = hongBaoManageService.getShareRate();
- ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE);
+ ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
+ acceptData.getVersion());
Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
.excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
--
Gitblit v1.8.0