Browse Source

附件下载2

zhuhaiwen 3 years ago
parent
commit
2fbc4e803a

+ 4 - 4
oa-app/src/main/java/com/css/oa/exam/announce/controller/AnnounceController.java

@ -64,15 +64,15 @@ public class AnnounceController extends BaseController {
64 64
65 65
    @ApiOperation(value = "下载公告中的文件")
66 66
    @GetMapping("/download")
67
    public void download(@RequestParam(value = "uuid") String uuid, HttpServletRequest request, HttpServletResponse response) {
67
    public void download(@RequestParam(value = "file_id") String file_id, HttpServletRequest request, HttpServletResponse response) {
68 68
        try {
69
            if(TextUtils.isEmpty(uuid)){
70
                exportPrint(response, "uuid不能为空");
69
            if(TextUtils.isEmpty(file_id)){
70
                exportPrint(response, "file_id不能为空");
71 71
                return;
72 72
            }
73 73
            String token = getToken();
74 74
            mService.setToken(token);
75
            mService.download(uuid, request, response);
75
            mService.download(file_id, request, response);
76 76
        } catch (Exception e) {
77 77
            e.printStackTrace();
78 78
            exportPrint(response, e.getMessage());

+ 6 - 6
oa-app/src/main/java/com/css/oa/exam/announce/service/AnnounceService.java

@ -74,13 +74,13 @@ public class AnnounceService extends BaseService implements IAnnounceService {
74 74
     *  @param uuid = OP_XM_ENCLOSURE表主键
75 75
     */
76 76
    @Override
77
    public void download(String uuid, HttpServletRequest request, HttpServletResponse response) throws Exception {
77
    public void download(String file_id, HttpServletRequest request, HttpServletResponse response) throws Exception {
78 78
        Admin admin = Admin.getAdminByToken(token);
79
        Announce announce = repository.findById(uuid).get();
80
        if(TextUtils.isEmpty(announce.getFile_id())){
81
            throw new Exception("此公告没有附件可下载");
82
        }
83
        uploadService.download(admin, announce.getFile_id(), request, response);
79
//        Announce announce = repository.findById(uuid).get();
80
//        if(TextUtils.isEmpty(announce.getFile_id())){
81
//            throw new Exception("此公告没有附件可下载");
82
//        }
83
        uploadService.download(admin, file_id, request, response);
84 84
    }
85 85
86 86
    @Override