| | |
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void openCloud(Long uid, Long orderId, CloudOrderMenuEnum menuEnum) throws UserCloudException {
|
| | | UserCloud existCloud = userCloudMapper.getByOrderId(orderId);
|
| | | if (existCloud != null) {
|
| | |
| | |
|
| | | if (dto == null) {
|
| | | LogHelper.cloudInfo("方法openCloud: [uid=" + uid + "][订单ID=" + orderId + "]机器人失败: 机器人创建失败");
|
| | | throw new UserCloudException(1, "机器人创建失败");
|
| | | }
|
| | |
|
| | | Integer robotId = dto.getId();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void fixedTimeSend(String id) {
|
| | | if (StringUtil.isNullOrEmpty(id)) |
| | | public void fixedTimeSend(List<GoodsEvaluate> listActivity, List<GoodsEvaluate> listGoods) {
|
| | | if (listGoods == null && listActivity == null) |
| | | return;
|
| | | |
| | | // 一个小时之前
|
| | | long time = java.lang.System.currentTimeMillis() - 1000 * 60 * 60 ;
|
| | | Date lastTime = new Date(time);
|
| | | |
| | | Date lastTime = new Date(java.lang.System.currentTimeMillis() - 1000 * 60 * 60);
|
| | | for (int i = 0; i < 1000; i ++) {
|
| | | // 查询哪些用户开通
|
| | | List<Long> list = userCloudMapper.listValidUid(i*1000, 1000);
|
| | | if (list == null || list.size() == 0) {
|
| | | List<Long> listUser = userCloudMapper.listValidUid(i*1000, 1000);
|
| | | if (listUser == null || listUser.size() == 0) {
|
| | | break;
|
| | | }
|
| | |
|
| | | for (Long uid: list) {
|
| | | try {
|
| | | // 判断是否该 内容已发
|
| | | UserCloudSendRecord record = userCloudSendRecordService.getByUidAndSendId(uid, id);
|
| | | if (record != null) |
| | | // 遍历用户
|
| | | for (Long uid: listUser) {
|
| | | try {// 判断是否开通官方采集
|
| | | UserCloudManage cloudManage = userCloudManageService.selectByPrimaryKey(uid);
|
| | | if (cloudManage == null || cloudManage.getOfficial() == null || !cloudManage.getOfficial()) {
|
| | | continue;
|
| | | |
| | | }
|
| | | // 是否在一个小时内已发送过
|
| | | UserCloudSendRecord last = userCloudSendRecordService.getLastByUid(uid, lastTime);
|
| | | if (last != null)
|
| | | continue;
|
| | |
|
| | | boolean official = false;
|
| | | UserCloudManage cloudManage = userCloudManageService.selectByPrimaryKey(uid);
|
| | | if (cloudManage != null) {
|
| | | if (cloudManage.getOfficial() != null)
|
| | | official = cloudManage.getOfficial();
|
| | | String evaluateId = null;
|
| | | // 活动
|
| | | if (listActivity != null && listActivity.size() > 0) {
|
| | | for (GoodsEvaluate evaluate: listActivity) {
|
| | | UserCloudSendRecord record = userCloudSendRecordService.getByUidAndSendId(uid, evaluate.getId());
|
| | | if (record != null) |
| | | continue;
|
| | | |
| | | evaluateId = evaluate.getId();
|
| | | break;
|
| | | }
|
| | | }
|
| | | |
| | | if (!Constant.IS_TEST && official) {
|
| | | UserCloudMQMsg msg = new UserCloudMQMsg(uid, id, UserCloudMQMsg.TYPE_EVALUATE);
|
| | | // 单品
|
| | | if (StringUtil.isNullOrEmpty(evaluateId) && listGoods != null && listGoods.size() > 0) {
|
| | | for (GoodsEvaluate evaluate: listGoods) {
|
| | | UserCloudSendRecord record = userCloudSendRecordService.getByUidAndSendId(uid, evaluate.getId());
|
| | | if (record != null) |
| | | continue;
|
| | | |
| | | evaluateId = evaluate.getId();
|
| | | break;
|
| | | }
|
| | | }
|
| | | |
| | | if(!StringUtil.isNullOrEmpty(evaluateId)) {
|
| | | UserCloudMQMsg msg = new UserCloudMQMsg(uid, evaluateId, UserCloudMQMsg.TYPE_EVALUATE);
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.userCloud, msg);
|
| | | producer.send(message);
|
| | | }
|