|
|
@ -22,6 +22,7 @@ import com.github.pagehelper.PageHelper;
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
import com.github.pagehelper.util.StringUtil;
|
|
|
|
import com.github.pagehelper.util.StringUtil;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
|
import org.springframework.scheduling.support.CronSequenceGenerator;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
|
@ -54,6 +55,23 @@ public class TaskSqlManagerImpl implements TaskSqlManager {
|
|
|
|
return response;
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ("Cron".equals(request.getTaskType())) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
new CronSequenceGenerator(request.getTypeValue());
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
response.addError(ErrorType.BUSINESS_ERROR, "Cron表达式错误!");
|
|
|
|
|
|
|
|
return response;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
String typeValue = request.getTypeValue();
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
Integer.parseInt(typeValue);
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
response.addError(ErrorType.BUSINESS_ERROR, "循环周期值错误!");
|
|
|
|
|
|
|
|
return response;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
long id = IDgenerator.nextId();
|
|
|
|
long id = IDgenerator.nextId();
|
|
|
|
TaskSql entity = MapperUtil.map(request, TaskSql.class);
|
|
|
|
TaskSql entity = MapperUtil.map(request, TaskSql.class);
|
|
|
|
entity.setId(id);
|
|
|
|
entity.setId(id);
|
|
|
@ -108,6 +126,23 @@ public class TaskSqlManagerImpl implements TaskSqlManager {
|
|
|
|
return response;
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ("Cron".equals(request.getTaskType())) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
new CronSequenceGenerator(request.getTypeValue());
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
response.addError(ErrorType.BUSINESS_ERROR, "Cron表达式错误!");
|
|
|
|
|
|
|
|
return response;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
String typeValue = request.getTypeValue();
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
Integer.parseInt(typeValue);
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
response.addError(ErrorType.BUSINESS_ERROR, "循环周期值错误!");
|
|
|
|
|
|
|
|
return response;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
long result = taskSqlMapper.update(request, token);
|
|
|
|
long result = taskSqlMapper.update(request, token);
|
|
|
|
if (1L != result) {
|
|
|
|
if (1L != result) {
|
|
|
|
response.addError(ErrorType.BUSINESS_ERROR, Message.UPDATE_FAILURE);
|
|
|
|
response.addError(ErrorType.BUSINESS_ERROR, Message.UPDATE_FAILURE);
|
|
|
|