|  |  |  | 
|---|
|  |  |  | import com.zy.acs.manager.common.utils.BusinessSortService; | 
|---|
|  |  |  | import com.zy.acs.manager.common.utils.ExcelUtil; | 
|---|
|  |  |  | import com.zy.acs.manager.manager.entity.Task; | 
|---|
|  |  |  | import com.zy.acs.manager.manager.enums.TaskStsType; | 
|---|
|  |  |  | import com.zy.acs.manager.manager.service.TaskService; | 
|---|
|  |  |  | import com.zy.acs.manager.system.controller.BaseController; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | 
|---|
|  |  |  | public R page(@RequestBody Map<String, Object> map) { | 
|---|
|  |  |  | BaseParam baseParam = buildParam(map, BaseParam.class); | 
|---|
|  |  |  | PageParam<Task, BaseParam> pageParam = new PageParam<>(baseParam, Task.class); | 
|---|
|  |  |  | QueryWrapper<Task> wrapper = pageParam.buildWrapper(true); | 
|---|
|  |  |  | QueryWrapper<Task> wrapper = pageParam.buildWrapper(true, "io_time"); | 
|---|
|  |  |  | if (hasCreateTimeDesc(pageParam.getOrders())) { | 
|---|
|  |  |  | wrapper.last(businessSortService.getOrderBySql(TaskStsType.class, "task_sts")); | 
|---|
|  |  |  | //            wrapper.last(businessSortService.getOrderBySql(TaskStsType.class, "task_sts")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok().add(taskService.page(pageParam, wrapper)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | ExcelUtil.build(ExcelUtil.create(taskService.list(), Task.class), response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('manager:task:update')") | 
|---|
|  |  |  | @OperationLog("Complete Task") | 
|---|
|  |  |  | @GetMapping("/task/complete/{id}") | 
|---|
|  |  |  | public R complete(@PathVariable Long id) { | 
|---|
|  |  |  | return taskService.complete(id, getLoginUserId()) ? R.ok("Complete Success") : R.error("Complete Fail"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('manager:task:update')") | 
|---|
|  |  |  | @OperationLog("Cancel Task") | 
|---|
|  |  |  | @GetMapping("/task/cancel/{id}") | 
|---|
|  |  |  | public R cancel(@PathVariable Long id) { | 
|---|
|  |  |  | return taskService.cancel(id, getLoginUserId()) ? R.ok("Cancel Success") : R.error("Cancel Fail"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|