From 2012b3b5db3c6b06535a68f775bcc81b16151b90 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 06 九月 2019 16:54:00 +0800 Subject: [PATCH] 加入任务 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ShareController.java | 59 ++++++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 40 insertions(+), 19 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ShareController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ShareController.java index 4853663..8b381b1 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ShareController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ShareController.java @@ -34,8 +34,8 @@ import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra; import com.yeshi.fanli.entity.taobao.TaoBaoLink; import com.yeshi.fanli.entity.taobao.TaoKeAppInfo; -import com.yeshi.fanli.exception.ShareGoodsException; import com.yeshi.fanli.exception.goods.ShareGoodsTextTemplateException; +import com.yeshi.fanli.exception.share.ShareGoodsException; import com.yeshi.fanli.exception.share.UserShareGoodsRecordException; import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException; import com.yeshi.fanli.exception.tlj.UserTaoLiJinRecordException; @@ -205,8 +205,7 @@ data.put("clickUrl", url); data.put("token", taoBaoLink.getTaoToken()); - data.put("rule", - "http://apph5.yeshitv.com/apppage/all_help_content.html?id=148&from=singlemessage&isappinstalled=0"); + data.put("rule", configService.get("share_single_goods_rule")); data.put("pictUrl", TbImgUtil.getTBSizeImg(taoBaoLink.getGoods().getPictUrl(), 500)); String shareText = ""; @@ -254,7 +253,7 @@ data.put("shareMoney", "楼" + shareMoney.toString()); try { - ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsDetail(uid, auctionId); + ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsDetail(uid, auctionId, Constant.SOURCE_TYPE_TAOBAO, false); data.put("shareId", shareRecord.getRedisKey()); } catch (Exception e) { try { @@ -321,7 +320,7 @@ TaoBaoGoodsBrief goods = taoBaoLink.getGoods(); // 璁$畻鎺ㄥ箍绾㈠寘 - String warningRate = configTaoLiJinService.getValueByKey("warning_value"); + String warningRate = configTaoLiJinService.getValueByKey("warning_value",null); BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, goods); // 鎺ㄥ箍绾㈠寘 涓嶈兘灏忎簬1 @@ -388,7 +387,7 @@ { String text = shareGoodsTextTemplateService.getTaoLiJinTemplate(uid); if (StringUtil.isNullOrEmpty(text)) - text = configTaoLiJinService.getValueByKey("goods_share_text"); + text = configTaoLiJinService.getValueByKey("goods_share_text",new Date()); shareText = text.replace("{鏍囬}", taoBaoLink.getGoods().getTitle()) .replace("{鍟嗗搧鍘熶环}", MoneyBigDecimalUtil.getWithNoZera(taoBaoLink.getGoods().getZkPrice()) + "") @@ -420,7 +419,7 @@ data.put("shareMoney", "楼" + shareMoney.toString()); try { - ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsDetail(uid, auctionId); + ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsDetail(uid, auctionId, Constant.SOURCE_TYPE_TAOBAO, true); data.put("shareId", shareRecord.getRedisKey()); } catch (Exception e) { try { @@ -586,7 +585,7 @@ @RequestMapping(value = "sharedetail", method = RequestMethod.POST) public void shareDetail(AcceptData acceptData, Long uid, Long auctionId, String type, PrintWriter out) { try { - userShareGoodsRecordService.saveSingleShareRecord(uid, auctionId); + userShareGoodsRecordService.saveSingleShareRecord(uid, auctionId, Constant.SOURCE_TYPE_TAOBAO); out.print(JsonUtil.loadTrueResult("鍒嗕韩鎴愬姛")); } catch (UserShareGoodsRecordException e) { out.print(JsonUtil.loadFalseResult(e.getMsg())); @@ -608,6 +607,7 @@ public void updateRecord(AcceptData acceptData, String shareId, String type, PrintWriter out) { if (StringUtil.isNullOrEmpty(shareId)) { out.print(JsonUtil.loadFalseResult("鍙傛暟涓嶆纭�")); + return; } // 鏇存柊鍒嗕韩鐢熸晥 @@ -615,7 +615,7 @@ @Override public void run() { try { - userShareGoodsRecordService.takeEffectShareRecord(shareId); + userShareGoodsRecordService.takeEffectShareRecord(acceptData, shareId); } catch (UserShareGoodsRecordException eu) { try { LogHelper.errorDetailInfo(eu); @@ -835,7 +835,7 @@ if (tljId != null) { String template = shareGoodsTextTemplateService.getTaoLiJinTemplate(uid); if (StringUtil.isNullOrEmpty(template)) - template = configTaoLiJinService.getValueByKey("goods_share_text"); + template = configTaoLiJinService.getValueByKey("goods_share_text",new Date()); return template; } else { String template = shareGoodsTextTemplateService.geteCouponTemplate(uid); @@ -886,7 +886,7 @@ @RequestMapping(value = "getShareTextTemplateRules", method = RequestMethod.POST) public void getShareTextTemplateRules(AcceptData acceptData, Long tljId, PrintWriter out) { if (tljId != null) { - out.print(JsonUtil.loadTrueResult(configTaoLiJinService.getValueByKey("share_goods_rules"))); + out.print(JsonUtil.loadTrueResult(configTaoLiJinService.getValueByKey("share_goods_rules",new Date()))); } else { out.print(JsonUtil.loadTrueResult(configService.get("share_goods_template_rules"))); } @@ -927,19 +927,40 @@ if (cid == 1 || cid == 2) { // 1 鐑攢鍗曞搧 2 鎺ㄨ崘濂借揣 if (cid == 1) { List<GoodsPicture> imgs = dynamicInfo.getImgs(); + if (imgs == null || imgs.size() == 0) { + out.print(JsonUtil.loadFalseResult("璇ュ晢鍝佸凡涓嬫灦")); + return; + } + GoodsPicture goodsPicture = imgs.get(0); if (goodsPicture.getGoodState() == 1) { out.print(JsonUtil.loadFalseResult("璇ュ晢鍝佸凡涓嬫灦")); return; - } else { - TaoBaoGoodsBriefExtra goods = goodsPicture.getGoods(); - try { - TaoKeApiUtil.getSimpleGoodsInfo(goods.getAuctionId()); - } catch (TaobaoGoodsDownException e) { - out.print(JsonUtil.loadFalseResult("璇ュ晢鍝佸凡涓嬫灦")); - return; - } + } + + TaoBaoGoodsBriefExtra goods = goodsPicture.getGoods(); + if (goods == null) { + out.print(JsonUtil.loadFalseResult("璇ュ晢鍝佸凡涓嬫灦")); + return; } + + if (goods.getState() != null && goods.getState() == 1) { + out.print(JsonUtil.loadFalseResult("璇ュ晢鍝佸凡涓嬫灦")); + return; + } + + if (!goods.isCoupon()) { + out.print(JsonUtil.loadFalseResult("璇ュ晢鍝佸凡涓嬫灦")); + return; + } + + try { + TaoKeApiUtil.getSimpleGoodsInfo(goods.getAuctionId()); + } catch (TaobaoGoodsDownException e) { + out.print(JsonUtil.loadFalseResult("璇ュ晢鍝佸凡涓嬫灦")); + return; + } + } // 鍒嗕韩鏂囧瓧 -- Gitblit v1.8.0