class UserGoodsOrderService implements IUserGoodsOrderService {

	@Override
	public  void batchInsert(Set<UserGoodsOrderPo> set) throws Exception{
		/**
		 * 由于多线程原因，保存之前必须检测该对象是否存在，数据存在不在保存，做更新操作
		 */
		Set<UserGoodsOrderPo> updateSet = new LinkedHashSet<UserGoodsOrderPo>();
		for(UserGoodsOrderPo vpo: set){
			if(StringUtils.isNotBlank(vpo.getShopCartGoodsCookieId())){
				UserGoodsOrderPo po = userGoodsOrderDao.findBy(vpo.getShopCartGoodsCookieId());
				if(null != po ) {
					updateSet.add(vpo);
					set.remove(vpo);
				}
				else{
					convertUpdateUserGoodsOrder(vpo, vpo);
					logger.info("Insert UserGoodsOrderPo " + vpo);
				}
			}
		}
		try {
			userGoodsOrderDao.save(set);		
		} catch (IllegalArgumentException e) {
			logger.error("批量保存失败，失败原因:"+e.getMessage(),e);
		}
		if(updateSet.size() > 0){
		    logger.info("有 "+updateSet.size()+" 个进入购物车动作延迟！");
			batchUpdate(updateSet);//假如进入购物车的动作后到，更新进入购物车的操作
		}		
	}

}