churf
2023-08-21 bdbce4e615d15f4f8423cc8ac5ee7fc66bb311ef
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/rest/TaskDaliyController.java
@@ -15,12 +15,15 @@
*/
package me.zhengjie.modules.task.rest;
import cn.hutool.core.date.DateTime;
import me.zhengjie.annotation.Log;
import me.zhengjie.modules.task.domain.TaskDaliy;
import me.zhengjie.modules.task.domain.TaskDaliyMongo;
import me.zhengjie.modules.task.service.TaskDaliyService;
import me.zhengjie.modules.task.service.dto.TaskDaliyQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -28,6 +31,8 @@
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.Date;
import javax.servlet.http.HttpServletResponse;
/**
@@ -48,7 +53,7 @@
    @GetMapping(value = "/download")
    @PreAuthorize("@el.check('taskDaliy:download')")
    public void exportTaskDaliy(HttpServletResponse response, TaskDaliyQueryCriteria criteria) throws IOException {
        taskDaliyService.download(taskDaliyService.queryAll(criteria), response);
        //taskDaliyService.download(taskDaliyService.queryAll(criteria), response);
    }
    @GetMapping
@@ -57,6 +62,15 @@
    @PreAuthorize("@el.check('taskDaliy:list')")
    public ResponseEntity<Object> queryTaskDaliy(TaskDaliyQueryCriteria criteria, Pageable pageable){
        return new ResponseEntity<>(taskDaliyService.queryAll(criteria,pageable),HttpStatus.OK);
    }
    @GetMapping(value= "/withHours")
    @Log("查询任务日报")
    @ApiOperation("查询任务日报")
    @PreAuthorize("@el.check('taskDaliy:list')")
    public ResponseEntity<Object> queryTaskDaliyWithTaskUser(TaskDaliyQueryCriteria criteria, Pageable pageable){
        //return new ResponseEntity<>(taskDaliyService.queryAllWithTaskUser(criteria,pageable),HttpStatus.OK);
        return null;
    }
    @GetMapping(value = "/all")
@@ -71,7 +85,7 @@
    @Log("新增任务日报")
    @ApiOperation("新增任务日报")
    @PreAuthorize("@el.check('taskDaliy:add')")
    public ResponseEntity<Object> createTaskDaliy(@Validated @RequestBody TaskDaliy resources){
    public ResponseEntity<Object> createTaskDaliy(@Validated @RequestBody TaskDaliyMongo resources){
        return new ResponseEntity<>(taskDaliyService.create(resources),HttpStatus.CREATED);
    }
@@ -79,7 +93,7 @@
    @Log("修改任务日报")
    @ApiOperation("修改任务日报")
    @PreAuthorize("@el.check('taskDaliy:edit')")
    public ResponseEntity<Object> updateTaskDaliy(@Validated @RequestBody TaskDaliy resources){
    public ResponseEntity<Object> updateTaskDaliy(@Validated @RequestBody TaskDaliyMongo resources){
        taskDaliyService.update(resources);
        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
    }
@@ -88,7 +102,7 @@
    @Log("删除任务日报")
    @ApiOperation("删除任务日报")
    @PreAuthorize("@el.check('taskDaliy:del')")
    public ResponseEntity<Object> deleteTaskDaliy(@RequestBody Long[] ids) {
    public ResponseEntity<Object> deleteTaskDaliy(@RequestBody String[] ids) {
        taskDaliyService.deleteAll(ids);
        return new ResponseEntity<>(HttpStatus.OK);
    }
@@ -98,14 +112,22 @@
    @ApiOperation("查询某月已完成工时")
    @PreAuthorize("@el.check('taskDaliy:list')")
    public ResponseEntity<Object> queryCompletedWork(TaskDaliyQueryCriteria criteria){
        return new ResponseEntity<>(taskDaliyService.queryCompletedWork(criteria),HttpStatus.OK);
        return new ResponseEntity<>(taskDaliyService.queryCompletedWork(criteria, false),HttpStatus.OK);
    }
    @GetMapping(value = "/complianceWork")
    @Log("查询某月已达标工时")
    @ApiOperation("查询某月已达标工时")
    @GetMapping(value = "/taskTotalConsumedHours")
    @Log("查询任务的总消耗工时")
    @ApiOperation("查询任务的总消耗工时")
    @PreAuthorize("@el.check('taskDaliy:list')")
    public ResponseEntity<Object> queryComplianceWork(TaskDaliyQueryCriteria criteria){
        return new ResponseEntity<>(taskDaliyService.queryComplianceWork(criteria),HttpStatus.OK);
    public ResponseEntity<Object> queryTaskTotalConsumedHours(TaskDaliyQueryCriteria criteria){
        return new ResponseEntity<>(taskDaliyService.queryTaskTotalConsumedHours(criteria),HttpStatus.OK);
    }
    @GetMapping(value = "/getDetail")
    @Log("查询任务的总消耗工时")
    @ApiOperation("获取任务日报的相关信息")
    @PreAuthorize("@el.check('taskDaliy:list')")
    public ResponseEntity<Object> getDailyDetail(String taskUserId, String fillDate){
        return new ResponseEntity<>(taskDaliyService.getDailyDetail(taskUserId,fillDate),HttpStatus.OK);
    }
}