package com.malk.zyjn.controller; import com.malk.server.common.McR; import com.malk.service.dingtalk.DDClient; import com.malk.zyjn.service.ZyjnService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.RequestBody; import javax.servlet.http.HttpServletResponse; import java.util.Map; import java.util.Objects; @RestController @Slf4j public class ZyjnController { @Autowired private ZyjnService zyjnService; @GetMapping("/test") public McR test() { return McR.success(); } @PostMapping("/test2") public McR test2(@RequestBody Map map) { return McR.success(); } /** * 上传部门月度考勤表(审核前) * @param map * @return */ @PostMapping("/getDeptAttendanceSheet") public McR getDeptAttendanceSheet(@RequestBody Map map) { if (Objects.isNull(map.get("userId")) || Objects.isNull(map.get("deptId")) || Objects.isNull(map.get("date")) || Objects.isNull(map.get("deptName")) || Objects.isNull(map.get("userName"))){ return McR.errorParam("缺少传参"); } String userId = map.get("userId").toString(); String userName = map.get("userName").toString(); String deptId = map.get("deptId").toString(); String deptName = map.get("deptName").toString(); Long date = Long.valueOf(map.get("date").toString()); return zyjnService.getDeptAttendanceSheet(userId,userName,deptId,date,deptName); } /** * 上传部门月度考勤表(审核后) * @param map * @return */ @PostMapping("/updateDeptAttendanceSheet") public McR updateDeptAttendanceSheet(@RequestBody Map map) { if (Objects.isNull(map.get("formInstId"))){ return McR.errorParam("缺少传参"); } String formInstId = map.get("formInstId").toString(); zyjnService.updateDeptAttendanceSheet(formInstId); return McR.success(); } @GetMapping("/download/{fileName}") public void download(@PathVariable("fileName") String fileName, HttpServletResponse response) { zyjnService.download(fileName, response); } }