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);
|
}
|
|
|
}
|