| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293 |
- 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:48
- */
- @ApiOperation(value = "更新员工的登录标识", notes = "更新员工的登录标识")
- @PostMapping({"update_feign_staff_flg_can_login"})
- public ResponseResultVO<?> updateFeignStaffFlgCanLogin(@RequestBody List<String> list) {
- return staffService.updateFeignStaffFlgCanLogin(list);
- }
- /**
- * @desc : 注册商户时候插入 角色 基础资料(仓库 渠道 收入 支出 入库 出库 账户 来源 盈亏原因) 计量单位 种类 打印票据 等等。
- * 返回角色的数据
- * @author : 姜永辉
- * @date : 2023/1/9 10:48
- */
- @ApiOperation(value = "注册商户时候插入基础信息", notes = "注册商户时候插入基础信息")
- @PostMapping({"insert_feign_company_data"})
- public ResponseResultVO<?> insertFeignCompanyData(@RequestBody Map<String, List<Map<String, Object>>> map) {
- return staffService.insertFeignCompanyData(map);
- }
- /**
- * @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 Map<String, Object> map) {
- log.info("feign_get_experience111111111" + map.toString());
- StaffQuery staffQuery = new StaffQuery();
- staffQuery.setCpId(Integer.parseInt(map.get("cpId").toString()));
- staffQuery.setStaffCode(map.get("staffCode").toString());
- ResponseResultVO<PageList<StaffResponse>> pageListResponseResultVO = staffService.selectByCond(staffQuery);
- log.info("feign_get_experience2" + 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);
- }
- /**
- * @desc : 生成幽灵标识的数据
- * @author : 常皓宁
- * @date : 2024/6/19 10:53
- */
- @ApiOperation(value = "生成幽灵标识的数据", notes = "生成幽灵标识的数据")
- @PostMapping({"insert_flg_ghost_staff"})
- public ResponseResultVO<?> insertGhostStaff(@RequestBody StaffVO staffVO) {
- return staffService.insertGhostStaff(staffVO);
- }
- /**
- * @desc : 删除幽灵标识数据
- * @author : 常皓宁
- * @date : 2024/6/20 8:51
- */
- @ApiOperation(value = "删除幽灵标识数据", notes = "删除幽灵标识数据")
- @PostMapping({"delete_flg_ghost_staff"})
- public ResponseResultVO<?> deleteGhostStaff(@RequestBody StaffVO staffVO) {
- return staffService.deleteGhostStaff(staffVO);
- }
- /**
- * @desc : 更新负责人标识
- * @author : 刘尧
- * @date : 2024/6/21 16:24
- */
- @ApiOperation(value = "更新负责人标识", notes = "更新负责人标识")
- @PostMapping({"update_flgInit"})
- public ResponseResultVO updateFlgInit(@RequestBody Map<String, Object> params){
- return staffService.updateFlgInit(params);
- }
- }
|