fix
This commit is contained in:
parent
e77804c269
commit
b78a5c1e15
@ -15,6 +15,7 @@ import com.lz.modules.sys.service.SysUserService;
|
|||||||
import com.lz.modules.sys.service.app.ResultDetailService;
|
import com.lz.modules.sys.service.app.ResultDetailService;
|
||||||
import com.lz.modules.third.service.TaskRespService;
|
import com.lz.modules.third.service.TaskRespService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.shiro.crypto.hash.Sha256Hash;
|
import org.apache.shiro.crypto.hash.Sha256Hash;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@ -67,6 +68,10 @@ public class ThirdTaskController {
|
|||||||
log.info("parse data :" + Arrays.toString(tokens));
|
log.info("parse data :" + Arrays.toString(tokens));
|
||||||
Object object = null;
|
Object object = null;
|
||||||
try {
|
try {
|
||||||
|
if(tokens.length<1){
|
||||||
|
log.info("未输入,空打印");
|
||||||
|
return R.ok(300);
|
||||||
|
}
|
||||||
object = SpringContextUtils.getBean(tokens[0]);
|
object = SpringContextUtils.getBean(tokens[0]);
|
||||||
if (object == null) {
|
if (object == null) {
|
||||||
return R.error("命令不存在。");
|
return R.error("命令不存在。");
|
||||||
|
|||||||
@ -0,0 +1,65 @@
|
|||||||
|
package com.lz.modules.command.base1000;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.lz.common.utils.Constant;
|
||||||
|
import com.lz.common.utils.NumberUtil;
|
||||||
|
import com.lz.common.utils.R;
|
||||||
|
import com.lz.modules.app.utils.t.Tuple;
|
||||||
|
import com.lz.modules.app.utils.t.TwoTuple;
|
||||||
|
import com.lz.modules.command.BaseCommand;
|
||||||
|
import com.lz.modules.command.ICommand;
|
||||||
|
import com.lz.modules.command.annotation.Description;
|
||||||
|
import com.lz.modules.command.annotation.Name;
|
||||||
|
import com.lz.modules.command.annotation.Summary;
|
||||||
|
import com.lz.modules.flow.model.TaskDto;
|
||||||
|
import com.lz.modules.performance.service.ResultTaskService;
|
||||||
|
import com.lz.modules.third.service.TaskRespService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: djc
|
||||||
|
* @Desc: 绩效任务删除命令
|
||||||
|
* @Date: 2021/1/28 16:12
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Name("delete")
|
||||||
|
@Component("delete")
|
||||||
|
@Summary("绩效任务删除 ")
|
||||||
|
@Description(Constant.EXAMPLE +
|
||||||
|
" delete 1.1 "
|
||||||
|
)
|
||||||
|
public class DeleteCommand extends BaseCommand<Tuple> implements ICommand<Tuple>{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ResultTaskService resultTaskService;
|
||||||
|
@Autowired
|
||||||
|
private TaskRespService taskRespService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R process(Tuple tuple) throws Exception {
|
||||||
|
tuple = doTaskParse();
|
||||||
|
TwoTuple<Boolean, String> data = tuple.getData();
|
||||||
|
if (!data.getFirst()) {
|
||||||
|
return R.error(data.getSecond());
|
||||||
|
}
|
||||||
|
if (tokens.length < 2) {
|
||||||
|
return R.error("delete 参数不对,如 delete 1");
|
||||||
|
}
|
||||||
|
TaskDto taskDto = (TaskDto) tuple.getData().getSecond();
|
||||||
|
boolean flag = taskRespService.updateIndex(user, taskDto, "list");
|
||||||
|
if (!flag) {
|
||||||
|
return R.error("请先输入 list 命令");
|
||||||
|
}
|
||||||
|
if(taskDto.getId() == null){
|
||||||
|
return R.error("请输入正确的任务索引 x.x");
|
||||||
|
}
|
||||||
|
log.info(" 删除任务 :" + JSON.toJSONString(taskDto));
|
||||||
|
R r = resultTaskService.deleteTask(taskDto.getId(), user.getUserId());
|
||||||
|
if (NumberUtil.objToIntDefault(r.get("code"), 500) != 200) { //如果返回值不是200
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
return R.ok(250, "删除任务成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user