package com.gkhy.safePlatform.account.controller;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
import com.gkhy.safePlatform.account.model.annotation.CommonLogEnable;
|
import com.gkhy.safePlatform.account.model.dto.req.GroupAddDTO;
|
import com.gkhy.safePlatform.account.model.dto.req.GroupModDTO;
|
import com.gkhy.safePlatform.account.model.dto.resp.*;
|
import com.gkhy.safePlatform.account.model.query.GroupMemberPageQuery;
|
import com.gkhy.safePlatform.account.model.query.GroupPageQuery;
|
import com.gkhy.safePlatform.account.model.query.GroupQuery;
|
import com.gkhy.safePlatform.account.model.query.GroupScheduleQuery;
|
import com.gkhy.safePlatform.account.service.GroupService;
|
import com.gkhy.safePlatform.account.service.GroupStrategyTimeTableService;
|
import com.gkhy.safePlatform.commons.co.ContextCacheUser;
|
import com.gkhy.safePlatform.commons.enums.Module;
|
import com.gkhy.safePlatform.commons.enums.ResultCodes;
|
import com.gkhy.safePlatform.commons.query.PageQuery;
|
import com.gkhy.safePlatform.commons.utils.PageUtils;
|
import com.gkhy.safePlatform.commons.vo.ResultVO;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.security.core.Authentication;
|
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;
|
|
/**
|
* @Description: 班组
|
*/
|
|
@RestController
|
@RequestMapping("/schedule/group")
|
public class GroupController {
|
|
@Autowired
|
private GroupService groupService;
|
|
|
|
@RequestMapping(value = "/page/list",method = RequestMethod.POST)
|
public ResultVO<List<GroupPageRespDTO>> listGroupByPage(Authentication authentication, @RequestBody PageQuery<GroupPageQuery> query){
|
PageUtils.checkCheck(query);
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
return groupService.listGroupInfoByPage(currentUser, query);
|
}
|
|
|
|
@RequestMapping(value = "/list",method = RequestMethod.POST)
|
public ResultVO<List<GroupRespDTO>> listGroup(Authentication authentication,@RequestBody GroupQuery query){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
List<GroupRespDTO> groupList = groupService.listGroupInfo(currentUser, query);
|
return new ResultVO<>(ResultCodes.OK,groupList);
|
}
|
|
/**
|
* @Description: 成员
|
*/
|
@RequestMapping(value = "/member/list",method = RequestMethod.GET)
|
public ResultVO<List<GroupMemberRespDTO>> listMembers(Authentication authentication, Long groupId){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
List<GroupMemberRespDTO> members = groupService.listGroupMembersByGroupId(currentUser,groupId);
|
return new ResultVO<>(ResultCodes.OK,members);
|
}
|
|
/**
|
* @Description: 成员分页
|
*/
|
@RequestMapping(value = "/member/page/list", method = RequestMethod.POST)
|
public ResultVO<List<GroupMemberPageRespDTO>> listMembersByPage(Authentication authentication,@RequestBody PageQuery<GroupMemberPageQuery> query) {
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
PageUtils.checkCheck(query);
|
return groupService.listGroupMembersByPage(currentUser, query);
|
}
|
|
@RequestMapping(value = "/add",method = RequestMethod.POST)
|
@CommonLogEnable(module = Module.ACCOUNT,content = "新增班组")
|
public ResultVO<String> addGroup(Authentication authentication,@RequestBody GroupAddDTO groupAddDTO) {
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
groupService.saveGroupInfo(currentUser,groupAddDTO);
|
return new ResultVO<>(ResultCodes.OK);
|
}
|
|
|
@RequestMapping(value = "/mod",method = RequestMethod.POST)
|
@CommonLogEnable(module = Module.ACCOUNT,content = "修改班组")
|
public ResultVO<String> modGroup(Authentication authentication,@RequestBody GroupModDTO groupModDTO) {
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
groupService.modGroupInfo(currentUser,groupModDTO);
|
return new ResultVO<>(ResultCodes.OK);
|
}
|
|
@RequestMapping(value = "/del",method = RequestMethod.POST)
|
@CommonLogEnable(module = Module.ACCOUNT,content = "删除班组")
|
public ResultVO<String> delGroup(Authentication authentication, @RequestBody JSONObject json) {
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
Long groupId = json.getLong("groupId");
|
groupService.delGroupInfo(currentUser,groupId);
|
return new ResultVO<>(ResultCodes.OK);
|
}
|
|
|
/**
|
* @Description: 获取班组的作息表
|
*/
|
@RequestMapping(value = "/schedule", method = RequestMethod.POST)
|
public ResultVO<GroupTimeTableRespDTO> getTimeTable(Authentication authentication, @RequestBody GroupScheduleQuery groupScheduleQuery) {
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
GroupTimeTableRespDTO timeTableInfo = groupService.getTimeTableInfo(currentUser, groupScheduleQuery);
|
return new ResultVO<>(ResultCodes.OK,timeTableInfo);
|
}
|
|
}
|