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); } }  @Override void batchInsert(Set<UserGoodsOrderPo> set); @Override synchronized void batchUpdate(Set<UserGoodsOrderPo> set); @Override synchronized void processingData(Set<UserGoodsOrderDetailVo> userGoodsOrderDetailVos);  }
@Test public void testBatchInsert() throws Exception{ userGoodsOrderService.batchInsert(userGoodsOrders); }