| | |
| | | */ |
| | | 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; |
| | |
| | | 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; |
| | | |
| | | /** |
| | |
| | | @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 |
| | |
| | | @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") |
| | |
| | | @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); |
| | | } |
| | | |
| | |
| | | @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); |
| | | } |
| | |
| | | @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); |
| | | } |
| | |
| | | @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); |
| | | } |
| | | } |