|
|
@@ -3,6 +3,10 @@ package top.lvzhiqiang.service.impl;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import me.chanjar.weixin.common.error.WxErrorException;
|
|
|
+import me.chanjar.weixin.cp.api.WxCpService;
|
|
|
+import me.chanjar.weixin.cp.bean.message.WxCpMessage;
|
|
|
+import me.chanjar.weixin.cp.bean.message.WxCpMessageSendResult;
|
|
|
import org.jsoup.Connection;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
@@ -49,7 +53,7 @@ public class CoinServiceImpl implements CoinService {
|
|
|
@Resource
|
|
|
private CoinMapper coinMapper;
|
|
|
|
|
|
- @Autowired(required = false)
|
|
|
+ @Resource
|
|
|
private WxCpService wxCpService;
|
|
|
@Autowired(required = false)
|
|
|
private WorkWeixinProperties properties;
|
|
|
@@ -91,7 +95,7 @@ public class CoinServiceImpl implements CoinService {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- //@Async("coinTaskExecutor")
|
|
|
+ @Async("coinTaskExecutor")
|
|
|
public String monitorJob() {
|
|
|
Timer timer = new Timer();
|
|
|
timer.scheduleAtFixedRate(new TimerTask() {
|
|
|
@@ -121,12 +125,6 @@ public class CoinServiceImpl implements CoinService {
|
|
|
}
|
|
|
}, 0, 2000);
|
|
|
|
|
|
- try {
|
|
|
- Thread.sleep(100000);
|
|
|
- } catch (InterruptedException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
-
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
@@ -146,9 +144,11 @@ public class CoinServiceImpl implements CoinService {
|
|
|
.url(logUrl).btnTxt(btnTxt)
|
|
|
.build();
|
|
|
try {
|
|
|
+ log.info("企业微信推送消息,send message: {}", wxCpMessage);
|
|
|
WxCpMessageSendResult sendResult = wxCpService.getMessageService().send(wxCpMessage);
|
|
|
- System.out.println(sendResult);
|
|
|
+ log.info("企业微信推送消息成功,send result: {}", sendResult);
|
|
|
} catch (WxErrorException e) {
|
|
|
+ log.error("企业微信推送消息失败!Detail: ", e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -174,8 +174,8 @@ public class CoinServiceImpl implements CoinService {
|
|
|
|
|
|
try {
|
|
|
String requestUrl = mainUrl + requestPath;
|
|
|
- Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 1080));
|
|
|
- //Proxy proxy = Proxy.NO_PROXY;
|
|
|
+ //Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 1080));
|
|
|
+ Proxy proxy = Proxy.NO_PROXY;
|
|
|
Connection.Response response = JsoupUtil.requestBody(requestUrl, httpMethod, proxy, headerMap, paramMap);
|
|
|
|
|
|
return JSONObject.parseObject(response.body());
|