package com.landtool.lanbase.modules.api.controller.MapPortal;
|
|
import java.text.SimpleDateFormat;
|
import java.util.HashMap;
|
import java.util.LinkedList;
|
import java.util.List;
|
import java.util.Map;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
import com.github.pagehelper.Page;
|
import com.github.pagehelper.PageHelper;
|
import com.landtool.lanbase.modules.api.utils.PageBean;
|
import com.landtool.lanbase.modules.res.entity.Res_MainInfo;
|
import com.landtool.lanbase.modules.res.entity.Res_QueryAround;
|
import com.landtool.lanbase.modules.res.service.ResMainInfoService;
|
import com.landtool.lanbase.modules.res.service.ResQueryAroundService;
|
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
|
@Controller
|
@RequestMapping("api")
|
@Api(value = "", tags = {"气泡周边查询"})
|
/**
|
* 气泡——周边查询
|
*/
|
public class ZhouBianChaXunController {
|
@Autowired
|
private ResQueryAroundService resQueryAroundService;
|
|
@Autowired
|
private ResMainInfoService resMainInfoService;
|
|
/**
|
* 当前用户自定义周边查询的关联资源列表
|
* @param res_queryAround
|
* @param pageBean
|
* @return
|
*/
|
@GetMapping("map/zhoubianchaxun")
|
@ResponseBody
|
@ApiOperation(value = "当前用户自定义周边查询的关联资源列表", notes = "")
|
public String getZhouBianChaXun(Res_QueryAround res_queryAround, PageBean pageBean) {
|
Page<Res_MainInfo> page = PageHelper.startPage(pageBean.getPage(), pageBean.getLimit());
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
List<Res_QueryAround> list = resQueryAroundService.getZhouBianChaXunList(res_queryAround);
|
int countNums = (int) ((Page) list).getTotal();
|
PageBean<Res_QueryAround> pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums);
|
pageData.setItems(list);
|
if (list.size() == 0) {
|
res_queryAround.setAdduserid(0);
|
list = resQueryAroundService.getZhouBianChaXunList(res_queryAround);
|
}
|
Map<String, Object> result = new HashMap<>();
|
result.put("totalCount", countNums);
|
List<Map<String, Object>> maps = new LinkedList<>();
|
for (Integer i = 0; i < list.size(); i++) {
|
Res_MainInfo resMainInfo = resMainInfoService.selectByPrimaryKey(list.get(i).getAroundresid());
|
|
Map<String, Object> map = new HashMap<>();
|
map.put("queryid", list.get(i).getQueryid());
|
map.put("resourceid", resMainInfo.getResourceid());
|
map.put("title", resMainInfo.getTitle());
|
map.put("resourceclass", resMainInfo.getResourceclass());
|
map.put("pubdate", sdf.format(resMainInfo.getPubdate()));
|
map.put("datasources", resMainInfo.getDatasources());
|
maps.add(map);
|
}
|
result.put("topics", maps);
|
|
return JSON.toJSONString(result, SerializerFeature.WriteMapNullValue);
|
}
|
|
/**
|
* 用户添加周边查询的关联选择列表
|
* @param resMainInfo
|
* @param pageBean
|
* @return
|
*/
|
@GetMapping("map/maininfoList")
|
@ResponseBody
|
@ApiOperation(value = "用户添加周边查询的关联选择列表", notes = "")
|
public String getMainInfoList(Res_MainInfo resMainInfo, PageBean pageBean) {
|
Page<Res_MainInfo> page = PageHelper.startPage(pageBean.getPage(), pageBean.getLimit());
|
resMainInfo.setResourceclass("KJ_YWTC");
|
List<Res_MainInfo> list = resMainInfoService.selectTiTle(resMainInfo);
|
int countNums = (int) ((Page) list).getTotal();
|
PageBean<Res_MainInfo> pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums);
|
pageData.setItems(list);
|
Map<String, Object> result = new HashMap<>();
|
result.put("totalCount", countNums);
|
List<Map<String, Object>> maps = new LinkedList<>();
|
for (Integer i = 0; i < list.size(); i++) {
|
String title = list.get(i).getTitle();
|
Map<String, Object> map = new HashMap<>();
|
map.put("resourceid", list.get(i).getResourceid());
|
map.put("title", title);
|
map.put("resourceclass", list.get(i).getResourceclass());
|
map.put("pubdate", list.get(i).getPubdate());
|
map.put("datasources", list.get(i).getDatasources());
|
maps.add(map);
|
}
|
result.put("topics", maps);
|
|
return JSON.toJSONString(result, SerializerFeature.WriteMapNullValue);
|
}
|
|
/**
|
* 删除当前用户关联的周边查询资源信息
|
* @param queryid
|
* @return
|
*/
|
@GetMapping("map/zhoubianGuanlianDel")
|
@ResponseBody
|
@ApiOperation(value = "删除当前用户关联的周边查询资源信息", notes = "")
|
public String delGuanlian(Integer queryid) {
|
Integer t = resQueryAroundService.deleteByPrimaryKey(queryid);
|
return t.toString();
|
}
|
}
|