|
@@ -7,10 +7,13 @@ import cn.clevercsc.niuniutool.dto.UserInfoDto;
|
|
|
import cn.clevercsc.niuniutool.util.ConnectUtils;
|
|
import cn.clevercsc.niuniutool.util.ConnectUtils;
|
|
|
import cn.clevercsc.niuniutool.util.DateUtils;
|
|
import cn.clevercsc.niuniutool.util.DateUtils;
|
|
|
import cn.clevercsc.niuniutool.util.HttpResult;
|
|
import cn.clevercsc.niuniutool.util.HttpResult;
|
|
|
|
|
+import cn.clevercsc.niuniutool.ws.DashboardWs;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
+import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.jsoup.Connection;
|
|
import org.jsoup.Connection;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
@@ -30,6 +33,9 @@ import java.util.Map;
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
public class NiuniuService {
|
|
public class NiuniuService {
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private DashboardWs dashboardWs;
|
|
|
|
|
+
|
|
|
public String accessToken;
|
|
public String accessToken;
|
|
|
|
|
|
|
|
public PinTuanDto lastPintuanDto;
|
|
public PinTuanDto lastPintuanDto;
|
|
@@ -125,4 +131,9 @@ public class NiuniuService {
|
|
|
dashboardDto.setChange(pinTuanDto.getAlready_pinzhong()-lastPintuanDto.getAlready_pinzhong());
|
|
dashboardDto.setChange(pinTuanDto.getAlready_pinzhong()-lastPintuanDto.getAlready_pinzhong());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Scheduled(cron = "0/5 * * * * ? ")
|
|
|
|
|
+ public void sendDashboardWs() {
|
|
|
|
|
+ dashboardWs.send(JSONObject.toJSONString(dashboardDto, SerializerFeature.DisableCircularReferenceDetect));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|