| | |
| | | package com.lf.server.controller.data; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.OrderItem; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.lf.server.annotation.SysLog; |
| | | import com.lf.server.controller.all.BaseQueryController; |
| | | import com.lf.server.controller.all.BaseController; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.bs.BsprojectEntity; |
| | | import com.lf.server.entity.ctrl.KeyValueEntity; |
| | | import com.lf.server.entity.data.DictEntity; |
| | | import com.lf.server.entity.data.DirEntity; |
| | | import com.lf.server.entity.sys.DepEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.helper.WebHelper; |
| | | import com.lf.server.mapper.bs.BsprojectMapper; |
| | | import com.lf.server.service.all.BaseQueryService; |
| | | import com.lf.server.service.data.DirService; |
| | | import com.lf.server.service.sys.DepService; |
| | | import com.lf.server.service.sys.TokenService; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 数据检索 |
| | | * 项目管理 |
| | | * @author WWW |
| | | */ |
| | | @Api(tags = "数据管理\\项目管理") |
| | | @RestController |
| | | @RequestMapping("/project") |
| | | public class ProjectController extends BaseQueryController { |
| | | public class ProjectController extends BaseController { |
| | | @Autowired |
| | | DepService depService; |
| | | |
| | |
| | | @Autowired |
| | | BsprojectMapper bsprojectMapper; |
| | | |
| | | @Autowired |
| | | BaseQueryService baseQueryService; |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询所有单位数据") |
| | | @GetMapping(value = "/selectDepAll") |
| | |
| | | List<DepEntity> list = depService.selectDepAll(); |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询所有目录数据") |
| | | @GetMapping(value = "/selectDirAll") |
| | | public ResponseMsg<List<DirEntity>> selectDirAll() { |
| | | @ApiOperation(value = "查询项目") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", example = "西") |
| | | }) |
| | | @GetMapping(value = "/selectProject") |
| | | public ResponseMsg<List<DirEntity>> selectProject(String name) { |
| | | try { |
| | | List<DirEntity> list = dirService.selectDirAll(); |
| | | 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查询") |
| | | @ApiOperation(value = "分页查询并返回记录数") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "dirid", value = "目录ID", dataType = "int", paramType = "query", example = "0") |
| | | @ApiImplicitParam(name = "dirid", value = "目录ID", dataType = "String", paramType = "query", example = "1"), |
| | | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectByDirid") |
| | | public ResponseMsg<BsprojectEntity> selectByDirid(int dirid) { |
| | | @GetMapping(value = "/selectByPageAndCount") |
| | | public ResponseMsg<Object> selectByPageAndCount(String dirid, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | Map<String, Object> map = new HashMap<>(1); |
| | | map.put("dirid", dirid); |
| | | |
| | | List<BsprojectEntity> list = bsprojectMapper.selectByMap(map); |
| | | if (null == list || list.isEmpty()) { |
| | | return success(null); |
| | | QueryWrapper<BsprojectEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.select("ST_AsText(geom) as geom, *"); |
| | | if (null != dirid) { |
| | | wrapper.eq("dirid", dirid); |
| | | } |
| | | |
| | | return success(list.get(0)); |
| | | Page<BsprojectEntity> page = new Page<>(pageIndex, pageSize); |
| | | page.addOrder(OrderItem.asc("gid")); |
| | | Page paged = bsprojectMapper.selectPage(page, wrapper); |
| | | |
| | | return success(paged.getTotal(), paged.getRecords()); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询字段信息") |
| | | @GetMapping(value = "/selectFields") |
| | | public ResponseMsg<List<DictEntity>> selectFields() { |
| | | try { |
| | | String tabName = BaseQueryService.getTabName(bsprojectMapper); |
| | | if (tabName == null) { |
| | | return null; |
| | | } |
| | | |
| | | String[] strs = tabName.split("\\."); |
| | | List<DictEntity> list = baseQueryService.selectFields(strs[0], strs[1]); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询位置") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "x", value = "X", dataType = "Double", paramType = "query", example = "114.178955"), |
| | | @ApiImplicitParam(name = "y", value = "Y", dataType = "Double", paramType = "query", example = "38.991743") |
| | | }) |
| | | @GetMapping(value = "/selectLocation") |
| | | public ResponseMsg<Object> selectLocation(double x, double y) { |
| | | try { |
| | | String wkt = String.format("POINT(%f %f)", x, y); |
| | | List<KeyValueEntity> list = baseQueryService.selectLocation(wkt); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(rows); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | entity.setCreateuser(ue.getId()); |
| | | entity.setCreatetime(WebHelper.getCurrentTimestamp()); |
| | | entity.setGeom(StringHelper.getGeomWKT(entity.getGeom())); |
| | | entity.setGeom(StringHelper.getGeomWkt(entity.getGeom())); |
| | | |
| | | List<BsprojectEntity> list = new ArrayList<>(); |
| | | list.add(entity); |
| | |
| | | |
| | | return success(rows); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | entity.setUpdateuser(ue.getId()); |
| | | entity.setUpdatetime(WebHelper.getCurrentTimestamp()); |
| | | entity.setGeom(StringHelper.getGeomWKT(entity.getGeom())); |
| | | entity.setGeom(StringHelper.getGeomWkt(entity.getGeom())); |
| | | |
| | | List<BsprojectEntity> list = new ArrayList<>(); |
| | | list.add(entity); |
| | |
| | | |
| | | return success(rows); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | } |