| | |
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.push.PushGoods;
|
| | | import com.yeshi.fanli.entity.push.PushGoodsGroup;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.exception.PushException;
|
| | | import com.yeshi.fanli.exception.push.PushException;
|
| | | import com.yeshi.fanli.exception.push.PushGoodsException;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | public void save(PushGoods record, List<Long> goodsIds) throws PushGoodsException, Exception {
|
| | |
|
| | | // 定时时间
|
| | |
| | | saveGoodsInfo(isAdd, pushId, goodsIds);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | public void saveGoodsInfo(boolean isAdd, Long pushId, List<Long> goodsIds) throws Exception {
|
| | |
|
| | | if (goodsIds == null || goodsIds.size() == 0) {
|
| | |
| | | List<Long> listCommonId = new ArrayList<Long>();
|
| | | for (Long auctionId : goodsIds) {
|
| | | // 获取商品详情
|
| | | TaoBaoGoodsBrief goodsBrief = TaoKeApiUtil.searchGoodsDetail(auctionId);
|
| | |
|
| | | // 转换简版商品信息
|
| | | CommonGoods commonGoods = CommonGoodsFactory.create(goodsBrief);
|
| | | if (commonGoods != null) {
|
| | | commonGoodsService.addOrUpdateCommonGoods(commonGoods);
|
| | | Long cid = commonGoods.getId();
|
| | | if (cid != null) {
|
| | | listCommonId.add(cid);
|
| | | try {
|
| | | TaoBaoGoodsBrief goodsBrief = TaoKeApiUtil.searchGoodsDetail(auctionId);
|
| | | // 转换简版商品信息
|
| | | CommonGoods commonGoods = CommonGoodsFactory.create(goodsBrief);
|
| | | if (commonGoods != null) {
|
| | | commonGoodsService.addOrUpdateCommonGoods(commonGoods);
|
| | | Long cid = commonGoods.getId();
|
| | | if (cid != null) {
|
| | | listCommonId.add(cid);
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | /* 修改时删除 部分 */
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | public int deleteBatchByPrimaryKey(List<Long> list) throws Exception {
|
| | |
|
| | | /*List<PushGoods> lisState = pushGoodsMapper.listByPushState(list);
|
| | |
| | |
|
| | | } else {
|
| | | /* 多个商品推送 */
|
| | | String url = configService.get("push_goods_details");
|
| | | String url = configService.get(ConfigKeyEnum.pushGoodsDetails.getKey());
|
| | | if (StringUtil.isNullOrEmpty(url)) {
|
| | | throw new PushGoodsException(1, "推送页面链接不存在");
|
| | | }
|