| | |
| | | }
|
| | | 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);
|
| | |
| | | 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;
|
| | |
| | |
|
| | | @Resource
|
| | | private XMPushService xmPushService;
|
| | |
|
| | | @Resource
|
| | | private OPPOPushService oPPOPushService;
|
| | |
|
| | | @Resource
|
| | | private PushRecordMapper pushRecordMapper;
|
| | |
| | | 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();
|
| | |
| | | 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();
|
| | |
| | | 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);
|
| | | }
|
| | | }
|
| | |
|
| | | // 插入推送记录
|
| | |
| | | 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);
|
| | | }
|
| | |
|
| | | // 插入推送记录
|
| | |
| | | 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);
|
| | |
| | | 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);
|
| | | }
|
| | |
|
| | | // 插入推送记录
|
| | |
| | | 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);
|
| | |
| | | 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) {
|
| | |
| | |
|
| | | @Component
|
| | | public class CommonGoodsUtil {
|
| | | |
| | |
|
| | | /**
|
| | | * 商品佣金包含¥符号
|
| | | * |
| | | * @param goods
|
| | | * @param rate
|
| | | * @return
|
| | |
| | | public static String getCommissionInfo(CommonGoods goods, BigDecimal rate) {
|
| | | return "¥" + getCommission(goods, rate).toString();
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 商品佣金
|
| | | * 商品佣金
|
| | | * |
| | | * @param goods
|
| | | * @param rate
|
| | | * @return
|
| | |
| | | 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);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 计算商品券后价,没有券则返回原价
|
| | | *
|
| | |
| | | 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 {// 不能用券
|
| | |
| | | }
|
| | |
|
| | | 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();
|
| | |
| | | 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<>());
|
| | |
| | | return detail;
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 各大榜单
|
| | | *
|
| | |
| | | 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) {
|
| | |
| | | }
|
| | | return hotWords;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | class DaTaoKeResult {
|
| | | Date updateTime;
|
| | | List<DaTaoKeDetail> dataList;
|