package com.gkhy.safePlatform.account.controller; import com.alibaba.fastjson.JSONObject; import com.gkhy.safePlatform.account.entity.schedule.BreakTimeGroupInfo; import com.gkhy.safePlatform.account.entity.schedule.BreakTimeRuleInfo; import com.gkhy.safePlatform.account.entity.schedule.ScheduleAllYearDateInfo; import com.gkhy.safePlatform.account.model.dto.req.BreakTimeGroupReqDTO; import com.gkhy.safePlatform.account.model.dto.req.BreakTimeRuleReqDTO; import com.gkhy.safePlatform.account.model.dto.req.DeleteDTO; import com.gkhy.safePlatform.account.model.dto.req.ScheduleAllYearDateReqDTO; import com.gkhy.safePlatform.account.model.dto.resp.BreakTimeGroupRespDTO; import com.gkhy.safePlatform.account.model.dto.resp.BreakTimeRuleRespDTO; import com.gkhy.safePlatform.account.service.BreakTimeService; 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("/breakTime") public class BreakTimeController { @Autowired private BreakTimeService breakTimeService; //休息规则 /** * 新增休息规则 */ @RequestMapping(value = "/addBreakTimeRule",method = RequestMethod.POST) public ResultVO addBreakTimeRule(Authentication authentication, @Validated @RequestBody BreakTimeRuleReqDTO breakTimeRuleReqDTO){ ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); return breakTimeService.addBreakTimeRule(currentUser,breakTimeRuleReqDTO); } /** * 修改休息规则 */ @RequestMapping(value = "/updateBreakTimeRule",method = RequestMethod.POST) public ResultVO updateBreakTimeRule(Authentication authentication, @Validated @RequestBody BreakTimeRuleReqDTO breakTimeRuleReqDTO){ ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); return breakTimeService.updateBreakTimeRule(currentUser,breakTimeRuleReqDTO); } /** * 删除休息规则 */ @RequestMapping(value = "/deleteBreakTimeRule",method = RequestMethod.POST) public ResultVO deleteBreakTimeRule( @RequestBody JSONObject json){ Long id = json.getLong("id"); return breakTimeService.deleteBreakTimeRule(id); } /** * 批量删除休息规则 */ @RequestMapping(value = "/deleteBatchBreakTimeRule",method = RequestMethod.POST) public ResultVO deleteBatchBreakTimeRule( @RequestBody DeleteDTO deleteDTO){ return breakTimeService.deleteBatchBreakTimeRule(deleteDTO); } /** * 查询所有的休息规则 */ @RequestMapping(value = "/getAllBreakTimeRule",method = RequestMethod.GET) public ResultVO getAllBreakTimeRule( BreakTimeRuleReqDTO breakTimeRuleReqDTO){ return breakTimeService.getAllBreakTimeRule(breakTimeRuleReqDTO); } /** * 分页查询 */ @RequestMapping(value = "/getAllBreakTimeRuleByPage",method = RequestMethod.POST) public SearchResultVO> getAllBreakTimeRuleByPage(@RequestBody PageQuery pageQuery){ return breakTimeService.getAllBreakTimeRuleByPage(pageQuery); } /** * 根据id查询数据 */ @RequestMapping(value = "/getBreakTimeRuleById",method = RequestMethod.GET) public ResultVO getBreakTimeRuleById(@RequestBody JSONObject json){ Long id = json.getLong("id"); return breakTimeService.getBreakTimeRuleById(id); } /***************************************休息时间组*******************************/ /** * 新增休息组 */ @RequestMapping(value = "/addBreakTimeGroup",method = RequestMethod.POST) public ResultVO addBreakTimeGroup(Authentication authentication, @Validated @RequestBody BreakTimeGroupReqDTO breakTimeRuleReqDTO){ ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); return breakTimeService.addBreakTimeGroup(currentUser,breakTimeRuleReqDTO); } /** * 修改休息时间组 */ @RequestMapping(value = "/updateBreakTimeGroup",method = RequestMethod.POST) public ResultVO updateBreakTimeGroup(Authentication authentication, @Validated @RequestBody BreakTimeGroupReqDTO breakTimeGroupReqDTO){ ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); return breakTimeService.updateBreakTimeGroup(currentUser,breakTimeGroupReqDTO); } /** * 删除休息时间组 */ @RequestMapping(value = "/deleteBreakTimeGroup",method = RequestMethod.POST) public ResultVO deleteBreakTimeGroup(@RequestBody JSONObject json){ Long id = json.getLong("id"); return breakTimeService.deleteBreakTimeGroup(id); } /** * 批量删除休息时间组 */ @RequestMapping(value = "/deleteBatchBreakTimeGroup",method = RequestMethod.POST) public ResultVO deleteBatchBreakTimeGroup(@RequestBody DeleteDTO deleteDTO){ return breakTimeService.deleteBatchBreakTimeGroup(deleteDTO); } /** * 查询所有的休息时间组 */ @RequestMapping(value = "/getAllBreakTimeGroup",method = RequestMethod.GET) public ResultVO getAllBreakTimeGroup(BreakTimeGroupReqDTO breakTimeGroupReqDTO){ return breakTimeService.getAllBreakTimeGroup(breakTimeGroupReqDTO); } /** * 休息时间组分页查询 */ @RequestMapping(value = "/getAllBreakTimeGroupByPage",method = RequestMethod.POST) public SearchResultVO> getAllBreakTimeGroupByPage(@RequestBody PageQuery pageQuery){ return breakTimeService.getAllBreakTimeGroupByPage(pageQuery); } /** * 根据id查询休息时间组 */ @RequestMapping(value = "/getBreakTimeGroupById",method = RequestMethod.GET) public ResultVO getBreakTimeGroupById(@RequestBody JSONObject json){ Long id = json.getLong("id"); return breakTimeService.getBreakTimeGroupById(id); } /** * 标注法定节假日 */ @RequestMapping("/updateScheduleAllYearDate") public ResultVO updateScheduleAllYearDate(@RequestBody ScheduleAllYearDateReqDTO scheduleAllYearDateReqDTO){ return breakTimeService.updateScheduleAllYearDate(scheduleAllYearDateReqDTO); } }