郑永安
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
package com.gkhy.safePlatform.account.controller;
 
import com.alibaba.fastjson.JSONObject;
import com.gkhy.safePlatform.account.entity.schedule.WorkTimeGroupAndPeriodRelationInfo;
import com.gkhy.safePlatform.account.entity.schedule.WorkTimeGroupInfo;
import com.gkhy.safePlatform.account.entity.schedule.WorkTimePeriodInfo;
import com.gkhy.safePlatform.account.model.dto.req.DeleteDTO;
import com.gkhy.safePlatform.account.model.dto.req.WorkTimeGroupReqDTO;
import com.gkhy.safePlatform.account.model.dto.req.WorkTimePeriodReqDTO;
import com.gkhy.safePlatform.account.model.dto.resp.WorkTimeGroupRespDTO;
import com.gkhy.safePlatform.account.model.dto.resp.WorkTimePeriodRespDTO;
import com.gkhy.safePlatform.account.service.WorkTimeService;
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.List;
 
@RestController
@RequestMapping("/workTime")
public class WorkTimeController {
    @Autowired
    private WorkTimeService workTimeService;
 
    /**
     * 新增时间组,可选取时间段,如果没有想要的时间段,可以自定义
     */
 
    /**
     * 新增工作时间组
     */
    @RequestMapping(value = "/addWorkTimeGroup",method = RequestMethod.POST)
    public ResultVO<WorkTimeGroupInfo> addWorkTimeGroup(Authentication authentication,@Validated @RequestBody  WorkTimeGroupReqDTO workTimeGroupReqDTO){
        ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
        return workTimeService.addWorkTimeGroup(currentUser,workTimeGroupReqDTO);
    }
 
    /**
     * 修改工作时间组
     */
    @RequestMapping(value = "/updateWorkTimeGroup",method = RequestMethod.POST)
    public ResultVO<WorkTimeGroupInfo> updateWorkTimeGroup(Authentication authentication,@Validated @RequestBody WorkTimeGroupReqDTO workTimeGroupReqDTO){
        ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
        return workTimeService.updateWorkTimeGroup(currentUser,workTimeGroupReqDTO);
    }
 
    /**
     * 逻辑删除工作时间组
     */
    @RequestMapping(value = "/deleteWorkTimeGroup",method = RequestMethod.POST)
    public ResultVO<WorkTimeGroupInfo> deletWorkTimeGroup(@RequestBody JSONObject json){
        Long id = json.getLong("id");
        return workTimeService.deleteWorkTimeGroupById(id);
    }
    /**
     * 批量删除工作时间组
     */
    @RequestMapping(value = "/deletBatchWorkTimeGroup",method = RequestMethod.POST)
    public ResultVO<WorkTimeGroupInfo> deletBatchWorkTimeGroup(@RequestBody DeleteDTO deleteDTO){
        return workTimeService.deletBatchWorkTimeGroup(deleteDTO);
    }
    /**
     * 查询时间工作组
     */
    @RequestMapping(value = "/getWorkTimeGroup",method = RequestMethod.GET)
    public  ResultVO<WorkTimeGroupInfo> getWorkTimeGroup(WorkTimeGroupReqDTO workTimeGroupReqDTO){
        return workTimeService.getWorkTimeGroup(workTimeGroupReqDTO);
    }
 
    /**
     * 查询时间工作组
     */
    @RequestMapping(value = "/getWorkTimeGroupByPage",method = RequestMethod.POST)
    public SearchResultVO<List<WorkTimeGroupRespDTO>> getWorkTimeGroupByPage(@RequestBody PageQuery<WorkTimeGroupReqDTO> query){
        return workTimeService.getWorkTimeGroupByPage(query);
    }
    /**
     * 根据id查询工作时间组信息
     */
    @RequestMapping(value = "/getWorkTimeGroupById",method = RequestMethod.GET)
    public  ResultVO<WorkTimeGroupInfo> getWorkTimeGroup(@RequestBody JSONObject json){
        Long id = json.getLong("id");
        return workTimeService.getWorkTimeGroupById(id);
    }
 
    /************************时间段***********************************************/
 
    /**
     * 新增工作时间段
     */
    @RequestMapping(value = "/addWorkTimePeriod",method = RequestMethod.POST)
    public ResultVO<WorkTimePeriodInfo> addWorkTimePeriod(Authentication authentication,@Validated @RequestBody WorkTimePeriodReqDTO workTimePeriodReqDTO){
        ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
        return workTimeService.addWorkTimePeriod(currentUser,workTimePeriodReqDTO);
    }
 
    /**
     * 修改工作时间段
     */
    @RequestMapping(value = "/updateWorkTimePeriod",method = RequestMethod.POST)
    public ResultVO<WorkTimePeriodInfo> updateWorkTimePeriod(Authentication authentication,@Validated @RequestBody WorkTimePeriodReqDTO workTimePeriodReqDTO){
        ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
        return workTimeService.updateWorkTimePeriod(currentUser,workTimePeriodReqDTO);
    }
 
    /**
     * 逻辑删除工作时间段
     */
    @RequestMapping(value = "/deletWorkTimePeriod",method = RequestMethod.POST)
    public ResultVO<WorkTimePeriodInfo> deteleWorkTimePeriod(@RequestBody JSONObject json){
        Long id = json.getLong("id");
        return workTimeService.deleteWorkTimePeriod(id);
    }
    /**
     * 逻辑删除工作时间段
     */
    @RequestMapping(value = "/deleteBatchWorkTimePeriod",method = RequestMethod.POST)
    public ResultVO<WorkTimePeriodInfo> deleteBatchWorkTimePeriod(@RequestBody DeleteDTO deleteDTO){
 
        return workTimeService.deleteBatchWorkTimePeriod(deleteDTO);
    }
    /**
     * 查询工作时间段信息
     */
    @RequestMapping(value = "/getWorkTimePeriod",method = RequestMethod.GET)
    public ResultVO<WorkTimePeriodRespDTO> getWorkTimePeriod(WorkTimePeriodReqDTO workTimePeriodReqDTO){
        return workTimeService.getWorkTimePeriod(workTimePeriodReqDTO);
    }
    /**
     * 根据id查询工作时间段信息
     */
    @RequestMapping(value = "/getWorkTimePeriodById",method = RequestMethod.GET)
    public ResultVO<WorkTimePeriodRespDTO> getWorkTimePeriodById( @RequestBody JSONObject json){
        Long id = json.getLong("id");
        return workTimeService.getWorkTimePeriodById(id);
    }
    /**
     *  分页查询
     */
    @RequestMapping(value = "/getWorkTimePeriodByPage",method = RequestMethod.POST)
    public ResultVO<List<WorkTimePeriodRespDTO>> getWorkTimePeriodByPage(@RequestBody PageQuery<WorkTimePeriodReqDTO> pageQuery){
        return workTimeService.getWorkTimePeriodByPage(pageQuery);
    }
 
    /**
     * 物理删除
     * 删除工作时间组和时间段关系
     */
 
    @RequestMapping(value = "/deleteWtgaprById",method = RequestMethod.POST)
    public  ResultVO<WorkTimeGroupAndPeriodRelationInfo> deleteWorkTimeGroupAndPeriodRelationById(@RequestBody JSONObject json){
        Long id = json.getLong("id");
        return workTimeService.deleteWorkTimeGroupAndPeriodRelationById(id);
    }
 
 
}