ZyjnController.java 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package com.malk.zyjn.controller;
  2. import com.malk.server.common.McR;
  3. import com.malk.service.dingtalk.DDClient;
  4. import com.malk.zyjn.service.ZyjnService;
  5. import lombok.extern.slf4j.Slf4j;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.web.bind.annotation.*;
  8. import org.springframework.web.bind.annotation.RequestBody;
  9. import javax.servlet.http.HttpServletResponse;
  10. import java.util.Map;
  11. import java.util.Objects;
  12. @RestController
  13. @Slf4j
  14. public class ZyjnController {
  15. @Autowired
  16. private ZyjnService zyjnService;
  17. @GetMapping("/test")
  18. public McR test() {
  19. return McR.success();
  20. }
  21. @PostMapping("/test2")
  22. public McR test2(@RequestBody Map map) {
  23. return McR.success();
  24. }
  25. /**
  26. * 上传部门月度考勤表(审核前)
  27. * @param map
  28. * @return
  29. */
  30. @PostMapping("/getDeptAttendanceSheet")
  31. public McR getDeptAttendanceSheet(@RequestBody Map map) {
  32. if (Objects.isNull(map.get("userId")) || Objects.isNull(map.get("deptId"))
  33. || Objects.isNull(map.get("date")) || Objects.isNull(map.get("deptName"))
  34. || Objects.isNull(map.get("userName"))){
  35. return McR.errorParam("缺少传参");
  36. }
  37. String userId = map.get("userId").toString();
  38. String userName = map.get("userName").toString();
  39. String deptId = map.get("deptId").toString();
  40. String deptName = map.get("deptName").toString();
  41. Long date = Long.valueOf(map.get("date").toString());
  42. return zyjnService.getDeptAttendanceSheet(userId,userName,deptId,date,deptName);
  43. }
  44. /**
  45. * 上传部门月度考勤表(审核后)
  46. * @param map
  47. * @return
  48. */
  49. @PostMapping("/updateDeptAttendanceSheet")
  50. public McR updateDeptAttendanceSheet(@RequestBody Map map) {
  51. if (Objects.isNull(map.get("formInstId"))){
  52. return McR.errorParam("缺少传参");
  53. }
  54. String formInstId = map.get("formInstId").toString();
  55. zyjnService.updateDeptAttendanceSheet(formInstId);
  56. return McR.success();
  57. }
  58. @GetMapping("/download/{fileName}")
  59. public void download(@PathVariable("fileName") String fileName, HttpServletResponse response) {
  60. zyjnService.download(fileName, response);
  61. }
  62. }