管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-02-18 3e1416bffcb3761d06261e327edcbfe10a5443fb
src/main/java/com/lf/server/controller/data/upload/UploadController.java
@@ -3,12 +3,14 @@
import com.lf.server.annotation.SysLog;
import com.lf.server.entity.all.ResponseMsg;
import com.lf.server.entity.all.StaticData;
import com.lf.server.entity.ctrl.KeyValueEntity;
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;
@@ -31,6 +33,9 @@
public class UploadController extends QueryController {
    @Autowired
    UploadService uploadService;
    @Autowired
    UploadAttachService uploadAttachService;
    @SysLog()
    @ApiOperation(value = "查询路径")
@@ -59,6 +64,8 @@
                return fail("没有找到上传文件", null);
            }
            uploadService.copePath(list);
            return success(list);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
@@ -75,19 +82,23 @@
    @ApiOperation(value = "上传Excel附件")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "path", value = "路径", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "ids", value = "元数据集合", dataType = "Integer", 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 {
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue == null) {
                return fail("用户未登录", null);
            }
            if (null == ids || ids.length == 0) {
                return fail("找不到元数据的ID集合");
                return fail("找不到源数据的ID集合");
            }
            List<MetaEntity> ms = metaService.selectXlsAnnex(ids);
            List<MetaEntity> ms = metaService.selectXlsAnnex(ids, UploadAttachService.getTabs());
            if (null == ms || ms.isEmpty()) {
                return fail("找不到要上传附件的元数据");
                return fail("找不到要上传附件的源数据");
            }
            List<MetaFileEntity> list = uploadService.uploadData(null, path, req, res);
@@ -95,7 +106,12 @@
                return fail("没有找到上传文件", null);
            }
            return success(list);
            List<KeyValueEntity> rs = uploadAttachService.uploadXlsAnnex(ue, ms, list, path);
            if (null == rs || rs.size() == 0) {
                return fail("没有要更新的源数据");
            }
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
@@ -180,7 +196,7 @@
    @SysLog()
    @ApiOperation(value = "插入文件")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "list", value = "元数据文件集合", dataType = "MetaFileEntity", paramType = "body")
            @ApiImplicitParam(name = "list", value = "源数据文件集合", dataType = "MetaFileEntity", paramType = "body")
    })
    @ResponseBody
    @PostMapping(value = "/insertFiles")
@@ -191,7 +207,7 @@
                return fail("用户未登录", null);
            }
            if (null == list || list.isEmpty()) {
                return fail("元数据文件集合为空", null);
                return fail("源数据文件集合为空", null);
            }
            uploadService.insertFiles(ue, list, req);
@@ -203,7 +219,7 @@
    }
    @SysLog()
    @ApiOperation(value = "删除元数据")
    @ApiOperation(value = "删除源数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ids", value = "ID数组", dataType = "Integer", paramType = "query", example = "1,2")
    })