|
|
@@ -53,6 +53,7 @@ import com.cyksj.model.manage.views.GroupsRelationView;
|
|
|
import com.cyksj.model.manage.views.OrderDonView;
|
|
|
import com.cyksj.model.request.OrderAttach;
|
|
|
import com.cyksj.model.request.OrderPayRequest;
|
|
|
+import com.cyksj.model.request.TelegramBotMsgReq;
|
|
|
import com.cyksj.model.request.TransferAccountsReq;
|
|
|
import com.cyksj.model.views.CouponNewUserView;
|
|
|
import com.cyksj.model.views.CouponUserView;
|
|
|
@@ -73,6 +74,7 @@ import com.cyksj.service.relation.GroupRelationClearService;
|
|
|
import com.cyksj.service.relation.GroupRelationFrontService;
|
|
|
import com.cyksj.service.relation.GroupsRelationExpiryRecordService;
|
|
|
import com.cyksj.service.sys.SysConfigService;
|
|
|
+import com.cyksj.service.telegram.TelegramService;
|
|
|
import com.cyksj.service.template.TemplateCommonService;
|
|
|
import com.cyksj.service.user.UserBenefitsService;
|
|
|
import com.cyksj.service.user.UserBindRelationService;
|
|
|
@@ -215,6 +217,8 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
|
|
|
private final UserPhoneSendRecordMapper userPhoneSendRecordMapper;
|
|
|
|
|
|
+ private final TelegramService telegramService;
|
|
|
+
|
|
|
private final List<String> noChekGoodsTemp = List.of("Apple One", "Youtube", "Spotify");
|
|
|
|
|
|
@Transactional(rollbackFor = Throwable.class)
|
|
|
@@ -626,6 +630,13 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
log.error("回传错误 {}", StringUtil.getErrorText(e));
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ //虚拟物品购买推送电报消息
|
|
|
+ if(goodsDon.getType() == 1){
|
|
|
+ TASK_POOL.execute(()->{
|
|
|
+ sendTelegramMsg(order, goodsDon);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -982,6 +993,13 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
log.error("回传错误 {}", StringUtil.getErrorText(e));
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ //虚拟物品购买推送电报消息
|
|
|
+ if(goodsDon.getType() == 1){
|
|
|
+ TASK_POOL.execute(()->{
|
|
|
+ sendTelegramMsg(orderDon, goodsDon);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void sendOrderPhoneMsg(Long userId) {
|
|
|
@@ -2282,4 +2300,27 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
transport.setAddress(address.getAddress());
|
|
|
orderDonTransportMapper.insert(transport);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 购买时发送电报消息
|
|
|
+ */
|
|
|
+ private void sendTelegramMsg(OrderDon orderDon, GoodsDon goodsDon) {
|
|
|
+ if(!redisService.hasKey(RedisKey.TELEGRAM_BOT_MSG)){
|
|
|
+ TelegramBotMsgReq msgReq = new TelegramBotMsgReq();
|
|
|
+ msgReq.setGoodsName(goodsDon.getTitle());
|
|
|
+ User user = userMapper.selectById(orderDon.getUserId());
|
|
|
+ msgReq.setName(user.getNickname());
|
|
|
+ GroupsRelation groupsRelation = groupsRelationMapper.selectById(orderDon.getRelationId());
|
|
|
+
|
|
|
+ msgReq.setDay(DateUtil.betweenDay(new Date(), groupsRelation.getExpiryTime(),true));
|
|
|
+ msgReq.setNumber(groupsRelation.getNum());
|
|
|
+ try {
|
|
|
+ telegramService.sendMsg(msgReq);
|
|
|
+ redisService.set(RedisKey.TELEGRAM_BOT_MSG,1, 60L * 3L);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("发送电报推送消息错误 msg:{}",StringUtil.getErrorText(e));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|