You've already forked FrameTour-BE
feat(message): 集成ZT消息服务发送通知
All checks were successful
ZhenTu-BE/pipeline/head This commit looks good
All checks were successful
ZhenTu-BE/pipeline/head This commit looks good
- 在TaskTaskServiceImpl中引入ZtMessageProducerService依赖 - 替换原有微信通知逻辑,使用ZT消息服务发送视频生成通知- 在DownloadNotificationTasker中引入ZtMessageProducerService依赖 - 修改视频下载通知发送逻辑,使用ZT消息服务 - 修改视频过期提醒通知逻辑,使用ZT消息服务 - 调整额外通知时间配置获取方式,从scenicConfigManager获取 - 统一构建通知消息参数格式,包含data和page信息 - 添加详细的日志记录,便于追踪消息发送过程
This commit is contained in:
@@ -5,6 +5,8 @@ import cn.hutool.crypto.digest.MD5;
|
||||
import com.ycwl.basic.integration.common.manager.DeviceConfigManager;
|
||||
import com.ycwl.basic.integration.common.manager.RenderWorkerConfigManager;
|
||||
import com.ycwl.basic.integration.common.manager.ScenicConfigManager;
|
||||
import com.ycwl.basic.integration.message.dto.ZtMessage;
|
||||
import com.ycwl.basic.integration.message.service.ZtMessageProducerService;
|
||||
import com.ycwl.basic.repository.MemberRelationRepository;
|
||||
import com.ycwl.basic.repository.SourceRepository;
|
||||
import com.ycwl.basic.utils.JacksonUtil;
|
||||
@@ -128,6 +130,8 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
private SourceRepository sourceRepository;
|
||||
@Autowired
|
||||
private MemberRelationRepository memberRelationRepository;
|
||||
@Autowired
|
||||
private ZtMessageProducerService ztMessageProducerService;
|
||||
|
||||
private RenderWorkerEntity getWorker(@NonNull WorkerAuthReqVo req) {
|
||||
String accessKey = req.getAccessKey();
|
||||
@@ -653,23 +657,26 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
* 生成时间 {{time4.DATA}}
|
||||
* 备注 {{thing3.DATA}}
|
||||
*/
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
Map<String, Object> dataParam = new HashMap<>();
|
||||
Map<String, String> videoMap = new HashMap<>();
|
||||
videoMap.put("value", title);
|
||||
dataParam.put("thing1", videoMap);
|
||||
Map<String, String> timeMap2 = new HashMap<>();
|
||||
timeMap2.put("value", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm"));
|
||||
dataParam.put("time4", timeMap2);
|
||||
Map<String, String> remarkMap = new HashMap<>();
|
||||
remarkMap.put("value", configContent);
|
||||
dataParam.put("thing3", remarkMap);
|
||||
params.put("data", dataParam);
|
||||
params.put("page", page);
|
||||
params.put("template_id", templateId);
|
||||
log.info("视频生成通知模板参数:{},用户ID:{}", params, openId);
|
||||
INotifyAdapter adapter = NotifyFactory.get(NotifyType.WX_MP_SRV, scenicMp.toMap());
|
||||
adapter.sendTo(new NotifyContent(title, page, params), openId);
|
||||
dataParam.put("thing1", title);
|
||||
dataParam.put("time4", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm"));
|
||||
dataParam.put("thing3", configContent);
|
||||
|
||||
// 构建extra,只包含data和page
|
||||
Map<String, Object> extra = new HashMap<>();
|
||||
extra.put("data", dataParam);
|
||||
extra.put("page", page);
|
||||
|
||||
// 使用ZT消息服务发送通知(第一次通知)
|
||||
ZtMessage msg = new ZtMessage();
|
||||
msg.setChannelId(templateId);
|
||||
msg.setTitle(title);
|
||||
msg.setContent("【" + item.getFaceId() + "/" + item.getVideoId() + "】"+configContent);
|
||||
msg.setTarget(openId);
|
||||
msg.setExtra(extra);
|
||||
msg.setSendReason("视频生成通知");
|
||||
msg.setSendBiz("视频生成");
|
||||
ztMessageProducerService.send(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user