Browse Source

sop生成群聊信息问题修复

三七 1 week ago
parent
commit
268fc6a778

+ 19 - 26
fs-qw-task/src/main/java/com/fs/app/controller/CommonController.java

@@ -50,10 +50,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import com.fs.app.task.qwTask;
 
 import java.time.*;
@@ -67,12 +64,10 @@ import java.util.*;
 public class CommonController {
 
     @Autowired
-    private SopLogsTaskService service;
+    private SopLogsTaskService taskService;
     @Autowired
     private IFsUserCourseVideoService courseVideoService;
     @Autowired
-    private SopLogsTaskService sopLogsTaskService;
-    @Autowired
     private SopWxLogsService sopWxLogsService;
     @Autowired
     private IQwExternalContactService qwExternalContactService;
@@ -175,6 +170,23 @@ public class CommonController {
     @Autowired
     private IFsIntegralCountService integralCountService;
 
+
+    @GetMapping("/testTime")
+    public R testTime(String time, String sopId) throws Exception {
+        log.info("进入sop任务");
+        LocalDateTime now = LocalDateTime.now();
+
+        List<String> sopIds = new ArrayList<>();
+        if (StringUtils.isNotEmpty(sopId)) {
+            sopIds = Arrays.asList(sopId.split(","));
+        }
+
+        taskService.selectSopUserLogsListByTime(DateUtil.parseLocalDateTime(time), sopIds);
+        LocalDateTime now1 = LocalDateTime.now();
+        return R.ok().put("start", now).put("end", now1);
+    }
+
+
     @GetMapping("/UserIntegralCount")
     public void UserIntegralCount(){
         log.info("=====用户积分每日消耗统计开始=====");
@@ -461,25 +473,6 @@ public class CommonController {
             }
         }
     }
-
-    @GetMapping("/test")
-    public R test(String time, String sopId) throws Exception {
-        log.info("进入sop任务");
-//        LocalDateTime currentTime = DateUtil.parseLocalDateTime(time);
-//        // 计算下一个整点时间
-//        LocalDateTime nextHourTime = currentTime.withMinute(0).withSecond(0).withNano(0).plusHours(1);
-//
-//        // 打印日志,确认时间
-//        log.info("任务实际执行时间: {}", currentTime);
-//        log.info("传递给任务的时间参数: {}", nextHourTime);
-        List<String> sopidList = new ArrayList<>();
-        if(StringUtils.isNotEmpty(sopId)){
-            sopidList = Arrays.asList(sopId.split(","));
-        }
-//        sopLogsTaskService.selectSopUserLogsListByTime(DateUtil.parseLocalDateTime(time), sopidList);
-        sopWxLogsTaskService.selectSopUserLogsListByTime(DateUtil.parseLocalDateTime(time), sopidList);
-        return R.ok();
-    }
     @GetMapping("/testWx")
     public R testWx(String time) throws Exception {
         sopWxLogsService.wxSopLogsByTime(DateUtil.parseLocalDateTime(time));

+ 3 - 1
fs-qw-task/src/main/java/com/fs/app/taskService/impl/SopLogsTaskServiceImpl.java

@@ -799,7 +799,6 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
         if (StringUtils.isNotEmpty(logVo.getChatId())) {
             QwGroupChat groupChat = groupChatMap.get(logVo.getChatId());
             if (groupChat.getChatUserList() != null && !groupChat.getChatUserList().isEmpty()) {
-                QwSopLogs sopLogs = createBaseLog(formattedSendTime, logVo, ruleTimeVO, groupChat.getChatId(), groupChat.getName(), null, isOfficial, null, null);
                 boolean hasGroupNotice = content.getSetting() != null && content.getSetting().stream()
                         .anyMatch(st -> "11".equals(st.getContentType()));
                 if(hasGroupNotice){
@@ -809,6 +808,9 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
                     ruleTimeVO.setSendType(6);
                 }
                 ruleTimeVO.setType(2);
+
+                QwSopLogs sopLogs = createBaseLog(formattedSendTime, logVo, ruleTimeVO, groupChat.getChatId(), groupChat.getName(), null, isOfficial, null, null);
+
                 handleLogBasedOnType(sopLogs, content, logVo, sendTime, courseId, videoId,
                         type, qwUserId, companyUserId, companyId, groupChat.getChatId(), welcomeText, qwUserName,
                         null, true, miniAppId, groupChat, config, miniMap, null, sendMsgType,