管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-02-04 2b170e6c4c20a4fe4f113c5a7ca0f3210c278d7f
src/main/java/com/lf/server/controller/data/upload/UploadController.java
@@ -4,10 +4,12 @@
import com.lf.server.entity.all.ResponseMsg;
import com.lf.server.entity.all.StaticData;
import com.lf.server.entity.data.DirEntity;
import com.lf.server.entity.data.MetaEntity;
import com.lf.server.entity.data.MetaFileEntity;
import com.lf.server.entity.data.VerEntity;
import com.lf.server.entity.sys.UserEntity;
import com.lf.server.helper.StringHelper;
import com.lf.server.service.all.UploadAttachService;
import com.lf.server.service.data.UploadService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -64,6 +66,42 @@
        }
    }
    /**
     * 接收数组1:@RequestParam(value = "ids")List<Integer> ids
     *          &ids=1209&ids=1180&ids=1387
     * 接收数据2:Integer[] ids
     *          formData.append("ids", 1209); formData.append("ids", 1180); formData.append("ids", 1387);
     */
    @SysLog()
    @ApiOperation(value = "上传Excel附件")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "path", value = "路径", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "ids", value = "元数据集合", dataType = "Integer", paramType = "query")
    })
    @ResponseBody
    @PostMapping(value = "/uploadXlsAnnex")
    public ResponseMsg<Object> uploadXlsAnnex(String path, Integer[] ids, HttpServletRequest req, HttpServletResponse res) {
        try {
            if (null == ids || ids.length == 0) {
                return fail("找不到元数据的ID集合");
            }
            List<MetaEntity> ms = metaService.selectXlsAnnex(ids, UploadAttachService.getTabs());
            if (null == ms || ms.isEmpty()) {
                return fail("找不到要上传附件的元数据");
            }
            List<MetaFileEntity> list = uploadService.uploadData(null, path, req, res);
            if (null == list || list.isEmpty()) {
                return fail("没有找到上传文件", null);
            }
            return success(list);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
    @SysLog()
    @ApiOperation(value = "查询文件")
    @ApiImplicitParams({