| | |
| | | import com.yeshi.fanli.service.inter.goods.CommonTemplateContentService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | |
| | |
|
| | | @Resource
|
| | | private CommonTemplateContentService commonTemplateContentService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
|
| | |
|
| | | /**
|
| | | * 通用模板导航
|
| | |
| | | root.put("goodsList", array);
|
| | | root.put("goodsCount", result.getCount());
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | |
|
| | | // 更新前5页数据
|
| | | if (page <= 5)
|
| | | try {
|
| | | taoBaoGoodsUpdateService.addUpdateQueueAsync(goodsList);
|
| | | } catch (Exception e) {
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | @RequestMapping(value = "/bindHWPush", method = RequestMethod.POST)
|
| | | public void bindHWDeviceToken(AcceptData acceptData, String token, Long uid, PrintWriter out) {
|
| | | deviceTokenHWService.addDeviceToken(token, acceptData.getDevice(), uid);
|
| | | deviceTokenHWService.addDeviceToken(token, acceptData.getDevice(), uid,
|
| | | Integer.parseInt(acceptData.getVersion()));
|
| | | out.print(JsonUtil.loadTrueResult("成功"));
|
| | | }
|
| | |
|
| | |
| | | List<TaoBaoGoodsBrief> goodsList = homeRecommendGoodsService.listGoodsByPage(null, acceptData.getDevice(),
|
| | | imei, idfa, page);
|
| | |
|
| | | if (page < 4) {// 前三页加入更新
|
| | | try {
|
| | | taoBaoGoodsUpdateService.addUpdateQueueAsync(goodsList);
|
| | | } catch (Exception e) {
|
| | | }
|
| | | }
|
| | |
|
| | | BigDecimal rate = hongBaoManageService.getFanLiRate();
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods, rate + "", null);
|
| | |
| | | import com.yeshi.fanli.service.inter.lable.LabelClassService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
|
| | | import com.yeshi.fanli.service.inter.lable.TaoKeGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | |
| | |
|
| | | @Resource
|
| | | private LabelClassService labelClassService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
|
| | |
|
| | | /**
|
| | | * 一级分类
|
| | |
| | | // 总条数
|
| | | long counttotal = 5000;
|
| | |
|
| | | List<TaoBaoGoodsBrief> updateGoodsList = new ArrayList<>();
|
| | |
|
| | | // 精选库数据为空时,网络进行查询
|
| | | if (listQuery == null || listQuery.size() == 0) {
|
| | | long count = qualityGoodsService.countQueryClassId(gcid);
|
| | |
| | | if (taoBaoGoodsBrief == null) {
|
| | | continue;
|
| | | }
|
| | | updateGoodsList.add(taoBaoGoodsBrief);
|
| | | GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate,
|
| | | shareRate);
|
| | | array.add(gson.toJson(goodsDetailVO));
|
| | |
| | | data.put("count", counttotal);
|
| | | data.put("result", array);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | try {
|
| | | taoBaoGoodsUpdateService.addUpdateQueueAsync(updateGoodsList);
|
| | | } catch (Exception e) {
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @param page
|
| | | * @param scid
|
| | | * @param filter
|
| | | * @param order 来源:【推荐:0 | 综合:4 、综合只看有券 1 、综合只看天猫 1 | 价格:低到高3 高到低2 | 销量:1】
|
| | | * 排序值:【销量由高到低: 1 ; 销量由低到高 5; 价格从高到低: 2 ; 价格从低到高:3 ; 推广量高到低:4
|
| | | * ; 其他默认: 销量由高到低】
|
| | | * @param order
|
| | | * 来源:【推荐:0 | 综合:4 、综合只看有券 1 、综合只看天猫 1 | 价格:低到高3 高到低2 | 销量:1】
|
| | | * 排序值:【销量由高到低: 1 ; 销量由低到高 5; 价格从高到低: 2 ; 价格从低到高:3 ; 推广量高到低:4 ;
|
| | | * 其他默认: 销量由高到低】
|
| | | *
|
| | | * @param startprice 起始价格
|
| | | * @param endprice 结束价格
|
| | | * @param fastFilter fastFilter 有券 [{"type":"quantype"}] 天猫商品
|
| | | * [{"type":"shoptype"}]
|
| | | * @param totalSales 销量以上
|
| | | * @param startprice
|
| | | * 起始价格
|
| | | * @param endprice
|
| | | * 结束价格
|
| | | * @param fastFilter
|
| | | * fastFilter 有券 [{"type":"quantype"}] 天猫商品 [{"type":"shoptype"}]
|
| | | * @param totalSales
|
| | | * 销量以上
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getSubGoods", method = RequestMethod.POST)
|
| | |
| | | if (catesId.endsWith(","))
|
| | | catesId = catesId.substring(0, catesId.length() - 1);
|
| | | sf.setCateIds(catesId);
|
| | | |
| | |
|
| | | // 按分类名称搜索
|
| | | if (!StringUtil.isNullOrEmpty(catesId)) {
|
| | | if (!StringUtil.isNullOrEmpty(catesId)) {
|
| | | String searchParam = goodsSubClass.getSearchJson();
|
| | | Gson gs = new Gson();
|
| | | SearchFilter searchfilter = gs.fromJson(searchParam, SearchFilter.class);
|
| | |
| | | totalSales);
|
| | | TaoBaoSearchResult searchResult = TaoKeApiUtil.searchWuLiao(searchfilter);
|
| | | long count = searchResult.getPageEntity().getTotalCount();
|
| | |
|
| | |
|
| | | List<TaoBaoGoodsBrief> resultGoodsList = searchResult.getTaoBaoGoodsBriefs();
|
| | | // 查询是否超过了最大的商品数
|
| | |
| | | resultGoodsList.addAll(resultListTemp);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | Gson gson2 = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().create();
|
| | | |
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | if (resultGoodsList != null)
|
| | | for (TaoBaoGoodsBrief goods : resultGoodsList) {
|
| | | GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(goods, null, fanLiRate, shareRate);
|
| | | GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(goods, null, fanLiRate,
|
| | | shareRate);
|
| | | array.add(gson2.toJson(goodsDetailVO));
|
| | | }
|
| | | |
| | |
|
| | | JSONObject result = new JSONObject();
|
| | | result.put("result", array);
|
| | | result.put("count", result.optLong("count") + count);
|
| | |
| | | searchfilter.setKey(goodsSubClass.getKey());
|
| | | taoKeGoodsService.setSearchFilter(searchfilter, filter, order, startprice, endprice, fastFilter,
|
| | | totalSales);
|
| | | |
| | |
|
| | | JSONObject result = taoKeGoodsService.searchWuLiaoV2(searchfilter);
|
| | | out.print(JsonUtil.loadTrueResult(result));
|
| | | return;
|
| | |
| | | import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
|
| | | import com.yeshi.fanli.service.inter.monitor.MonitorService;
|
| | | import com.yeshi.fanli.service.inter.pdd.PDDGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | |
|
| | | @Resource
|
| | | private PDDGoodsService pddGoodsService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
|
| | |
|
| | | /**
|
| | | * 新版推荐专题管理(1.5.3)
|
| | |
| | | List<TaoBaoGoodsBrief> goodsList = homeRecommendGoodsService.listGoodsByPage(null, acceptData.getDevice(),
|
| | | imei, idfa, page);
|
| | |
|
| | | if (page < 4) {// 前三页加入更新
|
| | | try {
|
| | | taoBaoGoodsUpdateService.addUpdateQueueAsync(goodsList);
|
| | | } catch (Exception e) {
|
| | | }
|
| | | }
|
| | |
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | |
| | | private String device;
|
| | | @Column(name = "dh_uid")
|
| | | private UserInfo user;
|
| | | @Column(name = "dh_version")
|
| | | private Integer version;
|
| | | @Column(name = "dh_updatetime")
|
| | | private Date updateTime;
|
| | |
|
| | |
| | | this.deviceTokenMd5 = deviceTokenMd5;
|
| | | }
|
| | |
|
| | | public Integer getVersion() {
|
| | | return version;
|
| | | }
|
| | |
|
| | | public void setVersion(Integer version) {
|
| | | this.version = version;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.persistence.Entity;
|
| | | import javax.persistence.GeneratedValue;
|
| | | import javax.persistence.GenerationType;
|
| | | import javax.persistence.Transient;
|
| | |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Entity
|
| | | @org.yeshi.utils.mybatis.Table("yeshi_ec_taobao_goods")
|
| | | @Document(collection="taoBaoGoodsCache")
|
| | | public class TaoBaoGoodsBrief implements Serializable {
|
| | |
| | | <result column="dh_updatetime" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | <result column="dh_token_md5" property="deviceTokenMd5" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="dh_version" property="version" jdbcType="INTEGER" /> |
| | | <association property="user" column="dh_uid" |
| | | resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap" /> |
| | | |
| | | </resultMap> |
| | | <sql id="Base_Column_List">dh_id,dh_token,dh_device,dh_uid as |
| | | id,dh_updatetime,dh_token_md5 |
| | | id,dh_updatetime,dh_token_md5,dh_version |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.push.DeviceTokenHW" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_uid_devicetoken_hw |
| | | (dh_id,dh_token,dh_device,dh_uid,dh_updatetime,dh_token_md5) values |
| | | (#{id,jdbcType=BIGINT},#{deviceToken,jdbcType=VARCHAR},#{device,jdbcType=VARCHAR},#{user.id,jdbcType=BIGINT},#{updateTime,jdbcType=TIMESTAMP},#{deviceTokenMd5,jdbcType=VARCHAR}) |
| | | (dh_id,dh_token,dh_device,dh_uid,dh_updatetime,dh_token_md5,dh_version) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{deviceToken,jdbcType=VARCHAR},#{device,jdbcType=VARCHAR},#{user.id,jdbcType=BIGINT},#{updateTime,jdbcType=TIMESTAMP},#{deviceTokenMd5,jdbcType=VARCHAR},#{version,jdbcType=INTEGER}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.push.DeviceTokenHW" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | |
| | | <if test="user != null">dh_uid,</if> |
| | | <if test="updateTime != null">dh_updatetime,</if> |
| | | <if test="deviceTokenMd5 != null">dh_token_md5,</if> |
| | | <if test="version != null">dh_version,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="device != null">#{device,jdbcType=VARCHAR},</if> |
| | | <if test="user != null">#{user.id,jdbcType=BIGINT},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="deviceTokenMd5 != null">#{deviceTokenMd5,jdbcType=VARCHAR}</if> |
| | | <if test="deviceTokenMd5 != null">#{deviceTokenMd5,jdbcType=VARCHAR},</if> |
| | | <if test="version != null">#{version,jdbcType=INTEGER}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.push.DeviceTokenHW">update |
| | |
| | | #{device,jdbcType=VARCHAR},dh_uid = |
| | | #{user.id,jdbcType=BIGINT},dh_updatetime = |
| | | #{updateTime,jdbcType=TIMESTAMP} ,dh_token_md5 |
| | | =#{deviceTokenMd5,jdbcType=VARCHAR} where dh_id = |
| | | #{id,jdbcType=BIGINT} |
| | | =#{deviceTokenMd5,jdbcType=VARCHAR} ,dh_version |
| | | =#{version,jdbcType=INTEGER} where dh_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.push.DeviceTokenHW"> |
| | | update yeshi_ec_uid_devicetoken_hw |
| | | <set> |
| | |
| | | <if test="user != null">dh_uid=#{user.id,jdbcType=BIGINT},</if> |
| | | <if test="updateTime != null">dh_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="deviceTokenMd5 !=null">dh_token_md5 =#{deviceTokenMd5,jdbcType=VARCHAR},</if> |
| | | <if test="version !=null">dh_version =#{version,jdbcType=INTEGER},</if> |
| | | </set> |
| | | where dh_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | |
| | | <update id="bindUidByDevice"> |
| | | update yeshi_ec_uid_devicetoken_hw |
| | | <set> |
| | | dh_uid=#{uid} |
| | | </set> |
| | | <set>dh_uid=#{uid}</set> |
| | | where dh_device = #{device} |
| | | </update> |
| | | |
| | | </mapper> |
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void addDeviceToken(String token, String device, Long uid) {
|
| | | public void addDeviceToken(String token, String device, Long uid, int version) {
|
| | | if (StringUtil.isNullOrEmpty(device))
|
| | | return;
|
| | | //
|
| | |
| | | deviceTokenHW.setDevice(device);
|
| | | deviceTokenHW.setDeviceToken(token);
|
| | | deviceTokenHW.setDeviceTokenMd5(StringUtil.Md5(token));
|
| | | deviceTokenHW.setVersion(version);
|
| | | deviceTokenHW.setUpdateTime(new Date());
|
| | | if (uid != null)
|
| | | deviceTokenHW.setUser(new UserInfo(uid));
|
| | |
| | | if (!StringUtil.isNullOrEmpty(token)) {
|
| | | update.setDeviceToken(token);
|
| | | update.setDeviceTokenMd5(StringUtil.Md5(token));
|
| | | update.setVersion(version);
|
| | | }
|
| | | update.setUpdateTime(new Date());
|
| | | if (uid != null)
|
| | |
| | | import com.yeshi.fanli.exception.taobao.TaoKeApiException;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
|
| | | 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.util.StringUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private EhCacheCacheManager ehCacheCacheManager;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
|
| | |
|
| | | @Override
|
| | | public void addTLJBuyGoods(TLJBuyGoods goods, TaoKeAppInfo taoKeAppInfo) {
|
| | |
| | | j--;
|
| | | }
|
| | | }
|
| | |
|
| | | // 加入更新队列
|
| | |
|
| | | try {
|
| | | for (TLJBuyGoods tljGoods : list)
|
| | | if (tljGoods != null && tljGoods.getGoods() != null && tljGoods.getGoods().getAuctionId() != null)
|
| | | taoBaoGoodsUpdateService.addUpdateQueueAsync(tljGoods.getGoods().getAuctionId());
|
| | | } catch (Exception e) {
|
| | | }
|
| | | return list;
|
| | | }
|
| | |
|
| | |
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.context.annotation.Lazy;
|
| | | import org.springframework.scheduling.annotation.Async;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | |
| | | @Resource
|
| | | private ActivityService activityService;
|
| | |
|
| | | @Lazy
|
| | | @Resource
|
| | | private QualityFactoryService qualityFactoryService;
|
| | |
|
| | |
| | | @Resource
|
| | | private ShareHotGoodsService shareHotGoodsService;
|
| | |
|
| | | @Lazy
|
| | | @Resource
|
| | | private TLJBuyGoodsService tljBuyGoodsService;
|
| | |
|
| | |
| | | tljBuyGoodsService.updateGoods(goods);
|
| | |
|
| | | // 总要商品更新
|
| | | // updateImplTBGoods(goods);
|
| | | // updateImplTBGoods(goods);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | taoBaoGoodsCacheUtil.addUpdateHistory(goods.getAuctionId());
|
| | | }
|
| | |
|
| | | @Async
|
| | | @Override
|
| | | public void addUpdateQueue(Long auctionId) {
|
| | | if (taoBaoGoodsCacheUtil.canAddToUpdateQueue(auctionId)) {
|
| | | // 添加到更新队列
|
| | | CMQManager.getInstance().addTBImpGoodsUpdate(auctionId);
|
| | | taoBaoGoodsCacheUtil.addAddToQueueHistory(auctionId);
|
| | | public void addUpdateQueueAsync(Long auctionId) {
|
| | | addUpdateQueueSync(auctionId);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 同步加入
|
| | | * |
| | | * @param auctionId
|
| | | */
|
| | | private void addUpdateQueueSync(Long auctionId) {
|
| | | try {
|
| | | if (taoBaoGoodsCacheUtil.canAddToUpdateQueue(auctionId)) {
|
| | | // 添加到更新队列
|
| | | CMQManager.getInstance().addTBImpGoodsUpdate(auctionId);
|
| | | taoBaoGoodsCacheUtil.addAddToQueueHistory(auctionId);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | @Async
|
| | | @Override
|
| | | public void addUpdateQueueAsync(List<TaoBaoGoodsBrief> goodsList) {
|
| | | if (goodsList != null)
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | | if (goods != null && goods.getAuctionId() != null)
|
| | | addUpdateQueueSync(goods.getAuctionId());
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> filterTaoBaoGoods(List<TaoBaoGoodsBrief> goodsList) {
|
| | | Map<Long, TaoBaoGoodsBrief> finalMap = new HashMap<>();
|
| | | // 原始数据全覆盖
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | | finalMap.put(goods.getAuctionId(), goods);
|
| | | }
|
| | |
|
| | | List<TaoBaoGoodsBrief> tempGoodsList = new ArrayList<>();
|
| | | tempGoodsList.addAll(goodsList);
|
| | | // 先从redis里面取覆盖
|
| | | for (int i = 0; i < tempGoodsList.size(); i++) {
|
| | | TaoBaoGoodsBrief goods = taoBaoGoodsCacheUtil.getCommonTaoBaoGoodsInfo(tempGoodsList.get(i).getAuctionId());
|
| | | if (goods != null) {
|
| | | finalMap.put(goods.getAuctionId(), goods);
|
| | | tempGoodsList.remove(i--);
|
| | | }
|
| | | }
|
| | |
|
| | | // 再从mongodb中取覆盖
|
| | | List<Long> auctionIds = new ArrayList<>();
|
| | | for (TaoBaoGoodsBrief goods : tempGoodsList) {
|
| | | auctionIds.add(goods.getAuctionId());
|
| | | }
|
| | | List<TaoBaoGoodsBrief> mList = taoBaoGoodsUpdateDao.listByAuctionIds(auctionIds);
|
| | | if (mList != null)
|
| | | for (TaoBaoGoodsBrief goods : mList) {
|
| | | finalMap.put(goods.getAuctionId(), goods);
|
| | | }
|
| | |
|
| | | List<TaoBaoGoodsBrief> finalList = new ArrayList<>();
|
| | | for (TaoBaoGoodsBrief goods : goodsList)
|
| | | finalList.add(finalMap.get(goods.getAuctionId()));
|
| | |
|
| | | return finalList;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | * @param token
|
| | | * @param device
|
| | | * @param uid
|
| | | * @param version
|
| | | */
|
| | | void addDeviceToken(String token, String device, Long uid);
|
| | | void addDeviceToken(String token, String device, Long uid,int version);
|
| | |
|
| | | /**
|
| | | * 获取某个用户的deviceToken
|
| | |
| | | public void updateByTaoKeGoodsDetail(Long id);
|
| | |
|
| | | /**
|
| | | * 批量加入更新队列
|
| | | * |
| | | * @param goodsList
|
| | | */
|
| | | public void addUpdateQueueAsync(List<TaoBaoGoodsBrief> goodsList);
|
| | |
|
| | | /**
|
| | | * 添加到更新队列
|
| | | *
|
| | | * @param auctionId
|
| | | */
|
| | | public void addUpdateQueue(Long auctionId);
|
| | | |
| | | public void addUpdateQueueAsync(Long auctionId);
|
| | |
|
| | | /**
|
| | | * 更新淘宝重要的商品
|
| | | * |
| | | * @param goods
|
| | | */
|
| | | public void updateImplTBGoods(TaoBaoGoodsBrief goods);
|
| | | public void updateImplTBGoods(TaoBaoGoodsBrief goods);
|
| | |
|
| | | /**
|
| | | * 过滤淘宝商品
|
| | | * |
| | | * @param goodsList
|
| | | * @return
|
| | | */
|
| | | public List<TaoBaoGoodsBrief> filterTaoBaoGoods(List<TaoBaoGoodsBrief> goodsList);
|
| | |
|
| | | }
|
| | |
| | |
|
| | | public static boolean greaterThan_1_6_0(String platform, String versionCode) {
|
| | | if ((("android".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 46))
|
| | | || (("ios".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 57)))
|
| | | || (("ios".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 58)))
|
| | | return true;
|
| | | else
|
| | | return false;
|
| | |
| | | import java.net.URL;
|
| | | import java.net.URLEncoder;
|
| | | import java.text.MessageFormat;
|
| | | import java.util.HashMap;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.Properties;
|
| | |
|
| | | import javax.annotation.PostConstruct;
|
| | |
| | |
|
| | | String intent = "intent:#Intent;launchFlags=0x4000000;component=" + activity + ";S.id=" + goodsId + ";end";
|
| | | try {
|
| | | String result = sendPushHWMessageForIntent(deviceTokens, title, content, intent);
|
| | | String result = sendPushHWMessageForIntent(deviceTokens, title, content, intent, null);
|
| | | net.sf.json.JSONObject data = net.sf.json.JSONObject.fromObject(result);
|
| | | if (!"success".equalsIgnoreCase(data.optString("msg")))
|
| | | throw new PushException(2, result);
|
| | |
| | | String intent = "intent:#Intent;launchFlags=0x4000000;component=" + activity + ";S.url="
|
| | | + URLEncoder.encode(url) + ";end";
|
| | | try {
|
| | | String result = sendPushHWMessageForIntent(deviceTokens, title, content, intent);
|
| | | String result = sendPushHWMessageForIntent(deviceTokens, title, content, intent, null);
|
| | | net.sf.json.JSONObject data = net.sf.json.JSONObject.fromObject(result);
|
| | | if (!"success".equalsIgnoreCase(data.optString("msg")))
|
| | | throw new PushException(2, result);
|
| | |
| | | * @throws PushException
|
| | | */
|
| | | public static void pushZNX(List<String> deviceTokens, String title, String content) throws PushException {
|
| | | if (deviceTokens != null && deviceTokens.size() > 1000)
|
| | | throw new PushException(1, "设备数不能超过1000个");
|
| | | if (deviceTokens != null && deviceTokens.size() > 100)
|
| | | throw new PushException(1, "设备数不能超过100个");
|
| | |
|
| | | String activity = Constant.systemCommonConfig.getAndroidBaseactivityName() + ".ui.mine.AppMailActivity";
|
| | | activity = activity.replace(Constant.systemCommonConfig.getAndroidPackageName(),
|
| | | Constant.systemCommonConfig.getAndroidPackageName() + "/");
|
| | |
|
| | | String intent = "intent:#Intent;launchFlags=0x4000000;component=" + activity + ";end";
|
| | | // String activity = Constant.systemCommonConfig.getAndroidBaseactivityName() + ".ui.mine.MainActivity";
|
| | | // activity = activity.replace(Constant.systemCommonConfig.getAndroidPackageName(),
|
| | | // Constant.systemCommonConfig.getAndroidPackageName() + "/");
|
| | | //
|
| | | // Map<String, String> custom = new HashMap<String, String>();
|
| | | // custom.put("type", "ZNX");
|
| | | // custom.put("type1", "ZNX");
|
| | | // String intent = "intent:#Intent;launchFlags=0x4000000;component=" + activity + ";end";
|
| | | // try {
|
| | | // String result = sendPushHWMessageForIntent(deviceTokens, title, content, intent, custom);
|
| | | // net.sf.json.JSONObject data = net.sf.json.JSONObject.fromObject(result);
|
| | | // if (!"success".equalsIgnoreCase(data.optString("msg")))
|
| | | // throw new PushException(2, result);
|
| | | // } catch (IOException e) {
|
| | | // e.printStackTrace();
|
| | | // }
|
| | | |
| | | try {
|
| | | String result = sendPushHWMessageForIntent(deviceTokens, title, content, intent);
|
| | | net.sf.json.JSONObject data = net.sf.json.JSONObject.fromObject(result);
|
| | | if (!"success".equalsIgnoreCase(data.optString("msg")))
|
| | | throw new PushException(2, result);
|
| | | sendMsg(deviceTokens,title,content, null);
|
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @throws IOException
|
| | | */
|
| | | private static String sendPushHWMessageForIntent(List<String> deviceTokens, String title, String content,
|
| | | String intent) throws IOException {
|
| | | String intent, Map<String, String> customizeMap) throws IOException {
|
| | | if (tokenExpiredTime <= System.currentTimeMillis()) {
|
| | | refreshToken();
|
| | | }
|
| | |
| | | // 定义需要打开的appPkgName
|
| | | JSONObject param = new JSONObject();
|
| | |
|
| | | param.put("intent", intent);
|
| | | // param.put("intent", intent);
|
| | | param.put("appPkgName", "com.yeshi.ec.rebate");
|
| | |
|
| | | JSONObject action = new JSONObject();
|
| | | action.put("type", 1);// (1 自定义行为:行为由参数intent定义;2 打开URL:URL地址由参数url定义;3
|
| | | action.put("type", 3);// (1 自定义行为:行为由参数intent定义;2 打开URL:URL地址由参数url定义;3
|
| | | // 打开APP:默认值,打开App的首页)
|
| | | action.put("param", param);// 消息点击动作参数
|
| | |
|
| | |
| | |
|
| | | // 扩展信息,含BI消息统计,特定展示风格,消息折叠。
|
| | | JSONObject ext = new JSONObject();
|
| | | ext.put("biTag", "Trump");// 设置消息标签,如果带了这个标签,会在回执中推送给CP用于检测某种类型消息的到达率和状态
|
| | | ext.put("biTag", "Trump");
|
| | | if (customizeMap != null) {// 传递自定义参数
|
| | | JSONArray array = new JSONArray();
|
| | | for (Iterator<String> its = customizeMap.keySet().iterator(); its.hasNext();) {
|
| | | String key = its.next();
|
| | | JSONObject json = new JSONObject();
|
| | | json.put(key, customizeMap.get(key));
|
| | | array.add(json);
|
| | | }
|
| | | ext.put("customize", array);
|
| | | }
|
| | |
|
| | | // ext.put("icon",
|
| | | // "http://pic.qiantucdn.com/58pic/12/38/18/13758PIC4GV.jpg");//
|
| | | // 自定义推送消息在通知栏的图标,value为一个公网可以访问的URL
|
| | |
| | | JSONObject payload = new JSONObject();
|
| | | payload.put("hps", hps);
|
| | |
|
| | | System.out.println(payload.toJSONString());
|
| | |
|
| | | String postBody = MessageFormat.format(
|
| | | "access_token={0}&nsp_svc={1}&nsp_ts={2}&device_token_list={3}&payload={4}",
|
| | | URLEncoder.encode(accessToken, "UTF-8"), URLEncoder.encode("openpush.message.api.send", "UTF-8"),
|
| | | URLEncoder.encode(String.valueOf(System.currentTimeMillis() / 1000), "UTF-8"),
|
| | | URLEncoder.encode(deviceTokenList.toString(), "UTF-8"), URLEncoder.encode(payload.toString(), "UTF-8"));
|
| | |
|
| | | String postUrl = apiUrl + "?nsp_ctx="
|
| | | + URLEncoder.encode("{\"ver\":\"1\", \"appId\":\"" + appId + "\"}", "UTF-8");
|
| | | String result = httpPost(postUrl, postBody, 5000, 5000);
|
| | |
|
| | | return result;
|
| | | }
|
| | |
|
| | | private static String sendMsg(List<String> deviceTokens,String title,String content, Map<String, String> customizeMap) throws IOException {
|
| | | if (tokenExpiredTime <= System.currentTimeMillis()) {
|
| | | refreshToken();
|
| | | }
|
| | |
|
| | | /* PushManager.requestToken为客户端申请token的方法,可以调用多次以防止申请token失败 */
|
| | | /* PushToken不支持手动编写,需使用客户端的onToken方法获取 */
|
| | | JSONArray deviceTokenList = new JSONArray();// 目标设备Token
|
| | | for (String deviceToken : deviceTokens) {
|
| | | deviceTokenList.add(deviceToken);
|
| | | }
|
| | |
|
| | | // 仅通知栏消息需要设置标题和内容,透传消息key和value为用户自定义
|
| | | JSONObject body = new JSONObject();
|
| | | body.put("type", "ZNX");// 消息标题
|
| | | body.put("title", title);// 消息标题
|
| | | body.put("content",content);// 消息标题
|
| | |
|
| | | JSONObject msg = new JSONObject();
|
| | | msg.put("type", 1);// 3: 通知栏消息,异步透传消息请根据接口文档设置
|
| | |
|
| | | msg.put("body", body);// 通知栏消息body内容
|
| | |
|
| | | JSONObject hps = new JSONObject();
|
| | | hps.put("msg", msg);
|
| | | JSONObject payload = new JSONObject();
|
| | | payload.put("hps", hps);
|
| | | System.out.println(payload.toJSONString());
|
| | |
|
| | | String postBody = MessageFormat.format(
|
| | | "access_token={0}&nsp_svc={1}&nsp_ts={2}&device_token_list={3}&payload={4}",
|
| | | URLEncoder.encode(accessToken, "UTF-8"), URLEncoder.encode("openpush.message.api.send", "UTF-8"),
|