|
|
@ -8,6 +8,7 @@ import cn.estsh.i3plus.icloud.andon.sdk.IAndonScheduleJobCloud;
|
|
|
|
import cn.estsh.i3plus.icloud.mes.pcn.sdk.IMesPcnScheduleJobCloud;
|
|
|
|
import cn.estsh.i3plus.icloud.mes.pcn.sdk.IMesPcnScheduleJobCloud;
|
|
|
|
import cn.estsh.i3plus.icloud.mes.sdk.IMesScheduleJobCloud;
|
|
|
|
import cn.estsh.i3plus.icloud.mes.sdk.IMesScheduleJobCloud;
|
|
|
|
import cn.estsh.i3plus.icloud.ptl.sdk.IPtlScheduleJobCloud;
|
|
|
|
import cn.estsh.i3plus.icloud.ptl.sdk.IPtlScheduleJobCloud;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.icloud.screen.sdk.IScreenScheduleJobCloud;
|
|
|
|
import cn.estsh.i3plus.icloud.softswitch.sdk.IBsScheduleJobCloud;
|
|
|
|
import cn.estsh.i3plus.icloud.softswitch.sdk.IBsScheduleJobCloud;
|
|
|
|
import cn.estsh.i3plus.icloud.wms.sdk.IWmsScheduleJobCloud;
|
|
|
|
import cn.estsh.i3plus.icloud.wms.sdk.IWmsScheduleJobCloud;
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
@ -40,13 +41,25 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
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.BufferedInputStream;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import java.io.OutputStream;
|
|
|
|
import java.net.URLEncoder;
|
|
|
|
import java.net.URLEncoder;
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
@ -82,7 +95,7 @@ public class SysTaskPlanController extends CoreBaseController {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private ISystemInitService systemInitService;
|
|
|
|
private ISystemInitService systemInitService;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource(name= CommonConstWords.IMPP_REDIS_RES)
|
|
|
|
@Resource(name = CommonConstWords.IMPP_REDIS_RES)
|
|
|
|
private ImppRedis redisRes;
|
|
|
|
private ImppRedis redisRes;
|
|
|
|
|
|
|
|
|
|
|
|
/************ 微服定时任务 *********/
|
|
|
|
/************ 微服定时任务 *********/
|
|
|
@ -107,6 +120,9 @@ public class SysTaskPlanController extends CoreBaseController {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private IPtlScheduleJobCloud ptlScheduleJobCloud;
|
|
|
|
private IPtlScheduleJobCloud ptlScheduleJobCloud;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private IScreenScheduleJobCloud screenScheduleJobCloud;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 根据来源切换定时任务服务
|
|
|
|
* 根据来源切换定时任务服务
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -137,6 +153,8 @@ public class SysTaskPlanController extends CoreBaseController {
|
|
|
|
// Ptl
|
|
|
|
// Ptl
|
|
|
|
} else if (source == CommonEnumUtil.SOFT_TYPE.PTL.getValue()) {
|
|
|
|
} else if (source == CommonEnumUtil.SOFT_TYPE.PTL.getValue()) {
|
|
|
|
quartzJobService = ptlScheduleJobCloud;
|
|
|
|
quartzJobService = ptlScheduleJobCloud;
|
|
|
|
|
|
|
|
} else if (source == CommonEnumUtil.SOFT_TYPE.SCREEN.getValue()) {
|
|
|
|
|
|
|
|
quartzJobService = screenScheduleJobCloud;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return quartzJobService;
|
|
|
|
return quartzJobService;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -551,8 +569,8 @@ public class SysTaskPlanController extends CoreBaseController {
|
|
|
|
|
|
|
|
|
|
|
|
// 判断是否失败如果失败进行补偿新增,避免出现勿删的情况
|
|
|
|
// 判断是否失败如果失败进行补偿新增,避免出现勿删的情况
|
|
|
|
if (!baseResultBean.isSuccess()) {
|
|
|
|
if (!baseResultBean.isSuccess()) {
|
|
|
|
LOGGER.error("重载任务计划name:{} group:{} 失败: {}",sysTaskPlan.getName()
|
|
|
|
LOGGER.error("重载任务计划name:{} group:{} 失败: {}", sysTaskPlan.getName()
|
|
|
|
,sysTaskPlan.getGroupName(),baseResultBean.getErrorMsg());
|
|
|
|
, sysTaskPlan.getGroupName(), baseResultBean.getErrorMsg());
|
|
|
|
|
|
|
|
|
|
|
|
getJobService(sysTaskPlan.getTaskSoftTypeRdd())
|
|
|
|
getJobService(sysTaskPlan.getTaskSoftTypeRdd())
|
|
|
|
.addTask(sysTask.getTaskPackage(), sysTask.getTaskClass(), sysTaskPlan.getName()
|
|
|
|
.addTask(sysTask.getTaskPackage(), sysTask.getTaskClass(), sysTaskPlan.getName()
|
|
|
@ -579,7 +597,7 @@ public class SysTaskPlanController extends CoreBaseController {
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/export")
|
|
|
|
@GetMapping(value = "/export")
|
|
|
|
@ApiOperation(value = "导出数据")
|
|
|
|
@ApiOperation(value = "导出数据")
|
|
|
|
public void exportExcel(SysTaskPlan sysTaskPlan,HttpServletResponse response) {
|
|
|
|
public void exportExcel(SysTaskPlan sysTaskPlan, HttpServletResponse response) {
|
|
|
|
File excelFile = null;
|
|
|
|
File excelFile = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Map<String, String> colMap = ExcelTool.getColName(SysTaskPlan.class);
|
|
|
|
Map<String, String> colMap = ExcelTool.getColName(SysTaskPlan.class);
|
|
|
@ -657,7 +675,7 @@ public class SysTaskPlanController extends CoreBaseController {
|
|
|
|
|
|
|
|
|
|
|
|
ConvertBean.modelInitialize(sysTaskPlan, AuthUtil.getSessionUser());
|
|
|
|
ConvertBean.modelInitialize(sysTaskPlan, AuthUtil.getSessionUser());
|
|
|
|
|
|
|
|
|
|
|
|
ResultBean resultBean = insertSysTaskTime(sysTaskPlan,CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
|
|
|
|
ResultBean resultBean = insertSysTaskTime(sysTaskPlan, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
|
|
|
|
if (!resultBean.isSuccess()) {
|
|
|
|
if (!resultBean.isSuccess()) {
|
|
|
|
return resultBean;
|
|
|
|
return resultBean;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -690,22 +708,22 @@ public class SysTaskPlanController extends CoreBaseController {
|
|
|
|
response.getOutputStream().write(excelTool.importTemplate(SysTaskPlan.class));
|
|
|
|
response.getOutputStream().write(excelTool.importTemplate(SysTaskPlan.class));
|
|
|
|
response.getOutputStream().flush();
|
|
|
|
response.getOutputStream().flush();
|
|
|
|
} 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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void putTaskPlanCache(SysTaskPlan plan){
|
|
|
|
private void putTaskPlanCache(SysTaskPlan plan) {
|
|
|
|
String redisKey = CommonConstWords.REDIS_PREFIX_TASK_LOG_LEVEL + ":" + plan.getName() + "." + plan.getGroupName();
|
|
|
|
String redisKey = CommonConstWords.REDIS_PREFIX_TASK_LOG_LEVEL + ":" + plan.getName() + "." + plan.getGroupName();
|
|
|
|
redisRes.putObject(redisKey, plan.getLogLevelVal(), -1);
|
|
|
|
redisRes.putObject(redisKey, plan.getLogLevelVal(), -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void removeTaskPlanCache(SysTaskPlan plan){
|
|
|
|
private void removeTaskPlanCache(SysTaskPlan plan) {
|
|
|
|
String redisKey = CommonConstWords.REDIS_PREFIX_TASK_LOG_LEVEL + ":" + plan.getName() + "." + plan.getGroupName();
|
|
|
|
String redisKey = CommonConstWords.REDIS_PREFIX_TASK_LOG_LEVEL + ":" + plan.getName() + "." + plan.getGroupName();
|
|
|
|
redisRes.deleteKey(redisKey);
|
|
|
|
redisRes.deleteKey(redisKey);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void reloadAllTaskPlanCache(){
|
|
|
|
private void reloadAllTaskPlanCache() {
|
|
|
|
systemInitService.reloadTaskPlanLogLevel();
|
|
|
|
systemInitService.reloadTaskPlanLogLevel();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|