49 lines
1.6 KiB
Java
49 lines
1.6 KiB
Java
|
|
package com.mini.capi.biz;
|
||
|
|
|
||
|
|
import com.mini.capi.biz.domain.BizSubTask;
|
||
|
|
import com.mini.capi.biz.service.BizSubTaskService;
|
||
|
|
import com.mini.capi.model.info.TodoHandleDTO;
|
||
|
|
import jakarta.annotation.Resource;
|
||
|
|
import org.springframework.http.ResponseEntity;
|
||
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
||
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
||
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||
|
|
import org.springframework.web.bind.annotation.RestController;
|
||
|
|
|
||
|
|
import java.time.LocalDateTime;
|
||
|
|
|
||
|
|
@RestController
|
||
|
|
@RequestMapping("/biz")
|
||
|
|
public class workController {
|
||
|
|
|
||
|
|
|
||
|
|
@Resource
|
||
|
|
private BizSubTaskService bizSubTaskService;
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 完成待办
|
||
|
|
*
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@PostMapping("/finishTodoSub")
|
||
|
|
public ResponseEntity<Void> finishTodoSub(@RequestBody TodoHandleDTO handleDTO) {
|
||
|
|
// 验证参数
|
||
|
|
if (handleDTO.getTaskId() == null || handleDTO.getOpinion() == null || handleDTO.getOpinion().trim().isEmpty()) {
|
||
|
|
return ResponseEntity.badRequest().build();
|
||
|
|
}
|
||
|
|
try {
|
||
|
|
// 调用服务层处理任务
|
||
|
|
BizSubTask bizSubTask = bizSubTaskService.getById(handleDTO.getTaskId());
|
||
|
|
bizSubTask.setUstatus("CPT");
|
||
|
|
bizSubTask.setFinishTime(LocalDateTime.now());
|
||
|
|
bizSubTask.setRemark(handleDTO.getOpinion());
|
||
|
|
bizSubTaskService.updateById(bizSubTask);
|
||
|
|
return ResponseEntity.ok().build();
|
||
|
|
} catch (Exception e) {
|
||
|
|
// 处理异常(如任务不存在、数据库错误等)
|
||
|
|
return ResponseEntity.status(500).build();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|