|
|
@@ -13,7 +13,6 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.jsoup.Connection;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
@@ -33,9 +32,6 @@ import java.util.Map;
|
|
|
@Slf4j
|
|
|
public class NiuniuService {
|
|
|
|
|
|
- @Autowired
|
|
|
- private DashboardWs dashboardWs;
|
|
|
-
|
|
|
public String accessToken;
|
|
|
|
|
|
public PinTuanDto lastPintuanDto;
|
|
|
@@ -112,7 +108,7 @@ public class NiuniuService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @Scheduled(cron = "12 0/2 * * * ? ")
|
|
|
+ @Scheduled(cron = "12 0/1 * * * ? ")
|
|
|
public void updatePinTuan() {
|
|
|
userInfo();
|
|
|
HttpResult httpResult = pinTuan();
|
|
|
@@ -126,18 +122,21 @@ public class NiuniuService {
|
|
|
if (dashboardDto==null){
|
|
|
dashboardDto= new DashboardDto();
|
|
|
}
|
|
|
- dashboardDto.setPinTuanDto(pinTuanDto);
|
|
|
+
|
|
|
if (!pinTuanDto.getAlready_pinzhong().equals(lastPintuanDto.getAlready_pinzhong())){
|
|
|
log.info("你拼中了 {} 个商品,请尽快处理",(pinTuanDto.getAlready_pinzhong()-lastPintuanDto.getAlready_pinzhong()));
|
|
|
- lastPintuanDto=pinTuanDto;
|
|
|
dashboardDto.setChange(pinTuanDto.getAlready_pinzhong()-lastPintuanDto.getAlready_pinzhong());
|
|
|
+ }else {
|
|
|
+ dashboardDto.setChange(0);
|
|
|
}
|
|
|
+ dashboardDto.setPinTuanDto(pinTuanDto);
|
|
|
+ lastPintuanDto=pinTuanDto;
|
|
|
}
|
|
|
|
|
|
- @Scheduled(cron = "0/5 * * * * ? ")
|
|
|
+ @Scheduled(cron = "15 0/1 * * * ? ")
|
|
|
public void sendDashboardWs() {
|
|
|
if (dashboardDto!=null){
|
|
|
- dashboardWs.send(JSONObject.toJSONString(dashboardDto, SerializerFeature.DisableCircularReferenceDetect));
|
|
|
+ DashboardWs.send(JSONObject.toJSONString(dashboardDto, SerializerFeature.DisableCircularReferenceDetect));
|
|
|
}
|
|
|
}
|
|
|
}
|