| | |
| | | comment on table lf.sys_meta is '源数据表'; |
| | | comment on column lf.sys_meta.id is '主键ID'; |
| | | comment on column lf.sys_meta.eventid is 'GUID'; |
| | | comment on column lf.sys_meta.metaid is '父元数据ID:0-没有'; |
| | | comment on column lf.sys_meta.metaid is '父源数据ID:0-没有'; |
| | | comment on column lf.sys_meta.dirid is '目录ID'; |
| | | comment on column lf.sys_meta.depid is '单位ID'; |
| | | comment on column lf.sys_meta.depcode is '目录编码'; |
| | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 元数据 |
| | | * 源数据 |
| | | * @author WWW |
| | | */ |
| | | @Api(tags = "数据管理\\源数据管理") |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询所有") |
| | | @GetMapping(value = "/selectAll") |
| | | public ResponseMsg<List<MetaEntity>> selectAll() { |
| | | try { |
| | | List<MetaEntity> list = metaService.selectAll(); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "根据ID查询") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询表中数据") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "元数据ID", dataType = "Integer", paramType = "query", example = "115"), |
| | | @ApiImplicitParam(name = "id", value = "源数据ID", dataType = "Integer", paramType = "query", example = "115"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1"), |
| | | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10") |
| | | }) |
| | |
| | | // noinspection AlibabaRemoveCommentedCode |
| | | try { |
| | | if (null == id || id < 0) { |
| | | return fail("元数据ID不能为空或小于0", null); |
| | | return fail("源数据ID不能为空或小于0", null); |
| | | } |
| | | |
| | | MetaEntity meta = metaService.selectById(id); |
| | | if (null == meta || null == meta.getTab() || !meta.getTab().contains(StaticData.POINT)) { |
| | | return fail("找不到元数据信息", null); |
| | | return fail("找不到源数据信息", null); |
| | | } |
| | | |
| | | String entity = meta.getTab().substring(meta.getTab().indexOf(".") + 1).replace("_", "").toLowerCase(); |
| | |
| | | |
| | | List<MetaEntity> list = metaService.selectMetaFiles(reqEntity.getIds()); |
| | | if (null == list || list.isEmpty()) { |
| | | return fail("没有找到元数据"); |
| | | return fail("没有找到源数据"); |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询元数据检查") |
| | | @ApiOperation(value = "查询源数据检查") |
| | | @GetMapping(value = "/selectCheckMeta") |
| | | public ResponseMsg<Object> selectCheckMeta(HttpServletRequest req) { |
| | | try { |
| | |
| | | fme.name = StringHelper.getGuid(); |
| | | fme.xmmc = "西气东输四线天然气管道工程(吐鲁番-中卫)(00116BT02)"; |
| | | fme.sjzy = "测量专业"; |
| | | fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\元数据检查.zip"; |
| | | fme.zipPath = "D:\\Project\\Data\\LF\\temp\\20230107010101\\源数据检查.zip"; |
| | | |
| | | String rs = fmeService.checkMeta(fme, req); |
| | | if (StringHelper.isEmpty(rs)) { |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询表中数据") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "元数据ID", dataType = "Integer", paramType = "query", example = "115"), |
| | | @ApiImplicitParam(name = "id", value = "源数据ID", dataType = "Integer", paramType = "query", example = "115"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1"), |
| | | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10") |
| | | }) |
| | |
| | | // noinspection AlibabaRemoveCommentedCode |
| | | try { |
| | | if (null == id || id < 0) { |
| | | return fail("元数据ID不能为空或小于0", null); |
| | | return fail("源数据ID不能为空或小于0", null); |
| | | } |
| | | |
| | | MetaEntity meta = metaService.selectById(id); |
| | | if (null == meta || null == meta.getTab() || !meta.getTab().contains(StaticData.POINT)) { |
| | | return fail("找不到元数据信息", null); |
| | | return fail("找不到源数据信息", null); |
| | | } |
| | | |
| | | String entity = meta.getTab().substring(meta.getTab().indexOf(".") + 1).replace("_", "").toLowerCase(); |
| | |
| | | @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") |
| | |
| | | return fail("用户未登录", null); |
| | | } |
| | | if (null == ids || ids.length == 0) { |
| | | return fail("找不到元数据的ID集合"); |
| | | return fail("找不到源数据的ID集合"); |
| | | } |
| | | |
| | | 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); |
| | |
| | | |
| | | List<KeyValueEntity> rs = uploadAttachService.uploadXlsAnnex(ue, ms, list, path); |
| | | if (null == rs || rs.size() == 0) { |
| | | return fail("没有要更新的元数据"); |
| | | return fail("没有要更新的源数据"); |
| | | } |
| | | |
| | | return success(rs); |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "插入文件") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "list", value = "元数据文件集合", dataType = "MetaFileEntity", paramType = "body") |
| | | @ApiImplicitParam(name = "list", value = "源数据文件集合", dataType = "MetaFileEntity", paramType = "body") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/insertFiles") |
| | |
| | | return fail("用户未登录", null); |
| | | } |
| | | if (null == list || list.isEmpty()) { |
| | | return fail("元数据文件集合为空", null); |
| | | return fail("源数据文件集合为空", null); |
| | | } |
| | | |
| | | uploadService.insertFiles(ue, list, req); |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "删除元数据") |
| | | @ApiOperation(value = "删除源数据") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "ids", value = "ID数组", dataType = "Integer", paramType = "query", example = "1,2") |
| | | }) |
| | |
| | | VerService verService; |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "分页查询元数据 *") |
| | | @ApiOperation(value = "分页查询源数据 *") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "depcode", value = "单位编码", dataType = "String", paramType = "query", example = "00"), |
| | | @ApiImplicitParam(name = "dircode", value = "目录编码", dataType = "String", paramType = "query", example = "00"), |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "分页查询元数据") |
| | | @ApiOperation(value = "分页查询源数据") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "depcode", value = "单位编码", dataType = "String", paramType = "query", example = "00"), |
| | | @ApiImplicitParam(name = "dirs", value = "目录编码", dataType = "String", paramType = "query", example = "00,01"), |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询表中数据") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "元数据ID", dataType = "Integer", paramType = "query", example = "115"), |
| | | @ApiImplicitParam(name = "id", value = "源数据ID", dataType = "Integer", paramType = "query", example = "115"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1"), |
| | | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10") |
| | | }) |
| | |
| | | // noinspection AlibabaRemoveCommentedCode |
| | | try { |
| | | if (null == id || id < 0) { |
| | | return fail("元数据ID不能为空或小于0", null); |
| | | return fail("源数据ID不能为空或小于0", null); |
| | | } |
| | | |
| | | MetaEntity meta = metaService.selectById(id); |
| | | if (null == meta || null == meta.getTab() || !meta.getTab().contains(StaticData.POINT)) { |
| | | return fail("找不到元数据信息", null); |
| | | return fail("找不到源数据信息", null); |
| | | } |
| | | |
| | | String entity = meta.getTab().substring(meta.getTab().indexOf(".") + 1).replace("_", "").toLowerCase(); |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "请求元数据下载") |
| | | @ApiOperation(value = "请求源数据下载") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "reqEntity", value = "请求下载实体", dataType = "DownloadReqEntity", paramType = "body") |
| | | }) |
| | |
| | | |
| | | List<MetaEntity> list = metaService.selectMetaFiles(reqEntity.getIds()); |
| | | if (null == list || list.isEmpty()) { |
| | | return fail("没有找到元数据"); |
| | | return fail("没有找到源数据"); |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | |
| | | import java.sql.Timestamp; |
| | | |
| | | /** |
| | | * 元数据 |
| | | * 源数据 |
| | | * @author WWW |
| | | */ |
| | | public class MetaEntity implements Serializable { |
| | |
| | | import java.sql.Timestamp; |
| | | |
| | | /** |
| | | * 元数据文件 |
| | | * 源数据文件 |
| | | * @author WWW |
| | | */ |
| | | public class MetaFileEntity implements Serializable { |
| | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 元数据 |
| | | * 源数据 |
| | | * @author WWW |
| | | */ |
| | | @Mapper |
| | |
| | | public MetaEntity selectByGuid(String guid, String tab); |
| | | |
| | | /** |
| | | * 查询元数据文件 |
| | | * 查询源数据文件 |
| | | * |
| | | * @param ids 元数据ID集合 |
| | | * @return 元数据文件集合 |
| | | * @param ids 源数据ID集合 |
| | | * @return 源数据文件集合 |
| | | */ |
| | | public List<MetaEntity> selectMetaFiles(List<Integer> ids); |
| | | |
| | | /** |
| | | * 查询Excel元数据 |
| | | * 查询Excel源数据 |
| | | * |
| | | * @param ids 元数据ID集合 |
| | | * @param ids 源数据ID集合 |
| | | * @param tabs 表名字符串 |
| | | * @return 元数据文件集合 |
| | | * @return 源数据文件集合 |
| | | */ |
| | | public List<MetaEntity> selectXlsAnnex(Integer[] ids, String tabs); |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 创建元数据文件实体类 |
| | | * 创建源数据文件实体类 |
| | | */ |
| | | private MetaFileEntity createMetaFileEntity(MetaFileEntity meta) { |
| | | MetaFileEntity mf = new MetaFileEntity(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 设置元数据文件的类型 |
| | | * 设置源数据文件的类型 |
| | | */ |
| | | private void setMetaType(List<MetaFileEntity> list) { |
| | | for (MetaFileEntity mf : list) { |
| | |
| | | * 打包文件 |
| | | * |
| | | * @param ue 用户实体 |
| | | * @param list 元数据文件集合 |
| | | * @param list 源数据文件集合 |
| | | * @param pwd 密码 |
| | | * @return 下载文件GUID |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 移除重复的元数据文件 |
| | | * 移除重复的源数据文件 |
| | | */ |
| | | private void rmRepeatMetaFiles(List<MetaEntity> list) { |
| | | List<String> guidList = new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 添加元数据文件至Zip包 |
| | | * 添加源数据文件至Zip包 |
| | | */ |
| | | private void addMetaFiles(ZipFile zip, ZipParameters params, List<MetaEntity> list) { |
| | | int i = 1; |
| | |
| | | private DownloadEntity getDownloadEntity(UserEntity ue, String file, String pwd) throws Exception { |
| | | DownloadEntity de = new DownloadEntity(); |
| | | de.setName(FileHelper.getFileName(file)); |
| | | // 1-Shp文件,2-专题图,3-元数据 |
| | | // 1-Shp文件,2-专题图,3-源数据,4-业务数据,5-管道分析,6-统计报告 |
| | | de.setType(3); |
| | | de.setSizes(FileHelper.sizeToMb(new File(file).length())); |
| | | de.setDepid(ue.getDepid()); |
| | | de.setDcount(0); |
| | | de.setPwd(pwd); |
| | | de.setUrl(FileHelper.getRelativePath(file)); |
| | | de.setDescr("元数据文件"); |
| | | de.setDescr("源数据文件"); |
| | | de.setGuid(FileHelper.getFileMd5(file)); |
| | | de.setCreateUser(ue.getId()); |
| | | // de.setGeom(null) |
| | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 元数据 |
| | | * 源数据 |
| | | * @author WWW |
| | | */ |
| | | @Service |
| | |
| | | } |
| | | |
| | | /** |
| | | * 检查元数据文件 |
| | | * 检查源数据文件 |
| | | */ |
| | | private void checkMetaFiles(UserEntity ue, List<MetaFileEntity> list) { |
| | | Timestamp createTime = WebHelper.getCurrentTimestamp(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取Excel元数据文件 |
| | | * 获取Excel源数据文件 |
| | | */ |
| | | private List<MetaFileEntity> getExcelFiles(List<MetaFileEntity> list) { |
| | | List<MetaFileEntity> xlsList = new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取Excel的元数据 |
| | | * 获取Excel的源数据 |
| | | */ |
| | | private MetaFileEntity getExcelMeta(List<MetaFileEntity> xlsList) { |
| | | List<String> pathList = new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 插入元数据 |
| | | * 插入源数据 |
| | | */ |
| | | private void insertMetas(List<MetaFileEntity> list) { |
| | | for (MetaFileEntity mf : list) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 创建元数据 |
| | | * 创建源数据 |
| | | */ |
| | | private MetaEntity createMeta(MetaFileEntity mf) { |
| | | MetaEntity me = new MetaEntity(); |
| | |
| | | private DownloadEntity getDownloadEntity(UserEntity ue, String file, String pwd) throws Exception { |
| | | DownloadEntity de = new DownloadEntity(); |
| | | de.setName(FileHelper.getFileName(file)); |
| | | // 1-Shp文件,2-专题图,3-元数据,4-业务数据 |
| | | // 1-Shp文件,2-专题图,3-源数据,4-业务数据,5-管道分析,6-统计报告 |
| | | de.setType(4); |
| | | de.setSizes(FileHelper.sizeToMb(new File(file).length())); |
| | | de.setDepid(ue.getDepid()); |
| | |
| | | private DownloadEntity getDownloadEntity(UserEntity ue, ExportEntity entity, String file) throws Exception { |
| | | DownloadEntity de = new DownloadEntity(); |
| | | de.setName(FileHelper.getFileName(file)); |
| | | // 1-Shp文件,2-专题图,3-源数据,4-业务数据,5-管道分析,6-统计报告 |
| | | de.setType(2); |
| | | de.setSizes(FileHelper.sizeToMb(new File(file).length())); |
| | | de.setDepid(ue.getDepid()); |
| | |
| | | private DownloadEntity getDownloadEntity(UserEntity ue, String file) throws Exception { |
| | | DownloadEntity de = new DownloadEntity(); |
| | | de.setName(FileHelper.getFileName(file)); |
| | | // 1-Shp文件,2-专题图,3-源数据,4-业务数据,5-管道分析,6-统计报告 |
| | | de.setType(1); |
| | | de.setSizes(FileHelper.sizeToMb(new File(file).length())); |
| | | de.setDepid(ue.getDepid()); |
| | | de.setDcount(0); |
| | | // de.setPwd(null) |
| | | de.setUrl(FileHelper.getRelativePath(file)); |
| | | de.setDescr("shp文件"); |
| | | de.setDescr("Shp文件"); |
| | | de.setGuid(FileHelper.getFileMd5(file)); |
| | | de.setCreateUser(ue.getId()); |
| | | // de.setGeom(null) |
| | |
| | | private DownloadEntity getDownloadEntity(UserEntity ue, String file, String pwd) throws Exception { |
| | | DownloadEntity de = new DownloadEntity(); |
| | | de.setName(FileHelper.getFileName(file)); |
| | | // 1-Shp文件,2-专题图,3-元数据,4-业务数据,5-管道分析 |
| | | // 1-Shp文件,2-专题图,3-源数据,4-业务数据,5-管道分析,6-统计报告 |
| | | de.setType(5); |
| | | de.setSizes(FileHelper.sizeToMb(new File(file).length())); |
| | | de.setDepid(ue.getDepid()); |
| | |
| | | private DownloadEntity getDownloadEntity(UserEntity ue, String file) { |
| | | DownloadEntity de = new DownloadEntity(); |
| | | de.setName(FileHelper.getFileName(file)); |
| | | // 1-Shp文件,2-专题图,3-源数据,4-业务数据,5-管道分析,6-统计报告 |
| | | de.setType(6); |
| | | de.setSizes(FileHelper.sizeToMb(new File(file).length())); |
| | | de.setDepid(ue.getDepid()); |