Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
| | |
| | | import com.yeshi.fanli.service.inter.push.PushService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
|
| | | import com.yeshi.fanli.util.factory.JumpDetailParamsFactory;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | |
| | | * @param uid
|
| | | * @param deviceToken
|
| | | */
|
| | |
|
| | | @RequestSerializableByKey(key = "#acceptData.device")
|
| | | @RequestMapping(value = "/uidBindDeviceToken", method = RequestMethod.POST)
|
| | | public void uidBindIOSDeviceToken(AcceptData acceptData, Long uid, String deviceToken, PrintWriter out) {
|
| | | if (uid != null && uid != 0 && !StringUtil.isNullOrEmpty(deviceToken)) {
|
| | |
| | | * -用户ID
|
| | | * @param out
|
| | | */
|
| | | @RequestSerializableByKey(key = "#acceptData.device")
|
| | | @RequestMapping(value = "/bindHWPush", method = RequestMethod.POST)
|
| | | public void bindHWDeviceToken(AcceptData acceptData, String token, Long uid, PrintWriter out) {
|
| | | deviceTokenHWService.addDeviceToken(token, acceptData.getDevice(), uid,
|
| | |
| | | // 推广红包
|
| | | if (from != null && from.equals("taolijin")) {
|
| | | // 计算推广红包
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value");
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value",null);
|
| | | BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, goods);
|
| | |
|
| | | // 推广红包 不能小于1
|
| | |
| | | data.put("userHongbao", userMoneyExtra.getTlj().setScale(2).toString());
|
| | | }
|
| | |
|
| | | noRebateHelpLink = configTaoLiJinService.getValueByKey("share_goods_help_link");
|
| | | noRebateHelpLink = configTaoLiJinService.getValueByKey("share_goods_help_link",null);
|
| | |
|
| | | if (Constant.IS_TEST) {
|
| | | fanliValid = true;
|
| | |
| | | TaoBaoGoodsBrief goods = taoBaoLink.getGoods();
|
| | |
|
| | | // 计算推广红包
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value");
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value",null);
|
| | | BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, goods);
|
| | |
|
| | | // 推广红包 不能小于1
|
| | |
| | | {
|
| | | 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()) + "")
|
| | |
| | | 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);
|
| | |
| | | @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")));
|
| | | }
|
| | |
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestSerializableByKey(key="#acceptData.device")
|
| | | @RequestMapping(value = "getUnReadMsgCount", method = RequestMethod.POST)
|
| | | public void getUnReadMsgCount(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | GsonBuilder androidBuilder = new GsonBuilder().registerTypeAdapter(Integer.class,
|
| | |
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | | // 推广红包
|
| | | if (from != null && from.equals("taolijin")) {
|
| | | // 计算推广红包
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value");
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value", new Date());
|
| | | BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, goods);
|
| | |
|
| | | // 推广红包 不能小于1
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | // 是否为新用户
|
| | | boolean isNewUser = userInfoExtraService.isNewUser(uid);
|
| | | // 取消新用户自购
|
| | | boolean isNewUser = false;// userInfoExtraService.isNewUser(uid);
|
| | | if (isNewUser) {
|
| | | // 判定为老用户: 新人只要使用了新人红包,也就是那1块钱,那么,他看到的分享爆款中的商品-就只能分享。
|
| | | long countRecord = userTaoLiJinRecordService.countRecordByUid(uid);
|
| | |
| | | otherInfo.setSpreadHongBao(spreadHongBao);
|
| | | goodsDetail.setOtherInfo(otherInfo);
|
| | |
|
| | | goodsDetail.getMoneyInfo().setFanliMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods,
|
| | | hongBaoManageService.getTLJShareRate(System.currentTimeMillis())));
|
| | | goodsDetail.getMoneyInfo().setShareMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods,
|
| | | hongBaoManageService.getTLJShareRate(System.currentTimeMillis())));
|
| | |
|
| | | // 用户淘礼金
|
| | | UserMoneyExtra userMoneyExtra = userMoneyExtraService.selectByPrimaryKey(uid);
|
| | | if (userMoneyExtra == null || userMoneyExtra.getTlj() == null) {
|
| | |
| | | } else {
|
| | | extraVO.setUserTLJ(userMoneyExtra.getTlj().setScale(2).toString());
|
| | | }
|
| | | helpLink = configTaoLiJinService.getValueByKey("share_goods_help_link");
|
| | | helpLink = configTaoLiJinService.getValueByKey("share_goods_help_link", new Date());
|
| | |
|
| | | } else if (from != null && from.equals("taolijin_buy")) {
|
| | | // 查询分享库
|
| | |
| | | * 获取淘宝的分享链接
|
| | | *
|
| | | * @param acceptData
|
| | | * @param uid -用户ID
|
| | | * @param auctionId-商品ID
|
| | | * @param uid
|
| | | * -用户ID
|
| | | * @param auctionId-商品ID
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "createShareInfo")
|
| | |
| | | public void createTaoLijin(Long uid, Long auctionId, int totalNum, String relationId, HttpServletRequest request,
|
| | | PrintWriter out) {
|
| | | try {
|
| | | TaoBaoLink taoBaoLink = shareGoodsService.getTaoLiJinLinkForShare(uid, auctionId, relationId);
|
| | | TaoBaoGoodsBrief goods = null;
|
| | | try {
|
| | | goods = TaoKeApiUtil.searchGoodsDetail(auctionId, new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET, TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT));
|
| | | } catch (TaobaoGoodsDownException e2) {
|
| | | e2.printStackTrace();
|
| | | }
|
| | |
|
| | | TaoBaoGoodsBrief goods = taoBaoLink.getGoods();
|
| | | if (goods == null) {
|
| | | out.print(JsonUtil.loadFalseResult("商品已下架"));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 计算推广红包
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value");
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value", new Date());
|
| | | BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, goods);
|
| | |
|
| | | // 推广红包 不能小于1
|
| | |
| | | }
|
| | | shareInfo.setClickUrl(url);
|
| | |
|
| | | TaoBaoLink taoBaoLink = new TaoBaoLink();
|
| | | taoBaoLink.setCouponLink(taoLiJinLink);
|
| | | taoBaoLink.setClickUrl(taoLiJinLink);
|
| | |
|
| | | // 创建淘口令
|
| | | if (!StringUtil.isNullOrEmpty(taoLiJinLink)) {// 通过立即推广方式获取淘口令成功
|
| | | String quanToken = TaoKeApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(), taoLiJinLink);
|
| | | if (!StringUtil.isNullOrEmpty(quanToken)) {
|
| | | taoBaoLink.setTaoToken(quanToken);
|
| | | }
|
| | | } else if (!StringUtil.isNullOrEmpty(taoBaoLink.getClickUrl())) {
|
| | | String quanToken = TaoKeApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(),
|
| | | taoBaoLink.getClickUrl());
|
| | | if (!StringUtil.isNullOrEmpty(quanToken)) {
|
| | | taoBaoLink.setTaoToken(quanToken);
|
| | | }
|
| | | }
|
| | | shareInfo.setToken(taoBaoLink.getTaoToken());
|
| | | shareInfo.setRule(configService.get("share_single_goods_rule"));
|
| | | shareInfo.setPictUrl(TbImgUtil.getTBSizeImg(taoBaoLink.getGoods().getPictUrl(), 500));
|
| | | shareInfo.setPictUrl(TbImgUtil.getTBSizeImg(goods.getPictUrl(), 500));
|
| | |
|
| | | // 无券
|
| | | String shopType = taoBaoLink.getGoods().getUserType() == 0 ? "淘宝价" : "天猫价";
|
| | | String shopType = goods.getUserType() == 0 ? "淘宝价" : "天猫价";
|
| | | String shareText = "";
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(taoBaoLink.getGoods().getCouponInfo())) {
|
| | | if (StringUtil.isNullOrEmpty(goods.getCouponInfo())) {
|
| | | String text = shareGoodsTextTemplateService.getCommonTemplate(uid);
|
| | | if (StringUtil.isNullOrEmpty(text))
|
| | | text = configService.get("goods_share_text_nocoupon");
|
| | | shareText = text.replace("{标题}", taoBaoLink.getGoods().getTitle()).replace("{商品原价}",
|
| | | MoneyBigDecimalUtil.getWithNoZera(taoBaoLink.getGoods().getZkPrice()) + "");
|
| | | shareText = text.replace("{标题}", goods.getTitle()).replace("{商品原价}",
|
| | | MoneyBigDecimalUtil.getWithNoZera(goods.getZkPrice()) + "");
|
| | | } else// 有券
|
| | | {
|
| | | 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()) + "")
|
| | | .replace("{优惠券面额}",
|
| | | MoneyBigDecimalUtil.getWithNoZera(taoBaoLink.getGoods().getCouponAmount()).toString())
|
| | | shareText = text.replace("{标题}", goods.getTitle())
|
| | | .replace("{商品原价}", MoneyBigDecimalUtil.getWithNoZera(goods.getZkPrice()) + "")
|
| | | .replace("{优惠券面额}", MoneyBigDecimalUtil.getWithNoZera(goods.getCouponAmount()).toString())
|
| | | .replace("{淘礼金面额}", MoneyBigDecimalUtil.getWithNoZera(spreadMoney).toString())
|
| | | .replace("{优惠券价}", TaoBaoUtil.getAfterUseCouplePrice(taoBaoLink.getGoods()) + "");
|
| | | .replace("{优惠券价}", TaoBaoUtil.getAfterUseCouplePrice(goods) + "");
|
| | | }
|
| | |
|
| | | shareText = shareText.replace("{店铺类型}", shopType)
|
| | | .replace("{月销量}", TaoBaoUtil.getSaleCount(taoBaoLink.getGoods().getBiz30day()))
|
| | | .replace("{领券短链}", shortLink).replace("{淘口令}", taoBaoLink.getTaoToken());
|
| | | .replace("{月销量}", TaoBaoUtil.getSaleCount(goods.getBiz30day())).replace("{领券短链}", shortLink)
|
| | | .replace("{淘口令}", taoBaoLink.getTaoToken());
|
| | | shareInfo.setShareText(shareText);
|
| | |
|
| | | String descText = shareText.replace(taoBaoLink.getGoods().getTitle(), "").trim();
|
| | | String descText = shareText.replace(goods.getTitle(), "").trim();
|
| | | if (descText.startsWith("\\r\\n"))
|
| | | descText = descText.substring(0);
|
| | |
|
| | |
| | |
|
| | | // 添加分享记录
|
| | | BigDecimal rate = hongBaoManageService.getShareRate();
|
| | | BigDecimal shareMoney = TaoBaoUtil.getShareGoodsHongBaoInfo(taoBaoLink.getGoods(), rate);
|
| | | BigDecimal shareMoney = TaoBaoUtil.getShareGoodsHongBaoInfo(goods, rate);
|
| | | shareInfo.setShareMoney("¥" + shareMoney.toString());
|
| | | try {
|
| | | ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsDetail(uid, auctionId,
|
| | |
| | | out.print(JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(shareInfo)));
|
| | |
|
| | | final TaoBaoLink taobaoLink = taoBaoLink;
|
| | | final TaoBaoGoodsBrief finalGoods=goods;
|
| | | // 异步操作
|
| | | com.yeshi.fanli.util.ThreadUtil.run(new Runnable() {
|
| | | @Override
|
| | |
| | | history.setTkCode(taobaoLink.getTaoToken());
|
| | | history.setLink(taobaoLink.getClickUrl());
|
| | | history.setQuanLink(taobaoLink.getCouponLink());
|
| | | history.setGoodsId(taobaoLink.getGoods().getAuctionId());
|
| | | history.setPostPicture(taobaoLink.getGoods().getPictUrl());
|
| | | history.setGoodsId(finalGoods.getAuctionId());
|
| | | history.setPostPicture(finalGoods.getPictUrl());
|
| | |
|
| | | List<String> imgList = taobaoLink.getGoods().getImgList();
|
| | | List<String> imgList = finalGoods.getImgList();
|
| | | if (imgList == null) {
|
| | | imgList = new ArrayList<>();
|
| | | }
|
| | |
| | | }
|
| | | });
|
| | | return;
|
| | | } catch (ShareGoodsException e) {
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e, "分享出错:uid:" + uid + "auctionId:" + auctionId, "");
|
| | | // 分享出错报警
|
| | | try {
|
| | | monitorService.addClientAPIMonitor(MonitorFactory.createClientAPI(request, e.getCode(), 0, "分享出错"));
|
| | | } catch (Exception e1) {
|
| | | }
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMessage()));
|
| | | out.print(JsonUtil.loadFalseResult("创建分享出错"));
|
| | | businessEmergent110Service.shareTaoBaoGoodsError(StringUtil.Md5(auctionId + ""));
|
| | | }
|
| | | }
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | // String url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(),
|
| | | // Constant.systemCommonConfig.getShareGoodsPagePathJD(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY),
|
| | | // goodsId + "");
|
| | | // String url = String.format("http://%s%s?uid=%s&id=%s",
|
| | | // configService.getH5Host(),
|
| | | // Constant.systemCommonConfig.getShareGoodsPagePathJD(),
|
| | | // AESUtil.encrypt(uid + "", Constant.UIDAESKEY),
|
| | | // goodsId + "");
|
| | |
|
| | | String couponUrl = null;
|
| | | JDCouponInfo couponInfo = jdGoods.getCouponInfo();
|
| | |
| | | couponUrl = couponInfo.getLink();
|
| | | }
|
| | | String materialId = "https://item.jd.com/" + goodsId + ".html";
|
| | | String jumpLink = JDApiUtil.convertShortLink(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "", uid+ "");
|
| | | |
| | | String jumpLink = JDApiUtil.convertShortLink(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "", uid + "");
|
| | |
|
| | | ShareInfoVO shareInfo = new ShareInfoVO();
|
| | | shareInfo.setClickUrl(jumpLink);
|
| | | shareInfo.setRule(configService.get("share_rule_link_jd"));
|
| | | shareInfo.setPictUrl(jdGoods.getPicUrl());
|
| | | |
| | |
|
| | | String shareText = "";
|
| | | boolean hasCoupon = false;
|
| | | |
| | |
|
| | | // 分享模板
|
| | | ShareGoodsTextTemplate textTemplate = shareGoodsTextTemplateService.getShareGoodsTextTemplate(uid);
|
| | | if (couponInfo == null) { // 无券模板
|
| | | if (textTemplate != null) |
| | | if (textTemplate != null)
|
| | | shareText = textTemplate.getShareJDTextTemplate();
|
| | | |
| | |
|
| | | if (StringUtil.isNullOrEmpty(shareText))
|
| | | shareText = configService.get("goods_share_text_nocoupon_jd");
|
| | | } else { // 有券模板
|
| | | hasCoupon = true;
|
| | | if (textTemplate != null)
|
| | | shareText = textTemplate.getShareJDTextTemplateCoupon();
|
| | | |
| | |
|
| | | if (StringUtil.isNullOrEmpty(shareText))
|
| | | shareText = configService.get("goods_share_text_coupon_jd");
|
| | | }
|
| | | shareText = shareGoodsTextTemplateService.createContentByTemplateJD(shareText, uid, jdGoods, jumpLink, hasCoupon);
|
| | | shareText = shareGoodsTextTemplateService.createContentByTemplateJD(shareText, uid, jdGoods, jumpLink,
|
| | | hasCoupon);
|
| | | shareInfo.setShareText(shareText);
|
| | |
|
| | | String descText = shareText.replace(jdGoods.getSkuName(), "").trim();
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | // String url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(),
|
| | | // Constant.systemCommonConfig.getShareGoodsPagePathPDD(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY),
|
| | | // goodsId + "");
|
| | | // String url = String.format("http://%s%s?uid=%s&id=%s",
|
| | | // configService.getH5Host(),
|
| | | // Constant.systemCommonConfig.getShareGoodsPagePathPDD(),
|
| | | // AESUtil.encrypt(uid + "", Constant.UIDAESKEY),
|
| | | // goodsId + "");
|
| | |
|
| | | String jumpLink = PinDuoDuoApiUtil.getPromotionUrl(goodsId, PinDuoDuoApiUtil.PID_SHARE + "", uid + "");
|
| | | |
| | |
|
| | | ShareInfoVO shareInfo = new ShareInfoVO();
|
| | | shareInfo.setClickUrl(jumpLink);
|
| | | shareInfo.setRule(configService.get("share_rule_link_pdd"));
|
| | |
| | | hasCoupon = true;
|
| | | if (textTemplate != null)
|
| | | template = textTemplate.getSharePDDTextTemplateCoupon();
|
| | | |
| | |
|
| | | if (StringUtil.isNullOrEmpty(template))
|
| | | template = configService.get("goods_share_text_coupon_pdd");
|
| | | }
|
| | |
|
| | | // 创建口令
|
| | | String token = PinDuoDuoApiUtil.createGenerate(goodsId);
|
| | | |
| | |
|
| | | // 生成分享内容
|
| | | String shareText = shareGoodsTextTemplateService.createContentByTemplatePDD(template, uid, goods, jumpLink,
|
| | | hasCoupon, token);
|
| | | hasCoupon, token);
|
| | | shareInfo.setShareText(shareText);
|
| | |
|
| | | String descText = shareText.replace(goods.getGoodsName(), "").trim();
|
| | |
| | | couponUrl = couponInfo.getLink();
|
| | | }
|
| | | String materialId = "https://item.jd.com/" + goodsId + ".html";
|
| | | String shortLink = JDApiUtil.convertShortLink(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "", uid+ "");
|
| | | String shortLink = JDApiUtil.convertShortLink(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "", uid + "");
|
| | |
|
| | | String content = shareGoodsTextTemplateService.createContentByTemplateJD(template, uid, goods, shortLink,
|
| | | hasCoupon);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | // // 创建h5连接
|
| | | // String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(),
|
| | | // Constant.systemCommonConfig.getShareGoodsPagePath(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY),
|
| | | // goodsId + "");
|
| | | // String shortLink = HttpUtil.getShortLink(url);
|
| | | |
| | | // // 创建h5连接
|
| | | // String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq",
|
| | | // configService.getH5Host(),
|
| | | // Constant.systemCommonConfig.getShareGoodsPagePath(),
|
| | | // AESUtil.encrypt(uid + "", Constant.UIDAESKEY),
|
| | | // goodsId + "");
|
| | | // String shortLink = HttpUtil.getShortLink(url);
|
| | |
|
| | | String shortLink = PinDuoDuoApiUtil.getPromotionUrl(goodsId, PinDuoDuoApiUtil.PID_SHARE + "", uid + "");
|
| | |
|
| | | // 创建口令
|
| | |
| | | if (tljId != null) {
|
| | | template = shareGoodsTextTemplateService.getTaoLiJinTemplate(uid);
|
| | | if (StringUtil.isNullOrEmpty(template))
|
| | | template = configTaoLiJinService.getValueByKey("goods_share_text");
|
| | | template = configTaoLiJinService.getValueByKey("goods_share_text", new Date());
|
| | | } else {
|
| | | template = shareGoodsTextTemplateService.geteCouponTemplate(uid);
|
| | | if (StringUtil.isNullOrEmpty(template))
|
| | |
| | |
|
| | | if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
|
| | | 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")));
|
| | | }
|
| | |
| | | *
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param hasCoupon -是否有券
|
| | | * @param hasCoupon
|
| | | * -是否有券
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "resetShareTextTemplate", method = RequestMethod.POST)
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
|
| | | if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
|
| | | if (hasCoupon) {
|
| | | if (tljId != null) {
|
| | | shareGoodsTextTemplateService.resetTaoLijinTemplate(uid);
|
| | |
| | | } else {
|
| | | shareGoodsTextTemplateService.resetCommonTemplate(uid);
|
| | | }
|
| | | } else if (goodsType == Constant.SOURCE_TYPE_JD) {
|
| | | if (hasCoupon) {
|
| | | } else if (goodsType == Constant.SOURCE_TYPE_JD) {
|
| | | if (hasCoupon) {
|
| | | shareGoodsTextTemplateService.resetCouponTemplateJD(uid);
|
| | | } else {
|
| | | shareGoodsTextTemplateService.resetCommonTemplateJD(uid);
|
| | | }
|
| | | } else if (goodsType == Constant.SOURCE_TYPE_PDD) {
|
| | | if (hasCoupon) {
|
| | | } else if (goodsType == Constant.SOURCE_TYPE_PDD) {
|
| | | if (hasCoupon) {
|
| | | shareGoodsTextTemplateService.resetCouponTemplatePDD(uid);
|
| | | } else {
|
| | | shareGoodsTextTemplateService.resetCommonTemplatePDD(uid);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | }
|
| | |
|
| | | if (goodsId != null) {
|
| | | viewShareTextTemplate(acceptData, uid, null, goodsType, goodsId, tljId, hasCoupon, out);
|
| | | return;
|
| | |
| | | if (lastMonthUse == null || lastMonthUse.compareTo(zero) > 0) {
|
| | | lastMonthUse = zero;
|
| | | }
|
| | | |
| | | |
| | | String giveMin = configTaoLiJinService.getValueByKey("give_min_amount");
|
| | | |
| | |
|
| | | // 问号链接
|
| | | String helpLink = configTaoLiJinService.getValueByKey("hongbao_help_link",null);
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("tlj", tlj.setScale(2).toString());
|
| | | data.put("giveMin", giveMin);
|
| | |
| | | // 已领取
|
| | | money = deviceRecord.getMoney();
|
| | | } else {
|
| | | String value = configTaoLiJinService.getValueByKey("hongbao_newbies");
|
| | | String value = configTaoLiJinService.getValueByKey("hongbao_newbies",null);
|
| | | if (StringUtil.isNullOrEmpty(value)) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统红包不存在"));
|
| | | return;
|
| | |
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon"));
|
| | | data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon",null));
|
| | | data.put("title", "新人红包");
|
| | | data.put("content", "自购直接抵现,优惠真实可见!");
|
| | | data.put("type", 1);
|
| | |
| | | data.put("usage", "领取成功,已存入“我的-推广红包”");
|
| | | data.put("jumpName", "去使用");
|
| | | data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot"));
|
| | | data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip"));
|
| | | data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link"));
|
| | | data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip",null));
|
| | | data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link",null));
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | |
| | | // 登录用户
|
| | | boolean isReceive = false;
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon"));
|
| | | data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon",null));
|
| | |
|
| | | if (type.equals(TaoLiJinOriginEnum.newbiesWin.name())) {
|
| | | BigDecimal hasMoney = null;
|
| | |
| | | data.put("usage", "领取成功,已存入“我的-推广红包”");
|
| | | data.put("jumpName", "去使用");
|
| | | data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot"));
|
| | | data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip"));
|
| | | data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link"));
|
| | | data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip",null));
|
| | | data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link",null));
|
| | |
|
| | | } else if (type.equals(TaoLiJinOriginEnum.rankWin.name())) {
|
| | | boolean isRank = false;
|
| | |
| | | data.put("money", "本月账户等级未达到\r\n继续加油");
|
| | | data.put("jumpName", "去查看");
|
| | | data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("user_rank"));
|
| | | data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_not_enough_tip"));
|
| | | data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link"));
|
| | | data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_not_enough_tip",null));
|
| | | data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link",null));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | } else {
|
| | |
| | | }
|
| | | data.put("jumpName", "去使用");
|
| | | data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot"));
|
| | | data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_tip"));
|
| | | data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link"));
|
| | | data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_tip",null));
|
| | | data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link",null));
|
| | | }
|
| | |
|
| | | } else {
|
| | |
| | | }
|
| | |
|
| | | // 计算推广红包
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value");
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value",new Date());
|
| | | BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, taoBaoGoodsBrief);
|
| | |
|
| | | // 推广红包 不能小于1
|
| | |
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | boolean isNewUser = userInfoExtraService.isNewUser(uid);
|
| | | //取消新人自购
|
| | | boolean isNewUser = false;//userInfoExtraService.isNewUser(uid);
|
| | | if (isNewUser) {
|
| | | // 判定为老用户: 新人只要使用了新人红包,也就是那1块钱,那么,他看到的分享爆款中的商品-就只能分享。
|
| | | long countRecord = userTaoLiJinRecordService.countRecordByUid(uid);
|
| | |
| | | }
|
| | |
|
| | |
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | BigDecimal fanLiRate = hongBaoManageService.getTLJShareRate(System.currentTimeMillis());
|
| | | BigDecimal shareRate = hongBaoManageService.getTLJShareRate(System.currentTimeMillis());
|
| | | for (ShareHotGoods hotGoods : listHot) {
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = hotGoods.getGoods();
|
| | | if (taoBaoGoodsBrief == null) {
|
| | |
| | | }
|
| | |
|
| | | // 计算推广红包
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value");
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value",new Date());
|
| | | BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, taoBaoGoodsBrief);
|
| | |
|
| | | // 推广红包 不能小于1
|
| | |
| | | *
|
| | | * @return
|
| | | */
|
| | | public List<DaTaoKeDetailV2> listPreShareHotGoods(int start, int count, String sortName) {
|
| | | public List<DaTaoKeDetailV2> listPreShareHotGoods(int start, int count, String sortName,BigDecimal minCommission) {
|
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("commission").gt(734));
|
| | | query.addCriteria(Criteria.where("commission").gt(minCommission.multiply(new BigDecimal(100)).intValue()));
|
| | | List<Order> orders = new ArrayList<>();
|
| | | orders.add(new Order(Direction.DESC, sortName));
|
| | | query.with(new Sort(orders)).skip(start);
|
| | |
| | | package com.yeshi.fanli.dao.mybatis.tlj; |
| | | |
| | | import java.util.Date; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | |
| | | * @param key |
| | | * @return |
| | | */ |
| | | ConfigTaoLiJin getByKey(@Param("key") String key); |
| | | ConfigTaoLiJin getByKey(@Param("key") String key,@Param("startTime")Date startTime); |
| | | } |
| | |
| | |
|
| | | @Column(name = "ct_create_time")
|
| | | private Date createTime;
|
| | | |
| | | @Column(name = "ct_start_time")
|
| | | private Date startTime;//开始使用时间
|
| | |
|
| | | public Date getStartTime() {
|
| | | return startTime;
|
| | | }
|
| | |
|
| | | public void setStartTime(Date startTime) {
|
| | | this.startTime = startTime;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.tlj.ConfigTaoLiJinMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.tlj.ConfigTaoLiJin"> |
| | | <id column="ct_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="ct_name" property="name" jdbcType="VARCHAR"/> |
| | | <result column="ct_key" property="key" jdbcType="VARCHAR"/> |
| | | <result column="ct_value" property="value" jdbcType="VARCHAR"/> |
| | | <result column="ct_beizhu" property="beizhu" jdbcType="VARCHAR"/> |
| | | <result column="ct_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">ct_id,ct_name,ct_key,ct_value,ct_beizhu,ct_create_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_config_taolijin where ct_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_config_taolijin where ct_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.tlj.ConfigTaoLiJin" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_config_taolijin (ct_id,ct_name,ct_key,ct_value,ct_beizhu,ct_create_time) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{key,jdbcType=VARCHAR},#{value,jdbcType=VARCHAR},#{beizhu,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.tlj.ConfigTaoLiJin" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_config_taolijin |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">ct_id,</if> |
| | | <if test="name != null">ct_name,</if> |
| | | <if test="key != null">ct_key,</if> |
| | | <if test="value != null">ct_value,</if> |
| | | <if test="beizhu != null">ct_beizhu,</if> |
| | | <if test="createTime != null">ct_create_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="name != null">#{name,jdbcType=VARCHAR},</if> |
| | | <if test="key != null">#{key,jdbcType=VARCHAR},</if> |
| | | <if test="value != null">#{value,jdbcType=VARCHAR},</if> |
| | | <if test="beizhu != null">#{beizhu,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.tlj.ConfigTaoLiJin">update yeshi_ec_config_taolijin set ct_name = #{name,jdbcType=VARCHAR},ct_key = #{key,jdbcType=VARCHAR},ct_value = #{value,jdbcType=VARCHAR},ct_beizhu = #{beizhu,jdbcType=VARCHAR},ct_create_time = #{createTime,jdbcType=TIMESTAMP} where ct_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.tlj.ConfigTaoLiJin">update yeshi_ec_config_taolijin |
| | | <set> |
| | | <if test="name != null">ct_name=#{name,jdbcType=VARCHAR},</if> |
| | | <if test="key != null">ct_key=#{key,jdbcType=VARCHAR},</if> |
| | | <if test="value != null">ct_value=#{value,jdbcType=VARCHAR},</if> |
| | | <if test="beizhu != null">ct_beizhu=#{beizhu,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">ct_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where ct_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="getByKey" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_config_taolijin t |
| | | WHERE t.`ct_key` = #{key} |
| | | </select> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.tlj.ConfigTaoLiJin"> |
| | | <id column="ct_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="ct_name" property="name" jdbcType="VARCHAR" /> |
| | | <result column="ct_key" property="key" jdbcType="VARCHAR" /> |
| | | <result column="ct_value" property="value" jdbcType="VARCHAR" /> |
| | | <result column="ct_beizhu" property="beizhu" jdbcType="VARCHAR" /> |
| | | <result column="ct_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="ct_start_time" property="startTime" jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">ct_id,ct_name,ct_key,ct_value,ct_beizhu,ct_create_time,ct_start_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_config_taolijin where ct_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_config_taolijin where ct_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.tlj.ConfigTaoLiJin" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_config_taolijin |
| | | (ct_id,ct_name,ct_key,ct_value,ct_beizhu,ct_create_time,ct_start_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{key,jdbcType=VARCHAR},#{value,jdbcType=VARCHAR},#{beizhu,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{startTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.tlj.ConfigTaoLiJin" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_config_taolijin |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">ct_id,</if> |
| | | <if test="name != null">ct_name,</if> |
| | | <if test="key != null">ct_key,</if> |
| | | <if test="value != null">ct_value,</if> |
| | | <if test="beizhu != null">ct_beizhu,</if> |
| | | <if test="createTime != null">ct_create_time,</if> |
| | | <if test="startTime != null">ct_start_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="name != null">#{name,jdbcType=VARCHAR},</if> |
| | | <if test="key != null">#{key,jdbcType=VARCHAR},</if> |
| | | <if test="value != null">#{value,jdbcType=VARCHAR},</if> |
| | | <if test="beizhu != null">#{beizhu,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="startTime != null">#{startTime,jdbcType=TIMESTAMP}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.tlj.ConfigTaoLiJin">update |
| | | yeshi_ec_config_taolijin set ct_name = #{name,jdbcType=VARCHAR},ct_key |
| | | = #{key,jdbcType=VARCHAR},ct_value = |
| | | #{value,jdbcType=VARCHAR},ct_beizhu = |
| | | #{beizhu,jdbcType=VARCHAR},ct_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP} ,ct_start_time |
| | | =#{startTime,jdbcType=TIMESTAMP} where ct_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.tlj.ConfigTaoLiJin"> |
| | | update yeshi_ec_config_taolijin |
| | | <set> |
| | | <if test="name != null">ct_name=#{name,jdbcType=VARCHAR},</if> |
| | | <if test="key != null">ct_key=#{key,jdbcType=VARCHAR},</if> |
| | | <if test="value != null">ct_value=#{value,jdbcType=VARCHAR},</if> |
| | | <if test="beizhu != null">ct_beizhu=#{beizhu,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">ct_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="startTime !=null">ct_start_time =#{startTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where ct_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <select id="getByKey" resultMap="BaseResultMap">SELECT * FROM |
| | | yeshi_ec_config_taolijin t WHERE t.`ct_key` = #{key} and #{startTime}>=ct_start_time order by ct_start_time desc limit 1</select> |
| | | </mapper> |
| | |
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private ConfigTaoLiJinService configTaoLiJinService;
|
| | | |
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void saveCommonTemplate(Long uid, String template) throws ShareGoodsTextTemplateException {
|
| | | isCommonTemplateRight(template);
|
| | |
| | | shareGoodsTextTemplateMapper.insertSelective(textTemplate);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void saveCommonTemplateJD(Long uid, String template) throws ShareGoodsTextTemplateException {
|
| | | isCommonTemplateRight(template);
|
| | |
| | | shareGoodsTextTemplateMapper.insertSelective(textTemplate);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void saveCommonTemplatePDD(Long uid, String template) throws ShareGoodsTextTemplateException {
|
| | | isCommonTemplateRight(template);
|
| | |
| | | public void saveCouponTemplate(Long uid, String template) throws ShareGoodsTextTemplateException {
|
| | | // 格式验证
|
| | | isTaoLiJinTemplateRight(template);
|
| | | |
| | |
|
| | | ShareGoodsTextTemplate old = shareGoodsTextTemplateMapper.selectByUid(uid);
|
| | | if (old != null) {
|
| | | ShareGoodsTextTemplate update = new ShareGoodsTextTemplate();
|
| | |
| | | shareGoodsTextTemplateMapper.insertSelective(textTemplate);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void saveCouponTemplateJD(Long uid, String template) throws ShareGoodsTextTemplateException {
|
| | | // 格式验证
|
| | | isTaoLiJinTemplateRight(template);
|
| | | |
| | |
|
| | | ShareGoodsTextTemplate old = shareGoodsTextTemplateMapper.selectByUid(uid);
|
| | | if (old != null) {
|
| | | ShareGoodsTextTemplate update = new ShareGoodsTextTemplate();
|
| | |
| | | shareGoodsTextTemplateMapper.insertSelective(textTemplate);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void saveCouponTemplatePDD(Long uid, String template) throws ShareGoodsTextTemplateException {
|
| | | // 格式验证
|
| | | isTaoLiJinTemplateRight(template);
|
| | | |
| | |
|
| | | ShareGoodsTextTemplate old = shareGoodsTextTemplateMapper.selectByUid(uid);
|
| | | if (old != null) {
|
| | | ShareGoodsTextTemplate update = new ShareGoodsTextTemplate();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | @Transactional
|
| | | @Override
|
| | | public void saveTaoLiJinTemplate(Long uid, String template) throws ShareGoodsTextTemplateException {
|
| | | |
| | |
|
| | | isCouponTemplateRight(template);
|
| | | |
| | |
|
| | | ShareGoodsTextTemplate old = shareGoodsTextTemplateMapper.selectByUid(uid);
|
| | | if (old != null) {
|
| | | ShareGoodsTextTemplate update = new ShareGoodsTextTemplate();
|
| | |
| | | }
|
| | |
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public String geteCouponTemplate(Long uid) {
|
| | | ShareGoodsTextTemplate template = shareGoodsTextTemplateMapper.selectByUid(uid);
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public String getTaoLiJinTemplate(Long uid) {
|
| | | ShareGoodsTextTemplate template = shareGoodsTextTemplateMapper.selectByUid(uid);
|
| | |
| | | return template.getShareTaoLiJinTextTemplate();
|
| | | return null;
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public ShareGoodsTextTemplate getShareGoodsTextTemplate(Long uid) {
|
| | | return shareGoodsTextTemplateMapper.selectByUid(uid);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void isCommonTemplateRight(String template) throws ShareGoodsTextTemplateException {
|
| | | String[] keys = new String[] { "{标题}", "{店铺类型}", "{商品原价}", "{月销量}", "{短链}", "{淘口令}" };
|
| | |
| | |
|
| | | @Override
|
| | | public void isCommonTemplateRightJD(String template) throws ShareGoodsTextTemplateException {
|
| | | String[] keys = new String[] { "{标题}","{京东价}", "{商品原价}", "{月销量}", "{短链接}" };
|
| | | String[] keys = new String[] { "{标题}", "{京东价}", "{商品原价}", "{月销量}", "{短链接}" };
|
| | | int keysCount = 0;
|
| | | for (String key : keys)
|
| | | if (template != null && template.contains(key))
|
| | |
| | | if (keysCount == 0)
|
| | | throw new ShareGoodsTextTemplateException(1, "模板格式有误");
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void isCommonTemplateRightPDD(String template) throws ShareGoodsTextTemplateException {
|
| | | String[] keys = new String[] { "{标题}", "{商品原价}", "{月销量}", "{短链接}"};
|
| | | String[] keys = new String[] { "{标题}", "{商品原价}", "{月销量}", "{短链接}" };
|
| | | int keysCount = 0;
|
| | | for (String key : keys)
|
| | | if (template != null && template.contains(key))
|
| | |
| | | if (keysCount == 0)
|
| | | throw new ShareGoodsTextTemplateException(1, "模板格式有误");
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void isCouponTemplateRight(String template) throws ShareGoodsTextTemplateException {
|
| | | String[] keys = new String[] { "{标题}", "{店铺类型}", "{商品原价}", "{优惠券面额}", "{优惠券价}", "{月销量}", "{领券短链}", "{淘口令}" };
|
| | |
| | | if (keysCount == 0)
|
| | | throw new ShareGoodsTextTemplateException(1, "模板格式有误");
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void isCouponTemplateRightJD(String template) throws ShareGoodsTextTemplateException {
|
| | | String[] keys = new String[] { "{标题}","{京东价}", "{商品原价}", "{优惠券面额}", "{优惠券价}", "{月销量}", "{短链接}" };
|
| | | String[] keys = new String[] { "{标题}", "{京东价}", "{商品原价}", "{优惠券面额}", "{优惠券价}", "{月销量}", "{短链接}" };
|
| | | int keysCount = 0;
|
| | | for (String key : keys)
|
| | | if (template != null && template.contains(key))
|
| | |
| | | throw new ShareGoodsTextTemplateException(1, "模板格式有误");
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void isCouponTemplateRightPDD(String template) throws ShareGoodsTextTemplateException {
|
| | | String[] keys = new String[] { "{标题}", "{商品原价}", "{优惠券面额}", "{优惠券价}", "{总销量}", "{短链接}"};
|
| | | String[] keys = new String[] { "{标题}", "{商品原价}", "{优惠券面额}", "{优惠券价}", "{总销量}", "{短链接}" };
|
| | | int keysCount = 0;
|
| | | for (String key : keys)
|
| | | if (template != null && template.contains(key))
|
| | |
| | | throw new ShareGoodsTextTemplateException(1, "模板格式有误");
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void isTaoLiJinTemplateRight(String template) throws ShareGoodsTextTemplateException {
|
| | | String[] keys = new String[] { "{标题}", "{店铺类型}", "{商品原价}", "{优惠券面额}", "{淘礼金面额}", "{优惠券价}", "{月销量}", "{领券短链}", "{淘口令}" };
|
| | | String[] keys = new String[] { "{标题}", "{店铺类型}", "{商品原价}", "{优惠券面额}", "{淘礼金面额}", "{优惠券价}", "{月销量}", "{领券短链}",
|
| | | "{淘口令}" };
|
| | | int keysCount = 0;
|
| | | for (String key : keys)
|
| | | if (template != null && template.contains(key))
|
| | |
| | | if (keysCount == 0)
|
| | | throw new ShareGoodsTextTemplateException(1, "模板格式有误");
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public String createContentByTemplate(String template, Long uid, TaoBaoGoodsBrief goods, String token,
|
| | | String shortLink, boolean hasCoupon, Long tljId) {
|
| | | |
| | |
|
| | | if (tljId != null) {
|
| | | // 计算推广红包
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value");
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value", new Date());
|
| | | BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, goods);
|
| | | |
| | | return template.replace("{标题}", goods.getTitle()).replace("{商品原价}", BigDecimalUtil.getWithNoZera( goods.getZkPrice()).toString())
|
| | |
|
| | | return template.replace("{标题}", goods.getTitle())
|
| | | .replace("{商品原价}", BigDecimalUtil.getWithNoZera(goods.getZkPrice()).toString())
|
| | | .replace("{月销量}", TaoBaoUtil.getSaleCount(goods.getBiz30day())).replace("{领券短链}", shortLink)
|
| | | .replace("{淘口令}", token).replace("{优惠券面额}", BigDecimalUtil.getWithNoZera(goods.getCouponAmount()).toString())
|
| | | .replace("{淘礼金面额}", BigDecimalUtil.getWithNoZera(spreadMoney).toString()).replace("{优惠券价}", BigDecimalUtil.getWithNoZera( TaoBaoUtil.getAfterUseCouplePrice(goods)).toString())
|
| | | .replace("{淘口令}", token)
|
| | | .replace("{优惠券面额}", BigDecimalUtil.getWithNoZera(goods.getCouponAmount()).toString())
|
| | | .replace("{淘礼金面额}", BigDecimalUtil.getWithNoZera(spreadMoney).toString())
|
| | | .replace("{优惠券价}",
|
| | | BigDecimalUtil.getWithNoZera(TaoBaoUtil.getAfterUseCouplePrice(goods)).toString())
|
| | | .replace("{店铺类型}", goods.getUserType() == 1 ? "天猫价" : "淘宝价");
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | if (!hasCoupon) {
|
| | | return template.replace("{标题}", goods.getTitle()).replace("{商品原价}", BigDecimalUtil.getWithNoZera(goods.getZkPrice()).toString())
|
| | | return template.replace("{标题}", goods.getTitle())
|
| | | .replace("{商品原价}", BigDecimalUtil.getWithNoZera(goods.getZkPrice()).toString())
|
| | | .replace("{月销量}", TaoBaoUtil.getSaleCount(goods.getBiz30day())).replace("{领券短链}", shortLink)
|
| | | .replace("{淘口令}", token).replace("{店铺类型}", goods.getUserType() == 1 ? "天猫价"
|
| | | : "淘宝价");
|
| | | } else {
|
| | | return template.replace("{标题}", goods.getTitle()).replace("{商品原价}", BigDecimalUtil.getWithNoZera( goods.getZkPrice()).toString())
|
| | | return template.replace("{标题}", goods.getTitle())
|
| | | .replace("{商品原价}", BigDecimalUtil.getWithNoZera(goods.getZkPrice()).toString())
|
| | | .replace("{月销量}", TaoBaoUtil.getSaleCount(goods.getBiz30day())).replace("{领券短链}", shortLink)
|
| | | .replace("{淘口令}", token).replace("{优惠券面额}", BigDecimalUtil.getWithNoZera(goods.getCouponAmount()).toString())
|
| | | .replace("{优惠券价}", BigDecimalUtil.getWithNoZera( TaoBaoUtil.getAfterUseCouplePrice(goods)).toString())
|
| | | .replace("{淘口令}", token)
|
| | | .replace("{优惠券面额}", BigDecimalUtil.getWithNoZera(goods.getCouponAmount()).toString())
|
| | | .replace("{优惠券价}",
|
| | | BigDecimalUtil.getWithNoZera(TaoBaoUtil.getAfterUseCouplePrice(goods)).toString())
|
| | | .replace("{店铺类型}", goods.getUserType() == 1 ? "天猫价" : "淘宝价");
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public String createContentByTemplateJD(String template, Long uid, JDGoods goods, String shortLink, boolean hasCoupon) {
|
| | | public String createContentByTemplateJD(String template, Long uid, JDGoods goods, String shortLink,
|
| | | boolean hasCoupon) {
|
| | | BigDecimal price = goods.getPrice();
|
| | | JDPingouInfo pinGouInfo = goods.getPinGouInfo();
|
| | | if (pinGouInfo != null) {
|
| | | price = pinGouInfo.getPingouPrice();
|
| | | }
|
| | | |
| | |
|
| | | if (!hasCoupon) {
|
| | | template = template.replace("{标题}", goods.getSkuName()).replace("{商品原价}", BigDecimalUtil.getWithNoZera(price).toString())
|
| | | template = template.replace("{标题}", goods.getSkuName())
|
| | | .replace("{商品原价}", BigDecimalUtil.getWithNoZera(price).toString())
|
| | | .replace("{月销量}", JDUtil.getSaleCount(goods.getInOrderCount30Days())).replace("{短链接}", shortLink);
|
| | | } else {
|
| | | template = template.replace("{标题}", goods.getSkuName()).replace("{商品原价}", BigDecimalUtil.getWithNoZera(price).toString())
|
| | | template = template.replace("{标题}", goods.getSkuName())
|
| | | .replace("{商品原价}", BigDecimalUtil.getWithNoZera(price).toString())
|
| | | .replace("{月销量}", JDUtil.getSaleCount(goods.getInOrderCount30Days())).replace("{短链接}", shortLink)
|
| | | .replace("{优惠券面额}", BigDecimalUtil.getWithNoZera(goods.getCouponInfo().getDiscount()).toString())
|
| | | .replace("{优惠券价}", BigDecimalUtil.getWithNoZera(JDUtil.getQuanPrice(goods)).toString());
|
| | | }
|
| | | |
| | |
|
| | | if (pinGouInfo != null) {
|
| | | template = template.replace("{京东价}", "拼购价");
|
| | | } else {
|
| | |
| | | }
|
| | | return template;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public String createContentByTemplatePDD(String template, Long uid, PDDGoodsDetail goods, |
| | | String shortLink, boolean hasCoupon, String token) {
|
| | | public String createContentByTemplatePDD(String template, Long uid, PDDGoodsDetail goods, String shortLink,
|
| | | boolean hasCoupon, String token) {
|
| | | BigDecimal hundred = new BigDecimal(100);
|
| | | BigDecimal price = MoneyBigDecimalUtil.div(new BigDecimal(goods.getMinGroupPrice()), hundred);
|
| | | BigDecimal price = MoneyBigDecimalUtil.div(new BigDecimal(goods.getMinGroupPrice()), hundred);
|
| | | if (!hasCoupon) {
|
| | | template = template.replace("{标题}", goods.getGoodsName()).replace("{商品原价}", BigDecimalUtil.getWithNoZera(price).toString())
|
| | | template = template.replace("{标题}", goods.getGoodsName())
|
| | | .replace("{商品原价}", BigDecimalUtil.getWithNoZera(price).toString())
|
| | | .replace("{总销量}", goods.getSalesTip()).replace("{短链接}", shortLink);
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|
| | | template = template.replace("复制本条信息,{多多口令}打开拼多多,立即购买", "点击链接,打开拼多多,立即购买");
|
| | |
| | | template = template.replace("{多多口令}", token);
|
| | | }
|
| | | } else {
|
| | | BigDecimal amount = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCouponDiscount()), hundred);
|
| | | template = template.replace("{标题}", goods.getGoodsName()).replace("{商品原价}", BigDecimalUtil.getWithNoZera(price).toString())
|
| | | BigDecimal amount = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCouponDiscount()), hundred);
|
| | | template = template.replace("{标题}", goods.getGoodsName())
|
| | | .replace("{商品原价}", BigDecimalUtil.getWithNoZera(price).toString())
|
| | | .replace("{总销量}", goods.getSalesTip()).replace("{短链接}", shortLink)
|
| | | .replace("{优惠券面额}", BigDecimalUtil.getWithNoZera(amount).toString())
|
| | | .replace("{优惠券价}", BigDecimalUtil.getWithNoZera(PinDuoDuoUtil.getQuanPrice(goods)).toString());
|
| | | |
| | |
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|
| | | template = template.replace("复制本条信息,{多多口令}打开拼多多,免费领券", "点击链接,打开拼多多,免费领券");
|
| | | } else {
|
| | | template = template.replace("{多多口令}", token);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | return template;
|
| | | }
|
| | |
|
| | |
| | | shareGoodsTextTemplateMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void resetCommonTemplateJD(Long uid) {
|
| | | ShareGoodsTextTemplate template = shareGoodsTextTemplateMapper.selectByUid(uid);
|
| | |
| | | shareGoodsTextTemplateMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void resetCommonTemplatePDD(Long uid) {
|
| | | ShareGoodsTextTemplate template = shareGoodsTextTemplateMapper.selectByUid(uid);
|
| | |
| | | shareGoodsTextTemplateMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | @Service
|
| | |
| | | }
|
| | | }
|
| | | } else if (type == HongBaoV2.TYPE_SHARE_GOODS) {
|
| | | BigDecimal fanliRate = hongBaoManageService.getShareRate(commonOrder.getCreateTime().getTime());
|
| | | BigDecimal fanliRate = null;
|
| | | if (commonOrder.getSourceType() == Constant.SOURCE_TYPE_TAOBAO
|
| | | && commonOrder.getSourcePosition().equalsIgnoreCase(TaoBaoConstant.TAOBAO_TLJ_RELATION_PID_DEFAULT))
|
| | | fanliRate = hongBaoManageService.getTLJShareRate(commonOrder.getCreateTime().getTime());
|
| | | else
|
| | | fanliRate = hongBaoManageService.getShareRate(commonOrder.getCreateTime().getTime());
|
| | |
|
| | | List<ShareGoodsActivityOrder> list = shareGoodsActivityOrderService
|
| | | .listByOrderIdAndUid(commonOrder.getUserInfo().getId(), commonOrder.getOrderNo());
|
| | | if (list != null && list.size() > 0) {
|
| | |
| | | if (commonOrder.getState() == CommonOrder.STATE_SX || commonOrder.getState() == CommonOrder.STATE_WQ)
|
| | | return;
|
| | | // 分享赚
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate(commonOrder.getCreateTime().getTime());
|
| | | BigDecimal shareRate = null;
|
| | | if (commonOrder.getSourceType() == Constant.SOURCE_TYPE_TAOBAO
|
| | | && commonOrder.getSourcePosition().equalsIgnoreCase(TaoBaoConstant.TAOBAO_TLJ_RELATION_PID_DEFAULT))// 来自于淘礼金的分享
|
| | | shareRate = hongBaoManageService.getTLJShareRate(commonOrder.getCreateTime().getTime());
|
| | | else
|
| | | shareRate = hongBaoManageService.getShareRate(commonOrder.getCreateTime().getTime());
|
| | |
|
| | | // 判断订单分享活动是否开启
|
| | | if ("1".equalsIgnoreCase(configService.get("share_goods_activity_open"))) {
|
| | |
| | | long count = hongBaoV2Mapper.countByParentUidAndTypeAndState(parentUid, typeList, stateList);
|
| | | int page = (int) (count % 100 == 0 ? count / 100 : count / 100 + 1);
|
| | | for (int i = 1; i <= page; i++) {
|
| | | List<HongBaoV2> list = hongBaoV2Mapper.listByParentUidAndTypeAndState(parentUid, typeList, stateList,
|
| | | 0, 100);
|
| | | List<HongBaoV2> list = hongBaoV2Mapper.listByParentUidAndTypeAndState(parentUid, typeList, stateList, 0,
|
| | | 100);
|
| | | if (list != null)
|
| | | for (HongBaoV2 v2 : list) {
|
| | | HongBaoV2 update = new HongBaoV2(v2.getId());
|
| | |
| | | import com.yeshi.fanli.service.inter.msg.UserMsgReadStateService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
|
| | | import redis.clients.jedis.Jedis;
|
| | | import redis.clients.jedis.JedisPool;
|
| | |
|
| | | @Service
|
| | | public class MsgOrderDetailServiceImpl implements MsgOrderDetailService {
|
| | |
|
| | |
| | | @Resource
|
| | | private UserMsgReadStateService userMsgReadStateService;
|
| | |
|
| | | @Resource
|
| | | private JedisPool jedisPool;
|
| | |
|
| | | @Override
|
| | | public void addMsgOrderDetail(MsgOrderDetail detail, boolean needNotify) throws MsgOrderDetailException {
|
| | | if (detail == null)
|
| | |
| | | if (detail.getOrderId() == null || detail.getType() == null || detail.getState() == null
|
| | | || detail.getUser() == null)
|
| | | throw new MsgOrderDetailException(2, "消息不完整");
|
| | | MsgOrderDetail old = msgOrderDetailMapper.selectByUidAndOrderId(detail.getUser().getId(), detail.getOrderId());
|
| | | if (old == null) {
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setRead(false);
|
| | | msgOrderDetailMapper.insertSelective(detail);
|
| | | } else {
|
| | | MsgOrderDetail update = new MsgOrderDetail();
|
| | | update.setId(old.getId());
|
| | | update.setUpdateTime(new Date());
|
| | | update.setState(detail.getState());
|
| | | update.setPayMoney(detail.getPayMoney());
|
| | | update.setHongBaoMoney(detail.getHongBaoMoney());
|
| | | update.setRead(false);
|
| | | update.setBeiZhu(detail.getBeiZhu());
|
| | | msgOrderDetailMapper.updateByPrimaryKeySelective(update);
|
| | | // 锁住订单号
|
| | | Jedis jedis = jedisPool.getResource();
|
| | | try {
|
| | | String key = "rs-order-" + detail.getOrderId();
|
| | | if (jedis.setnx(key, "1") > 0) {
|
| | | jedis.expire(key, 60);
|
| | | MsgOrderDetail old = msgOrderDetailMapper.selectByUidAndOrderId(detail.getUser().getId(),
|
| | | detail.getOrderId());
|
| | | if (old == null) {
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setRead(false);
|
| | | msgOrderDetailMapper.insertSelective(detail);
|
| | | } else {
|
| | | MsgOrderDetail update = new MsgOrderDetail();
|
| | | update.setId(old.getId());
|
| | | update.setUpdateTime(new Date());
|
| | | update.setState(detail.getState());
|
| | | update.setPayMoney(detail.getPayMoney());
|
| | | update.setHongBaoMoney(detail.getHongBaoMoney());
|
| | | update.setRead(false);
|
| | | update.setBeiZhu(detail.getBeiZhu());
|
| | | msgOrderDetailMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | if (needNotify)
|
| | | userMsgReadStateService.addOrderMsgUnReadCount(detail.getUser().getId(), 1);
|
| | | jedis.del(key);
|
| | | }
|
| | |
|
| | | } finally {
|
| | | jedisPool.returnResource(jedis);
|
| | | }
|
| | | if (needNotify)
|
| | | userMsgReadStateService.addOrderMsgUnReadCount(detail.getUser().getId(), 1);
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | update.setPayMoney(detail.getPayMoney());
|
| | | if (detail.getState().intValue() != msg.getState()) {
|
| | | update.setState(detail.getState());
|
| | | // update.setUpdateTime(new Date());
|
| | | // update.setUpdateTime(new Date());
|
| | | if (needNotify)
|
| | | userMsgReadStateService.addOrderMsgUnReadCount(detail.getUser().getId(), 1);
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.taobao;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.math.RoundingMode;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | |
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
|
| | |
|
| | | @Resource
|
| | | private ConfigTaoLiJinService configTaoLiJinService;
|
| | |
|
| | | @Override
|
| | | public void addShareHotGoods(ShareHotGoods goods) {
|
| | |
| | | goodsList.add(shg.getGoods());
|
| | | }
|
| | |
|
| | | //过滤基本商品信息
|
| | | goodsList=taoBaoGoodsUpdateService.filterImportantTaoBaoGoods(goodsList);
|
| | | // 过滤基本商品信息
|
| | | goodsList = taoBaoGoodsUpdateService.filterImportantTaoBaoGoods(goodsList);
|
| | |
|
| | | // 过滤下线商品
|
| | | goodsList = taoBaoGoodsBriefService.filterOffLineGoods(goodsList);
|
| | |
| | |
|
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> listPreGoods(int page) {
|
| | | List<DaTaoKeDetailV2> list = daTaoKeGoodsDetailV2Service.listPreShareHotGoods(page);
|
| | | String warningValue = configTaoLiJinService.getValueByKey("warning_value",
|
| | | new Date(TimeUtil.convertToTimeTemp(
|
| | | TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 60 * 24L, "yyyy-MM-dd"),
|
| | | "yyyy-MM-dd")));
|
| | |
|
| | | BigDecimal minComminsion = new BigDecimal(1)
|
| | | .divide(new BigDecimal(warningValue).multiply(new BigDecimal("0.01")), 2, RoundingMode.UP);
|
| | |
|
| | | List<DaTaoKeDetailV2> list = daTaoKeGoodsDetailV2Service.listPreShareHotGoods(page, minComminsion);
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | if (list != null) {
|
| | | for (DaTaoKeDetailV2 v2 : list)
|
| | |
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailV2Service;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<DaTaoKeDetailV2> listPreShareHotGoods(int page) {
|
| | | public List<DaTaoKeDetailV2> listPreShareHotGoods(int page,BigDecimal minCommission) {
|
| | | Map<Long, DaTaoKeDetailV2> map = new HashMap<>();
|
| | | List<DaTaoKeDetailV2> list = daTaoKeGoodsDetailV2Dao.listPreShareHotGoods((page - 1) * 100, 100, "monthSales");
|
| | | List<DaTaoKeDetailV2> list = daTaoKeGoodsDetailV2Dao.listPreShareHotGoods((page - 1) * 100, 100, "hotPush",minCommission);
|
| | | System.out.println(list);
|
| | | for (DaTaoKeDetailV2 v2 : list) {
|
| | | map.put(v2.getId(), v2);
|
| | |
| | | package com.yeshi.fanli.service.impl.tlj;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | |
| | | import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService;
|
| | |
|
| | | @Service
|
| | | public class ConfigTaoLiJinServiceImpl implements ConfigTaoLiJinService{
|
| | | public class ConfigTaoLiJinServiceImpl implements ConfigTaoLiJinService {
|
| | |
|
| | | @Resource
|
| | | private ConfigTaoLiJinMapper configTaoLiJinMapper;
|
| | |
|
| | | @Override
|
| | | public ConfigTaoLiJin getByKey(String key) {
|
| | | return configTaoLiJinMapper.getByKey(key);
|
| | | return configTaoLiJinMapper.getByKey(key, new Date());
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | @Cacheable(value = "config", key = "'getValueByKey-' + #key")
|
| | | public String getValueByKey(String key) {
|
| | | ConfigTaoLiJin config = configTaoLiJinMapper.getByKey(key);
|
| | | if(config != null) {
|
| | | ConfigTaoLiJin config = configTaoLiJinMapper.getByKey(key, new Date());
|
| | | if (config != null) {
|
| | | return config.getValue();
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @Override
|
| | | public ConfigTaoLiJin getByKey(String key, Date date) {
|
| | | if (date == null)
|
| | | return getByKey(key);
|
| | | return configTaoLiJinMapper.getByKey(key, date);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public String getValueByKey(String key, Date date) {
|
| | | if (date == null)
|
| | | return getValueByKey(key);
|
| | | ConfigTaoLiJin config = configTaoLiJinMapper.getByKey(key, date);
|
| | | if (config != null) {
|
| | | return config.getValue();
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | if (uid == null) {
|
| | | throw new UserTaoLiJinOriginException(1, "参数不能为空");
|
| | | }
|
| | | String value = configTaoLiJinService.getValueByKey("hongbao_newbies");
|
| | | String value = configTaoLiJinService.getValueByKey("hongbao_newbies",null);
|
| | | if (StringUtil.isNullOrEmpty(value)) {
|
| | | throw new UserTaoLiJinOriginException(1, "系统红包不存在");
|
| | | }
|
| | |
| | | throw new UserTaoLiJinOriginException(2, "用户等级不足");
|
| | | }
|
| | |
|
| | | String value = configTaoLiJinService.getValueByKey(key);
|
| | | String value = configTaoLiJinService.getValueByKey(key,null);
|
| | | if (StringUtil.isNullOrEmpty(value)) {
|
| | | throw new UserTaoLiJinOriginException(1, "系统红包不存在");
|
| | | }
|
| | |
| | | throw new UserTaoLiJinOriginException(1, "参数不能为空");
|
| | | }
|
| | |
|
| | | String value = configTaoLiJinService.getValueByKey("hongbao_invite");
|
| | | String value = configTaoLiJinService.getValueByKey("hongbao_invite",null);
|
| | | if (StringUtil.isNullOrEmpty(value)) {
|
| | | throw new UserTaoLiJinOriginException(1, "系统红包不存在");
|
| | | }
|
| | |
| | | throw new UserTaoLiJinOriginException(1, "用户未登录");
|
| | | }
|
| | |
|
| | | String value = configTaoLiJinService.getValueByKey("hongbao_share");
|
| | | String value = configTaoLiJinService.getValueByKey("hongbao_share",null);
|
| | | if (StringUtil.isNullOrEmpty(value)) {
|
| | | throw new UserTaoLiJinOriginException(1, "系统红包不存在");
|
| | | }
|
| | |
| | | throw new UserTaoLiJinOriginException(1, "参数不能为空");
|
| | | }
|
| | |
|
| | | String value = configTaoLiJinService.getValueByKey("hongbao_invite");
|
| | | String value = configTaoLiJinService.getValueByKey("hongbao_invite",null);
|
| | | if (StringUtil.isNullOrEmpty(value)) {
|
| | | throw new UserTaoLiJinOriginException(1, "系统红包不存在");
|
| | | }
|
| | |
| | | perface = new BigDecimal(1);
|
| | | } else {
|
| | | // 计算推广红包
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value");
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value",new Date());
|
| | | perface = TaoLiJinUtil.getSpreadMoney(warningRate, goods);
|
| | | }
|
| | |
|
| | | UserTaoLiJinRecord record = createUserTaoLiJin(2, uid, goods.getAuctionId(), perface, totalNum, name,
|
| | | sendStartTime, sendEndTime, null, useEndTime, TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT);
|
| | | sendStartTime, sendEndTime, null, useEndTime, TaoBaoConstant.TAOBAO_TLJ_RELATION_PID_DEFAULT);
|
| | | String sendUrl = record.getSendUrl() + "&relationId=" + relationId;
|
| | | record.setSendUrl(sendUrl);
|
| | | UserTaoLiJinRecord updateRecoed=new UserTaoLiJinRecord();
|
| | |
| | | package com.yeshi.fanli.service.inter.taobao.dataoke;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | |
| | | *
|
| | | * @return
|
| | | */
|
| | | public List<DaTaoKeDetailV2> listPreShareHotGoods(int page);
|
| | | public List<DaTaoKeDetailV2> listPreShareHotGoods(int page,BigDecimal minCommission);
|
| | |
|
| | | /**
|
| | | * 拉取自购立减备选商品
|
| | |
| | | package com.yeshi.fanli.service.inter.tlj;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.tlj.ConfigTaoLiJin;
|
| | |
|
| | | public interface ConfigTaoLiJinService {
|
| | | |
| | |
|
| | | /**
|
| | | * 根据key值查询
|
| | | * |
| | | * @param key
|
| | | * @return
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 根据key值 获取value
|
| | | * |
| | | * @param key
|
| | | * @return
|
| | | */
|
| | | public String getValueByKey(String key);
|
| | |
|
| | | public ConfigTaoLiJin getByKey(String key, Date date);
|
| | |
|
| | | public String getValueByKey(String key, Date date);
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.util.taobao;
|
| | |
|
| | | import java.io.File;
|
| | | import java.io.FileInputStream;
|
| | | import java.io.FileNotFoundException;
|
| | | import java.io.IOException;
|
| | | import java.io.InputStream;
|
| | | import java.math.BigDecimal;
|
| | |
| | | String tradeId = taoBaoOrder.getTradeId();
|
| | | String orderByStr = tradeId.substring(startIndex, endIndex + 1);
|
| | | if (orderByStr.length() > 8) {
|
| | | LogHelper.error("订单的orderBy超过8位:" + taoBaoOrder.getOrderBy());
|
| | | LogHelper.error(taoBaoOrder.getOrderId()+ "-订单的orderBy超过8位:" + taoBaoOrder.getOrderBy());
|
| | | }
|
| | | int orderBy = Integer.parseInt(orderByStr);
|
| | | // taoBaoOrder.setOrderBy(orderBy);
|