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 @@
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
<version>2.1.0</version>
<version>2.4.0</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
......@@ -331,7 +331,7 @@
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.77.Final</version>
<version>4.1.90.Final</version>
</dependency>
<dependency>
<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;
import cn.quantgroup.xyqb.service.register.IUserDeregisterService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -11,14 +10,13 @@ import org.springframework.stereotype.Component;
* 删除注销时间大于90的注销记录
*/
@Component
@JobHandler(value = "DeregisterTimeJobHandler")
public class DeregisterTimeJobHandler extends IJobHandler {
public class DeregisterTimeJobHandler {
@Autowired
private IUserDeregisterService userDeregisterService;
@Override
public ReturnT<String> execute(String s) throws Exception {
@XxlJob(value = "DeregisterTimeJobHandler")
public void execute() throws Exception {
userDeregisterService.executeTask();
return SUCCESS;
XxlJobHelper.handleSuccess();
}
}
package cn.quantgroup.xyqb.xxlJob;
import cn.quantgroup.xyqb.service.captcha.IGeetestLogService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -11,14 +10,13 @@ import org.springframework.stereotype.Component;
* 删除极验验证时间大于180天的记录
*/
@Component
@JobHandler(value = "GeetestLogTimeJobHandler")
public class GeetestLogTimeJobHandler extends IJobHandler {
public class GeetestLogTimeJobHandler {
@Autowired
private IGeetestLogService geetestLogService;
@Override
public ReturnT<String> execute(String s) throws Exception {
@XxlJob(value = "GeetestLogTimeJobHandler")
public void execute() throws Exception {
geetestLogService.executeTask();
return SUCCESS;
XxlJobHelper.handleSuccess();
}
}
package cn.quantgroup.xyqb.xxlJob;
import cn.quantgroup.xyqb.service.wechat.IWechatFollowService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
@JobHandler(value = "WechatFollowStatusJobHandler")
public class WechatFollowStatusJobHandler extends IJobHandler {
public class WechatFollowStatusJobHandler {
@Autowired
private IWechatFollowService wechatFollowService;
@Override
public ReturnT<String> execute(String s) throws Exception {
@XxlJob(value = "WechatFollowStatusJobHandler")
public void execute() throws Exception {
wechatFollowService.executeTask();
return SUCCESS;
XxlJobHelper.handleSuccess();
}
}
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 org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
......@@ -31,7 +31,7 @@ public class XxlJobConfig {
private int logRetentionDays;
@Bean(initMethod = "start", destroyMethod = "destroy")
@Bean
public XxlJobSpringExecutor xxlJobSpringExecutor() {
log.info(">>>>>>>>>>> xxl-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
......@@ -41,7 +41,7 @@ public class XxlJobConfig {
// 执行器AppName [选填]:执行器心跳注册分组依据;为空则关闭自动注册
xxlJobSpringExecutor.setAppName(appName);
xxlJobSpringExecutor.setAppname(appName);
//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