wjj vor 2 Tagen
Ursprung
Commit
3401d28686

+ 7 - 20
fs-qw-task/src/main/java/com/fs/app/task/qwTask.java

@@ -19,9 +19,7 @@ import org.springframework.stereotype.Component;
 
 import java.time.LocalDate;
 import java.time.LocalDateTime;
-import java.time.LocalTime;
 import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -119,30 +117,19 @@ public class qwTask {
         sopLogsTaskService.selectSopUserLogsListByTime(currentTime);
     }
 
-    @Scheduled(cron = "0 7 18 * * ?") // 每天下午6点执行
+    @Scheduled(cron = "0 5 * * * ?") // 每小时的第5分钟触发
     @Async
     public void selectSopUserLogsListByTimeNew() throws Exception {
-        // 获取第二天
-        LocalDate tomorrow = LocalDate.now().plusDays(1);
+        // 获取当前时间的第二天
+        LocalDate nextDay = LocalDate.now().plusDays(1);
+        log.info("任务执行日期: {}", nextDay);
 
-        List<LocalDateTime> dateTimeList = new ArrayList<>();
-        // 从 4 点到 23 点(包含 23 点)
+        // 从凌晨4点到晚上24点循环调用
         for (int hour = 4; hour <= 23; hour++) {
-            LocalDateTime dt = LocalDateTime.of(tomorrow, LocalTime.of(hour, 0));
-            dateTimeList.add(dt);
-        }
-        for (LocalDateTime currentTime : dateTimeList) {
-            log.info("每天18点任务实际执行时间: {}", currentTime);
-            // 调用服务方法处理SOP用户日志
+            LocalDateTime currentTime = nextDay.atTime(hour, 0, 0);
+            log.info("任务实际执行时间: {}", currentTime);
             sopLogsTaskService.selectNewSopUserLogsListByTime(currentTime);
         }
-//        // 获取当前时间,精确到小时
-//        LocalDateTime currentTime = LocalDateTime.now().withMinute(0).withSecond(0).withNano(0);
-//        // 打印日志,确认任务执行时间
-//        log.info("任务实际执行时间: {}", currentTime);
-//
-//        // 调用服务方法处理SOP用户日志
-//        sopLogsTaskService.selectNewSopUserLogsListByTime(currentTime);
     }
 
     /**

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

@@ -1772,19 +1772,19 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
                     if (org.apache.commons.lang3.StringUtils.isBlank(feiShuDocId)) {
                         feiShuDocId = getFeiShuDocId(video, companyIdLong, companyUserIdLong);
                         if (org.apache.commons.lang3.StringUtils.isNotBlank(feiShuDocId)) {
-                            redisCache.setCacheObject("fei_shu_doc_id:" + externalIdLong + "_" + video.getVideoId(), feiShuDocId,1,TimeUnit.DAYS);
+                            redisCache.setCacheObject("fei_shu_doc_id:" + externalIdLong + "_" + video.getVideoId(), feiShuDocId,2,TimeUnit.DAYS);
                         }
                     }
                     break;
                 case "19" :
+                    sopLogs.setContentJson(JSON.toJSONString(clonedContent));
+                    enqueueQwSopLogs(sopLogs);
                     break;
                 default:
                     break;
             }
 
         }
-        sopLogs.setContentJson(JSON.toJSONString(clonedContent));
-        enqueueQwSopLogs(sopLogs);
     }
 
     public List<FeishuAccount> getFeiShuAccountCompanyUser(Long companyId, Long companyUserId) {

+ 30 - 0
fs-qwhook/src/main/java/com/fs/app/controller/QwUserController.java

@@ -13,6 +13,7 @@ import com.fs.common.param.LoginParam;
 import com.fs.common.utils.PatternUtils;
 import com.fs.common.utils.SecurityUtils;
 import com.fs.common.utils.StringUtils;
+
 import com.fs.company.domain.Company;
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.param.CompanyUserCodeParam;
@@ -222,4 +223,33 @@ public class QwUserController extends BaseController {
             return R.error("登录异常:"+e.getMessage());
         }
     }
+//
+//    @GetMapping("/getOpenidForRedPacket")
+//    @ApiOperation("侧边栏发红包-获取外部联系人的openid(优先从本地映射表获取)")
+//    public R getOpenidForRedPacket(@ApiParam(value = "外部联系人id", required = true) @RequestParam Long qwExternalContactId) {
+//        String openid = qwExternalContactService.getOpenidByExternalContactId(qwExternalContactId);
+//        if (StringUtils.isEmpty(openid)) {
+//            return R.error("获取openid失败,该用户可能未关注公众号");
+//        }
+//        return R.ok().put("data", openid);
+//    }
+//
+//    @PostMapping("/sendRedPacket")
+//    @ApiOperation("侧边栏发红包-给外部联系人发送企业红包(默认0.3元)")
+//    public R sendRedPacket(@RequestBody SendRedPacketRequest request) {
+//        Integer amount = request.getAmount() != null ? request.getAmount() : 30;
+//        String wishing = request.getWishing() != null ? request.getWishing() : "";
+//        String actName = request.getActName() != null ? request.getActName() : "";
+//        String remark = request.getRemark() != null ? request.getRemark() : "";
+//        if (!request.getQwExternalContactId().equals(6703893L)){
+//            return R.ok();
+//        }
+//        SidebarRedPacketService.RedPacketSendResult result =
+//                sidebarRedPacketService.sendSidebarRedPacket(request.getQwExternalContactId(), amount, wishing, actName, remark);
+//        if (result.isSuccess()) {
+//            return R.ok("发送成功").put("mchBillno", result.getMchBillno()).put("sendListid", result.getSendListid());
+//        }
+//        return R.error(result.getErrorMsg());
+//    }
+
 }