| | |
| | | import org.hibernate.Session;
|
| | | import org.springframework.orm.hibernate4.HibernateCallback;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.goods.CollectionGoodsDao;
|
| | | import com.yeshi.fanli.entity.bus.user.CollectionGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.service.inter.goods.CollectionGoodsService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void updateCollectionGoods(TaoBaoGoodsBrief goods) {
|
| | | if (goods != null && goods.getAuctionId() != null) {
|
| | | long count = dao.getCount("select count(*) from CollectionGoods cg where cg.auctionId=?",
|
| | | new Serializable[] { goods.getAuctionId() });
|
| | | if (count > 0) {
|
| | | int pageSize = 50;
|
| | | int page = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | for (int i = 0; i < page; i++) {
|
| | | List<CollectionGoods> list = dao.list("from CollectionGoods cg where cg.auctionId=?", i * pageSize,
|
| | | pageSize, new Serializable[] { goods.getAuctionId() });
|
| | | if (list != null)
|
| | | for (CollectionGoods cg : list) {
|
| | | cg = getCollectionGoods(cg, goods);
|
| | | if (cg != null)
|
| | | dao.update(cg);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private static CollectionGoods getCollectionGoods(CollectionGoods collectionGoods, TaoBaoGoodsBrief goods) {
|
| | | if (collectionGoods == null || goods == null)
|
| | | return null;
|
| | | // 更新商品信息(标题,销量,图片,佣金比例,价格,券信息)
|
| | | collectionGoods.setBiz30day(goods.getBiz30day());
|
| | | collectionGoods.setTitle(goods.getTitle());
|
| | | collectionGoods.setCouponAmount(goods.getCouponAmount());
|
| | | collectionGoods.setCouponEffectiveEndTime(goods.getCouponEffectiveEndTime());
|
| | | collectionGoods.setCouponLeftCount(goods.getCouponLeftCount());
|
| | | collectionGoods.setCouponInfo(goods.getCouponInfo());
|
| | | collectionGoods.setCouponEffectiveStartTime(goods.getCouponEffectiveStartTime());
|
| | | collectionGoods.setCouponStartFee(goods.getCouponStartFee());
|
| | | collectionGoods.setCouponTotalCount(goods.getCouponTotalCount());
|
| | | collectionGoods.setTkRate(goods.getTkRate());
|
| | | collectionGoods.setPictUrl(goods.getPictUrl());
|
| | | collectionGoods.setZkPrice(goods.getZkPrice());
|
| | | collectionGoods.setReservePrice(goods.getReservePrice());
|
| | | return collectionGoods;
|
| | | }
|
| | |
|
| | | }
|