| | |
| | | import com.lf.server.entity.ctrl.IdNameEntity; |
| | | import com.lf.server.entity.ctrl.KeyValueEntity; |
| | | import com.lf.server.entity.ctrl.TabEntity; |
| | | import com.lf.server.entity.data.DictEntity; |
| | | import com.lf.server.entity.data.DomainEntity; |
| | | import com.lf.server.entity.data.DownloadEntity; |
| | | import com.lf.server.entity.data.*; |
| | | import com.lf.server.entity.sys.AttachEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.AesHelper; |
| | |
| | | import com.lf.server.mapper.all.BasicMapper; |
| | | import com.lf.server.mapper.all.GeomBaseMapper; |
| | | import com.lf.server.service.all.BaseQueryService; |
| | | import com.lf.server.service.data.DictService; |
| | | import com.lf.server.service.data.DirService; |
| | | import com.lf.server.service.data.DownloadService; |
| | | import com.lf.server.service.data.MetaService; |
| | | import com.lf.server.service.show.DataLibService; |
| | | import com.lf.server.service.sys.AttachService; |
| | | import com.lf.server.service.sys.DepService; |
| | |
| | | DepService depService; |
| | | |
| | | @Autowired |
| | | DirService dirService; |
| | | |
| | | @Autowired |
| | | MetaService metaService; |
| | | |
| | | @Autowired |
| | | DataLibService dataLibService; |
| | | |
| | | @Autowired |
| | |
| | | |
| | | @Autowired |
| | | BaseQueryService baseQueryService; |
| | | |
| | | @Autowired |
| | | DictService dictService; |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询记录数") |
| | |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "分页查询") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "映射名称", dataType = "String", paramType = "query", example = "dlgagnp"), |
| | | @ApiImplicitParam(name = "depcode", value = "单位编码", dataType = "String", paramType = "query", example = "00"), |
| | | @ApiImplicitParam(name = "dirs", value = "目录编码", dataType = "String", paramType = "query", example = "00,01"), |
| | | @ApiImplicitParam(name = "filter", value = "过滤条件", dataType = "String", paramType = "query", example = "gid >= 50 and name like '县' and objectid < 5000.0"), |
| | | @ApiImplicitParam(name = "wkt", value = "WKT(著名文本)", dataType = "String", paramType = "query", example = ""), |
| | | //@ApiImplicitParam(name = "srid", value = "空间引用标识符", dataType = "Integer", paramType = "query", example = "4326"), |
| | |
| | | }) |
| | | @GetMapping(value = "/selectByPage") |
| | | @PostMapping(value = "/selectByPage") |
| | | public ResponseMsg<List<Object>> selectByPage(String name, String filter, String wkt, Integer pageIndex, Integer pageSize) { |
| | | public ResponseMsg<List<Object>> selectByPage(String name, String depcode, String dirs, String filter, String wkt, Integer pageIndex, Integer pageSize) { |
| | | try { |
| | | BasicMapper baseMapper = ClassHelper.getBasicMapper(name); |
| | | if (baseMapper == null) { |
| | |
| | | QueryWrapper wrapper = new QueryWrapper(); |
| | | baseQueryService.addFilterWrapper(wrapper, filter); |
| | | baseQueryService.addGeomWrapper(baseMapper, wrapper, wkt); |
| | | if (!StringHelper.isEmpty(depcode)) { |
| | | wrapper.likeRight("depid", depcode); |
| | | } |
| | | |
| | | dirs = DataLibService.copeCodes(dirs, "dirid"); |
| | | if (!StringHelper.isEmpty(dirs)) { |
| | | wrapper.apply(dirs); |
| | | } |
| | | |
| | | Page<Object> page = new Page<>(pageIndex, pageSize); |
| | | page.addOrder(OrderItem.asc("gid")); |
| | |
| | | |
| | | return success(paged.getTotal(), paged.getRecords()); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "根据父ID分页查询并返回记录数") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "metaid", value = "父ID", dataType = "String", paramType = "query", example = "0"), |
| | | @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectPageAndCountByPid") |
| | | public ResponseMsg<List<MetaEntity>> selectPageAndCountByPid(Integer metaid, String name, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("每页页数或分页数小于1", null); |
| | | } |
| | | if (null == metaid || metaid < 1) { |
| | | return fail("父ID不能为空且大于1", null); |
| | | } |
| | | |
| | | int count = metaService.selectCountByPid(metaid, name); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | |
| | | List<MetaEntity> rs = metaService.selectPageByPid(metaid, name, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(wkt); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询所有表") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", example = "点") |
| | | }) |
| | | @GetMapping(value = "/selectTabs") |
| | | public ResponseMsg<List<TabEntity>> selectTabs() { |
| | | public ResponseMsg<List<TabEntity>> selectTabs(String name) { |
| | | try { |
| | | List<TabEntity> list = baseQueryService.selectTabs(); |
| | | List<TabEntity> list = dictService.selectDictTab(name); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | |
| | | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | public ResponseMsg<List<TabEntity>> selectTabsByPage(String depcode, String dirs, String tab, Integer pageSize, Integer pageIndex) { |
| | | public ResponseMsg<Object> selectTabsByPage(String depcode, String dirs, String tab, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("每页页数或分页数小于1", null); |
| | |
| | | return fail("单位代码含有非法字符", null); |
| | | } |
| | | |
| | | String filter = "1=1"; |
| | | String filters = "1=1"; |
| | | if (!StringHelper.isEmpty(depcode)) { |
| | | filter += String.format(" and depid like '%s%%'", depcode); |
| | | filters += String.format(" and depid like '%s%%'", depcode); |
| | | } |
| | | dirs = DataLibService.copeCodes(dirs, "dircode"); |
| | | dirs = DataLibService.copeCodes(dirs, "dirid"); |
| | | if (dirs != null) { |
| | | filter += String.format(" and (%s)", dirs); |
| | | filters += String.format(" and (%s)", dirs); |
| | | } |
| | | filter = filter.replace("1=1 and ", ""); |
| | | |
| | | int count = baseQueryService.selectTabsForCount(tab, filter); |
| | | int count = baseQueryService.selectTabsForCount(tab); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | |
| | | List<TabEntity> rs = baseQueryService.selectTabsByPage(tab, filter, pageSize, pageSize * (pageIndex - 1)); |
| | | List<TabEntity> rs = baseQueryService.selectTabsByPage(tab, filters, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(rows); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), 0); |
| | | return fail(ex, 0); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "根据单位ID集合查询单位") |
| | | @ApiOperation(value = "根据单位编码数组查询单位") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "ids", value = "单位ID集合", dataType = "Integer", paramType = "query", allowMultiple = true, example = "1,10") |
| | | @ApiImplicitParam(name = "codes", value = "单位编码数组", dataType = "String", paramType = "query", allowMultiple = true, example = "00,0001") |
| | | }) |
| | | @GetMapping(value = "/selectDepsByIds") |
| | | public ResponseMsg<Object> selectDepsByIds(Integer[] ids) { |
| | | @GetMapping(value = "/selectDepsByCodes") |
| | | public ResponseMsg<Object> selectDepsByCodes(String[] codes) { |
| | | try { |
| | | if (null == ids || ids.length == 0) { |
| | | if (null == codes || codes.length == 0) { |
| | | return fail("单位ID集合为空"); |
| | | } |
| | | |
| | | List<IdNameEntity> list = depService.selectDepsByIds(ids); |
| | | List<IdNameEntity> list = depService.selectDepsByCodes(codes); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | String guid = dataLibService.createZipFile(ue, dre.getEntities(), dre.getWkt(), dre.getPwd()); |
| | | String depcode = null == dre.getDepcodes() || dre.getDepcodes().isEmpty() ? null : dre.getDepcodes().get(0); |
| | | String guid = dataLibService.createZipFile(ue, dre.getEntities(), depcode, dre.getDirs(), dre.getWkt(), dre.getPwd()); |
| | | |
| | | return success(guid); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | String guid = dataLibService.zipDbData(ue, dre.getEntities().get(0), dre.getFilter(), dre.getPwd()); |
| | | String depcode = null == dre.getDepcodes() || dre.getDepcodes().isEmpty() ? null : dre.getDepcodes().get(0); |
| | | String guid = dataLibService.zipDbData(ue, dre.getEntities().get(0), depcode, dre.getDirs(), dre.getFilter(), dre.getPwd()); |
| | | |
| | | return success(guid); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查看文件") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "guid", value = "附件Guid", dataType = "String", paramType = "body") |
| | | }) |
| | | @GetMapping(value = "/downloadForView") |
| | | public void downloadForView(String guid, HttpServletResponse res) { |
| | | metaService.downloadForView(guid, true, res); |
| | | } |
| | | |
| | | @SysLog() |
| | |
| | | return fail("用户未登录", null); |
| | | } |
| | | |
| | | int count = downloadService.selectCountForUser(ue.getCreateUser(), 4, name); |
| | | int count = downloadService.selectCountForUser(ue.getId(), 4, name); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | List<DownloadEntity> rs = downloadService.selectByPageForUser(ue.getCreateUser(), 4, name, pageSize, pageSize * (pageIndex - 1)); |
| | | List<DownloadEntity> rs = downloadService.selectByPageForUser(ue.getId(), 4, name, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询基础地理类别") |
| | | @GetMapping(value = "/selectBaseType") |
| | | public ResponseMsg<Object> selectBaseType() { |
| | | @ApiOperation(value = "查询目录类别") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", example = "D") |
| | | }) |
| | | @GetMapping(value = "/selectDirTypes") |
| | | public ResponseMsg<Object> selectDirTypes(String name) { |
| | | try { |
| | | List<KeyValueEntity> list = baseQueryService.selectBaseType(); |
| | | List<KeyValueEntity> list = baseQueryService.selectDirTypes(name); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询业务类别") |
| | | @GetMapping(value = "/selectBusinessType") |
| | | public ResponseMsg<Object> selectBusinessType() { |
| | | try { |
| | | List<KeyValueEntity> list = baseQueryService.selectBusinessType(); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询项目名称") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", example = "西") |
| | | }) |
| | | @GetMapping(value = "/selectProject") |
| | | public ResponseMsg<Object> selectProject() { |
| | | public ResponseMsg<Object> selectProject(String name) { |
| | | try { |
| | | List<KeyValueEntity> list = baseQueryService.selectProject(); |
| | | List<DirEntity> list = dirService.selectProject(name); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "根据元数据ID查询") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectMetaById") |
| | | public ResponseMsg<MetaEntity> selectMetaById(int id) { |
| | | try { |
| | | MetaEntity entity = metaService.selectById(id); |
| | | |
| | | return success(entity); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | } |