| | |
| | | @PostMapping(value = "/uploadFiles") |
| | | public ResponseMsg<Object> uploadFiles(String path, HttpServletRequest req, HttpServletResponse res) { |
| | | try { |
| | | List<MetaFileEntity> list = uploadService.uploadData(null, path, req, res); |
| | | List<MetaFileEntity> list = uploadService.uploadData(null, path, false, req, res); |
| | | if (null == list || list.isEmpty()) { |
| | | return fail("没有找到上传文件", null); |
| | | } |
| | |
| | | return fail("找不到要上传附件的源数据"); |
| | | } |
| | | |
| | | List<MetaFileEntity> list = uploadService.uploadData(null, path, req, res); |
| | | List<MetaFileEntity> list = uploadService.uploadData(null, path, false, req, res); |
| | | if (null == list || list.isEmpty()) { |
| | | return fail("没有找到上传文件", null); |
| | | } |
| | |
| | | return fail("用户未登录", null); |
| | | } |
| | | |
| | | List<MetaFileEntity> meList = baseUploadService.uploadData(null, null, req, res); |
| | | List<MetaFileEntity> meList = baseUploadService.uploadData(null, null, false, req, res); |
| | | if (meList == null || meList.size() < StaticData.FOUR) { |
| | | return fail("没有找到已上传的数据或不完整", null); |
| | | } |
| | |
| | | return fail("用户未登录", null); |
| | | } |
| | | |
| | | List<MetaFileEntity> list = baseUploadService.uploadData(null, null, req, res); |
| | | List<MetaFileEntity> list = baseUploadService.uploadData(null, null, false, req, res); |
| | | if (list == null || list.size() < StaticData.FOUR) { |
| | | return fail("没有找到已上传的数据或不完整", null); |
| | | } |
| | |
| | | /** |
| | | * 上传文件 |
| | | */ |
| | | public <T> List<MetaFileEntity> uploadData(T t, String path, HttpServletRequest req, HttpServletResponse res) throws Exception { |
| | | public <T> List<MetaFileEntity> uploadData(T t, String path, boolean isGetGuid, HttpServletRequest req, HttpServletResponse res) throws Exception { |
| | | StandardMultipartHttpServletRequest request = (StandardMultipartHttpServletRequest) req; |
| | | req.setCharacterEncoding("utf-8"); |
| | | res.setContentType("application/json;charset=utf-8"); |
| | |
| | | setEntity(t, request); |
| | | } |
| | | |
| | | return getFiles(path, request); |
| | | return getFiles(path, isGetGuid, request); |
| | | } |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 获取文件 |
| | | */ |
| | | public List<MetaFileEntity> getFiles(String subPath, StandardMultipartHttpServletRequest req) throws Exception { |
| | | public List<MetaFileEntity> getFiles(String subPath, boolean isGetGuid, StandardMultipartHttpServletRequest req) throws Exception { |
| | | List<MetaFileEntity> list = new ArrayList<>(); |
| | | |
| | | String path = pathHelper.getTempPath(subPath); |
| | |
| | | mf.setPath(path + File.separator + mf.getName()); |
| | | |
| | | file.transferTo(new File(mf.getPath())); |
| | | mf.setGuid(FileHelper.getFileMd5(mf.getPath())); |
| | | if (isGetGuid) { |
| | | mf.setGuid(FileHelper.getFileMd5(mf.getPath())); |
| | | } |
| | | |
| | | list.add(mf); |
| | | } |
| | |
| | | for (MetaFileEntity mf : list) { |
| | | if (mf.getName().contains(StaticData.ZIP)) { |
| | | List<String> subs = getZipFiles(mf, path); |
| | | if (null == subs || subs.size() > 0) { |
| | | if (null != subs && subs.size() > 0) { |
| | | files.addAll(subs); |
| | | } |
| | | continue; |