抢票日志
This commit is contained in:
parent
692e7119b3
commit
8c4b1756ce
@ -74,7 +74,6 @@ public class PerformController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 获取演出详细信息
|
* 获取演出详细信息
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('system:perform:query')")
|
|
||||||
@GetMapping(value = "/normal/{id}")
|
@GetMapping(value = "/normal/{id}")
|
||||||
public AjaxResult getInfoNormal(@PathVariable("id") Long id) {
|
public AjaxResult getInfoNormal(@PathVariable("id") Long id) {
|
||||||
return success(performService.getInfoNormal(id));
|
return success(performService.getInfoNormal(id));
|
||||||
@ -101,6 +100,17 @@ public class PerformController extends BaseController {
|
|||||||
return toAjax(performService.updatePerform(perform));
|
return toAjax(performService.updatePerform(perform));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新人员状态
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:perform:refresh')")
|
||||||
|
@GetMapping(value = "/refresh/{id}")
|
||||||
|
public AjaxResult refresh(@PathVariable("id") Long id) throws Exception {
|
||||||
|
return toAjax(performService.refresh(id));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除演出
|
* 删除演出
|
||||||
*/
|
*/
|
||||||
|
@ -69,7 +69,6 @@ public class RyTask {
|
|||||||
String base64Hmac = Base64.getEncoder().encodeToString(hmacBytes);
|
String base64Hmac = Base64.getEncoder().encodeToString(hmacBytes);
|
||||||
|
|
||||||
// 输出生成的HMAC Base64编码值
|
// 输出生成的HMAC Base64编码值
|
||||||
System.out.println("HMAC-SHA1 (Base64): " + base64Hmac);
|
|
||||||
// 指定使用的字符编码(如UTF-8)
|
// 指定使用的字符编码(如UTF-8)
|
||||||
String charset = "UTF-8";
|
String charset = "UTF-8";
|
||||||
|
|
||||||
@ -112,74 +111,114 @@ public class RyTask {
|
|||||||
throw new Exception("没有参与人员");
|
throw new Exception("没有参与人员");
|
||||||
}
|
}
|
||||||
|
|
||||||
long time = System.currentTimeMillis();
|
Perform perform1 = new Perform();
|
||||||
String data = "/notice/v1.0/notice-" + perform.getNotice() + "?fieldSet=noticeV1&appId=be4d79eb8fc7bd008ee82c8ec4ff6fd4&language=zh-cn&os=WEB&platform=WEB&wpf=pc";
|
String eValue = null;
|
||||||
String base = "https://global.apis.naver.com/weverse/wevweb";
|
if (perform.getNum() == null || perform.getNum().isEmpty()) {
|
||||||
|
long time = System.currentTimeMillis();
|
||||||
|
String data = "/notice/v1.0/notice-" + perform.getNotice() + "?fieldSet=noticeV1&appId=be4d79eb8fc7bd008ee82c8ec4ff6fd4&language=zh-cn&os=WEB&platform=WEB&wpf=pc";
|
||||||
|
String base = "https://global.apis.naver.com/weverse/wevweb";
|
||||||
|
|
||||||
String wmd = getWMD(data + time);
|
String wmd = getWMD(data + time);
|
||||||
if (wmd == null || wmd.isEmpty()) {
|
if (wmd == null || wmd.isEmpty()) {
|
||||||
throw new Exception("wmd解析失败");
|
throw new Exception("wmd解析失败");
|
||||||
|
}
|
||||||
|
// 创建HttpClient实例
|
||||||
|
HttpClient httpClient = HttpClient.newBuilder()
|
||||||
|
.connectTimeout(Duration.ofSeconds(10))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// 创建HttpRequest
|
||||||
|
String url = base + data + "&wmsgpad=" + time + "&wmd=" + wmd;
|
||||||
|
HttpRequest request = HttpRequest.newBuilder()
|
||||||
|
.uri(new URI(url))
|
||||||
|
.GET()
|
||||||
|
.header("Authorization", "Bearer " + applies.get(0).getToken())
|
||||||
|
.header("Origin", "https://weverse.io")
|
||||||
|
.header("Referer", "https://weverse.io/")
|
||||||
|
.header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// 发送请求并获取响应
|
||||||
|
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
|
||||||
|
// 检查响应状态码
|
||||||
|
if (response.statusCode() == 200) {
|
||||||
|
// 打印响应体
|
||||||
|
String responseBody = response.body();
|
||||||
|
WeverseData weverseData = JSONObject.parseObject(responseBody, WeverseData.class);
|
||||||
|
if (weverseData == null ||
|
||||||
|
weverseData.getButton() == null ||
|
||||||
|
weverseData.getButton().getWebLink() == null ||
|
||||||
|
weverseData.getButton().getWebLink().getUrl() == null ||
|
||||||
|
weverseData.getButton().getWebLink().getUrl().isEmpty()) {
|
||||||
|
throw new Exception("button获取失败");
|
||||||
|
}
|
||||||
|
URI uri = new URI(weverseData.getButton().getWebLink().getUrl());
|
||||||
|
|
||||||
|
String query = uri.getQuery();
|
||||||
|
String[] params = query.split("&");
|
||||||
|
Map<String, String> paramMap = new HashMap<>();
|
||||||
|
|
||||||
|
for (String param : params) {
|
||||||
|
String[] keyValue = param.split("=");
|
||||||
|
String key = URLDecoder.decode(keyValue[0], "UTF-8");
|
||||||
|
String value = URLDecoder.decode(keyValue[1], "UTF-8");
|
||||||
|
paramMap.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取参数e的值
|
||||||
|
eValue = paramMap.get("e");
|
||||||
|
} else {
|
||||||
|
throw new Exception("button请求失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eValue == null || eValue.isEmpty()) {
|
||||||
|
throw new Exception("button为空");
|
||||||
|
}
|
||||||
|
perform1.setNum(eValue);
|
||||||
|
} else {
|
||||||
|
eValue = perform.getNum();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 创建HttpClient实例
|
// 创建HttpClient实例
|
||||||
HttpClient httpClient = HttpClient.newBuilder()
|
HttpClient httpClient = HttpClient.newBuilder()
|
||||||
.connectTimeout(Duration.ofSeconds(10))
|
.connectTimeout(Duration.ofSeconds(10))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// 创建HttpRequest
|
|
||||||
String url = base + data + "&wmsgpad=" + time + "&wmd=" + wmd;
|
|
||||||
System.out.println(url);
|
|
||||||
HttpRequest request = HttpRequest.newBuilder()
|
HttpRequest request = HttpRequest.newBuilder()
|
||||||
.uri(new URI(url))
|
.uri(new URI("https://faneventapi.weverse.io/api/v1/user/events/" + eValue))
|
||||||
.GET()
|
.GET()
|
||||||
.header("Authorization", "Bearer " + applies.get(0).getToken())
|
.header("Authorization", "Bearer " + applies.get(0).getToken())
|
||||||
.header("Origin", "https://weverse.io")
|
.header("Origin", "https://weverse.io")
|
||||||
.header("Referer", "https://weverse.io/")
|
.header("Referer", "https://weverse.io/")
|
||||||
.header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36")
|
.header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// 发送请求并获取响应
|
// 发送请求并获取响应
|
||||||
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
|
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
|
||||||
String eValue = null;
|
if (response.statusCode() == 200) {
|
||||||
// 检查响应状态码
|
WeverseAgree weverseAgree = JSONObject.parseObject(response.body(), WeverseAgree.class);
|
||||||
if (response.statusCode() == 403) {
|
System.out.println(weverseAgree);
|
||||||
// 打印响应体
|
if (weverseAgree == null || weverseAgree.getMetadata() == null ||
|
||||||
String responseBody = response.body();
|
weverseAgree.getMetadata().getForm() == null ||
|
||||||
WeverseResponse weverseResponse = JSONObject.parseObject(responseBody, WeverseResponse.class);
|
weverseAgree.getMetadata().getForm().getTerms() == null ||
|
||||||
if (weverseResponse == null || weverseResponse.getData() == null ||
|
weverseAgree.getMetadata().getForm().getTerms().isEmpty()) {
|
||||||
weverseResponse.getData().getButton() == null ||
|
throw new Exception("协议未找到");
|
||||||
weverseResponse.getData().getButton().getWebLink() == null ||
|
|
||||||
weverseResponse.getData().getButton().getWebLink().getUrl() == null ||
|
|
||||||
weverseResponse.getData().getButton().getWebLink().getUrl().isEmpty()) {
|
|
||||||
throw new Exception("button获取失败");
|
|
||||||
}
|
|
||||||
URI uri = new URI(weverseResponse.getData().getButton().getWebLink().getUrl());
|
|
||||||
|
|
||||||
String query = uri.getQuery();
|
|
||||||
String[] params = query.split("&");
|
|
||||||
Map<String, String> paramMap = new HashMap<>();
|
|
||||||
|
|
||||||
for (String param : params) {
|
|
||||||
String[] keyValue = param.split("=");
|
|
||||||
String key = URLDecoder.decode(keyValue[0], "UTF-8");
|
|
||||||
String value = URLDecoder.decode(keyValue[1], "UTF-8");
|
|
||||||
paramMap.put(key, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取参数e的值
|
StringBuffer sb = new StringBuffer();
|
||||||
eValue = paramMap.get("e");
|
weverseAgree.getMetadata().getForm().getTerms().forEach(str -> {
|
||||||
|
sb.append(str.getId()).append(",");
|
||||||
|
});
|
||||||
|
sb.deleteCharAt(sb.length() - 1);
|
||||||
|
|
||||||
System.out.println(weverseResponse);
|
String agree = sb.toString();
|
||||||
} else {
|
if (!agree.isEmpty()) {
|
||||||
throw new Exception("button请求失败");
|
perform1.setAgree(agree);
|
||||||
|
}
|
||||||
|
log.info(agree);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eValue == null || eValue.isEmpty()) {
|
|
||||||
throw new Exception("button为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
Perform perform1 = new Perform();
|
|
||||||
perform1.setId(pid);
|
perform1.setId(pid);
|
||||||
perform1.setNum(eValue);
|
|
||||||
performMapper.updatePerform(perform1);
|
performMapper.updatePerform(perform1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,6 +228,7 @@ public class RyTask {
|
|||||||
* @param pid
|
* @param pid
|
||||||
*/
|
*/
|
||||||
public void rob(Long pid, Long jobId) throws Exception {
|
public void rob(Long pid, Long jobId) throws Exception {
|
||||||
|
log.info("pid:" + pid + " 任务开始了");
|
||||||
//status
|
//status
|
||||||
Perform pStatus1 = new Perform();
|
Perform pStatus1 = new Perform();
|
||||||
pStatus1.setStatus("2");
|
pStatus1.setStatus("2");
|
||||||
@ -243,7 +283,6 @@ public class RyTask {
|
|||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
String jsonPayload = mapper.writeValueAsString(eventData);
|
String jsonPayload = mapper.writeValueAsString(eventData);
|
||||||
System.out.println(jsonPayload);
|
|
||||||
HttpClient client = HttpClient.newHttpClient();
|
HttpClient client = HttpClient.newHttpClient();
|
||||||
HttpRequest request = HttpRequest.newBuilder()
|
HttpRequest request = HttpRequest.newBuilder()
|
||||||
.uri(URI.create(url))
|
.uri(URI.create(url))
|
||||||
@ -252,7 +291,7 @@ public class RyTask {
|
|||||||
.header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36")
|
.header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36")
|
||||||
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
|
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
|
||||||
.build();
|
.build();
|
||||||
req.add(new MyReq(client, request, a.getName()));
|
req.add(new MyReq(client, request, a.getWeverseEmail()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
@ -260,7 +299,7 @@ public class RyTask {
|
|||||||
calendar.add(Calendar.HOUR_OF_DAY, -1);
|
calendar.add(Calendar.HOUR_OF_DAY, -1);
|
||||||
long start = calendar.getTimeInMillis();
|
long start = calendar.getTimeInMillis();
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
Thread.sleep(start - now);
|
Thread.sleep(start - now - 500);
|
||||||
log.info("抢票开始了");
|
log.info("抢票开始了");
|
||||||
for (MyReq r : req) {
|
for (MyReq r : req) {
|
||||||
log.info("【用户】:" + r.getUser());
|
log.info("【用户】:" + r.getUser());
|
||||||
@ -282,6 +321,13 @@ public class RyTask {
|
|||||||
pStatus2.setStatus("3");
|
pStatus2.setStatus("3");
|
||||||
pStatus2.setId(pid);
|
pStatus2.setId(pid);
|
||||||
performMapper.updatePerform(pStatus2);
|
performMapper.updatePerform(pStatus2);
|
||||||
|
|
||||||
|
for (Apply upApply : applies) {
|
||||||
|
Apply apply1 = new Apply();
|
||||||
|
apply1.setId(upApply.getId());
|
||||||
|
apply1.setStatus("6");
|
||||||
|
applyMapper.updateApply(apply1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.ruoyi.web.task;
|
||||||
|
|
||||||
|
public class WeverseAgree {
|
||||||
|
private WeverseMetadata metadata;
|
||||||
|
|
||||||
|
public WeverseMetadata getMetadata() {
|
||||||
|
return metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMetadata(WeverseMetadata metadata) {
|
||||||
|
this.metadata = metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "WeverseAgree{" +
|
||||||
|
"metadata=" + metadata +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.ruoyi.web.task;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class WeverseForm {
|
||||||
|
|
||||||
|
private List<WeverseTerms> terms;
|
||||||
|
|
||||||
|
public List<WeverseTerms> getTerms() {
|
||||||
|
return terms;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTerms(List<WeverseTerms> terms) {
|
||||||
|
this.terms = terms;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "WeverseForm{" +
|
||||||
|
"terms=" + terms +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.ruoyi.web.task;
|
||||||
|
|
||||||
|
public class WeverseMetadata {
|
||||||
|
private WeverseForm form;
|
||||||
|
|
||||||
|
public WeverseForm getForm() {
|
||||||
|
return form;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setForm(WeverseForm form) {
|
||||||
|
this.form = form;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "WeverseMetadata{" +
|
||||||
|
"form=" + form +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.ruoyi.web.task;
|
||||||
|
|
||||||
|
public class WeverseTerms {
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "WeverseTerms{" +
|
||||||
|
"id=" + id +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.ruoyi.system.domain;
|
||||||
|
|
||||||
|
public class WeverseAgree {
|
||||||
|
private String userStatus;
|
||||||
|
private WeverseMetadata metadata;
|
||||||
|
|
||||||
|
public WeverseMetadata getMetadata() {
|
||||||
|
return metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMetadata(WeverseMetadata metadata) {
|
||||||
|
this.metadata = metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserStatus() {
|
||||||
|
return userStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserStatus(String userStatus) {
|
||||||
|
this.userStatus = userStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "WeverseAgree{" +
|
||||||
|
"userStatus='" + userStatus + '\'' +
|
||||||
|
", metadata=" + metadata +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.ruoyi.system.domain;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class WeverseForm {
|
||||||
|
|
||||||
|
private List<WeverseTerms> terms;
|
||||||
|
|
||||||
|
public List<WeverseTerms> getTerms() {
|
||||||
|
return terms;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTerms(List<WeverseTerms> terms) {
|
||||||
|
this.terms = terms;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "WeverseForm{" +
|
||||||
|
"terms=" + terms +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.ruoyi.system.domain;
|
||||||
|
|
||||||
|
public class WeverseMetadata {
|
||||||
|
private WeverseForm form;
|
||||||
|
|
||||||
|
public WeverseForm getForm() {
|
||||||
|
return form;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setForm(WeverseForm form) {
|
||||||
|
this.form = form;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "WeverseMetadata{" +
|
||||||
|
"form=" + form +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.ruoyi.system.domain;
|
||||||
|
|
||||||
|
public class WeverseTerms {
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "WeverseTerms{" +
|
||||||
|
"id=" + id +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
@ -29,6 +29,8 @@ public interface ApplyMapper
|
|||||||
|
|
||||||
public List<Apply> selectApplyListAllow(Apply apply);
|
public List<Apply> selectApplyListAllow(Apply apply);
|
||||||
|
|
||||||
|
public List<Apply> selectApplyListRob(Apply apply);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Apply selectApplyPerform(Apply apply);
|
public Apply selectApplyPerform(Apply apply);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.ruoyi.system.service;
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ruoyi.system.domain.Perform;
|
import com.ruoyi.system.domain.Perform;
|
||||||
@ -74,4 +75,6 @@ public interface IPerformService {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deletePerformById(Long id);
|
public int deletePerformById(Long id);
|
||||||
|
|
||||||
|
public boolean refresh(Long id) throws Exception;
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,25 @@
|
|||||||
package com.ruoyi.system.service.impl;
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.http.HttpClient;
|
||||||
|
import java.net.http.HttpRequest;
|
||||||
|
import java.net.http.HttpResponse;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.Duration;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.ruoyi.common.exception.job.TaskException;
|
import com.ruoyi.common.exception.job.TaskException;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.quartz.domain.SysJob;
|
import com.ruoyi.quartz.domain.SysJob;
|
||||||
import com.ruoyi.quartz.service.ISysJobService;
|
import com.ruoyi.quartz.service.ISysJobService;
|
||||||
|
import com.ruoyi.system.domain.Apply;
|
||||||
|
import com.ruoyi.system.domain.WeverseAgree;
|
||||||
|
import com.ruoyi.system.mapper.ApplyMapper;
|
||||||
import org.quartz.SchedulerException;
|
import org.quartz.SchedulerException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -30,6 +40,8 @@ public class PerformServiceImpl implements IPerformService {
|
|||||||
private PerformMapper performMapper;
|
private PerformMapper performMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysJobService jobService;
|
private ISysJobService jobService;
|
||||||
|
@Autowired
|
||||||
|
private ApplyMapper applyMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询演出
|
* 查询演出
|
||||||
@ -202,4 +214,48 @@ public class PerformServiceImpl implements IPerformService {
|
|||||||
public int deletePerformById(Long id) {
|
public int deletePerformById(Long id) {
|
||||||
return performMapper.deletePerformById(id);
|
return performMapper.deletePerformById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean refresh(Long id) throws Exception {
|
||||||
|
//人员
|
||||||
|
Apply apply = new Apply();
|
||||||
|
apply.setPerformId(id);
|
||||||
|
List<Apply> applies = applyMapper.selectApplyListRob(apply);
|
||||||
|
if (applies.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (Apply a : applies) {
|
||||||
|
// 创建HttpClient实例
|
||||||
|
HttpClient httpClient = HttpClient.newBuilder()
|
||||||
|
.connectTimeout(Duration.ofSeconds(10))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
HttpRequest request = HttpRequest.newBuilder()
|
||||||
|
.uri(new URI("https://faneventapi.weverse.io/api/v1/user/events/4632"))
|
||||||
|
.GET()
|
||||||
|
.header("Authorization", "Bearer " + a.getToken())
|
||||||
|
.header("Origin", "https://weverse.io")
|
||||||
|
.header("Referer", "https://weverse.io/")
|
||||||
|
.header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36")
|
||||||
|
.build();
|
||||||
|
// 发送请求并获取响应
|
||||||
|
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
|
||||||
|
if (response.statusCode() == 200) {
|
||||||
|
WeverseAgree weverseAgree = JSONObject.parseObject(response.body(), WeverseAgree.class);
|
||||||
|
System.out.println(weverseAgree);
|
||||||
|
if (weverseAgree == null || weverseAgree.getUserStatus() == null) {
|
||||||
|
throw new Exception("状态未找到");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("DROPPED".equals(weverseAgree.getUserStatus())) {
|
||||||
|
Apply apply1 = new Apply();
|
||||||
|
apply1.setId(a.getId());
|
||||||
|
apply1.setStatus("4");
|
||||||
|
applyMapper.updateApply(apply1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,6 +100,29 @@
|
|||||||
and a.token is not null
|
and a.token is not null
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectApplyListRob" parameterType="Apply" resultMap="ApplyResult">
|
||||||
|
select a.id,
|
||||||
|
a.perform_id,
|
||||||
|
a.weverse_email,
|
||||||
|
a.weverse_password,
|
||||||
|
a.birthday,
|
||||||
|
a.country_code,
|
||||||
|
a.phone_num,
|
||||||
|
a.wechat_num,
|
||||||
|
a.token,
|
||||||
|
a.status,
|
||||||
|
a.create_by,
|
||||||
|
a.create_time,
|
||||||
|
a.update_by,
|
||||||
|
a.update_time,
|
||||||
|
a.remark,
|
||||||
|
p.name,
|
||||||
|
p.start_time
|
||||||
|
from apply a left join perform p on p.id = a.perform_id
|
||||||
|
where a.perform_id = #{performId}
|
||||||
|
and a.status = '6'
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectApplyPerform" parameterType="Apply" resultMap="ApplyResult">
|
<select id="selectApplyPerform" parameterType="Apply" resultMap="ApplyResult">
|
||||||
<include refid="selectApplyVo"/>
|
<include refid="selectApplyVo"/>
|
||||||
where user_id = #{userId} and perform_id = #{performId}
|
where user_id = #{userId} and perform_id = #{performId}
|
||||||
|
Loading…
Reference in New Issue
Block a user