Commit 661d4ece authored by 王亮's avatar 王亮

Merge remote-tracking branch 'origin/master' into feature-migration-20230628

# Conflicts:
#	src/main/java/cn/quantgroup/xyqb/controller/internal/user/InnerController.java
#	src/main/java/cn/quantgroup/xyqb/controller/middleoffice/wx/WxController.java
#	src/main/java/cn/quantgroup/xyqb/service/middleoffice/applet/impl/AppletServiceImpl.java
#	src/main/java/cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
parents b9612a26 f373fddb
...@@ -315,7 +315,7 @@ ...@@ -315,7 +315,7 @@
<dependency> <dependency>
<groupId>com.xuxueli</groupId> <groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId> <artifactId>xxl-job-core</artifactId>
<version>2.1.0</version> <version>2.4.0</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>org.codehaus.groovy</groupId> <groupId>org.codehaus.groovy</groupId>
...@@ -331,7 +331,7 @@ ...@@ -331,7 +331,7 @@
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-all</artifactId> <artifactId>netty-all</artifactId>
<version>4.1.77.Final</version> <version>4.1.90.Final</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.quantgroup</groupId> <groupId>cn.quantgroup</groupId>
......
package cn.quantgroup.xyqb.util;
import com.xxl.job.core.executor.XxlJobExecutor;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import java.util.Iterator;
import java.util.Map;
public class XxlJobSpringExecutor extends XxlJobExecutor implements ApplicationContextAware {
private static ApplicationContext applicationContext;
public void start() throws Exception {
this.initJobHandlerRepository(applicationContext);
super.start();
}
private void initJobHandlerRepository(ApplicationContext applicationContext) {
if (applicationContext != null) {
Map<String, Object> serviceBeanMap = applicationContext
.getBeansWithAnnotation(JobHandler.class);
if (serviceBeanMap != null && serviceBeanMap.size() > 0) {
Iterator var3 = serviceBeanMap.values().iterator();
while (var3.hasNext()) {
Object serviceBean = var3.next();
if (serviceBean instanceof IJobHandler) {
String name = ((JobHandler) serviceBean.getClass().getAnnotation(JobHandler.class))
.value();
IJobHandler handler = (IJobHandler) serviceBean;
if (loadJobHandler(name) != null) {
throw new RuntimeException("xxl-job jobhandler naming conflicts.");
}
registJobHandler(name, handler);
}
}
}
}
}
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
XxlJobSpringExecutor.applicationContext = applicationContext;
}
public static ApplicationContext getApplicationContext() {
return applicationContext;
}
}
package cn.quantgroup.xyqb.xxlJob; package cn.quantgroup.xyqb.xxlJob;
import cn.quantgroup.xyqb.service.register.IUserDeregisterService; import cn.quantgroup.xyqb.service.register.IUserDeregisterService;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.IJobHandler; import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.handler.annotation.JobHandler;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -11,14 +10,13 @@ import org.springframework.stereotype.Component; ...@@ -11,14 +10,13 @@ import org.springframework.stereotype.Component;
* 删除注销时间大于90的注销记录 * 删除注销时间大于90的注销记录
*/ */
@Component @Component
@JobHandler(value = "DeregisterTimeJobHandler") public class DeregisterTimeJobHandler {
public class DeregisterTimeJobHandler extends IJobHandler {
@Autowired @Autowired
private IUserDeregisterService userDeregisterService; private IUserDeregisterService userDeregisterService;
@Override @XxlJob(value = "DeregisterTimeJobHandler")
public ReturnT<String> execute(String s) throws Exception { public void execute() throws Exception {
userDeregisterService.executeTask(); userDeregisterService.executeTask();
return SUCCESS; XxlJobHelper.handleSuccess();
} }
} }
package cn.quantgroup.xyqb.xxlJob; package cn.quantgroup.xyqb.xxlJob;
import cn.quantgroup.xyqb.service.captcha.IGeetestLogService; import cn.quantgroup.xyqb.service.captcha.IGeetestLogService;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.IJobHandler; import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.handler.annotation.JobHandler;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -11,14 +10,13 @@ import org.springframework.stereotype.Component; ...@@ -11,14 +10,13 @@ import org.springframework.stereotype.Component;
* 删除极验验证时间大于180天的记录 * 删除极验验证时间大于180天的记录
*/ */
@Component @Component
@JobHandler(value = "GeetestLogTimeJobHandler") public class GeetestLogTimeJobHandler {
public class GeetestLogTimeJobHandler extends IJobHandler {
@Autowired @Autowired
private IGeetestLogService geetestLogService; private IGeetestLogService geetestLogService;
@Override @XxlJob(value = "GeetestLogTimeJobHandler")
public ReturnT<String> execute(String s) throws Exception { public void execute() throws Exception {
geetestLogService.executeTask(); geetestLogService.executeTask();
return SUCCESS; XxlJobHelper.handleSuccess();
} }
} }
package cn.quantgroup.xyqb.xxlJob; package cn.quantgroup.xyqb.xxlJob;
import cn.quantgroup.xyqb.service.wechat.IWechatFollowService; import cn.quantgroup.xyqb.service.wechat.IWechatFollowService;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.IJobHandler; import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.handler.annotation.JobHandler;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
@JobHandler(value = "WechatFollowStatusJobHandler") public class WechatFollowStatusJobHandler {
public class WechatFollowStatusJobHandler extends IJobHandler {
@Autowired @Autowired
private IWechatFollowService wechatFollowService; private IWechatFollowService wechatFollowService;
@Override @XxlJob(value = "WechatFollowStatusJobHandler")
public ReturnT<String> execute(String s) throws Exception { public void execute() throws Exception {
wechatFollowService.executeTask(); wechatFollowService.executeTask();
return SUCCESS; XxlJobHelper.handleSuccess();
} }
} }
package cn.quantgroup.xyqb.xxlJob; package cn.quantgroup.xyqb.xxlJob;
import cn.quantgroup.xyqb.util.XxlJobSpringExecutor; import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
...@@ -31,7 +31,7 @@ public class XxlJobConfig { ...@@ -31,7 +31,7 @@ public class XxlJobConfig {
private int logRetentionDays; private int logRetentionDays;
@Bean(initMethod = "start", destroyMethod = "destroy") @Bean
public XxlJobSpringExecutor xxlJobSpringExecutor() { public XxlJobSpringExecutor xxlJobSpringExecutor() {
log.info(">>>>>>>>>>> xxl-job config init."); log.info(">>>>>>>>>>> xxl-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
...@@ -41,7 +41,7 @@ public class XxlJobConfig { ...@@ -41,7 +41,7 @@ public class XxlJobConfig {
// 执行器AppName [选填]:执行器心跳注册分组依据;为空则关闭自动注册 // 执行器AppName [选填]:执行器心跳注册分组依据;为空则关闭自动注册
xxlJobSpringExecutor.setAppName(appName); xxlJobSpringExecutor.setAppname(appName);
//xxlJobSpringExecutor.setAppName("xxl-job-executor-vcc-analysis"); //xxlJobSpringExecutor.setAppName("xxl-job-executor-vcc-analysis");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment