yujian
2019-08-16 e97b71caed03d1f1aa3ae21b1ea0deac4dd9ffe0
Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
22个文件已修改
661 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/PushController.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ShareController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMsgController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java 154 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/TaoLiJinControllerV2.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/goods/taobao/dataoke/DaTaoKeGoodsDetailV2Dao.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/tlj/ConfigTaoLiJinMapper.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/tlj/ConfigTaoLiJin.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/tlj/ConfigTaoLiJinMapper.xml 116 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/ShareGoodsTextTemplateServiceImpl.java 133 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOrderDetailServiceImpl.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/ShareHotGoodsServiceImpl.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/dataoke/DaTaoKeGoodsDetailV2ServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/ConfigTaoLiJinServiceImpl.java 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinRecordServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/taobao/dataoke/DaTaoKeGoodsDetailV2Service.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/tlj/ConfigTaoLiJinService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoBaoOrderUtil.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/PushController.java
@@ -35,6 +35,7 @@
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;
@@ -121,7 +122,7 @@
     * @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)) {
@@ -155,6 +156,7 @@
     *            -用户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,
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java
@@ -2273,7 +2273,7 @@
        // 推广红包
        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
@@ -2332,7 +2332,7 @@
                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;
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ShareController.java
@@ -320,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
@@ -387,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()) + "")
@@ -834,7 +834,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);
@@ -885,7 +885,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")));
        }
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMsgController.java
@@ -262,6 +262,7 @@
     * @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,
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
@@ -3,6 +3,7 @@
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
@@ -412,7 +413,7 @@
        // 推广红包
        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
@@ -421,8 +422,8 @@
                return;
            }
            // 是否为新用户
            boolean isNewUser = userInfoExtraService.isNewUser(uid);
            // 取消新用户自购
            boolean isNewUser = false;// userInfoExtraService.isNewUser(uid);
            if (isNewUser) {
                // 判定为老用户: 新人只要使用了新人红包,也就是那1块钱,那么,他看到的分享爆款中的商品-就只能分享。
                long countRecord = userTaoLiJinRecordService.countRecordByUid(uid);
@@ -466,6 +467,11 @@
            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) {
@@ -473,7 +479,7 @@
            } 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")) {
            // 查询分享库
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java
@@ -158,8 +158,9 @@
     * 获取淘宝的分享链接
     * 
     * @param acceptData
     * @param uid        -用户ID
     * @param            auctionId-商品ID
     * @param uid
     *            -用户ID
     * @param auctionId-商品ID
     * @param out
     */
    @RequestMapping(value = "createShareInfo")
@@ -367,12 +368,21 @@
    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
@@ -406,53 +416,50 @@
            }
            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);
@@ -468,7 +475,7 @@
            // 添加分享记录
            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,
@@ -484,6 +491,7 @@
            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
@@ -497,10 +505,10 @@
                    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<>();
                    }
@@ -509,14 +517,9 @@
                }
            });
            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 + ""));
        }
    }
@@ -539,9 +542,11 @@
            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();
@@ -549,34 +554,34 @@
            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();
@@ -653,12 +658,14 @@
            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"));
@@ -677,17 +684,17 @@
            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();
@@ -946,7 +953,7 @@
            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);
@@ -998,12 +1005,14 @@
            }
        }
//        // 创建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 + "");
        // 创建口令
@@ -1033,7 +1042,7 @@
                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))
@@ -1126,7 +1135,8 @@
        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")));
            }
@@ -1207,7 +1217,8 @@
     * 
     * @param acceptData
     * @param uid
     * @param hasCoupon  -是否有券
     * @param hasCoupon
     *            -是否有券
     * @param out
     */
    @RequestMapping(value = "resetShareTextTemplate", method = RequestMethod.POST)
@@ -1223,7 +1234,7 @@
            return;
        }
         if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
        if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
            if (hasCoupon) {
                if (tljId != null) {
                    shareGoodsTextTemplateService.resetTaoLijinTemplate(uid);
@@ -1233,21 +1244,20 @@
            } 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;
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/TaoLiJinControllerV2.java
@@ -253,9 +253,12 @@
        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);
@@ -399,7 +402,7 @@
                // 已领取
                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;
@@ -409,7 +412,7 @@
            }
            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);
@@ -417,8 +420,8 @@
            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;
@@ -427,7 +430,7 @@
        // 登录用户
        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;
@@ -451,8 +454,8 @@
            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;
@@ -488,8 +491,8 @@
                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 {
@@ -504,8 +507,8 @@
                }
                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 {
@@ -557,7 +560,7 @@
            }
            // 计算推广红包
            String warningRate = configTaoLiJinService.getValueByKey("warning_value");
            String warningRate = configTaoLiJinService.getValueByKey("warning_value",new Date());
            BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, taoBaoGoodsBrief);
            // 推广红包 不能小于1
@@ -619,7 +622,8 @@
        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);
@@ -629,8 +633,8 @@
        }
        
        
        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) {
@@ -638,7 +642,7 @@
            }
            
            // 计算推广红包
            String warningRate = configTaoLiJinService.getValueByKey("warning_value");
            String warningRate = configTaoLiJinService.getValueByKey("warning_value",new Date());
            BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, taoBaoGoodsBrief);
            
            // 推广红包 不能小于1
fanli/src/main/java/com/yeshi/fanli/dao/goods/taobao/dataoke/DaTaoKeGoodsDetailV2Dao.java
@@ -150,9 +150,9 @@
     * 
     * @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);
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/tlj/ConfigTaoLiJinMapper.java
@@ -1,5 +1,7 @@
package com.yeshi.fanli.dao.mybatis.tlj;
import java.util.Date;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
@@ -12,5 +14,5 @@
     * @param key
     * @return
     */
    ConfigTaoLiJin getByKey(@Param("key") String key);
    ConfigTaoLiJin getByKey(@Param("key") String key,@Param("startTime")Date startTime);
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/tlj/ConfigTaoLiJin.java
@@ -32,6 +32,17 @@
    @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;
fanli/src/main/java/com/yeshi/fanli/mapping/tlj/ConfigTaoLiJinMapper.xml
@@ -2,52 +2,72 @@
<!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>
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/ShareGoodsTextTemplateServiceImpl.java
@@ -40,12 +40,10 @@
    @Resource
    private ConfigService configService;
    @Resource
    private ConfigTaoLiJinService configTaoLiJinService;
    @Override
    public void saveCommonTemplate(Long uid, String template) throws ShareGoodsTextTemplateException {
        isCommonTemplateRight(template);
@@ -64,7 +62,7 @@
            shareGoodsTextTemplateMapper.insertSelective(textTemplate);
        }
    }
    @Override
    public void saveCommonTemplateJD(Long uid, String template) throws ShareGoodsTextTemplateException {
        isCommonTemplateRight(template);
@@ -83,7 +81,7 @@
            shareGoodsTextTemplateMapper.insertSelective(textTemplate);
        }
    }
    @Override
    public void saveCommonTemplatePDD(Long uid, String template) throws ShareGoodsTextTemplateException {
        isCommonTemplateRight(template);
@@ -116,7 +114,7 @@
    public void saveCouponTemplate(Long uid, String template) throws ShareGoodsTextTemplateException {
        // 格式验证
        isTaoLiJinTemplateRight(template);
        ShareGoodsTextTemplate old = shareGoodsTextTemplateMapper.selectByUid(uid);
        if (old != null) {
            ShareGoodsTextTemplate update = new ShareGoodsTextTemplate();
@@ -132,13 +130,13 @@
            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();
@@ -154,14 +152,13 @@
            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();
@@ -178,13 +175,12 @@
        }
    }
    @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();
@@ -201,7 +197,7 @@
        }
    }
    @Override
    public String geteCouponTemplate(Long uid) {
        ShareGoodsTextTemplate template = shareGoodsTextTemplateMapper.selectByUid(uid);
@@ -210,7 +206,6 @@
        return null;
    }
    @Override
    public String getTaoLiJinTemplate(Long uid) {
        ShareGoodsTextTemplate template = shareGoodsTextTemplateMapper.selectByUid(uid);
@@ -218,12 +213,12 @@
            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[] { "{标题}", "{店铺类型}", "{商品原价}", "{月销量}", "{短链}", "{淘口令}" };
@@ -237,7 +232,7 @@
    @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))
@@ -245,10 +240,10 @@
        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))
@@ -256,7 +251,7 @@
        if (keysCount == 0)
            throw new ShareGoodsTextTemplateException(1, "模板格式有误");
    }
    @Override
    public void isCouponTemplateRight(String template) throws ShareGoodsTextTemplateException {
        String[] keys = new String[] { "{标题}", "{店铺类型}", "{商品原价}", "{优惠券面额}", "{优惠券价}", "{月销量}", "{领券短链}", "{淘口令}" };
@@ -267,11 +262,10 @@
        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))
@@ -280,10 +274,9 @@
            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))
@@ -292,10 +285,10 @@
            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))
@@ -303,57 +296,66 @@
        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 {
@@ -361,15 +363,15 @@
        }
        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("复制本条信息,{多多口令}打开拼多多,立即购买", "点击链接,打开拼多多,立即购买");
@@ -377,19 +379,20 @@
                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;
    }
@@ -417,8 +420,7 @@
            shareGoodsTextTemplateMapper.updateByPrimaryKeySelective(update);
        }
    }
    @Override
    public void resetCommonTemplateJD(Long uid) {
        ShareGoodsTextTemplate template = shareGoodsTextTemplateMapper.selectByUid(uid);
@@ -443,8 +445,7 @@
            shareGoodsTextTemplateMapper.updateByPrimaryKeySelective(update);
        }
    }
    @Override
    public void resetCommonTemplatePDD(Long uid) {
        ShareGoodsTextTemplate template = shareGoodsTextTemplateMapper.selectByUid(uid);
@@ -481,5 +482,5 @@
            shareGoodsTextTemplateMapper.updateByPrimaryKeySelective(update);
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java
@@ -53,6 +53,7 @@
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
@@ -501,7 +502,13 @@
                }
            }
        } 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) {
@@ -818,7 +825,12 @@
            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"))) {
@@ -1061,8 +1073,8 @@
        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());
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOrderDetailServiceImpl.java
@@ -15,6 +15,9 @@
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 {
@@ -24,6 +27,9 @@
    @Resource
    private UserMsgReadStateService userMsgReadStateService;
    @Resource
    private JedisPool jedisPool;
    @Override
    public void addMsgOrderDetail(MsgOrderDetail detail, boolean needNotify) throws MsgOrderDetailException {
        if (detail == null)
@@ -31,25 +37,39 @@
        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
@@ -87,7 +107,7 @@
        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);
        }
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/ShareHotGoodsServiceImpl.java
@@ -1,6 +1,7 @@
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;
@@ -24,7 +25,9 @@
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;
@@ -41,9 +44,12 @@
    @Resource
    private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
    @Resource
    private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
    @Resource
    private ConfigTaoLiJinService configTaoLiJinService;
    @Override
    public void addShareHotGoods(ShareHotGoods goods) {
@@ -70,8 +76,8 @@
                goodsList.add(shg.getGoods());
        }
        //过滤基本商品信息
        goodsList=taoBaoGoodsUpdateService.filterImportantTaoBaoGoods(goodsList);
        // 过滤基本商品信息
        goodsList = taoBaoGoodsUpdateService.filterImportantTaoBaoGoods(goodsList);
        // 过滤下线商品
        goodsList = taoBaoGoodsBriefService.filterOffLineGoods(goodsList);
@@ -98,7 +104,15 @@
    @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)
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/dataoke/DaTaoKeGoodsDetailV2ServiceImpl.java
@@ -22,7 +22,6 @@
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;
@@ -212,9 +211,9 @@
    }
    @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);
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/ConfigTaoLiJinServiceImpl.java
@@ -1,5 +1,7 @@
package com.yeshi.fanli.service.impl.tlj;
import java.util.Date;
import javax.annotation.Resource;
import org.springframework.cache.annotation.Cacheable;
@@ -10,27 +12,42 @@
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;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java
@@ -148,7 +148,7 @@
        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, "系统红包不存在");
        }
@@ -207,7 +207,7 @@
            throw new UserTaoLiJinOriginException(2, "用户等级不足");
        }
        
        String value = configTaoLiJinService.getValueByKey(key);
        String value = configTaoLiJinService.getValueByKey(key,null);
        if (StringUtil.isNullOrEmpty(value)) {
            throw new UserTaoLiJinOriginException(1, "系统红包不存在");
        }
@@ -246,7 +246,7 @@
            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, "系统红包不存在");
        }
@@ -285,7 +285,7 @@
            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, "系统红包不存在");
        }
@@ -533,7 +533,7 @@
            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, "系统红包不存在");
        }
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinRecordServiceImpl.java
@@ -220,12 +220,12 @@
            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();
fanli/src/main/java/com/yeshi/fanli/service/inter/taobao/dataoke/DaTaoKeGoodsDetailV2Service.java
@@ -1,5 +1,6 @@
package com.yeshi.fanli.service.inter.taobao.dataoke;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@@ -111,7 +112,7 @@
     * 
     * @return
     */
    public List<DaTaoKeDetailV2> listPreShareHotGoods(int page);
    public List<DaTaoKeDetailV2> listPreShareHotGoods(int page,BigDecimal minCommission);
    /**
     * 拉取自购立减备选商品
fanli/src/main/java/com/yeshi/fanli/service/inter/tlj/ConfigTaoLiJinService.java
@@ -1,11 +1,14 @@
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
     */
@@ -13,9 +16,14 @@
    /**
     * 根据key值 获取value
     *
     * @param key
     * @return
     */
    public String getValueByKey(String key);
    public ConfigTaoLiJin getByKey(String key, Date date);
    public String getValueByKey(String key, Date date);
}
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoBaoOrderUtil.java
@@ -1,8 +1,5 @@
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;
@@ -737,7 +734,7 @@
            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);