package com.landtool.lanbase.modules.api.controller.MapPortal; 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_BusinessRef; import com.landtool.lanbase.modules.res.entity.Res_ExtIntegrate; import com.landtool.lanbase.modules.res.entity.Res_MainInfo; import com.landtool.lanbase.modules.res.service.ResBusinessRefService; import com.landtool.lanbase.modules.res.service.ResExtBusinessLayerService; import com.landtool.lanbase.modules.res.service.ResExtIntegrateService; import com.landtool.lanbase.modules.res.service.ResExtMapUrlService; import com.landtool.lanbase.modules.res.service.ResMainInfoService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @Controller @RequestMapping("api") @Api(value = "", tags = {"气泡关联分析"}) /** * 气泡——关联分析 */ public class GuanLianFenXiController { @Autowired private ResBusinessRefService resBusinessRefService; @Autowired private ResMainInfoService resMainInfoService; @Autowired private ResExtBusinessLayerService resExtBusinessLayerService; @Autowired private ResExtMapUrlService resExtMapUrlService; @Autowired private ResExtIntegrateService resExtIntegrateService; /** * 获取相关关联图层列表 * @param resBusinessRef * @return */ @GetMapping("map/getResBusinessRefList") @ResponseBody @ApiOperation(value = "获取相关关联图层列表", notes = "") public String getResBusinessRefList(Res_BusinessRef resBusinessRef, PageBean pageBean) { pageBean.setLimit(10); PageHelper.startPage(pageBean.getPage(), pageBean.getLimit());//设置当前页数及每页条数 List list = resBusinessRefService.getResBusinesssRefList(resBusinessRef); int countNums = (int) ((Page) list).getTotal();//获取记录总数 PageBean pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums); pageData.setItems(list); List> maps = new LinkedList<>(); for (Integer i = 0; i < list.size(); i++) { Res_MainInfo resMainInfo = resMainInfoService.selectByPrimaryKey(list.get(i).getRefresourceid()); Res_BusinessRef resBusinessRef1 = resBusinessRefService.selectByPrimaryKey(list.get(i).getResourceid()); Res_ExtIntegrate resExtIntegrate = resExtIntegrateService.selectByPrimaryKey(list.get(i).getRefresourceid()); Map map = new HashMap<>(); map.put("title", resMainInfo.getTitle()); map.put("resourceid", resMainInfo.getResourceid()); map.put("resourceclass", resMainInfo.getResourceclass()); map.put("createuserid", resMainInfo.getCreateuserid()); if (resBusinessRef1 != null) { map.put("inputparam", resBusinessRef1.getInputparam()); map.put("outputparam", resBusinessRef1.getOutputparam()); map.put("reftype", resBusinessRef1.getReftype()); } else { map.put("inputparam", ""); map.put("outputparam", ""); map.put("reftype", ""); } if (resExtIntegrate != null) { map.put("serverurl", resExtIntegrate.getServerurl()); map.put("showmodel", resExtIntegrate.getShowmodel()); } else { map.put("serverurl", ""); map.put("showmodel", ""); } map.put("datasources", resMainInfo.getDatasources()); maps.add(map); } Map result = new HashMap<>(); result.put("Count", countNums); result.put("Page", pageBean.getPage()); result.put("ShuJu", maps); return JSON.toJSONString(result, SerializerFeature.WriteMapNullValue); } }