|
@@ -2,15 +2,12 @@ package com.txz.cif.task;
|
|
|
|
|
|
import cn.hutool.http.HttpRequest;
|
|
import cn.hutool.http.HttpRequest;
|
|
import cn.hutool.http.HttpResponse;
|
|
import cn.hutool.http.HttpResponse;
|
|
-import cn.hutool.http.HttpUtil;
|
|
|
|
-import cn.hutool.json.JSONObject;
|
|
|
|
-import cn.hutool.json.JSONUtil;
|
|
|
|
|
|
+import com.txz.cif.configurer.Parameters;
|
|
import com.txz.cif.dubbo.client.OrderDubboServiceClient;
|
|
import com.txz.cif.dubbo.client.OrderDubboServiceClient;
|
|
import com.txz.cif.service.DayCutService;
|
|
import com.txz.cif.service.DayCutService;
|
|
-import com.txz.cif.configurer.Parameters;
|
|
|
|
|
|
+import com.txz.cif.service.RechargeRecordService;
|
|
import com.xxl.job.core.biz.model.ReturnT;
|
|
import com.xxl.job.core.biz.model.ReturnT;
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
-import org.apache.commons.codec.binary.Hex;
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
@@ -21,7 +18,7 @@ import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 常规job
|
|
* 常规job
|
|
- *
|
|
|
|
|
|
+ * <p>
|
|
* 开发步骤:
|
|
* 开发步骤:
|
|
* 1、在Spring Bean实例中,开发Job方法,方式格式要求为 "public ReturnT<String> execute(String param)"
|
|
* 1、在Spring Bean实例中,开发Job方法,方式格式要求为 "public ReturnT<String> execute(String param)"
|
|
* 2、为Job方法添加注解 "@XxlJob(value="自定义jobhandler名称", init = "JobHandler初始化方法", destroy = "JobHandler销毁方法")",注解value值对应的是调度中心新建任务的JobHandler属性的值。
|
|
* 2、为Job方法添加注解 "@XxlJob(value="自定义jobhandler名称", init = "JobHandler初始化方法", destroy = "JobHandler销毁方法")",注解value值对应的是调度中心新建任务的JobHandler属性的值。
|
|
@@ -32,17 +29,20 @@ import java.util.Map;
|
|
@Component
|
|
@Component
|
|
public class GeneralJob {
|
|
public class GeneralJob {
|
|
private static Logger logger = LoggerFactory.getLogger(GeneralJob.class);
|
|
private static Logger logger = LoggerFactory.getLogger(GeneralJob.class);
|
|
-
|
|
|
|
|
|
+
|
|
@Resource
|
|
@Resource
|
|
private DayCutService dayCutService;
|
|
private DayCutService dayCutService;
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
@Resource
|
|
@Resource
|
|
private OrderDubboServiceClient orderDubboServiceClient;
|
|
private OrderDubboServiceClient orderDubboServiceClient;
|
|
-
|
|
|
|
|
|
+
|
|
@Resource
|
|
@Resource
|
|
private Parameters parameters;
|
|
private Parameters parameters;
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private RechargeRecordService rechargeRecordService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 日切
|
|
* 日切
|
|
*/
|
|
*/
|
|
@@ -58,36 +58,34 @@ public class GeneralJob {
|
|
}
|
|
}
|
|
return ReturnT.SUCCESS;
|
|
return ReturnT.SUCCESS;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@XxlJob("checkin")
|
|
@XxlJob("checkin")
|
|
public ReturnT<String> checkin(String param) throws Exception {
|
|
public ReturnT<String> checkin(String param) throws Exception {
|
|
- Map<String,Object> map = new HashMap<>();
|
|
|
|
- map.put("email","351550660@qq.com");
|
|
|
|
- map.put("passwd","Lin123456");
|
|
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
+ map.put("email", "351550660@qq.com");
|
|
|
|
+ map.put("passwd", "Lin123456");
|
|
HttpResponse resp = HttpRequest.post("https://chynet01.azureedge.net/auth/login").form(map).timeout(-1).execute();
|
|
HttpResponse resp = HttpRequest.post("https://chynet01.azureedge.net/auth/login").form(map).timeout(-1).execute();
|
|
String key = resp.getCookie("key").toString();
|
|
String key = resp.getCookie("key").toString();
|
|
String expire_in = resp.getCookie("expire_in").toString();
|
|
String expire_in = resp.getCookie("expire_in").toString();
|
|
- String cookie = "cookie:PHPSESSID=fun75tna6st563e78799552e69; cnxad_lunbo=yes; crisp-client%2Fsession%2F7850791f-bbe4-4874-9f05-c9dea3c63595=session_8a49d3eb-e9c7-43f8-9fe9-12d1560a4122; crisp-client%2Fsession%2F7850791f-bbe4-4874-9f05-c9dea3c63595%2Fc89170bf-a23d-3152-9ad4-fda9810011f7=session_8a49d3eb-e9c7-43f8-9fe9-12d1560a4122; uid=14105; email=351550660%40qq.com; ip=5f0f60145ce69c8054af6bb0a24e9c1a;"+key+"; "+expire_in;
|
|
|
|
|
|
+ String cookie = "cookie:PHPSESSID=fun75tna6st563e78799552e69; cnxad_lunbo=yes; crisp-client%2Fsession%2F7850791f-bbe4-4874-9f05-c9dea3c63595=session_8a49d3eb-e9c7-43f8-9fe9-12d1560a4122; crisp-client%2Fsession%2F7850791f-bbe4-4874-9f05-c9dea3c63595%2Fc89170bf-a23d-3152-9ad4-fda9810011f7=session_8a49d3eb-e9c7-43f8-9fe9-12d1560a4122; uid=14105; email=351550660%40qq.com; ip=5f0f60145ce69c8054af6bb0a24e9c1a;" + key + "; " + expire_in;
|
|
String ret = HttpRequest.post("https://chynet01.azureedge.net/user/checkin").cookie(cookie).timeout(-1).execute().body();
|
|
String ret = HttpRequest.post("https://chynet01.azureedge.net/user/checkin").cookie(cookie).timeout(-1).execute().body();
|
|
- logger.error("[checkin]:"+ret);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-// JSONObject json = new JSONObject();
|
|
|
|
-// json.put("username","linxinkai");
|
|
|
|
-// json.put("password","Lin123456");
|
|
|
|
-// String ret2 = HttpUtil.post("https://c4.a0.chat/v1/user/login/",json.toString());
|
|
|
|
-// String token = JSONUtil.parseObj(ret2).getJSONObject("data").getStr("token");
|
|
|
|
-// json = new JSONObject();
|
|
|
|
-// json.put("action","sign_today");
|
|
|
|
-// ret = HttpRequest.post("https://c4.a0.chat/v1/user/info/").body(json.toString()).header("Authorization",token).timeout(-1).execute().body();
|
|
|
|
-// logger.error("[checkin]:"+ret);
|
|
|
|
-
|
|
|
|
|
|
+ logger.error("[checkin]:" + ret);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // JSONObject json = new JSONObject();
|
|
|
|
+ // json.put("username","linxinkai");
|
|
|
|
+ // json.put("password","Lin123456");
|
|
|
|
+ // String ret2 = HttpUtil.post("https://c4.a0.chat/v1/user/login/",json.toString());
|
|
|
|
+ // String token = JSONUtil.parseObj(ret2).getJSONObject("data").getStr("token");
|
|
|
|
+ // json = new JSONObject();
|
|
|
|
+ // json.put("action","sign_today");
|
|
|
|
+ // ret = HttpRequest.post("https://c4.a0.chat/v1/user/info/").body(json.toString()).header("Authorization",token).timeout(-1).execute().body();
|
|
|
|
+ // logger.error("[checkin]:"+ret);
|
|
|
|
+
|
|
return ReturnT.SUCCESS;
|
|
return ReturnT.SUCCESS;
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
@XxlJob("scheduledTaskStorePinkSummaryClose")
|
|
@XxlJob("scheduledTaskStorePinkSummaryClose")
|
|
public ReturnT<String> scheduledTaskStorePinkSummaryClose(String param) throws Exception {
|
|
public ReturnT<String> scheduledTaskStorePinkSummaryClose(String param) throws Exception {
|
|
try {
|
|
try {
|
|
@@ -100,8 +98,8 @@ public class GeneralJob {
|
|
}
|
|
}
|
|
return ReturnT.SUCCESS;
|
|
return ReturnT.SUCCESS;
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
@XxlJob("scheduledTaskBatchSigning")
|
|
@XxlJob("scheduledTaskBatchSigning")
|
|
public ReturnT<String> scheduledTaskBatchSigning(String param) throws Exception {
|
|
public ReturnT<String> scheduledTaskBatchSigning(String param) throws Exception {
|
|
try {
|
|
try {
|
|
@@ -114,7 +112,7 @@ public class GeneralJob {
|
|
}
|
|
}
|
|
return ReturnT.SUCCESS;
|
|
return ReturnT.SUCCESS;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@XxlJob("orderTimeoutAutomaticCancel")
|
|
@XxlJob("orderTimeoutAutomaticCancel")
|
|
public ReturnT<String> orderTimeoutAutomaticCancel(String param) throws Exception {
|
|
public ReturnT<String> orderTimeoutAutomaticCancel(String param) throws Exception {
|
|
try {
|
|
try {
|
|
@@ -127,33 +125,46 @@ public class GeneralJob {
|
|
}
|
|
}
|
|
return ReturnT.SUCCESS;
|
|
return ReturnT.SUCCESS;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ @XxlJob("closeRecharge")
|
|
|
|
+ public ReturnT<String> closeRecharge() throws Exception {
|
|
|
|
+ try {
|
|
|
|
+ logger.info("【关闭支付订单】开始");
|
|
|
|
+ rechargeRecordService.closeRecharge();
|
|
|
|
+ logger.info("【关闭支付订单】完成");
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ logger.error("【关闭支付订单】异常:e{}", e);
|
|
|
|
+ return ReturnT.FAIL;
|
|
|
|
+ }
|
|
|
|
+ return ReturnT.SUCCESS;
|
|
|
|
+ }
|
|
|
|
+
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
-// int quhao = 154;
|
|
|
|
-// int weihao = 9642;
|
|
|
|
-// String a = Hex.encodeHexString( new byte[] {(byte)((quhao>>8)&0x00FF),(byte)(quhao&0x00FF),(byte)((weihao>>8)&0x00FF),(byte)(weihao&0x00FF)});
|
|
|
|
-// System.out.println(a);
|
|
|
|
-//
|
|
|
|
-// String b = Hex.encodeHexString( new byte[] {(byte)((quhao>>8)&0x00FF),(byte)(quhao&0x00FF)});
|
|
|
|
-// System.out.println(b);
|
|
|
|
-// String hex = "009a25aa";
|
|
|
|
-// int decimal = Integer.parseInt(hex, 16);
|
|
|
|
-// System.out.println(decimal); // 输出:2571
|
|
|
|
-// String str = String.format("%09d", decimal);
|
|
|
|
-// System.out.println(str); // 输出:2571
|
|
|
|
-// System.out.println(str.substring(0,6)); // 输出:2571
|
|
|
|
-// System.out.println(str.substring(6)); // 输出:2571
|
|
|
|
-
|
|
|
|
- Map<String,Object> map = new HashMap<>();
|
|
|
|
- map.put("email","351550660@qq.com");
|
|
|
|
- map.put("passwd","Lin123456");
|
|
|
|
|
|
+ // int quhao = 154;
|
|
|
|
+ // int weihao = 9642;
|
|
|
|
+ // String a = Hex.encodeHexString( new byte[] {(byte)((quhao>>8)&0x00FF),(byte)(quhao&0x00FF),(byte)((weihao>>8)&0x00FF),(byte)(weihao&0x00FF)});
|
|
|
|
+ // System.out.println(a);
|
|
|
|
+ //
|
|
|
|
+ // String b = Hex.encodeHexString( new byte[] {(byte)((quhao>>8)&0x00FF),(byte)(quhao&0x00FF)});
|
|
|
|
+ // System.out.println(b);
|
|
|
|
+ // String hex = "009a25aa";
|
|
|
|
+ // int decimal = Integer.parseInt(hex, 16);
|
|
|
|
+ // System.out.println(decimal); // 输出:2571
|
|
|
|
+ // String str = String.format("%09d", decimal);
|
|
|
|
+ // System.out.println(str); // 输出:2571
|
|
|
|
+ // System.out.println(str.substring(0,6)); // 输出:2571
|
|
|
|
+ // System.out.println(str.substring(6)); // 输出:2571
|
|
|
|
+
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
+ map.put("email", "351550660@qq.com");
|
|
|
|
+ map.put("passwd", "Lin123456");
|
|
HttpResponse resp = HttpRequest.post("https://chynet01.azureedge.net/auth/login").form(map).timeout(-1).execute();
|
|
HttpResponse resp = HttpRequest.post("https://chynet01.azureedge.net/auth/login").form(map).timeout(-1).execute();
|
|
String key = resp.getCookie("key").toString();
|
|
String key = resp.getCookie("key").toString();
|
|
String expire_in = resp.getCookie("expire_in").toString();
|
|
String expire_in = resp.getCookie("expire_in").toString();
|
|
- String cookie = "cookie:PHPSESSID=fun75tna6st563e78799552e69; cnxad_lunbo=yes; crisp-client%2Fsession%2F7850791f-bbe4-4874-9f05-c9dea3c63595=session_8a49d3eb-e9c7-43f8-9fe9-12d1560a4122; crisp-client%2Fsession%2F7850791f-bbe4-4874-9f05-c9dea3c63595%2Fc89170bf-a23d-3152-9ad4-fda9810011f7=session_8a49d3eb-e9c7-43f8-9fe9-12d1560a4122; uid=14105; email=351550660%40qq.com; ip=5f0f60145ce69c8054af6bb0a24e9c1a;"+key+"; "+expire_in;
|
|
|
|
|
|
+ String cookie = "cookie:PHPSESSID=fun75tna6st563e78799552e69; cnxad_lunbo=yes; crisp-client%2Fsession%2F7850791f-bbe4-4874-9f05-c9dea3c63595=session_8a49d3eb-e9c7-43f8-9fe9-12d1560a4122; crisp-client%2Fsession%2F7850791f-bbe4-4874-9f05-c9dea3c63595%2Fc89170bf-a23d-3152-9ad4-fda9810011f7=session_8a49d3eb-e9c7-43f8-9fe9-12d1560a4122; uid=14105; email=351550660%40qq.com; ip=5f0f60145ce69c8054af6bb0a24e9c1a;" + key + "; " + expire_in;
|
|
String ret = HttpRequest.post("https://chynet01.azureedge.net/user/checkin").cookie(cookie).timeout(-1).execute().body();
|
|
String ret = HttpRequest.post("https://chynet01.azureedge.net/user/checkin").cookie(cookie).timeout(-1).execute().body();
|
|
- logger.error("[checkin]:"+ret);
|
|
|
|
|
|
+ logger.error("[checkin]:" + ret);
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|