admin
2018-12-10 5f01b1bf63bd3dd242fc29e012e15c37fc03a190
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserShareGoodsGroupServiceImpl.java
@@ -100,38 +100,44 @@
   
   /**
    * 更新浏览记录数据
    * @param uid
    * @param auctionId
    * @param shareId 分享id
    * @param count 浏览次数
    */
   @Override
   public void updateBrowseRecord (Long uid, Long auctionId, int count) throws UserShareGoodsRecordException{
      if (uid == null) {
         throw new UserShareGoodsRecordException(1, "用户ID不能为空");
   public void updateBrowseRecord (Long shareId, int count) throws UserShareGoodsRecordException{
      if (shareId == null) {
         throw new UserShareGoodsRecordException(1, "分享id为空");
      }
      
      if (auctionId == null) {
         throw new UserShareGoodsRecordException(1, "商品ID不能为空");
      List<UserShareGoodsGroup> list = listByRecordId(shareId);
      if (list == null || list.size() == 0) {
         throw new UserShareGoodsRecordException(1, "分享商品已不存在");
      }
      
      UserShareGoodsGroup newestRecord = getNewestRecord(uid, auctionId);
      List<UserShareGoodsGroup> listUpdate = new ArrayList<UserShareGoodsGroup>();
      
      if (newestRecord != null) {
      for (UserShareGoodsGroup group: list) {
         // 注意: 修改记录数据、但不可修改更新设置
         UserShareGoodsGroup shareGoodsGroup = new UserShareGoodsGroup(newestRecord.getId());
         UserShareGoodsGroup shareGoodsGroup = new UserShareGoodsGroup(group.getId());
         
         shareGoodsGroup.setTotalBrowse(newestRecord.getTotalBrowse() + count);
         shareGoodsGroup.setTotalBrowse(group.getTotalBrowse() + count);
         
         Date browseTime = newestRecord.getBrowseTime();
         Date browseTime = group.getBrowseTime();
         if (DateUtil.isSameDay(browseTime, new Date())) {
            shareGoodsGroup.setTodayBrowse(newestRecord.getTodayBrowse() + count);
            shareGoodsGroup.setTodayBrowse(group.getTodayBrowse() + count);
         } else {
            shareGoodsGroup.setTodayBrowse(count);
            shareGoodsGroup.setBrowseTime(new Date());
         }
         
         updateByPrimaryKeySelective(shareGoodsGroup);
         listUpdate.add(shareGoodsGroup);
      }
      userShareGoodsGroupMapper.updateBatchSelective(listUpdate);
   }
   
   /**
    * 更新订单记录数据
@@ -238,9 +244,10 @@
            if (!StringUtil.isNullOrEmpty(pictUrl) && !pictUrl.contains("320x320")) {
               commonGoods.setPicture(TbImgUtil.getTBSize320Img(pictUrl));
            }
            String json = gson
                  .toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief, proportion, fcRate));
            dataObject.put("groupId", userShareGoodsGroup.getId());
            dataObject.put("goods", json);