郑永安
2023-06-19 7a6abd05683528032687c75e80e0bd2030a3e46c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package com.gkhy.safePlatform.specialWork.controller;
 
import com.alibaba.fastjson.JSONObject;
import com.gkhy.safePlatform.commons.co.ContextCacheUser;
import com.gkhy.safePlatform.commons.query.PageQuery;
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.commons.vo.SearchResultVO;
import com.gkhy.safePlatform.specialWork.model.dto.req.ApprovalRuleItemMeasureAddReqDTO;
import com.gkhy.safePlatform.specialWork.model.dto.req.DeleteForm;
import com.gkhy.safePlatform.specialWork.model.dto.req.SpecialWorkAppointmentAddReqDTO;
import com.gkhy.safePlatform.specialWork.model.dto.req.SpecialWorkAppointmentModReqDTO;
import com.gkhy.safePlatform.specialWork.model.dto.resp.SpecialWorkAppointmentRespDTO;
import com.gkhy.safePlatform.specialWork.model.dto.resp.WorkStatisticsRespDTO;
import com.gkhy.safePlatform.specialWork.model.query.SpecialWorkAppointmentQuery;
import com.gkhy.safePlatform.specialWork.service.SpecialWorkAppointmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.Authentication;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * (SpecialWorkAppointment)表控制层
 *
 * @author makejava
 * @since 2022-09-09 10:33:45
 */
@RestController
@RequestMapping("/specialWork/appointment")
public class SpecialWorkAppointmentController {
 
    @Autowired
    private SpecialWorkAppointmentService specialWorkAppointmentService;
 
    @RequestMapping(value = "/save",method = RequestMethod.POST)
    public ResultVO save(Authentication authentication, @Validated @RequestBody SpecialWorkAppointmentAddReqDTO addReqDTO){
        ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
        return  specialWorkAppointmentService.save(currentUser, addReqDTO);
    }
    @RequestMapping(value = "/update",method = RequestMethod.POST)
    public ResultVO save(Authentication authentication, @Validated @RequestBody SpecialWorkAppointmentModReqDTO modReqDTO){
        ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
        return  specialWorkAppointmentService.update(currentUser, modReqDTO);
    }
    @RequestMapping(value = "/delete",method = RequestMethod.POST)
    public ResultVO save(Authentication authentication, @Validated @RequestBody JSONObject jsonObject){
        Long id = jsonObject.getLong("id");
        ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
        return  specialWorkAppointmentService.deleteOne(currentUser, id);
    }
    @RequestMapping(value = "/batchDelete",method = RequestMethod.POST)
    public ResultVO batchDelete(Authentication authentication, @Validated @RequestBody DeleteForm deleteForm){
        ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
        return  specialWorkAppointmentService.batchDelete(currentUser, deleteForm);
    }
    @RequestMapping(value = "/queryById",method = RequestMethod.POST)
    public ResultVO queryById(Authentication authentication, @Validated @RequestBody JSONObject jsonObject){
        Long id = jsonObject.getLong("id");
        ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
        return  specialWorkAppointmentService.queryById(currentUser, id);
    }
    @RequestMapping(value = "/listAll",method = RequestMethod.POST)
    public SearchResultVO<List<SpecialWorkAppointmentRespDTO>> listAll(Authentication authentication, @RequestBody PageQuery<SpecialWorkAppointmentQuery> pageQuery){
        ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
        return  specialWorkAppointmentService.listAll(currentUser, pageQuery);
    }
    @RequestMapping(value = "/listByDep",method = RequestMethod.POST)
    public SearchResultVO<List<SpecialWorkAppointmentRespDTO>> listByDep(Authentication authentication, @RequestBody PageQuery<SpecialWorkAppointmentQuery> pageQuery){
        ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
        return  specialWorkAppointmentService.listByDep(currentUser, pageQuery);
    }
    @RequestMapping(value = "/statistics",method = RequestMethod.POST)
    public ResultVO<List<WorkStatisticsRespDTO>> statisticsAppointment(Authentication authentication, @RequestBody SpecialWorkAppointmentQuery query){
        ContextCacheUser contextCacheUser = (ContextCacheUser) authentication.getPrincipal();
        return specialWorkAppointmentService.statisticsAppointment(query);
    }
}