|
|
@ -1,5 +1,6 @@
|
|
|
|
package cn.estsh.i3plus.core.apiservice.controller.busi;
|
|
|
|
package cn.estsh.i3plus.core.apiservice.controller.busi;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.base.ISystemInitService;
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysTaskCycleService;
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysTaskCycleService;
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysTaskPlanService;
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysTaskPlanService;
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysTaskService;
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysTaskService;
|
|
|
@ -13,6 +14,7 @@ import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.ExcelTool;
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.ExcelTool;
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.FileTool;
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.FileTool;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
|
|
|
|
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
|
|
|
|
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.BaseResultBean;
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.BaseResultBean;
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
|
|
@ -28,6 +30,7 @@ import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
import cn.estsh.impp.framework.boot.quartz.IQuartzJobService;
|
|
|
|
import cn.estsh.impp.framework.boot.quartz.IQuartzJobService;
|
|
|
|
import cn.estsh.impp.framework.boot.quartz.ScheduleTool;
|
|
|
|
import cn.estsh.impp.framework.boot.quartz.ScheduleTool;
|
|
|
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ImppRedis;
|
|
|
|
import cn.estsh.impp.framework.boot.util.RedisCacheTool;
|
|
|
|
import cn.estsh.impp.framework.boot.util.RedisCacheTool;
|
|
|
|
import cn.estsh.impp.framework.boot.util.ResultBean;
|
|
|
|
import cn.estsh.impp.framework.boot.util.ResultBean;
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
@ -40,6 +43,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.persistence.EntityManager;
|
|
|
|
import javax.persistence.EntityManager;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import java.io.*;
|
|
|
|
import java.io.*;
|
|
|
@ -75,6 +79,12 @@ public class SysTaskPlanController extends CoreBaseController {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private EntityManager entityManager;
|
|
|
|
private EntityManager entityManager;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private ISystemInitService systemInitService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource(name= CommonConstWords.IMPP_REDIS_RES)
|
|
|
|
|
|
|
|
private ImppRedis redisRes;
|
|
|
|
|
|
|
|
|
|
|
|
/************ 微服定时任务 *********/
|
|
|
|
/************ 微服定时任务 *********/
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private ScheduleTool scheduleTool;
|
|
|
|
private ScheduleTool scheduleTool;
|
|
|
@ -211,6 +221,9 @@ public class SysTaskPlanController extends CoreBaseController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新任务计划缓存
|
|
|
|
|
|
|
|
putTaskPlanCache(sysTaskPlan);
|
|
|
|
|
|
|
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultObject(sysTaskPlan);
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultObject(sysTaskPlan);
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
isMakeUpOperate = true;
|
|
|
|
isMakeUpOperate = true;
|
|
|
@ -301,6 +314,10 @@ public class SysTaskPlanController extends CoreBaseController {
|
|
|
|
resultBean = ResultBean.fail(baseResultBean.getErrorMsg());
|
|
|
|
resultBean = ResultBean.fail(baseResultBean.getErrorMsg());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新任务计划缓存
|
|
|
|
|
|
|
|
putTaskPlanCache(sysTaskPlan);
|
|
|
|
|
|
|
|
|
|
|
|
return resultBean;
|
|
|
|
return resultBean;
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
@ -329,6 +346,9 @@ public class SysTaskPlanController extends CoreBaseController {
|
|
|
|
sysTaskPlanService.deleteSysTaskPlanById(Long.parseLong(id));
|
|
|
|
sysTaskPlanService.deleteSysTaskPlanById(Long.parseLong(id));
|
|
|
|
getJobService(sysTaskPlan.getTaskSoftTypeRdd()).deleteTask(sysTaskPlan.getName(), sysTaskPlan.getGroupName());
|
|
|
|
getJobService(sysTaskPlan.getTaskSoftTypeRdd()).deleteTask(sysTaskPlan.getName(), sysTaskPlan.getGroupName());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 清理缓存
|
|
|
|
|
|
|
|
removeTaskPlanCache(sysTaskPlan);
|
|
|
|
|
|
|
|
|
|
|
|
return ResultBean.success().setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
return ResultBean.success().setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
@ -495,6 +515,10 @@ public class SysTaskPlanController extends CoreBaseController {
|
|
|
|
, sysTaskPlan.getGroupName(), sysTaskCycle.getTaskCycleExps(), sysTaskPlan.getTaskPlanParam());
|
|
|
|
, sysTaskPlan.getGroupName(), sysTaskCycle.getTaskCycleExps(), sysTaskPlan.getTaskPlanParam());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 刷新全部缓存
|
|
|
|
|
|
|
|
reloadAllTaskPlanCache();
|
|
|
|
|
|
|
|
|
|
|
|
return ResultBean.success("操作成功");
|
|
|
|
return ResultBean.success("操作成功");
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
@ -535,6 +559,10 @@ public class SysTaskPlanController extends CoreBaseController {
|
|
|
|
, sysTaskPlan.getGroupName(), sysTaskCycle.getTaskCycleExps(), sysTaskPlan.getTaskPlanParam());
|
|
|
|
, sysTaskPlan.getGroupName(), sysTaskCycle.getTaskCycleExps(), sysTaskPlan.getTaskPlanParam());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 刷新全部缓存
|
|
|
|
|
|
|
|
reloadAllTaskPlanCache();
|
|
|
|
|
|
|
|
|
|
|
|
return ResultBean.success("操作成功");
|
|
|
|
return ResultBean.success("操作成功");
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
@ -566,8 +594,7 @@ public class SysTaskPlanController extends CoreBaseController {
|
|
|
|
|
|
|
|
|
|
|
|
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
|
|
|
|
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
|
|
|
|
response.setCharacterEncoding("UTF-8");
|
|
|
|
response.setCharacterEncoding("UTF-8");
|
|
|
|
response.setHeader("Content-Disposition",
|
|
|
|
response.setHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(excelFile.getName(), "UTF-8"));
|
|
|
|
"attachment;fileName=" + URLEncoder.encode(excelFile.getName(), "UTF-8"));
|
|
|
|
|
|
|
|
response.flushBuffer();
|
|
|
|
response.flushBuffer();
|
|
|
|
|
|
|
|
|
|
|
|
BufferedInputStream bis = null;
|
|
|
|
BufferedInputStream bis = null;
|
|
|
@ -592,8 +619,8 @@ public class SysTaskPlanController extends CoreBaseController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
LOGGER.error("下载异常",e);
|
|
|
|
LOGGER.error("下载异常", e);
|
|
|
|
throw ImppExceptionBuilder.newInstance().setErrorDetail(e.getMessage()).build();
|
|
|
|
throw ImppExceptionBuilder.newInstance().setErrorDetail(e.getMessage()).build();
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
if (excelFile != null) {
|
|
|
|
if (excelFile != null) {
|
|
|
@ -632,6 +659,9 @@ public class SysTaskPlanController extends CoreBaseController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 刷新全部缓存
|
|
|
|
|
|
|
|
reloadAllTaskPlanCache();
|
|
|
|
|
|
|
|
|
|
|
|
return ResultBean.success("导入成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
return ResultBean.success("导入成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
@ -660,4 +690,18 @@ public class SysTaskPlanController extends CoreBaseController {
|
|
|
|
throw ImppExceptionBuilder.newInstance().setErrorDetail(e.getMessage()).build();
|
|
|
|
throw ImppExceptionBuilder.newInstance().setErrorDetail(e.getMessage()).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void putTaskPlanCache(SysTaskPlan plan){
|
|
|
|
|
|
|
|
String redisKey = CommonConstWords.REDIS_PREFIX_TASK_LOG_LEVEL + ":" + plan.getGroupName() + "." + plan.getName();
|
|
|
|
|
|
|
|
redisRes.putObject(redisKey, plan.getLogLevelVal(), -1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void removeTaskPlanCache(SysTaskPlan plan){
|
|
|
|
|
|
|
|
String redisKey = CommonConstWords.REDIS_PREFIX_TASK_LOG_LEVEL + ":" + plan.getGroupName() + "." + plan.getName();
|
|
|
|
|
|
|
|
redisRes.deleteKey(redisKey);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void reloadAllTaskPlanCache(){
|
|
|
|
|
|
|
|
systemInitService.reloadTaskPlanLogLevel();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|