| | |
| | | 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;
|
| | | import com.yeshi.fanli.dto.jd.JDCouponInfo;
|
| | | import com.yeshi.fanli.dto.jd.JDPingouInfo;
|
| | | 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.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | |
| | | import com.yeshi.fanli.util.jd.JDUtil;
|
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
|
| | | 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.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO;
|
| | |
|
| | |
| | | @Resource
|
| | | private UserCloudSendContentService userCloudSendContentService;
|
| | |
|
| | | @Resource(name = "producer")
|
| | | private Producer producer;
|
| | |
|
| | |
|
| | | @Override
|
| | |
| | |
|
| | |
|
| | | String qrCode = null;
|
| | | String cloudPic = null;
|
| | | ImgInfo imgVideo = null;
|
| | | List<String> listImg = new ArrayList<>();
|
| | |
|
| | |
| | | imgVideo = imgInfo;
|
| | | continue;
|
| | | }
|
| | | |
| | | if (imgInfo.getType() == ImgEnum.goods) {
|
| | | cloudPic = imgInfo.getUrl();
|
| | | }
|
| | | |
| | | GoodsDetailVO goodsVO = imgInfo.getGoodsVO();
|
| | | if (goodsVO == null) {
|
| | | listImg.add(imgInfo.getUrl());
|
| | |
| | | qrCode = jumpLink;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | if (cloudPic == null) {
|
| | | cloudPic = imgs.get(0).getUrl();
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | // 发送图片
|
| | | String picurl = null;
|
| | | if (!StringUtil.isNullOrEmpty(qrCode)) {
|
| | | picurl = qrCode;
|
| | | } else if (listImg.size() > 0) {
|
| | | picurl = listImg.get(0);
|
| | | }
|
| | | if (!StringUtil.isNullOrEmpty(picurl)) {
|
| | | String imgBase64 = ImageToBase64.NetImageToBase64(picurl);
|
| | | if (!StringUtil.isNullOrEmpty(cloudPic)) {
|
| | | String imgBase64 = ImageToBase64.NetImageToBase64(cloudPic);
|
| | | boolean macsend = AitaokerApiUtil.macsendImgBase64(robotId, cloudGroup.getGroupId(), imgBase64);
|
| | | if (macsend)
|
| | | sendContent.setPicUrl(picurl);
|
| | | sendContent.setPicUrl(cloudPic);
|
| | | }
|
| | |
|
| | | // 评论文本
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 商品分享跳转链接
|
| | | * @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(), goodsVO.getGoodsId(), relationId);
|
| | | taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(user.getId(), Long.parseLong(goodsVO.getGoodsId()), relationId);
|
| | | } catch (ShareGoodsException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()), taoBaoLink.getGoods(),
|
| | | TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
|
| | | } else if (goodsVO.getGoodsType() == Constant.SOURCE_TYPE_JD) {
|
| | | JDGoods jdGoods = jdGoodsCacheUtil.getGoodsInfo(goodsVO.getGoodsId());
|
| | | JDGoods jdGoods = jdGoodsCacheUtil.getGoodsInfo(Long.parseLong(goodsVO.getGoodsId()));
|
| | | if (jdGoods == null) {
|
| | | return null;
|
| | | }
|
| | |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "",
|
| | | user.getId() + "");
|
| | | } else if (goodsVO.getGoodsType() == Constant.SOURCE_TYPE_PDD) {
|
| | | jumpLink = PinDuoDuoApiUtil.getPromotionUrl(goodsVO.getGoodsId(), PinDuoDuoApiUtil.PID_SHARE + "",
|
| | | jumpLink = PinDuoDuoApiUtil.getPromotionUrl(Long.parseLong(goodsVO.getGoodsId()), PinDuoDuoApiUtil.PID_SHARE + "",
|
| | | user.getId() + "");
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | }
|
| | | @Override
|
| | | public void fixedTimeSend(String id) {
|
| | | if (StringUtil.isNullOrEmpty(id)) |
| | | return;
|
| | | |
| | | // 一个小时之前
|
| | | long rand = 1000 * 60 * 60 ;
|
| | | long time = java.lang.System.currentTimeMillis() - rand;
|
| | | Date lastTime = new Date(time);
|
| | | |
| | | |
| | | for (int i = 0; i < 1000; i ++) {
|
| | | List<Long> list = userCloudMapper.listValidUid((i-1)*1000, 1000);
|
| | | if (list == null || list.size() == 0) {
|
| | | break;
|
| | | }
|
| | | |
| | | for (Long uid: list) {
|
| | | try {
|
| | | UserCloudSendRecord record = userCloudSendRecordService.getByUidAndSendId(uid, id);
|
| | | if (record != null) |
| | | continue;
|
| | | |
| | | UserCloudSendRecord last = userCloudSendRecordService.getLastByUid(uid, lastTime);
|
| | | if (last != null)
|
| | | continue;
|
| | | |
| | | if (!Constant.IS_TEST) {
|
| | | UserCloudMQMsg msg = new UserCloudMQMsg(uid, id, UserCloudMQMsg.TYPE_EVALUATE);
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.userCloud, msg);
|
| | | producer.send(message);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | | } |