| | |
| | | package com.yeshi.fanli.service.impl.push;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | |
| | | import com.yeshi.fanli.entity.push.PushGoodsGroup;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.exception.PushException;
|
| | | import com.yeshi.fanli.exception.push.PushCouponException;
|
| | | import com.yeshi.fanli.exception.push.PushGoodsException;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
|
| | |
| | | if (goodsList == null || goodsList.size() == 0) {
|
| | | throw new PushException(1, "推送无商品,请完善数据");
|
| | | }
|
| | |
|
| | | |
| | | List<String> listVersion = null;
|
| | | String versions = pushGoods.getVersions();
|
| | | if (versions != null && versions.trim().length() > 0) {
|
| | | listVersion = Arrays.asList(versions.split(","));
|
| | | if (listVersion == null || listVersion.size() == 0) {
|
| | | throw new PushCouponException(1, "版本号格式不正确\"");
|
| | | }
|
| | | }
|
| | | |
| | | if (goodsList.size() == 1) {
|
| | | /* 单个商品推送: 直接处理为商品信息 */
|
| | | PushGoodsGroup pushGoodsGroup = goodsList.get(0);
|
| | |
| | |
|
| | | Long goodsId = commonGoods.getGoodsId();
|
| | | String url = "https://item.taobao.com/item.htm?id=" + goodsId;
|
| | | |
| | | pushService.pushGoods(pushGoods.getUid(), url, alertTitle, alertContent, listVersion);
|
| | |
|
| | | pushService.pushGoods(pushGoods.getUid(), url, alertTitle, alertContent);
|
| | |
|
| | | } else {
|
| | | /* 多个商品推送 */
|
| | | String url = configService.get("push_goods_details");
|
| | |
| | | // 生成链接
|
| | | url = url + "?id=" + id;
|
| | |
|
| | | pushService.pushUrl(pushGoods.getUid(), url, alertTitle, alertContent);
|
| | | pushService.pushUrl(pushGoods.getUid(), url, alertTitle, alertContent, listVersion);
|
| | | }
|
| | |
|
| | | // 已推送
|