admin
2020-07-01 c54fb6a88876be994906d57d2d18e844686964d0
fanli/src/main/java/com/yeshi/fanli/service/impl/user/cloud/UserCloudServiceImpl.java
@@ -14,7 +14,6 @@
import org.yeshi.utils.BigDecimalUtil;
import org.yeshi.utils.taobao.TbImgUtil;
import com.alibaba.druid.support.logging.Log;
import com.aliyun.openservices.ons.api.Message;
import com.aliyun.openservices.ons.api.Producer;
import com.yeshi.fanli.dao.mybatis.user.cloud.UserCloudMapper;
@@ -74,6 +73,7 @@
import com.yeshi.fanli.service.inter.user.cloud.UserCloudService;
import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
import com.yeshi.fanli.service.manger.goods.ConvertLinkManager;
import com.yeshi.fanli.service.manger.msg.RocketMQManager;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.ImageToBase64;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
@@ -162,8 +162,8 @@
   @Resource
   private UserCloudManageService userCloudManageService;
   @Resource(name = "producer")
   private Producer producer;
   @Resource
   private RocketMQManager rocketMQManager;
   @Resource
   private UserOtherMsgNotificationService userOtherMsgNotificationService;
@@ -532,7 +532,18 @@
      if (!hasToken)
         throw new UserCloudException(1, "该内容包含可转链口令或链接");
      // 异步执行发送
      executor.execute(new Runnable() {
         @Override
         public void run() {
            sendEvaluate(uid, evaluate, way, userCloud, listOpen, listComment);
         }
      });
   }
   private void sendEvaluate(Long uid, GoodsEvaluate evaluate, int way, UserCloud userCloud,
         List<UserCloudGroup> listOpen, List<String> listComment) {
      ImgInfo imgVideo = null;
      List<String> listImg = new ArrayList<>();
@@ -547,14 +558,12 @@
         }
      }
      
      long time7= java.lang.System.currentTimeMillis();
      LogHelper.test("sendCircleByDynamic发圈内容组织转链:" + (time7 - time6));
      String wxId = userCloud.getWxId();
      Integer robotId = userCloud.getRobotId();
      // 保存发送记录
      UserCloudSendRecord sendRecord = new UserCloudSendRecord();
      sendRecord.setUid(uid);
      sendRecord.setSendId(id);
      sendRecord.setSendId(evaluate.getId());
      sendRecord.setSendWay(way);
      sendRecord.setWxId(wxId);
      sendRecord.setRobotId(robotId);
@@ -563,9 +572,6 @@
      UserCloudSendRecord result = userCloudSendRecordService.save(sendRecord);
      String pid = result.getId();
      long time8= java.lang.System.currentTimeMillis();
      LogHelper.test("sendCircleByDynamic保存发圈记录:" + (time8 - time7));
      
      for (UserCloudGroup cloudGroup : listOpen) {
         String title = evaluate.getTitle();
@@ -658,12 +664,10 @@
         }
         userCloudSendContentService.save(sendContent);
      }
      long time9= java.lang.System.currentTimeMillis();
      LogHelper.test("sendCircleByDynamic执行发圈耗时:" + (time9 - time8));
   }
   @Override
   @Transactional(rollbackFor = Exception.class)
   public void sendCustomGoods(Long uid, Long goodsId, Integer goodsType, Long sellerId) throws UserCloudException {
@@ -908,8 +912,13 @@
      String commentText = shareGoodsTextTemplateService.getCommentTextByTaoToken(coupon, taoBaoLink.getTaoToken(),
            goods.getZkPrice().toString(), quanPrice);
      // 云发单
      sendGoods(robotId, wxId, listOpen, recommendText, commentText, goods.getImgList(), user.getId(), pid);
      // 异步执行发送
      executor.execute(new Runnable() {
         @Override
         public void run() {
            sendGoods(robotId, wxId, listOpen, recommendText, commentText, goods.getImgList(), user.getId(), pid);
         }
      });
   }
   /**
@@ -966,8 +975,14 @@
      String commentText = shareGoodsTextTemplateService.getCommentTextByLink(coupon, jumpLink, zkPrice, quanPrice,
            ConfigKeyEnum.quickShareJDCommentText);
      // 云发单
      sendGoods(robotId, wxId, listOpen, recommendText, commentText, jdGoods.getImageList(), user.getId(), pid);
      // 异步执行发送
      executor.execute(new Runnable() {
         @Override
         public void run() {
            sendGoods(robotId, wxId, listOpen, recommendText, commentText, jdGoods.getImageList(), user.getId(), pid);
         }
      });
   }
   /**
@@ -1023,8 +1038,16 @@
      if (goodsGalleryUrls != null && goodsGalleryUrls.length > 0) {
         list = Arrays.asList(goodsGalleryUrls);
      }
      // 云发单
      sendGoods(robotId, wxId, listOpen, recommendText, commentText, list, user.getId(), pid);
      List<String> list2 = list;
      // 异步执行发送
      executor.execute(new Runnable() {
         @Override
         public void run() {
            sendGoods(robotId, wxId, listOpen, recommendText, commentText, list2, user.getId(), pid);
         }
      });
   }
   /**
@@ -1059,9 +1082,14 @@
      String commentText = shareGoodsTextTemplateService.getCommentTextByLink(coupon, jumpLink,
            goods.getMarketPrice(), quanPrice, ConfigKeyEnum.quickShareVIPCommentText);
      // 云发单
      sendGoods(robotId, wxId, listOpen, recommendText, commentText, goods.getGoodsDetailPictures(), user.getId(),
            pid);
      // 异步执行发送
      executor.execute(new Runnable() {
         @Override
         public void run() {
            sendGoods(robotId, wxId, listOpen, recommendText, commentText, goods.getGoodsDetailPictures(), user.getId(),
                  pid);
         }
      });
   }
   /**
@@ -1105,9 +1133,14 @@
      for (SuningGoodsImg img : goods.getCommodityInfo().getPictureUrl()) {
         imgList.add(img.getPicUrl());
      }
      // 云发单
      sendGoods(robotId, wxId, listOpen, recommendText, commentText, imgList, user.getId(), pid);
      executor.execute(new Runnable() {
         @Override
         public void run() {
            // 云发单
            sendGoods(robotId, wxId, listOpen, recommendText, commentText, imgList, user.getId(), pid);
         }
      });
   }
   /**
@@ -1258,7 +1291,7 @@
                  UserCloudMQMsg msg = new UserCloudMQMsg(uid, evaluateId, UserCloudMQMsg.TYPE_EVALUATE);
                  Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.userCloud,
                        msg);
                  producer.send(message);
                  rocketMQManager.sendNormalMsg(message, null);
               }
            } catch (Exception e) {
               LogHelper.errorDetailInfo(e);
@@ -1292,7 +1325,7 @@
         UserCloudMQMsg msg = new UserCloudMQMsg(uid, UserCloudMQMsg.TYPE_PUSH);
         Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.userCloud, msg);
         message.setStartDeliverTime(java.lang.System.currentTimeMillis() + 1000 * 60 * 10);
         producer.send(message);
         rocketMQManager.sendNormalMsg(message, null);
      }
      // 更新已提醒