| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- package com.dk.mdm.controller.mst;
- import com.dk.common.model.pojo.PageList;
- import com.dk.common.response.ResponseResultUtil;
- import com.dk.common.response.ResponseResultVO;
- import com.dk.common.util.ExcelUtils;
- import com.dk.mdm.model.pojo.mst.Staff;
- import com.dk.common.service.BaseService;
- import com.dk.mdm.model.query.mst.StaffQuery;
- import com.dk.common.model.response.mst.StaffResponse;
- import com.dk.common.model.vo.mst.StaffVO;
- import io.swagger.annotations.ApiOperation;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.transaction.annotation.Transactional;
- import org.springframework.web.bind.annotation.*;
- import org.springframework.beans.factory.annotation.Autowired;
- import io.swagger.annotations.Api;
- import com.dk.mdm.service.mst.StaffService;
- import org.springframework.web.multipart.MultipartFile;
- import javax.servlet.http.HttpServletResponse;
- import java.util.ArrayList;
- import java.util.Dictionary;
- import java.util.List;
- import java.util.Map;
- /**
- * @author : 姜永辉
- * @desc : 员工API接口
- * @date : 2023/1/4 9:25
- */
- @Api(tags = "员工API接口")
- @RestController
- @RequestMapping("/mst/staff")
- @Slf4j
- public class StaffController {
- public BaseService<Staff> getService() {
- return staffService;
- }
- @Autowired
- private StaffService staffService;
- /**
- * @desc : 条件查询
- * @author : 姜永辉
- * @date : 2023/1/9 10:36
- */
- @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
- @PostMapping({"list_by"})
- public ResponseResultVO<PageList<StaffResponse>> selectByCond(@RequestBody StaffQuery staffQuery) {
- return staffService.selectByCond(staffQuery);
- }
- /**
- * @desc : 通过ID查询
- * @author : 姜永辉
- * @date : 2023/1/9 10:41
- */
- @PostMapping({"/{id}"})
- public ResponseResultVO selectById(@PathVariable String id) {
- return staffService.selectById(id);
- }
- /**
- * @desc : 新建员工--权限
- * @author : 姜永辉
- * @date : 2023/1/9 10:48
- */
- @ApiOperation(value = "新建员工--权限", notes = "新建员工--权限")
- @PostMapping({"save_staff_right"})
- public ResponseResultVO<?> saveStaffRight(@RequestBody StaffVO staffVO) {
- return staffService.saveStaffRight(staffVO);
- }
- /**
- * @desc : 新建员工--权限
- * @author : 姜永辉
- * @date : 2023/1/9 10:48
- */
- @ApiOperation(value = "新建员工--权限", notes = "新建员工--权限")
- @PostMapping({"save_staff_preview"})
- public ResponseResultVO<?> saveStaffPurview(@RequestBody StaffVO staffVO) {
- return staffService.saveStaffPurview(staffVO);
- }
- /**
- * @desc : 新建员工
- * @author : 姜永辉
- * @date : 2023/1/9 10:48
- */
- @ApiOperation(value = "新建员工", notes = "新建员工")
- @PostMapping({"insert"})
- public ResponseResultVO<?> insert(@RequestBody StaffVO staffVO) {
- return staffService.insert(staffVO);
- }
- /**
- * @desc : 新建员工--邀请员工的确定
- * @author : 姜永辉
- * @date : 2023/1/9 10:48
- */
- @ApiOperation(value = "邀请员工的确定", notes = "邀请员工的确定")
- @PostMapping({"insert_request"})
- public ResponseResultVO<?> insertRequestStaff(@RequestBody StaffVO staffVO) {
- return staffService.insertRequestStaff(staffVO);
- }
- /**
- * @desc : 新建员工--注册商户用的
- * @author : 姜永辉
- * @date : 2023/1/9 10:48
- */
- @ApiOperation(value = "新建员工", notes = "新建员工")
- @PostMapping({"insert_feign_staff"})
- public ResponseResultVO<?> insertFeignStaff(@RequestBody StaffVO staffVO) {
- return staffService.insertFeignStaff(staffVO);
- }
- /**
- * @desc : 编辑员工
- * @author : 姜永辉
- * @date : 2023/1/9 10:49
- */
- @ApiOperation(value = "编辑员工", notes = "编辑员工")
- @PostMapping({"update"})
- public ResponseResultVO<Boolean> update(@RequestBody StaffVO staffVO) {
- return staffService.update(staffVO);
- }
- /**
- * @desc : 停用
- * @author : 姜永辉
- * @date : 2023/1/9 10:34
- */
- @ApiOperation(value = "停用", notes = "停用")
- @PostMapping("disable/{id}")
- public ResponseResultVO<Boolean> disable(@PathVariable String id) {
- return this.getService().disable(id);
- }
- /**
- * @desc : 启用
- * @author : 姜永辉
- * @date : 2023/1/9 10:34
- */
- @ApiOperation(value = "启用", notes = "启用")
- @PostMapping("enable/{id}")
- public ResponseResultVO<Boolean> enable(@PathVariable String id) {
- return this.getService().enable(id);
- }
- /**
- * @desc : 员工离职
- * @author : 姜永辉
- * @date : 2023/2/13 13:15
- */
- @ApiOperation(value = "员工离职", notes = "员工离职")
- @PostMapping({"dimission"})
- @Transactional(rollbackFor = Exception.class)
- public ResponseResultVO<Boolean> dimission(@RequestBody StaffVO staffVO) {
- return staffService.dimission(staffVO);
- }
- /**
- * @desc : 员工导入
- * @author : 姜永辉
- * @date : 2023/2/28 14:32
- */
- @ApiOperation(value = "导入", notes = "导入")
- @PostMapping("import")
- @Transactional(rollbackFor = Exception.class)
- public ResponseResultVO<Boolean> importList(MultipartFile file) {
- List<StaffVO> list = ExcelUtils.importExcel(file, 1, 1, StaffVO.class);
- return staffService.importStaffList(list);
- }
- /**
- * @desc : 导出模板
- * @author : 洪旭东
- * @date : 2023-08-01 11:44
- */
- @ApiOperation(value = "导出模板", notes = "导出模板")
- @GetMapping("export_template")
- public void exportTemplate(HttpServletResponse response) {
- String title = "员工导入模板";
- ExcelUtils.exportExcel(new ArrayList<>(), title, title, StaffVO.class, title + ".xls", response);
- }
- /**
- * @desc : 体验产品-从oauth服务调用的函数
- * @author : 姜永辉
- * @date : 2023-11-02 16:27
- */
- @PostMapping({"/feign_get_experience"})
- ResponseResultVO<StaffResponse> getFeignExperience(@RequestBody StaffQuery staffQuery) {
- ResponseResultVO<PageList<StaffResponse>> pageListResponseResultVO = staffService.selectByCond(staffQuery);
- log.info("feign_get_experience" + pageListResponseResultVO.toString());
- return ResponseResultUtil.success(pageListResponseResultVO.getData().getList().get(0));
- }
- /**
- * @desc : 登录后获取信息
- * @author : 周兴
- * @date : 2024/3/4 12:47
- */
- @ApiOperation(
- value = "登录后获取信息",
- notes = "登录后获取信息"
- )
- @PostMapping("get_info_after_login")
- public ResponseResultVO<Dictionary<String,Object>> getInfoAfterLogin(@RequestBody Map<String, Object> param) {
- return staffService.getInfoAfterLogin(param);
- }
- /**
- * @desc : 退出登录
- * @author : 周兴
- * @date : 2024/3/18 12:47
- */
- @ApiOperation(
- value = "退出登录",
- notes = "退出登录"
- )
- @PostMapping("logout")
- public ResponseResultVO<Boolean> logout(@RequestBody Map<String, Object> param) {
- return staffService.logout(param);
- }
- }
|