已经得到pdf文件地址,怎么用java代码将其转换成压缩包格式,并传给前端?

@RequestMapping("/makeUserWB")
public Response<?> makeUserWB(@RequestParam("userIds")String userIds, @RequestParam("subjectId")int subjectId){

    try {
        String[] us=userIds.split(",");

        List<String> list = new ArrayList<String>();

        for(String userId : us) {
            Long userId1 = DataTypeUtil.toLong(userId);
            String path = wrongBookService.productDateRangPdfA4(userId1, subjectId, null, null, 1);
            list.add(path);
        }

        //如果分割后大于1,打成压缩包
        if(list.size()>1) {

        }else {
            Long userId1 = DataTypeUtil.toLong(userIds);
            String path = wrongBookService.productDateRangPdfA4(userId1, subjectId, null, null, 1);
            return Response.success("生成成功!", path);
        }       
    } catch (Exception e) {
        logger.error("", e);
        return Response.error(e);
    }
    return null;
}

问题已解决,已发表在我的博客中https://blog.csdn.net/mj94520/article/details/101201317

ZipOutputStream
https://blog.csdn.net/Xiaowu_First/article/details/89441665