2
13693261870
2022-09-16 653761a31dfeb50dd3d007e892d69c90bf0cdafc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
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();
    }
}