Pārlūkot izejas kodu

增加探活接口

xueyiming 7 mēneši atpakaļ
vecāks
revīzija
28f22388c3

+ 20 - 0
we-com-server/src/main/java/com/tzld/piaoquan/wecom/controller/IndexController.java

@@ -0,0 +1,20 @@
+package com.tzld.piaoquan.wecom.controller;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/")
+public class IndexController {
+
+    /**
+     * 探活
+     *
+     * @return
+     */
+    @GetMapping("/healthcheck")
+    public String healthcheck() {
+        return "ok";
+    }
+}

+ 2 - 1
we-com-server/src/main/java/com/tzld/piaoquan/wecom/job/WeComUserDataJob.java

@@ -2,6 +2,7 @@ package com.tzld.piaoquan.wecom.job;
 
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.tzld.piaoquan.wecom.common.constant.TimeConstant;
 import com.tzld.piaoquan.wecom.dao.mapper.StaffMapper;
 import com.tzld.piaoquan.wecom.dao.mapper.StaffMapper;
 import com.tzld.piaoquan.wecom.dao.mapper.StaffWithUserMapper;
 import com.tzld.piaoquan.wecom.dao.mapper.StaffWithUserMapper;
 import com.tzld.piaoquan.wecom.dao.mapper.UserMapper;
 import com.tzld.piaoquan.wecom.dao.mapper.UserMapper;
@@ -132,7 +133,7 @@ public class WeComUserDataJob {
         userExample.setOrderByClause("create_time desc");
         userExample.setOrderByClause("create_time desc");
         userExample.setPage(new Page<>(1, 1));
         userExample.setPage(new Page<>(1, 1));
         List<User> userList = userMapper.selectByExample(userExample);
         List<User> userList = userMapper.selectByExample(userExample);
-        long startTime = userList.get(0).getCreateTime().getTime() / 1000;
+        long startTime = userList.get(0).getCreateTime().getTime() / 1000 - 2L * TimeConstant.HOUR;
         long endTime = System.currentTimeMillis() / 1000;
         long endTime = System.currentTimeMillis() / 1000;
         StaffExample example = new StaffExample();
         StaffExample example = new StaffExample();
         List<Staff> staffList = staffMapper.selectByExample(example);
         List<Staff> staffList = staffMapper.selectByExample(example);