StaffController.java 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. package com.dk.mdm.controller.mst;
  2. import com.dk.common.model.pojo.PageList;
  3. import com.dk.common.response.ResponseResultUtil;
  4. import com.dk.common.response.ResponseResultVO;
  5. import com.dk.common.util.ExcelUtils;
  6. import com.dk.mdm.model.pojo.mst.Staff;
  7. import com.dk.common.service.BaseService;
  8. import com.dk.mdm.model.query.mst.StaffQuery;
  9. import com.dk.common.model.response.mst.StaffResponse;
  10. import com.dk.common.model.vo.mst.StaffVO;
  11. import io.swagger.annotations.ApiOperation;
  12. import lombok.extern.slf4j.Slf4j;
  13. import org.springframework.transaction.annotation.Transactional;
  14. import org.springframework.web.bind.annotation.*;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import io.swagger.annotations.Api;
  17. import com.dk.mdm.service.mst.StaffService;
  18. import org.springframework.web.multipart.MultipartFile;
  19. import javax.servlet.http.HttpServletResponse;
  20. import java.util.ArrayList;
  21. import java.util.Dictionary;
  22. import java.util.List;
  23. import java.util.Map;
  24. /**
  25. * @author : 姜永辉
  26. * @desc : 员工API接口
  27. * @date : 2023/1/4 9:25
  28. */
  29. @Api(tags = "员工API接口")
  30. @RestController
  31. @RequestMapping("/mst/staff")
  32. @Slf4j
  33. public class StaffController {
  34. public BaseService<Staff> getService() {
  35. return staffService;
  36. }
  37. @Autowired
  38. private StaffService staffService;
  39. /**
  40. * @desc : 条件查询
  41. * @author : 姜永辉
  42. * @date : 2023/1/9 10:36
  43. */
  44. @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
  45. @PostMapping({"list_by"})
  46. public ResponseResultVO<PageList<StaffResponse>> selectByCond(@RequestBody StaffQuery staffQuery) {
  47. return staffService.selectByCond(staffQuery);
  48. }
  49. /**
  50. * @desc : 通过ID查询
  51. * @author : 姜永辉
  52. * @date : 2023/1/9 10:41
  53. */
  54. @PostMapping({"/{id}"})
  55. public ResponseResultVO selectById(@PathVariable String id) {
  56. return staffService.selectById(id);
  57. }
  58. /**
  59. * @desc : 新建员工--权限
  60. * @author : 姜永辉
  61. * @date : 2023/1/9 10:48
  62. */
  63. @ApiOperation(value = "新建员工--权限", notes = "新建员工--权限")
  64. @PostMapping({"save_staff_right"})
  65. public ResponseResultVO<?> saveStaffRight(@RequestBody StaffVO staffVO) {
  66. return staffService.saveStaffRight(staffVO);
  67. }
  68. /**
  69. * @desc : 新建员工--权限
  70. * @author : 姜永辉
  71. * @date : 2023/1/9 10:48
  72. */
  73. @ApiOperation(value = "新建员工--权限", notes = "新建员工--权限")
  74. @PostMapping({"save_staff_preview"})
  75. public ResponseResultVO<?> saveStaffPurview(@RequestBody StaffVO staffVO) {
  76. return staffService.saveStaffPurview(staffVO);
  77. }
  78. /**
  79. * @desc : 新建员工
  80. * @author : 姜永辉
  81. * @date : 2023/1/9 10:48
  82. */
  83. @ApiOperation(value = "新建员工", notes = "新建员工")
  84. @PostMapping({"insert"})
  85. public ResponseResultVO<?> insert(@RequestBody StaffVO staffVO) {
  86. return staffService.insert(staffVO);
  87. }
  88. /**
  89. * @desc : 新建员工--邀请员工的确定
  90. * @author : 姜永辉
  91. * @date : 2023/1/9 10:48
  92. */
  93. @ApiOperation(value = "邀请员工的确定", notes = "邀请员工的确定")
  94. @PostMapping({"insert_request"})
  95. public ResponseResultVO<?> insertRequestStaff(@RequestBody StaffVO staffVO) {
  96. return staffService.insertRequestStaff(staffVO);
  97. }
  98. /**
  99. * @desc : 新建员工--注册商户用的
  100. * @author : 姜永辉
  101. * @date : 2023/1/9 10:48
  102. */
  103. @ApiOperation(value = "新建员工", notes = "新建员工")
  104. @PostMapping({"insert_feign_staff"})
  105. public ResponseResultVO<?> insertFeignStaff(@RequestBody StaffVO staffVO) {
  106. return staffService.insertFeignStaff(staffVO);
  107. }
  108. /**
  109. * @desc : 更新员工的登录标识
  110. * @author : 姜永辉
  111. * @date : 2023/1/9 10:48
  112. */
  113. @ApiOperation(value = "更新员工的登录标识", notes = "更新员工的登录标识")
  114. @PostMapping({"update_feign_staff_flg_can_login"})
  115. public ResponseResultVO<?> updateFeignStaffFlgCanLogin(@RequestBody List<String> list) {
  116. return staffService.updateFeignStaffFlgCanLogin(list);
  117. }
  118. /**
  119. * @desc : 注册商户时候插入 角色 基础资料(仓库 渠道 收入 支出 入库 出库 账户 来源 盈亏原因) 计量单位 种类 打印票据 等等。
  120. * 返回角色的数据
  121. * @author : 姜永辉
  122. * @date : 2023/1/9 10:48
  123. */
  124. @ApiOperation(value = "注册商户时候插入基础信息", notes = "注册商户时候插入基础信息")
  125. @PostMapping({"insert_feign_company_data"})
  126. public ResponseResultVO<?> insertFeignCompanyData(@RequestBody Map<String, List<Map<String, Object>>> map) {
  127. return staffService.insertFeignCompanyData(map);
  128. }
  129. /**
  130. * @desc : 编辑员工
  131. * @author : 姜永辉
  132. * @date : 2023/1/9 10:49
  133. */
  134. @ApiOperation(value = "编辑员工", notes = "编辑员工")
  135. @PostMapping({"update"})
  136. public ResponseResultVO<Boolean> update(@RequestBody StaffVO staffVO) {
  137. return staffService.update(staffVO);
  138. }
  139. /**
  140. * @desc : 停用
  141. * @author : 姜永辉
  142. * @date : 2023/1/9 10:34
  143. */
  144. @ApiOperation(value = "停用", notes = "停用")
  145. @PostMapping("disable/{id}")
  146. public ResponseResultVO<Boolean> disable(@PathVariable String id) {
  147. return this.getService().disable(id);
  148. }
  149. /**
  150. * @desc : 启用
  151. * @author : 姜永辉
  152. * @date : 2023/1/9 10:34
  153. */
  154. @ApiOperation(value = "启用", notes = "启用")
  155. @PostMapping("enable/{id}")
  156. public ResponseResultVO<Boolean> enable(@PathVariable String id) {
  157. return this.getService().enable(id);
  158. }
  159. /**
  160. * @desc : 员工离职
  161. * @author : 姜永辉
  162. * @date : 2023/2/13 13:15
  163. */
  164. @ApiOperation(value = "员工离职", notes = "员工离职")
  165. @PostMapping({"dimission"})
  166. @Transactional(rollbackFor = Exception.class)
  167. public ResponseResultVO<Boolean> dimission(@RequestBody StaffVO staffVO) {
  168. return staffService.dimission(staffVO);
  169. }
  170. /**
  171. * @desc : 员工导入
  172. * @author : 姜永辉
  173. * @date : 2023/2/28 14:32
  174. */
  175. @ApiOperation(value = "导入", notes = "导入")
  176. @PostMapping("import")
  177. @Transactional(rollbackFor = Exception.class)
  178. public ResponseResultVO<Boolean> importList(MultipartFile file) {
  179. List<StaffVO> list = ExcelUtils.importExcel(file, 1, 1, StaffVO.class);
  180. return staffService.importStaffList(list);
  181. }
  182. /**
  183. * @desc : 导出模板
  184. * @author : 洪旭东
  185. * @date : 2023-08-01 11:44
  186. */
  187. @ApiOperation(value = "导出模板", notes = "导出模板")
  188. @GetMapping("export_template")
  189. public void exportTemplate(HttpServletResponse response) {
  190. String title = "员工导入模板";
  191. ExcelUtils.exportExcel(new ArrayList<>(), title, title, StaffVO.class, title + ".xls", response);
  192. }
  193. /**
  194. * @desc : 体验产品-从oauth服务调用的函数
  195. * @author : 姜永辉
  196. * @date : 2023-11-02 16:27
  197. */
  198. @PostMapping({"/feign_get_experience"})
  199. ResponseResultVO<StaffResponse> getFeignExperience(@RequestBody Map<String, Object> map) {
  200. log.info("feign_get_experience111111111" + map.toString());
  201. StaffQuery staffQuery = new StaffQuery();
  202. staffQuery.setCpId(Integer.parseInt(map.get("cpId").toString()));
  203. staffQuery.setStaffCode(map.get("staffCode").toString());
  204. ResponseResultVO<PageList<StaffResponse>> pageListResponseResultVO = staffService.selectByCond(staffQuery);
  205. log.info("feign_get_experience2" + pageListResponseResultVO.toString());
  206. return ResponseResultUtil.success(pageListResponseResultVO.getData().getList().get(0));
  207. }
  208. /**
  209. * @desc : 登录后获取信息
  210. * @author : 周兴
  211. * @date : 2024/3/4 12:47
  212. */
  213. @ApiOperation(
  214. value = "登录后获取信息",
  215. notes = "登录后获取信息"
  216. )
  217. @PostMapping("get_info_after_login")
  218. public ResponseResultVO<Dictionary<String, Object>> getInfoAfterLogin(@RequestBody Map<String, Object> param) {
  219. return staffService.getInfoAfterLogin(param);
  220. }
  221. /**
  222. * @desc : 退出登录
  223. * @author : 周兴
  224. * @date : 2024/3/18 12:47
  225. */
  226. @ApiOperation(
  227. value = "退出登录",
  228. notes = "退出登录"
  229. )
  230. @PostMapping("logout")
  231. public ResponseResultVO<Boolean> logout(@RequestBody Map<String, Object> param) {
  232. return staffService.logout(param);
  233. }
  234. /**
  235. * @desc : 生成幽灵标识的数据
  236. * @author : 常皓宁
  237. * @date : 2024/6/19 10:53
  238. */
  239. @ApiOperation(value = "生成幽灵标识的数据", notes = "生成幽灵标识的数据")
  240. @PostMapping({"insert_flg_ghost_staff"})
  241. public ResponseResultVO<?> insertGhostStaff(@RequestBody StaffVO staffVO) {
  242. return staffService.insertGhostStaff(staffVO);
  243. }
  244. /**
  245. * @desc : 删除幽灵标识数据
  246. * @author : 常皓宁
  247. * @date : 2024/6/20 8:51
  248. */
  249. @ApiOperation(value = "删除幽灵标识数据", notes = "删除幽灵标识数据")
  250. @PostMapping({"delete_flg_ghost_staff"})
  251. public ResponseResultVO<?> deleteGhostStaff(@RequestBody StaffVO staffVO) {
  252. return staffService.deleteGhostStaff(staffVO);
  253. }
  254. /**
  255. * @desc : 更新负责人标识
  256. * @author : 刘尧
  257. * @date : 2024/6/21 16:24
  258. */
  259. @ApiOperation(value = "更新负责人标识", notes = "更新负责人标识")
  260. @PostMapping({"update_flgInit"})
  261. public ResponseResultVO updateFlgInit(@RequestBody Map<String, Object> params){
  262. return staffService.updateFlgInit(params);
  263. }
  264. }