You've already forked FrameTour-BE
refactor(notifications): 重构通知系统使用统一的微信订阅通知触发服务
- 移除 UserNotificationAuthController 中的 getScenicTemplatesWithAuth 方法 - 从 ScenicRepository 中删除微信模板ID相关方法和配置 - 重命名 WechatSubscribeNotifyTriggerService 为 notifyTriggerService - 更新 TaskTaskServiceImpl 中的视频生成通知逻辑 - 重构 DownloadNotificationTasker 中的通知发送方式 - 统一使用 WechatSubscribeNotifyTriggerRequest 和 WechatSubscribeNotifyTriggerResult - 移除 ZT 消息服务相关代码 - 简化变量传递和通知模板逻辑
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
package com.ycwl.basic.repository;
|
||||
|
||||
import com.ycwl.basic.facebody.enums.FaceBodyAdapterType;
|
||||
import com.ycwl.basic.integration.common.util.ConfigValueUtil;
|
||||
import com.ycwl.basic.integration.scenic.dto.scenic.ScenicV2DTO;
|
||||
import com.ycwl.basic.integration.common.response.PageResponse;
|
||||
import com.ycwl.basic.integration.scenic.service.ScenicIntegrationService;
|
||||
@@ -14,8 +12,6 @@ import com.ycwl.basic.model.pc.mp.MpNotifyConfigEntity;
|
||||
import com.ycwl.basic.model.pc.mp.ScenicMpNotifyVO;
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicEntity;
|
||||
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
||||
import com.ycwl.basic.pay.enums.PayAdapterType;
|
||||
import com.ycwl.basic.storage.enums.StorageType;
|
||||
import com.ycwl.basic.utils.JacksonUtil;
|
||||
import com.ycwl.basic.integration.common.manager.ScenicConfigManager;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -41,8 +37,6 @@ public class ScenicRepository {
|
||||
|
||||
public static final String SCENIC_MP_CACHE_KEY = "scenic:%s:mp";
|
||||
public static final String SCENIC_MP_NOTIFY_CACHE_KEY = "scenic:%s:mpNotify";
|
||||
@Autowired
|
||||
private MpNotifyConfigMapper mpNotifyConfigMapper;
|
||||
|
||||
public ScenicV2DTO getScenicBasic(Long id) {
|
||||
ScenicV2DTO scenicDTO = scenicIntegrationService.getScenic(id);
|
||||
@@ -70,61 +64,6 @@ public class ScenicRepository {
|
||||
return mpConfigEntity;
|
||||
}
|
||||
|
||||
public ScenicMpNotifyVO getScenicMpNotifyConfig(Long scenicId) {
|
||||
if (redisTemplate.hasKey(String.format(SCENIC_MP_NOTIFY_CACHE_KEY, scenicId))) {
|
||||
return JacksonUtil.parseObject(redisTemplate.opsForValue().get(String.format(SCENIC_MP_NOTIFY_CACHE_KEY, scenicId)), ScenicMpNotifyVO.class);
|
||||
}
|
||||
MpConfigEntity mpConfig = getScenicMpConfig(scenicId);
|
||||
if (mpConfig == null) {
|
||||
return null;
|
||||
}
|
||||
ScenicMpNotifyVO mpNotifyConfig = new ScenicMpNotifyVO();
|
||||
mpNotifyConfig.setAppId(mpConfig.getAppId());
|
||||
mpNotifyConfig.setAppSecret(mpConfig.getAppSecret());
|
||||
mpNotifyConfig.setMpId(mpConfig.getId());
|
||||
mpNotifyConfig.setAppState(mpConfig.getState());
|
||||
List<MpNotifyConfigEntity> mpNotifyConfigList = mpNotifyConfigMapper.listByMpId(mpConfig.getId());
|
||||
mpNotifyConfigList.forEach(item -> {
|
||||
switch (item.getType()) {
|
||||
case 0:
|
||||
mpNotifyConfig.setVideoGeneratedTemplateId(item.getTemplateId());
|
||||
break;
|
||||
case 1:
|
||||
mpNotifyConfig.setVideoDownloadTemplateId(item.getTemplateId());
|
||||
break;
|
||||
case 2:
|
||||
mpNotifyConfig.setVideoPreExpireTemplateId(item.getTemplateId());
|
||||
break;
|
||||
}
|
||||
});
|
||||
redisTemplate.opsForValue().set(String.format(SCENIC_MP_NOTIFY_CACHE_KEY, scenicId), JacksonUtil.toJSONString(mpNotifyConfig));
|
||||
return mpNotifyConfig;
|
||||
}
|
||||
|
||||
public String getVideoGeneratedTemplateId(Long scenicId) {
|
||||
ScenicMpNotifyVO scenicMpNotifyConfig = getScenicMpNotifyConfig(scenicId);
|
||||
if (scenicMpNotifyConfig != null) {
|
||||
return scenicMpNotifyConfig.getVideoGeneratedTemplateId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getVideoDownloadTemplateId(Long scenicId) {
|
||||
ScenicMpNotifyVO scenicMpNotifyConfig = getScenicMpNotifyConfig(scenicId);
|
||||
if (scenicMpNotifyConfig != null) {
|
||||
return scenicMpNotifyConfig.getVideoDownloadTemplateId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getVideoPreExpireTemplateId(Long scenicId) {
|
||||
ScenicMpNotifyVO scenicMpNotifyConfig = getScenicMpNotifyConfig(scenicId);
|
||||
if (scenicMpNotifyConfig != null) {
|
||||
return scenicMpNotifyConfig.getVideoPreExpireTemplateId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<ScenicV2DTO> list(ScenicReqQuery scenicReqQuery) {
|
||||
try {
|
||||
// 将 ScenicReqQuery 参数转换为 zt-scenic 服务需要的参数
|
||||
|
||||
Reference in New Issue
Block a user