| | |
| | | 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.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 org.springframework.web.context.request.ServletRequestAttributes;
|
| | |
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import javax.servlet.http.HttpSession;
|
| | | import java.util.List;
|
| | |
|
| | |
|
| | | /**
|
| | | * @author kimi
|
| | | * @description
|
| | | * @description xxljob执行job的handler类
|
| | | * @date 2020-03-02 9:35
|
| | | */
|
| | | @Slf4j
|
| | |
| | | @XxlJob("assembleJob")
|
| | | public ReturnT<String> assembleJobHandler(String assembleId) throws Exception {
|
| | | XxlJobLogger.log("assemble Job start");
|
| | |
|
| | | 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");
|
| | |
| | | }else {
|
| | | return ReturnT.FAIL;
|
| | | }
|
| | | }
|
| | |
|
| | | @XxlJob("test")
|
| | | public ReturnT<String> test(String assembleId) throws Exception {
|
| | | XxlJobLogger.log("assemble Job start");
|
| | | XxlJobLogger.log("test Job run");
|
| | | ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
| | | HttpServletRequest request = requestAttributes.getRequest();
|
| | | HttpSession session = request.getSession();
|
| | | session.setAttribute("11", assembleId);
|
| | | return ReturnT.SUCCESS;
|
| | | }
|
| | |
|
| | | }
|