From 552c700f584700316e8d1919dd1ad7f551c53ec4 Mon Sep 17 00:00:00 2001 From: kongdeqiang <123456> Date: 星期二, 12 十一月 2024 10:03:22 +0800 Subject: [PATCH] fix : 新增日统计接口 --- src/main/java/com/boying/controller/phone/UpdateAppController.java | 27 ++++++++++++++++++++------- 1 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/boying/controller/phone/UpdateAppController.java b/src/main/java/com/boying/controller/phone/UpdateAppController.java index de14b69..bd84a29 100644 --- a/src/main/java/com/boying/controller/phone/UpdateAppController.java +++ b/src/main/java/com/boying/controller/phone/UpdateAppController.java @@ -1,27 +1,29 @@ package com.boying.controller.phone; +import cn.hutool.core.io.IoUtil; import com.boying.common.R; +import com.boying.common.SystemConfigProperties; import com.boying.entity.UpdateApp; import com.boying.service.UpdateAppService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; import java.util.List; @RestController @RequestMapping("ffzf/updateApp") @RequiredArgsConstructor -@Tag(description = "ffzf/updateApp" , name = "app鏇存柊鎺ュ彛" ) public class UpdateAppController{ private final UpdateAppService updateAppService; + private final SystemConfigProperties systemConfigProperties; @PostMapping("/getUpdateApp") - @Operation(summary = "鑾峰彇鏈�鏂癮pp鐗堟湰" , description = "鑾峰彇鏈�鏂癮pp鐗堟湰" ) public Object getUpdateApp(){ List<UpdateApp> all = updateAppService.list(); if(all.size()==0){ @@ -29,4 +31,15 @@ } return R.ok(all.get(0)); } + @GetMapping("/getFile/{filename}") + public void getFile(@PathVariable String filename, HttpServletResponse response){ + try { + InputStream input = new FileInputStream(new File(systemConfigProperties.getUploadImgPath()+filename)); + response.setContentType("application/octet-stream; charset=UTF-8"); + IoUtil.copy(input, response.getOutputStream()); + }catch (Exception e){ + System.out.println("鏂囦欢璇诲彇寮傚父锛�"+e.getLocalizedMessage()); + } + } + } -- Gitblit v1.9.1