| | |
| | | import com.sinata.appointment.service.AppointmentApplicationService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import java.io.IOException; |
| | | import lombok.RequiredArgsConstructor; |
| | | import java.time.LocalDate; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | @RequestParam(defaultValue = "10") long size, |
| | | @RequestParam(required = false) String visitedUserName, |
| | | @RequestParam(required = false) Long visitedDeptId, |
| | | @RequestParam(required = false) Long accessAreaId, |
| | | @RequestParam(required = false) String accessArea, |
| | | @RequestParam(required = false) String localUnit, |
| | | @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate visitDateStart, |
| | |
| | | size, |
| | | visitedUserName, |
| | | visitedDeptId, |
| | | accessAreaId, |
| | | accessArea, |
| | | localUnit, |
| | | visitDateStart, |
| | |
| | | @Operation(summary = "导出 Excel") |
| | | @GetMapping("/export") |
| | | @SaCheckPermission("appointments:export") |
| | | public ResponseEntity<byte[]> export( |
| | | public void export( |
| | | HttpServletResponse response, |
| | | @RequestParam(required = false) String visitedUserName, |
| | | @RequestParam(required = false) Long visitedDeptId, |
| | | @RequestParam(required = false) Long accessAreaId, |
| | | @RequestParam(required = false) String accessArea, |
| | | @RequestParam(required = false) String localUnit, |
| | | @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate visitDateStart, |
| | |
| | | @RequestParam(required = false) String displayStatus, |
| | | @RequestParam(required = false) String approvalStatus, |
| | | @RequestParam(required = false) String visitorKeyword, |
| | | @RequestParam(required = false) String visitReasonCode) { |
| | | byte[] body = |
| | | appointmentApplicationService.exportExcel( |
| | | visitedUserName, |
| | | visitedDeptId, |
| | | accessArea, |
| | | localUnit, |
| | | visitDateStart, |
| | | visitDateEnd, |
| | | displayStatus, |
| | | approvalStatus, |
| | | visitorKeyword, |
| | | visitReasonCode); |
| | | return ResponseEntity.ok() |
| | | .contentType( |
| | | MediaType.parseMediaType( |
| | | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")) |
| | | .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"appointments.xlsx\"") |
| | | .body(body); |
| | | @RequestParam(required = false) String visitReasonCode) |
| | | throws IOException { |
| | | appointmentApplicationService.exportExcel( |
| | | response, |
| | | visitedUserName, |
| | | visitedDeptId, |
| | | accessAreaId, |
| | | accessArea, |
| | | localUnit, |
| | | visitDateStart, |
| | | visitDateEnd, |
| | | displayStatus, |
| | | approvalStatus, |
| | | visitorKeyword, |
| | | visitReasonCode); |
| | | } |
| | | |
| | | @Operation(summary = "详情含访客") |