|
|
|
@ -5,10 +5,13 @@ import cn.estsh.i3plus.core.api.iservice.busi.ITaskTimeService;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.*;
|
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ResultBean;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
@ -49,7 +52,8 @@ public class TaskTimeController {
|
|
|
|
|
ValidatorBean.beginValid(taskTime)
|
|
|
|
|
.notNull("timeId", taskTime.getTimeId())
|
|
|
|
|
.notNull("name", taskTime.getName())
|
|
|
|
|
.notNull("taskDescription", taskTime.getTaskDescription());
|
|
|
|
|
.notNull("timeId",taskTime.getTimeId())
|
|
|
|
|
.notNull("taskMethodTypeId", taskTime.getTaskMethodTypeId());
|
|
|
|
|
|
|
|
|
|
TaskTimeExpression taskTimeExpression = taskTimeExpressionService.getTaskTimeExpressionById(taskTime.getTimeId().toString());
|
|
|
|
|
ValidatorBean.beginValid(taskTimeExpression);
|
|
|
|
@ -58,9 +62,9 @@ public class TaskTimeController {
|
|
|
|
|
taskTime.setRedTimeExpression(taskTimeExpression.getTimeExpression());
|
|
|
|
|
|
|
|
|
|
ConvertBean.modelInitialize(taskTime, AuthUtil.getSessionUser());
|
|
|
|
|
taskTime.setTaskStatus(CommonEnumUtil.DATA_STATUS.ENABLE.getValue());
|
|
|
|
|
|
|
|
|
|
taskTime = taskTimeService.insertTaskTime(taskTime);
|
|
|
|
|
|
|
|
|
|
return ResultBean.success("操作成功")
|
|
|
|
|
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode())
|
|
|
|
|
.setResultObject(taskTime);
|
|
|
|
@ -82,7 +86,7 @@ public class TaskTimeController {
|
|
|
|
|
.notNull("id", taskTime.getId())
|
|
|
|
|
.notNull("timeId", taskTime.getTimeId())
|
|
|
|
|
.notNull("name", taskTime.getName())
|
|
|
|
|
.notNull("taskDescription", taskTime.getTaskDescription());
|
|
|
|
|
.notNull("taskMethodTypeId",taskTime.getTaskMethodTypeId());
|
|
|
|
|
|
|
|
|
|
TaskTimeExpression taskTimeExpression = taskTimeExpressionService.getTaskTimeExpressionById(taskTime.getTimeId().toString());
|
|
|
|
|
|
|
|
|
@ -198,4 +202,52 @@ public class TaskTimeController {
|
|
|
|
|
return ResultBean.fail().setCode(ImppExceptionEnum.SYSTEM_EXCEPTION.getCode());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@DeleteMapping("/batch-delete")
|
|
|
|
|
@ApiOperation(value = "根据id批量删除定时任务",notes = "根据id批量删除定时任务")
|
|
|
|
|
public ResultBean deleteTaskTimeByIds(String[] ids){
|
|
|
|
|
try{
|
|
|
|
|
if(ids.length == 0){
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("请选择需要删除的资源。")
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
taskTimeService.deleteTaskTimeByIds(ids);
|
|
|
|
|
return ResultBean.success("删除成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}catch(ImppBusiException busExcep){
|
|
|
|
|
LOGGER.error(busExcep.getErrorMsg() + ":{}",busExcep.getErrorDetail(),busExcep);
|
|
|
|
|
return ResultBean.fail(busExcep.getErrorShow());
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
LOGGER.error(ImppExceptionEnum.SYSTEM_EXCEPTION.getDescription() + ":{}",e.getMessage(),e);
|
|
|
|
|
return ResultBean.fail().setCode(ImppExceptionEnum.SYSTEM_EXCEPTION.getCode());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PutMapping(value = "/batch-status")
|
|
|
|
|
@ApiOperation(value = "批量修改系统任务状态",notes = "批量修改系统任务状态")
|
|
|
|
|
public ResultBean updateTaskTimeStatusByIds(String[] ids,Integer status){
|
|
|
|
|
try {
|
|
|
|
|
// 数据校验
|
|
|
|
|
if(ids.length == 0){
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("请选择需要删除的资源。")
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
ValidatorBean.checkNotZero(status,"状态不能为空");
|
|
|
|
|
|
|
|
|
|
taskTimeService.updateTaskTimeStatusByIds(ids,status);
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
} catch(ImppBusiException busExcep){
|
|
|
|
|
LOGGER.error(busExcep.getErrorMsg() + ":{}",busExcep.getErrorDetail(),busExcep);
|
|
|
|
|
return ResultBean.fail(busExcep.getErrorShow());
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
LOGGER.error(ImppExceptionEnum.BUSINESS_EXCEPTION_DATA_ERROR.getDescription() + ":{}",e.getMessage(),e);
|
|
|
|
|
return ResultBean.fail().setCode(ImppExceptionEnum.BUSINESS_EXCEPTION_DATA_ERROR.getCode());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|