| | |
| | | package com.highdatas.mdm.job;
|
| | |
|
| | | import com.highdatas.mdm.entity.SysAssemble;
|
| | | import com.highdatas.mdm.pojo.Result;
|
| | | import com.highdatas.mdm.service.ISysAssembleService;
|
| | | import com.highdatas.mdm.util.DbUtils;
|
| | | import com.xxl.job.core.biz.model.ReturnT;
|
| | | import com.xxl.job.core.handler.annotation.XxlJob;
|
| | | import com.xxl.job.core.log.XxlJobLogger;
|
| | | import lombok.extern.slf4j.Slf4j;
|
| | | import org.apache.catalina.session.StandardSession;
|
| | | import org.apache.commons.lang3.StringUtils;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Component;
|
| | | import com.xxl.job.core.handler.annotation.XxlJob;
|
| | | import org.springframework.web.context.request.RequestContextHolder;
|
| | |
|
| | | import javax.servlet.ServletContext;
|
| | | import javax.servlet.http.HttpSession;
|
| | | import javax.servlet.http.HttpSessionContext;
|
| | | import java.util.Enumeration;
|
| | | import java.util.List;
|
| | |
|
| | |
|
| | | /**
|
| | | * @author kimi
|
| | | * @description
|
| | | * @description xxljob执行job的handler类
|
| | | * @date 2020-03-02 9:35
|
| | | */
|
| | | @Slf4j
|
| | |
| | | ISysAssembleService assembleService;
|
| | |
|
| | | @XxlJob("assembleJob")
|
| | | public ReturnT<String> demoJobHandler(String assembleId) throws Exception {
|
| | | public ReturnT<String> assembleJobHandler(String assembleId) throws Exception {
|
| | | XxlJobLogger.log("assemble Job start");
|
| | | if (StringUtils.isEmpty(assembleId)) {
|
| | | XxlJobLogger.log("params: assembleId is null");
|
| | | List<String> split = DbUtils.split(assembleId, "&&");
|
| | | if (split.size() < 1) {
|
| | | XxlJobLogger.log("params: assemble is not found");
|
| | | return ReturnT.FAIL;
|
| | | }
|
| | | assembleId = split.get(0);
|
| | | SysAssemble assemble = assembleService.selectById(assembleId);
|
| | | if (assemble == null) {
|
| | | XxlJobLogger.log("params: assemble is not found");
|
| | | }
|
| | |
|
| | | // assembleService.run()
|
| | |
|
| | | return ReturnT.SUCCESS;
|
| | | Result run = assembleService.run(assembleId);
|
| | | XxlJobLogger.log("log info:" + run.getMessage());
|
| | | if (run.getSuccess()) {
|
| | | return ReturnT.SUCCESS;
|
| | | }else {
|
| | | return ReturnT.FAIL;
|
| | | }
|
| | | }
|
| | |
|
| | | }
|