| | |
| | | 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.TabMapperEntity; |
| | | import com.lf.server.entity.ctrl.UploadEntity; |
| | | 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.sys.UserEntity; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.helper.WebHelper; |
| | | import com.lf.server.service.all.BaseUploadService; |
| | | import com.lf.server.service.data.DataLoaderService; |
| | | import com.lf.server.service.data.DataUploadService; |
| | | import com.lf.server.service.data.DirService; |
| | | import com.lf.server.service.data.UploadService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @RequestMapping("/dataUpload") |
| | | public class UploadController extends QueryController { |
| | | @Autowired |
| | | protected DataLoaderService dataLoaderService; |
| | | |
| | | @Autowired |
| | | protected BaseUploadService baseUploadService; |
| | | |
| | | @Autowired |
| | | protected DataUploadService dataUploadService; |
| | | |
| | | private final static List<String> EXT_LIST = new ArrayList<>(Arrays.asList(".xls", ".xlsx", ".mdb", ".zip")); |
| | | UploadService uploadService; |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询路径") |
| | | @GetMapping(value = "/selectPath") |
| | | public ResponseMsg<String> selectPath() { |
| | | try { |
| | | String pathName = baseUploadService.selectPath(); |
| | | String pathName = uploadService.selectPath(); |
| | | |
| | | return success(pathName); |
| | | } catch (Exception ex) { |
| | |
| | | @PostMapping(value = "/uploadFiles") |
| | | public ResponseMsg<Object> uploadFiles(String path, HttpServletRequest req, HttpServletResponse res) { |
| | | try { |
| | | List<MetaFileEntity> list = baseUploadService.uploadData(null, path, req, res); |
| | | List<MetaFileEntity> list = uploadService.uploadData(null, path, req, res); |
| | | if (null == list || list.isEmpty()) { |
| | | return fail("没有找到上传文件", null); |
| | | } |
| | |
| | | @GetMapping(value = "/selectFiles") |
| | | public ResponseMsg<List<MetaFileEntity>> selectFiles(String path) { |
| | | try { |
| | | List<MetaFileEntity> list = baseUploadService.selectFiles(path, StaticData.ALL_EXTENSION); |
| | | List<MetaFileEntity> list = uploadService.selectFiles(path, StaticData.ALL_EXTENSION); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | @SysLog() |
| | | @ApiOperation(value = "查询文件") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "path", value = "路径", dataType = "String", paramType = "query") |
| | | }) |
| | | @GetMapping(value = "/selectFiles2") |
| | | public ResponseMsg<List<MetaFileEntity>> selectFiles2(String path) { |
| | | try { |
| | | List<MetaFileEntity> list = baseUploadService.selectFiles(path, null); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "删除文件") |
| | |
| | | return fail("没有找到文件", null); |
| | | } |
| | | |
| | | int rows = baseUploadService.deleteFiles(list); |
| | | int rows = uploadService.deleteFiles(list); |
| | | |
| | | return success("成功", rows); |
| | | } catch (Exception ex) { |
| | |
| | | return fail("目录ID=" + dirid + "不存在"); |
| | | } |
| | | |
| | | List<TabMapperEntity> list = dataLoaderService.selectMappers(path); |
| | | List<MetaFileEntity> metas = uploadService.selectFiles(path, StaticData.ALL_EXTENSION); |
| | | if (null == metas || metas.isEmpty()) { |
| | | return fail("目录" + path + "下查无文件"); |
| | | } |
| | | |
| | | List<MetaFileEntity> list = uploadService.selectMappers(metas, dir, epsgCode); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | /*@SysLog() |
| | | @ApiOperation(value = "插入文件") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "entity", value = "上传实体类", dataType = "UploadEntity", paramType = "body") |
| | |
| | | // me.setBatch(StringHelper.YMDHMS_FORMAT.format(new Date(me.getCreateTime().getTime()))) |
| | | me.setCreateUser(ue.getId()); |
| | | |
| | | int rows = dataUploadService.insertFiles(me, entity.getFileEntities()); |
| | | // int rows = uploadService.insertFiles(me, entity.getFileEntities()) |
| | | |
| | | return success("成功", rows); |
| | | return success("成功", 0); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | |
| | | // me.setBatch(StringHelper.YMDHMS_FORMAT.format(new Date(me.getCreateTime().getTime()))) |
| | | me.setCreateUser(ue.getId()); |
| | | |
| | | dataLoaderService.insertFiles(me, entity.getFileEntities(), entity.getTabEntities()); |
| | | // uploadService.insertFiles(me, entity.getFileEntities(), entity.getTabEntities()) |
| | | |
| | | return success("成功", entity.getTabEntities()); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | }*/ |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "删除元数据") |