admin
2019-09-28 98c7c508c05c765838a4a3318423ff9627b46e17
自购立减商品规则添加
5个文件已修改
135 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/job/TaoLiJinJob.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/dataoke/DaTaoKeGoodsDetailV2ServiceImpl.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/CommonGoodsUtil.java 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/dataoke/DaTaoKeApiUtil.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/TaoLiJinJob.java
@@ -151,8 +151,13 @@
            }
            if (goods != null && goods.getCouponAmount() != null
                    && goods.getCouponAmount().compareTo(new BigDecimal(0)) > 0) {
                // 淘礼金的金额位于1-10块之间 必须是天猫
                if (TaoBaoUtil.getAfterUseCouplePrice(goods).multiply(goods.getTkRate())
                        .compareTo(new BigDecimal("143")) >= 0) {
                        .compareTo(new BigDecimal("143")) >= 0
                        && TaoBaoUtil.getAfterUseCouplePrice(goods).multiply(goods.getTkRate())
                                .compareTo(new BigDecimal("1430")) <= 0
                        && goods.getUserType() == 1) {
                    goods = daTaoKeGoodsDetailService.filterTaoBaoGoods(goods);
                    int totalHongBaoCount = 2000 + (int) (Math.random() * 8000);
                    int leftHongBaoCount = 200 + (int) (Math.random() * 2000);
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java
@@ -20,6 +20,7 @@
import com.yeshi.fanli.service.inter.push.DeviceTokenHWService;
import com.yeshi.fanli.service.inter.push.HWPushService;
import com.yeshi.fanli.service.inter.push.IOSPushService;
import com.yeshi.fanli.service.inter.push.OPPOPushService;
import com.yeshi.fanli.service.inter.push.PushRecordService;
import com.yeshi.fanli.service.inter.push.PushService;
import com.yeshi.fanli.service.inter.push.XMPushService;
@@ -55,6 +56,9 @@
    @Resource
    private XMPushService xmPushService;
    @Resource
    private OPPOPushService oPPOPushService;
    @Resource
    private PushRecordMapper pushRecordMapper;
@@ -100,6 +104,15 @@
                    versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
                hwPushService.pushGoods(uid, Long.parseLong(gid), title, content, versionCodeList);
            }
            // OPPO推送
            if (listAndroid == null || listAndroid.size() > 0) {
                List<Integer> versionCodeList = null;
                if (listAndroid != null)
                    versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
                oPPOPushService.pushGoods(uid, Long.parseLong(gid), title, content, versionCodeList);
            }
        }
        PushRecord pushRecord = new PushRecord();
@@ -149,6 +162,15 @@
                    versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
                hwPushService.pushUrl(uid, url, title, content, versionCodeList);
            }
            // OPPO推送
            if (listAndroid == null || listAndroid.size() > 0) {
                List<Integer> versionCodeList = null;
                if (listAndroid != null)
                    versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
                oPPOPushService.pushUrl(uid, url, title, content, versionCodeList);
            }
        }
        PushRecord pushRecord = new PushRecord();
@@ -215,6 +237,14 @@
                    versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
                hwPushService.pushZNX(uId, title, content, versionCodeList);
            }
            // OPPO推送
            if (listAndroid == null || listAndroid.size() > 0) {
                List<Integer> versionCodeList = null;
                if (listAndroid != null)
                    versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
                oPPOPushService.pushZNX(uId, title, content, versionCodeList);
            }
        }
        // 插入推送记录
@@ -262,6 +292,14 @@
            if (listAndroid != null)
                versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
            hwPushService.pushWEEX(uid, title, content, weexUrl, versionCodeList);
        }
        // OPPO推送
        if (listAndroid == null || listAndroid.size() > 0) {
            List<Integer> versionCodeList = null;
            if (listAndroid != null)
                versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
            oPPOPushService.pushWEEX(uid, title, content, weexUrl, versionCodeList);
        }
        // 插入推送记录
@@ -312,6 +350,14 @@
            hwPushService.pushBaiChuanUrl(uid, title, content, url, versionCodeList);
        }
        // OPPO推送
        if (listAndroid == null || listAndroid.size() > 0) {
            List<Integer> versionCodeList = null;
            if (listAndroid != null)
                versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
            oPPOPushService.pushBaiChuanUrl(uid, title, content, url, versionCodeList);
        }
        // 插入推送记录
        PushRecord pushRecord = new PushRecord();
        pushRecord.setUrl(url);
@@ -357,6 +403,14 @@
            if (listAndroid != null)
                versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
            hwPushService.pushWelfareCenter(uid, title, content, versionCodeList);
        }
        // OPPO推送
        if (listAndroid == null || listAndroid.size() > 0) {
            List<Integer> versionCodeList = null;
            if (listAndroid != null)
                versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
            oPPOPushService.pushWelfareCenter(uid, title, content, versionCodeList);
        }
        // 插入推送记录
@@ -484,6 +538,14 @@
            hwPushService.pushUserSignInNotification(uid, title, content, versionCodeList);
        }
        // OPPO推送
        if (listAndroid == null || listAndroid.size() > 0) {
            List<Integer> versionCodeList = null;
            if (listAndroid != null)
                versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
            oPPOPushService.pushUserSignInNotification(uid, title, content, versionCodeList);
        }
        // 插入推送记录
        PushRecord pushRecord = new PushRecord();
        pushRecord.setTitle(title);
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/dataoke/DaTaoKeGoodsDetailV2ServiceImpl.java
@@ -252,13 +252,25 @@
    public List<DaTaoKeDetailV2> listPreTLJBuyGoods(int page) {
        if (page == 1) {
            List<DaTaoKeDetailV2> listPreGoodsList = new ArrayList<>();
            // 热销榜
            DaTaoKeGoodsResult result = DaTaoKeApiUtil.getRankingList(DaTaoKeApiUtil.RANK_TYPE_HOT, null);
            if (result != null && result.getGoodsList() != null)
                listPreGoodsList.addAll(result.getGoodsList());
            // 复购榜
            result = DaTaoKeApiUtil.getRankingList(DaTaoKeApiUtil.RANK_TYPE_REBUY, null);
            if (result != null && result.getGoodsList() != null)
                listPreGoodsList.addAll(result.getGoodsList());
            // 综合搜索
            try {
                result = DaTaoKeApiUtil.search("", null, null, null, 1, 200, DaTaoKeApiUtil.SORT_DEFAULT);
                if (result == null)
                    throw new Exception();
            } catch (Exception e) {// 异常重复一次
                result = DaTaoKeApiUtil.search("", null, null, null, 1, 200, DaTaoKeApiUtil.SORT_DEFAULT);
            }
            if (result != null && result.getGoodsList() != null)
                listPreGoodsList.addAll(result.getGoodsList());
            List<DaTaoKeDetailV2> goodsList = new ArrayList<>();
            for (DaTaoKeDetailV2 v2 : listPreGoodsList) {
fanli/src/main/java/com/yeshi/fanli/util/CommonGoodsUtil.java
@@ -11,9 +11,10 @@
@Component
public class CommonGoodsUtil {
    /**
     * 商品佣金包含¥符号
     *
     * @param goods
     * @param rate
     * @return
@@ -21,10 +22,10 @@
    public static String getCommissionInfo(CommonGoods goods, BigDecimal rate) {
        return "¥" + getCommission(goods, rate).toString();
    }
    /**
     *        商品佣金
     * 商品佣金
     *
     * @param goods
     * @param rate
     * @return
@@ -32,34 +33,35 @@
    public static BigDecimal getCommission(CommonGoods goods, BigDecimal rate) {
        BigDecimal money = null;
        if (StringUtil.isNullOrEmpty(goods.getCouponInfo())
                || goods.getCouponInfo().trim().equalsIgnoreCase("无")) {
            money = MoneyBigDecimalUtil.mul(
                    MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(goods.getPrice(), goods.getRate()),
                            new BigDecimal("0.01")),
        if (StringUtil.isNullOrEmpty(goods.getCouponInfo()) || goods.getCouponInfo().trim().equalsIgnoreCase("无")) {
            money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil
                    .mul(MoneyBigDecimalUtil.mul(goods.getPrice(), goods.getRate()), new BigDecimal("0.01")),
                    MoneyBigDecimalUtil.div(rate, new BigDecimal(100)));
        } else// 有券
        {
            List<BigDecimal> list = TaoBaoCouponUtil.getCouponInfo(goods.getCouponInfo());
            BigDecimal startFee = list.get(0);
            BigDecimal couponAccount = list.get(1);
            if (startFee.compareTo(goods.getPrice()) <= 0
                    && goods.getPrice().compareTo(couponAccount) > 0) {
            if (startFee.compareTo(goods.getPrice()) <= 0 && goods.getPrice().compareTo(couponAccount) > 0) {
                BigDecimal finalPrice = goods.getPrice().subtract(couponAccount);
                money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil
                        .mul(MoneyBigDecimalUtil.mul(finalPrice, goods.getRate()), new BigDecimal("0.01")),
                        MoneyBigDecimalUtil.div(rate, new BigDecimal(100)));
            } else {// 不能用券
                money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(
                        MoneyBigDecimalUtil.mul(goods.getPrice(), goods.getRate()),
                        new BigDecimal("0.01")), MoneyBigDecimalUtil.div(rate, new BigDecimal(100)));
                money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil
                        .mul(MoneyBigDecimalUtil.mul(goods.getPrice(), goods.getRate()), new BigDecimal("0.01")),
                        MoneyBigDecimalUtil.div(rate, new BigDecimal(100)));
            }
        }
        return BigDecimalUtil.getWithNoZera(money);
        // 京东商品特殊处理
        if (goods.getGoodsType() == Constant.SOURCE_TYPE_JD)
            return BigDecimalUtil.getWithNoZera(MoneyBigDecimalUtil.mul(money, new BigDecimal("0.9")));
        else
            return BigDecimalUtil.getWithNoZera(money);
    }
    /**
     * 计算商品券后价,没有券则返回原价
     * 
@@ -73,8 +75,7 @@
            List<BigDecimal> list = TaoBaoCouponUtil.getCouponInfo(goods.getCouponInfo());
            BigDecimal startFee = list.get(0);
            BigDecimal couponAccount = list.get(1);
            if (startFee.compareTo(goods.getPrice()) <= 0
                    && goods.getPrice().compareTo(couponAccount) > 0) {
            if (startFee.compareTo(goods.getPrice()) <= 0 && goods.getPrice().compareTo(couponAccount) > 0) {
                BigDecimal finalPrice = goods.getPrice().subtract(couponAccount);
                return finalPrice;
            } else {// 不能用券
fanli/src/main/java/com/yeshi/fanli/util/dataoke/DaTaoKeApiUtil.java
@@ -360,7 +360,7 @@
    }
    public static DaTaoKeGoodsResult search(String key, List<Integer> cidList, BigDecimal priceLowerLimit,
            BigDecimal priceUpperLimit, int page, int pageSize, int sort) {
            BigDecimal priceUpperLimit, int page, int pageSize, Integer sort) {
        TaoKeAppInfo app = getRandomApp();
        DaTaoKeGoodsResult daTaoKeGoodsResult = new DaTaoKeGoodsResult();
@@ -385,7 +385,8 @@
            params.put("cids", cids);
        params.put("keyWords", key);
        params.put("sort", sort + "");
        if (sort != null)
            params.put("sort", sort + "");
        params.put("sign", getSign(params, app.getAppSecret()));
        String result = HttpUtil.get("https://openapi.dataoke.com/api/goods/get-dtk-search-goods", params,
                new HashMap<>());
@@ -543,7 +544,6 @@
        return detail;
    }
    /**
     * 各大榜单
     * 
@@ -556,14 +556,14 @@
        params.put("version", "v1.0.1");
        params.put("appKey", app.getAppKey());
        params.put("sign", getSign(params, app.getAppSecret()));
        String result = null;
        try {
            result = HttpUtil.get("https://openapi.dataoke.com/api/category/get-top100", params, new HashMap<>());
        } catch (Exception e) {
            result = HttpUtil.get("https://openapi.dataoke.com/api/category/get-top100", params, new HashMap<>());
        }
        String hotWords = null;
        JSONObject json = JSONObject.fromObject(result);
        if (json != null) {
@@ -574,8 +574,7 @@
        }
        return hotWords;
    }
    class DaTaoKeResult {
        Date updateTime;
        List<DaTaoKeDetail> dataList;