admin
2020-06-10 271ae63c20fcbe28d29c47f1881138ff6551a2a1
fanli/src/main/java/com/yeshi/fanli/service/impl/user/cloud/UserCloudServiceImpl.java
@@ -11,11 +11,9 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.yeshi.utils.BigDecimalUtil;
import org.yeshi.utils.entity.FileUploadResult;
import com.aliyun.openservices.ons.api.Message;
import com.aliyun.openservices.ons.api.Producer;
import com.yeshi.fanli.controller.client.v2.ShareControllerV2;
import com.yeshi.fanli.dao.mybatis.user.cloud.UserCloudMapper;
import com.yeshi.fanli.dto.aitaoker.RobotInfoDTO;
import com.yeshi.fanli.dto.aitaoker.WeiXinGroupDTO;
@@ -24,12 +22,17 @@
import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
import com.yeshi.fanli.dto.mq.user.body.UserCloudMQMsg;
import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
import com.yeshi.fanli.dto.suning.SuningGoodsImg;
import com.yeshi.fanli.dto.suning.SuningGoodsInfo;
import com.yeshi.fanli.dto.vip.VIPConvertResultDTO;
import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo;
import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.cloud.CloudOrderMenuEnum;
import com.yeshi.fanli.entity.bus.user.cloud.UserCloud;
import com.yeshi.fanli.entity.bus.user.cloud.UserCloudGoods;
import com.yeshi.fanli.entity.bus.user.cloud.UserCloudGroup;
import com.yeshi.fanli.entity.bus.user.cloud.UserCloudManage;
import com.yeshi.fanli.entity.bus.user.cloud.UserCloudSendContent;
import com.yeshi.fanli.entity.bus.user.cloud.UserCloudSendRecord;
import com.yeshi.fanli.entity.dynamic.CommentInfo;
@@ -45,6 +48,7 @@
import com.yeshi.fanli.exception.goods.ConvertLinkExceptionException;
import com.yeshi.fanli.exception.share.ShareGoodsException;
import com.yeshi.fanli.exception.user.cloud.UserCloudException;
import com.yeshi.fanli.exception.user.cloud.UserCloudGoodsException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.dynamic.GoodsEvaluateService;
@@ -58,6 +62,7 @@
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.cloud.UserCloudGoodsService;
import com.yeshi.fanli.service.inter.user.cloud.UserCloudGroupService;
import com.yeshi.fanli.service.inter.user.cloud.UserCloudManageService;
import com.yeshi.fanli.service.inter.user.cloud.UserCloudSendContentService;
import com.yeshi.fanli.service.inter.user.cloud.UserCloudSendRecordService;
import com.yeshi.fanli.service.inter.user.cloud.UserCloudService;
@@ -77,7 +82,11 @@
import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil;
import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
import com.yeshi.fanli.util.rocketmq.MQTopicName;
import com.yeshi.fanli.util.suning.SuningApiUtil;
import com.yeshi.fanli.util.suning.SuningUtil;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import com.yeshi.fanli.util.vipshop.VipShopApiUtil;
import com.yeshi.fanli.util.vipshop.VipShopUtil;
import com.yeshi.fanli.vo.goods.GoodsDetailVO;
@Service
@@ -143,6 +152,9 @@
   @Resource
   private UserCloudSendContentService userCloudSendContentService;
   
   @Resource
   private UserCloudManageService userCloudManageService;
   @Resource(name = "producer")
   private Producer producer;
   
@@ -160,6 +172,20 @@
   @Override
   public long countByUid(Long uid) {
      Long count = userCloudMapper.countByUid(uid);
      return count;
   }
   @Override
   public List<UserCloud> query(int page, int count,String key, Integer state) {
      return userCloudMapper.query((page-1)* count, count, key, state);
   }
   @Override
   public long count(String key, Integer state) {
      Long count = userCloudMapper.count(key, state);
      if (count == null)
         count = 0L;
      return count;
   }
@@ -205,7 +231,7 @@
            renew = true;
         // 验证套餐是否相同
         if (renew && userCloud.getRobotType() != menuEnum.getType()) {
            LogHelper.error("方法openCloud: [uid=" + uid + "][订单ID=" + orderId + "]已有其他云发单套餐还未结束");
            LogHelper.cloudInfo("方法openCloud: [uid=" + uid + "][订单ID=" + orderId + "]已有其他云发单套餐还未结束");
            throw new UserCloudException(1, "已有其他云发单套餐还未结束");
         }
      }
@@ -218,13 +244,13 @@
      }
      if (dto == null) {
         LogHelper.error("方法openCloud: [uid=" + uid + "][订单ID=" + orderId + "]机器人失败: 返回空值");
         LogHelper.cloudInfo("方法openCloud: [uid=" + uid + "][订单ID=" + orderId + "]机器人失败: 返回空值");
         throw new UserCloudException(1, "机器人获取失败");
      }
      String endTimeStr = dto.getEndTime();
      if (StringUtil.isNullOrEmpty(endTimeStr)) {
         LogHelper.error("方法openCloud: [uid=" + uid + "][订单ID=" + orderId + "]机器人失败: 返回时间为空");
         LogHelper.cloudInfo("方法openCloud: [uid=" + uid + "][订单ID=" + orderId + "]机器人失败: 返回时间为空");
         throw new UserCloudException(1, "机器人返回时间为空");
      }
@@ -232,19 +258,19 @@
      try {
         endTime = Long.parseLong(endTimeStr);
      } catch (Exception e) {
         LogHelper.error("方法openCloud: [uid=" + uid + "][订单ID=" + orderId + "]机器人失败: 返回时间格式不正确");
         LogHelper.cloudInfo("方法openCloud: [uid=" + uid + "][订单ID=" + orderId + "]机器人失败: 返回时间格式不正确");
         throw new UserCloudException(1, "机器人返回时间格式不正确");
      }
      Integer robotId = dto.getId();
      if (robotId == null) {
         LogHelper.error("方法openCloud: [uid=" + uid + "][订单ID=" + orderId + "]机器人失败: 机器人ID返回为空");
         LogHelper.cloudInfo("方法openCloud: [uid=" + uid + "][订单ID=" + orderId + "]机器人失败: 机器人ID返回为空");
         throw new UserCloudException(1, "机器人ID返回为空");
      }
      Integer groupNum = dto.getGroupNum();
      if (groupNum == null) {
         LogHelper.error("方法openCloud: [uid=" + uid + "][订单ID=" + orderId + "]机器人失败: groupNum返回为空");
         LogHelper.cloudInfo("方法openCloud: [uid=" + uid + "][订单ID=" + orderId + "]机器人失败: groupNum返回为空");
         throw new UserCloudException(1, "groupNum返回为空");
      }
@@ -254,10 +280,17 @@
      newCloud.setGroupNum(groupNum);
      newCloud.setRobotId(robotId);
      newCloud.setRobotType(menuEnum.getType());
      newCloud.setStartTime(new Date());
      if (renew) {
         newCloud.setStartTime(userCloud.getStartTime());
      } else {
         newCloud.setStartTime(new Date());
      }
      newCloud.setEndTime(new Date(endTime * 1000)); // Unix 转换 普通时间
      newCloud.setCreateTime(new Date());
      userCloudMapper.insertSelective(newCloud);
      // 开启发圈功能
      userCloudManageService.save(uid, null, null);
   }
   @Override
@@ -286,7 +319,18 @@
   
   
   @Override
   @Transactional(rollbackFor = Exception.class)
   public void autoSendByDynamic(Long uid, String id) {
      boolean official = false;
      UserCloudManage cloudManage = userCloudManageService.selectByPrimaryKey(uid);
      if (cloudManage != null) {
         if (cloudManage.getOfficial() != null)
            official = cloudManage.getOfficial();
      }
      if (!official)
         return;
      try {
         sendCircleByDynamic(uid, id, UserCloudSendRecord.SEND_WAY_AUTO);
      } catch (UserCloudException e) {
@@ -306,7 +350,7 @@
      
      String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
      if (StringUtil.isNullOrEmpty(inviteCode))
         throw new UserCloudException(1, "邀请码未激活");
         throw new UserCloudException(3, "邀请码未激活");
      UserExtraTaoBaoInfo taoBaoInfo = userExtraTaoBaoInfoService.getByUid(uid);
      String relationId = null;
@@ -321,20 +365,20 @@
      // 验证是否开通
      UserCloud userCloud = userCloudMapper.getValidByUid(uid);
      if (userCloud == null)
         throw new UserCloudException(1, "云发单已过期");
         throw new UserCloudException(1001, "云发单已过期");
      Integer robotId = userCloud.getRobotId();
      if (robotId == null)
         throw new UserCloudException(1, "云发单机器人不存在");
         throw new UserCloudException(1002, "云发单机器人不存在");
      String wxId = userCloud.getWxId();
      if (StringUtil.isNullOrEmpty(wxId)) 
         throw new UserCloudException(1, "微信号缺失");
         throw new UserCloudException(1003, "微信号不存在,请先微信登录");
      
      // 验证开启状态
      List<UserCloudGroup> listGroup = userCloudGroupService.listByUid(uid);
      if (listGroup == null || listGroup.size() == 0)
         throw new UserCloudException(1, "请先添加云发单群信息");
         throw new UserCloudException(1004, "请先微信登录");
      List<UserCloudGroup> listOpen = new ArrayList<>();
      for (UserCloudGroup cloudGrou : listGroup) {
@@ -343,7 +387,8 @@
         }
      }
      if (listOpen.size() == 0)
         throw new UserCloudException(1, "请先开启云发单群功能");
         throw new UserCloudException(1005, "请先开启云发单群功能");
      
      // 验证发圈是否可行
      GoodsEvaluate evaluate = goodsEvaluateService.getById(id);
@@ -358,6 +403,11 @@
      if (comments == null || comments.size() == 0)
         throw new UserCloudException(1, "该内容不能转链");
      // 检测微信是否登录状态
      if (!AitaokerApiUtil.onlineCheck(robotId)) {
         throw new UserCloudException(1003, "请重新登录微信");
      }
      
      boolean hasToken = false;
      List<String> listComment = new ArrayList<>();
@@ -414,16 +464,18 @@
            if (imgInfo.getType() == ImgEnum.goods) {
               cloudPic = imgInfo.getUrl();
            }
            listImg.add(imgInfo.getUrl());
            
            GoodsDetailVO goodsVO = imgInfo.getGoodsVO();
            if (goodsVO == null) {
               listImg.add(imgInfo.getUrl());
            } else {
               String jumpLink = getJumpLink(goodsVO, user, relationId, inviteCode, imgInfo.getUrl());
               if (!StringUtil.isNullOrEmpty(jumpLink)) {
                  qrCode = jumpLink;
               }
            }
            // 取消二维码图
//            GoodsDetailVO goodsVO = imgInfo.getGoodsVO();
//            if (goodsVO == null) {
//               listImg.add(imgInfo.getUrl());
//            } else {
//               String jumpLink = getJumpLink(goodsVO, user, relationId, inviteCode, imgInfo.getUrl());
//               if (!StringUtil.isNullOrEmpty(jumpLink)) {
//                  qrCode = jumpLink;
//               }
//            }
         }
         
         if (cloudPic == null) {
@@ -502,10 +554,14 @@
            
            // 发送图片
            if (!StringUtil.isNullOrEmpty(cloudPic)) {
               String imgBase64 = ImageToBase64.NetImageToBase64(cloudPic);
               boolean macsend = AitaokerApiUtil.macsendImgBase64(robotId, cloudGroup.getGroupId(), imgBase64);
               if (macsend)
                  sendContent.setPicUrl(cloudPic);
               try {
                  String imgBase64 = ImageToBase64.NetImageToBase64(cloudPic);
                  boolean macsend = AitaokerApiUtil.macsendImgBase64(robotId, cloudGroup.getGroupId(), imgBase64);
                  if (macsend)
                     sendContent.setPicUrl(cloudPic);
               } catch (Exception e) {
                  LogHelper.errorDetailInfo(e);
               }
            }
            
            // 评论文本
@@ -523,62 +579,27 @@
      }
   }
   
   /**
    * 商品分享跳转链接
    * @param goodsVO
    * @param user
    * @param relationId
    * @param inviteCode
    * @param mainPic
    * @return
    */
   private String getJumpLink(GoodsDetailVO goodsVO, UserInfo user, String relationId, String inviteCode,
         String mainPic) {
      String jumpLink = null;
      if (goodsVO.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) {
         TaoBaoLink taoBaoLink = null;
         try {
            taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(user.getId(), Long.parseLong(goodsVO.getGoodsId()), relationId);
         } catch (ShareGoodsException e) {
            e.printStackTrace();
         }
         jumpLink = ShareControllerV2.getERCodeContentNew(
               configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()), taoBaoLink.getGoods(),
               TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
      } else if (goodsVO.getGoodsType() == Constant.SOURCE_TYPE_JD) {
         JDGoods jdGoods = jdGoodsCacheUtil.getGoodsInfo(Long.parseLong(goodsVO.getGoodsId()));
         if (jdGoods == null) {
            return null;
         }
         String couponUrl = null;
         JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(jdGoods);
         if (couponInfo != null) {
            couponUrl = couponInfo.getLink();
         }
         String materialId = "https://item.jd.com/" + goodsVO.getGoodsId() + ".html";
         jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "",
               user.getId() + "");
      } else if (goodsVO.getGoodsType() == Constant.SOURCE_TYPE_PDD) {
         jumpLink = PinDuoDuoApiUtil.getPromotionUrl(Long.parseLong(goodsVO.getGoodsId()), PinDuoDuoApiUtil.PID_SHARE + "",
               user.getId() + "");
      }
      FileUploadResult uploadResult = qrCodeService.drawDynamicGoodsPoster(jumpLink, user.getPortrait(), inviteCode, mainPic, goodsVO);
      if (uploadResult != null) {
         return uploadResult.getUrl();
      }
      return null;
   }
   
   @Override
   public void sendCustomGoods(Long uid, Long goodsId, Integer goodsType) throws UserCloudException{
      sendCircleByGoods(uid, goodsId, goodsType, null);
   @Transactional(rollbackFor = Exception.class)
   public void sendCustomGoods(Long uid, Long goodsId, Integer goodsType, Long sellerId) throws UserCloudException{
      sendCircleByGoods(uid, goodsId, goodsType, null, sellerId);
   }
   @Override
   @Transactional(rollbackFor = Exception.class)
   public void autoSendCustomGoods(Long uid, Long id) {
      boolean custom = false;
      UserCloudManage cloudManage = userCloudManageService.selectByPrimaryKey(uid);
      if (cloudManage != null) {
         if (cloudManage.getCustom() != null)
            custom = cloudManage.getCustom();
      }
      if (!custom) {
         return;
      }
      UserCloudGoods cloudGoods = userCloudGoodsService.selectByPrimaryKey(id);
      if (cloudGoods == null) {
         return;
@@ -589,19 +610,13 @@
      
      try {
         // 发送商品
         sendCircleByGoods(uid, cgoods.getGoodsId(), cgoods.getGoodsType(), id);
         UserCloudGoods record = new UserCloudGoods();
         record.setId(id);
         record.setState(UserCloudGoods.STATE_SHARED);
         record.setUpdateTime(new Date());
         userCloudGoodsService.updateByPrimaryKeySelective(record);
         sendCircleByGoods(uid, cgoods.getGoodsId(), cgoods.getGoodsType(), id, cgoods.getSellerId());
      } catch (UserCloudException e) {
         LogHelper.cloudInfo("autoSendCustomGoods - [uid:" +uid + " 库id:"+  id +  "]原因:"+ e.getMsg());
      }
   }
   private void sendCircleByGoods(Long uid, Long goodsId, Integer goodsType, Long storeId) throws UserCloudException {
   private void sendCircleByGoods(Long uid, Long goodsId, Integer goodsType, Long storeId, Long sellerId) throws UserCloudException {
      // 验证是否授权
      UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
      if (user == null)
@@ -610,6 +625,10 @@
      if (user != null && user.getState() != UserInfo.STATE_NORMAL) {
         throw new UserCloudException(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC);
      }
      String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
      if (StringUtil.isNullOrEmpty(inviteCode))
         throw new UserCloudException(3, "邀请码未激活");
      UserExtraTaoBaoInfo taoBaoInfo = userExtraTaoBaoInfoService.getByUid(uid);
      String relationId = null;
@@ -623,20 +642,44 @@
      // 验证是否开通
      UserCloud userCloud = userCloudMapper.getValidByUid(uid);
      if (userCloud == null)
         throw new UserCloudException(1, "云发单已过期");
         throw new UserCloudException(1001, "云发单已过期");
      // 加入我的备选库
      if (storeId == null) {
         try {
            UserCloudGoods cloudGoods = userCloudGoodsService.addGoods(uid, goodsId, goodsType, sellerId);
            if (cloudGoods != null)
               storeId =cloudGoods.getId();
         } catch (UserCloudGoodsException e) {
            LogHelper.cloudInfo("sendCustomGoods - [uid:" +uid + "goodsId:"+  goodsId +  "goodsType" + goodsType +"]原因:"+ e.getMsg());
            throw new UserCloudException(1, "加入云发单备选库失败");
         }
      }
      // 自选库商品是否打开
      boolean custom = false;
      UserCloudManage cloudManage = userCloudManageService.selectByPrimaryKey(uid);
      if (cloudManage != null) {
         if (cloudManage.getCustom() != null)
            custom = cloudManage.getCustom();
      }
      if (!custom) {
         throw new UserCloudException(0, "成功加入云发单库");
      }
      Integer robotId = userCloud.getRobotId();
      if (robotId == null)
         throw new UserCloudException(1, "云发单机器人不存在");
      String wxId = userCloud.getWxId();
      if (StringUtil.isNullOrEmpty(wxId)) 
         throw new UserCloudException(1, "微信号缺失");
         throw new UserCloudException(1002, "请先登录微信");
      
      // 验证开启状态
      List<UserCloudGroup> listGroup = userCloudGroupService.listByUid(uid);
      if (listGroup == null || listGroup.size() == 0)
         throw new UserCloudException(1, "请先添加云发单群信息");
         throw new UserCloudException(1003, "请先登录微信");
      List<UserCloudGroup> listOpen = new ArrayList<>();
      for (UserCloudGroup cloudGrou : listGroup) {
@@ -646,7 +689,14 @@
      }
      
      if (listOpen.size() == 0)
         throw new UserCloudException(1, "请先开启云发单群功能");
         throw new UserCloudException(1004, "请先开启云发单群功能");
      // 检测微信是否登录状态
      if (!AitaokerApiUtil.onlineCheck(robotId)) {
         throw new UserCloudException(1003, "请重新登录微信");
      }
      
      // 保存发送记录
      UserCloudSendRecord sendRecord = new UserCloudSendRecord();
@@ -672,9 +722,19 @@
      } else if (goodsType == Constant.SOURCE_TYPE_PDD) {
         sendPDDGoods(user, robotId, wxId, goodsId, relationId, listOpen, result.getId());
      } else if (goodsType == Constant.SOURCE_TYPE_VIP) {
         sendVIPGoods(user, robotId, wxId, goodsId, relationId, listOpen, result.getId());
      } else if (goodsType == Constant.SOURCE_TYPE_SUNING) {
         sendSuNingGoods(user, robotId, wxId, goodsId, sellerId, relationId, listOpen, result.getId());
      }
      // 更新发单记录
      if (storeId != null) {
         UserCloudGoods record = new UserCloudGoods();
         record.setId(storeId);
         record.setState(UserCloudGoods.STATE_SHARED);
         record.setSendTime(new Date());
         record.setUpdateTime(new Date());
         userCloudGoodsService.updateByPrimaryKeySelective(record);
      }
   }
   
@@ -843,6 +903,89 @@
   
   
   /**
    * 唯品会商品
    * @param user
    * @param robotId
    * @param wxId
    * @param goodsId
    * @param relationId
    * @param listOpen
    * @param pid
    * @throws UserCloudException
    */
   private void sendVIPGoods(UserInfo user, int robotId, String wxId, Long goodsId, String relationId,
         List<UserCloudGroup> listOpen, String pid) throws UserCloudException {
      VIPGoodsInfo goods = VipShopApiUtil.getGoodsDetail(goodsId + "");
      if (goods == null)
         throw new UserCloudException(1, "该商品已下架");
      VIPConvertResultDTO resultDTO = VipShopApiUtil.convertLink(goodsId + "", VipShopUtil.getShareChanTag(user.getId()));
      String jumpLink = resultDTO.getUrl();
      boolean coupon = false;
      String quanPrice = "";
      String couponAmount = "";
      // 获取推荐语
      String recommendText = shareGoodsTextTemplateService.getRecommendText(coupon, goods.getGoodsName(), null,
            couponAmount, null);
      // 获取评论语
      String commentText = shareGoodsTextTemplateService.getCommentTextByLink(coupon, jumpLink, goods.getMarketPrice(),
            quanPrice, ConfigKeyEnum.quickShareVIPCommentText);
      // 云发单
      sendGoods(robotId, wxId, listOpen, recommendText, commentText, goods.getGoodsDetailPictures(), user.getId(), pid);
   }
   /**
    * 京东商品云发单
    * @param user
    * @param robotId
    * @param wxId
    * @param goodsId
    * @param relationId
    * @param listOpen
    * @throws UserCloudException
    */
   private void sendSuNingGoods(UserInfo user, int robotId, String wxId, Long goodsId, Long sellerId, String relationId,
         List<UserCloudGroup> listOpen, String pid) throws UserCloudException {
      SuningGoodsInfo goods = SuningApiUtil.getGoodsDetail(goodsId +"", sellerId +"");
      if (goods == null)
         throw new UserCloudException(1, "该商品已下架");
      String couponLink = goods.getCouponInfo().getCouponUrl();
      String jumpLink = SuningApiUtil.convertLink(SuningUtil.getProductUrl(sellerId +"", goodsId +""),
            StringUtil.isNullOrEmpty(couponLink) ? null : couponLink, SuningApiUtil.PID_SHARE, user.getId() + "");
      boolean coupon = false;
      String couponAmount = "";
      String sales = null;
      if (goods.getCouponInfo() != null && !StringUtil.isNullOrEmpty(goods.getCouponInfo().getCouponUrl())) {// 有券
         couponAmount = new BigDecimal(goods.getCouponInfo().getCouponValue()).toString();
         coupon = true;
      }
      // 获取推荐语
      String recommendText = shareGoodsTextTemplateService.getRecommendText(coupon, goods.getCommodityInfo().getCommodityName(), sales,
            couponAmount, null);
      // 生成快捷分享内容
      String template = configService.get(ConfigKeyEnum.quickShareSuNingCommentText.getKey());
      String commentText = shareGoodsTextTemplateService.createQuickShareTextSuNing(template, goods, jumpLink);
      List<String> imgList = new ArrayList<>();
      for (SuningGoodsImg img : goods.getCommodityInfo().getPictureUrl()) {
         imgList.add(img.getPicUrl());
      }
      // 云发单
      sendGoods(robotId, wxId, listOpen, recommendText, commentText, imgList, user.getId(), pid);
   }
   /**
    * 发送商品
    * @param robotId
    * @param title
@@ -896,10 +1039,15 @@
            // 发送图片
            String picurl = listImg.get(0);
            if (!StringUtil.isNullOrEmpty(picurl)) {
               String imgBase64 = ImageToBase64.NetImageToBase64(picurl);
               boolean macsend = AitaokerApiUtil.macsendImgBase64(robotId, cloudGroup.getGroupId(), imgBase64);
               if (macsend)
                  sendContent.setPicUrl(picurl);
               try {
                  String imgBase64 = ImageToBase64.NetImageToBase64(picurl);
                  boolean macsend = AitaokerApiUtil.macsendImgBase64(robotId, cloudGroup.getGroupId(), imgBase64);
                  if (macsend)
                     sendContent.setPicUrl(picurl);
               } catch (Exception e) {
                  LogHelper.errorDetailInfo(e);
               }
            }
            // 评论文本
            List<String> list = new ArrayList<>();
@@ -920,10 +1068,8 @@
         return;
      
      // 一个小时之前
      long rand = 1000 * 60 * 60 ;
      long time = java.lang.System.currentTimeMillis() - rand;
      long time = java.lang.System.currentTimeMillis() -  1000 * 60 * 60 ;
      Date lastTime =  new Date(time);
      
      for (int i = 0; i < 1000; i ++) {
         List<Long> list = userCloudMapper.listValidUid((i-1)*1000, 1000);
@@ -941,7 +1087,14 @@
               if (last != null)
                  continue;
               
               if (!Constant.IS_TEST) {
               boolean official = false;
               UserCloudManage cloudManage = userCloudManageService.selectByPrimaryKey(uid);
               if (cloudManage != null) {
                  if (cloudManage.getOfficial() != null)
                     official = cloudManage.getOfficial();
               }
               if (!Constant.IS_TEST && official) {
                  UserCloudMQMsg msg = new UserCloudMQMsg(uid, id, UserCloudMQMsg.TYPE_EVALUATE);
                  Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.userCloud, msg);
                  producer.send(message);