|
|
@@ -20,6 +20,12 @@ import com.fs.live.param.LiveReplayParam;
|
|
|
import com.fs.live.service.*;
|
|
|
import com.fs.live.utils.ProcessManager;
|
|
|
import com.fs.live.vo.*;
|
|
|
+import com.fs.store.domain.FsMiniprogramSubNotifyTask;
|
|
|
+import com.fs.store.domain.FsUser;
|
|
|
+import com.fs.store.dto.TemplateMessageSendRequestDTO;
|
|
|
+import com.fs.store.enums.MiniAppNotifyTaskStatusEnum;
|
|
|
+import com.fs.store.mapper.FsMiniprogramSubNotifyTaskMapper;
|
|
|
+import com.fs.store.mapper.FsUserMapper;
|
|
|
import com.fs.system.domain.SysConfig;
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
|
import com.hc.openapi.tool.codec.DigestUtils;
|
|
|
@@ -36,6 +42,7 @@ import com.fs.common.utils.sign.Md5Utils;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.time.temporal.ChronoUnit;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
@@ -80,6 +87,10 @@ public class LiveServiceImpl implements ILiveService
|
|
|
private RedisCache redisCache;
|
|
|
@Autowired
|
|
|
private LiveMapper baseMapper;
|
|
|
+ @Autowired
|
|
|
+ private FsMiniprogramSubNotifyTaskMapper fsMiniprogramSubNotifyTaskMapper;
|
|
|
+ @Autowired
|
|
|
+ private FsUserMapper fsUserMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private RedisUtil redisUtil;
|
|
|
@@ -195,6 +206,40 @@ public class LiveServiceImpl implements ILiveService
|
|
|
return baseMapper.liveCompanyList(companyId);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public R subNotifyLive(HashMap<String, Object> param) {
|
|
|
+ FsMiniprogramSubNotifyTask notifyTask = new FsMiniprogramSubNotifyTask();
|
|
|
+ notifyTask.setPage("/pages_course/living?liveId=" + param.get("liveId"));
|
|
|
+ notifyTask.setTaskName("直播间预约提醒");
|
|
|
+ notifyTask.setTemplateId((String) param.get("templateId"));
|
|
|
+ FsUser fsUser = fsUserMapper.selectFsUserById(Long.valueOf((Integer) param.get("userId")));
|
|
|
+ String maOpenId = fsUser.getMaOpenId();
|
|
|
+ notifyTask.setTouser(maOpenId);
|
|
|
+ notifyTask.setPage(String.valueOf(1));
|
|
|
+
|
|
|
+ notifyTask.setCreateTime(LocalDateTime.now());
|
|
|
+ // 状态等待执行
|
|
|
+ notifyTask.setStatus(MiniAppNotifyTaskStatusEnum.WAITING.getValue());
|
|
|
+ notifyTask.setRetryCount(0);
|
|
|
+ notifyTask.setMaxRetries(3);
|
|
|
+ Map<String, TemplateMessageSendRequestDTO.TemplateDataValue> data = new HashMap<>();
|
|
|
+ HashMap<String,String> mapData = (HashMap<String, String>) param.get("data");
|
|
|
+ // 定义日期时间格式器,注意与字符串格式完全匹配
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+
|
|
|
+ notifyTask.setUpdateTime(LocalDateTime.parse(mapData.get("date7"), formatter).minusSeconds(5));
|
|
|
+ mapData.forEach((k,v)->{
|
|
|
+ TemplateMessageSendRequestDTO.TemplateDataValue dataValue = new TemplateMessageSendRequestDTO.TemplateDataValue();
|
|
|
+ dataValue.setValue(mapData.get(k));
|
|
|
+ data.put(k, dataValue);
|
|
|
+ });
|
|
|
+ notifyTask.setData(JSON.toJSONString(data));
|
|
|
+ return R.ok("success");
|
|
|
+// fsMiniprogramSubNotifyTaskMapper.insert(notifyTask);
|
|
|
+
|
|
|
+// return R.ok("success");
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查询企业直播
|
|
|
* @param liveId 直播ID
|