修改控制器及新增城市功能
This commit is contained in:
		| @@ -159,14 +159,22 @@ public class AorestCoverageController { | ||||
|         return  upload; | ||||
|     } | ||||
|  | ||||
|     @RequestMapping(value = "/Dictionary") | ||||
|     @RequestMapping(value = "/Dictionary",method = {RequestMethod.POST}) | ||||
|     @ApiOperation(value = "字典查询",httpMethod = "POST") | ||||
|      public  AjaxResult Dictionary(@RequestBody Dictionary dic) | ||||
|      { | ||||
|         List<Dictionary> diclist=service.selectDic(dic.getCodingType(),dic.getCodingType1(), dic.getCodingType2()); | ||||
|          return AjaxResult.success(diclist); | ||||
|  | ||||
|      } | ||||
|  | ||||
|     @RequestMapping(value = "/selectNow",method = {RequestMethod.GET}) | ||||
|     @ApiOperation(value = "字典查询",httpMethod = "GET") | ||||
|     public  AjaxResult selectNow(String type) | ||||
|     { | ||||
|         List<Dictionary> diclist=service.selectNow(type); | ||||
|         return AjaxResult.success(diclist); | ||||
|     } | ||||
|  | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,33 @@ | ||||
| package com.ruoyi.web.controller.yada; | ||||
|  | ||||
| import com.ruoyi.common.core.domain.AjaxResult; | ||||
| import com.ruoyi.system.domain_yada.CityVo; | ||||
| import com.ruoyi.system.service_yada.ICityService; | ||||
| import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiOperation; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RequestMethod; | ||||
| import org.springframework.web.bind.annotation.RequestParam; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
|  | ||||
| import javax.annotation.Resource; | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * 城市 | ||||
|  */ | ||||
| @RestController | ||||
| @RequestMapping(value = "/business-service/api/City") | ||||
| @Api(tags = "城市") | ||||
| public class CityController | ||||
| { | ||||
|     @Resource | ||||
|     private ICityService cityService; | ||||
|     @RequestMapping(value = "/getImpervious",method = {RequestMethod.GET}) | ||||
|     @ApiOperation(value = "不透水面面积",httpMethod = "GET") | ||||
|     public AjaxResult getImpervious(String city,String country) | ||||
|     { | ||||
|         List<CityVo> cityVos=cityService.selectCity(city,country); | ||||
|         return  AjaxResult.success(cityVos); | ||||
|     } | ||||
| } | ||||
| @@ -76,11 +76,6 @@ public class SpecialController { | ||||
|         map.put("output","json"); | ||||
|         String value= WeatherUtils.httpRequest(url,map); | ||||
|         WeatherUtilsVO vo = JSON.parseObject(value,WeatherUtilsVO.class); | ||||
| //        String value2=vo.getForecasts().substring(1,vo.getForecasts().length()-1); | ||||
| //        System.out.println(value2); | ||||
| //        vo.setForecast(JSON.parseObject(value2,ForecastVo.class)); | ||||
| //        JSONObject userJson=JSONObject.parseObject(value); | ||||
| //        WeatherUtilsVO utilsValue= JSON.toJavaObject(userJson,WeatherUtilsVO.class); | ||||
|  | ||||
|         return AjaxResult.success(vo); | ||||
|     }    /** | ||||
|   | ||||
| @@ -0,0 +1,38 @@ | ||||
| package com.ruoyi.web.controller.yada; | ||||
|  | ||||
| import com.ruoyi.common.core.domain.AjaxResult; | ||||
| import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiOperation; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RequestMethod; | ||||
| import org.springframework.web.bind.annotation.RequestParam; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
|  | ||||
| /** | ||||
|  * 专题报告 | ||||
|  */ | ||||
| @RestController | ||||
| @RequestMapping(value = "/business-service/api/Special", produces = "application/json;charset=UTF-8") | ||||
| @Api(tags = "专题报告") | ||||
| public class SpecialReportController | ||||
| { | ||||
|  | ||||
|     @RequestMapping(value = "/getWord",method = {RequestMethod.GET}) | ||||
|     @ApiOperation(value = "返回专题报告路径",httpMethod = "GET") | ||||
|     public AjaxResult getWord(@RequestParam("path") String path,@RequestParam("name") String name) | ||||
|     { | ||||
|         String route=""; | ||||
|         switch (path) | ||||
|         { | ||||
|             case "ch": | ||||
|                 route="avatar/word/全球生态环境遥感监测2021年度报告-中文版-20220309.docx"; | ||||
|                 break; | ||||
|             case "en": | ||||
|                 route="avatar/word/全球生态环境遥感监测2021年度报告-英文简本-20211102.docx"; | ||||
|                 break; | ||||
|             default: | ||||
|                 return  AjaxResult.error("未找到对应路径"); | ||||
|         } | ||||
|         return  AjaxResult.success(route); | ||||
|     } | ||||
| } | ||||
| @@ -18,7 +18,7 @@ public class WeatherUtils | ||||
|         //buffer用于接受返回的字符 | ||||
|         StringBuffer buffer = new StringBuffer(); | ||||
|         try { | ||||
|             //建立URL,把请求地址给补全,其中urlencode()方法用于把params里的参数给取出来 | ||||
|             //拼接url连接 | ||||
|             URL url = new URL(requestUrl+"?"+urlencode(params)); | ||||
|             //打开http连接 | ||||
|             HttpURLConnection httpUrlConn = (HttpURLConnection) url.openConnection(); | ||||
| @@ -40,7 +40,6 @@ public class WeatherUtils | ||||
|             bufferedReader.close(); | ||||
|             inputStreamReader.close(); | ||||
|             inputStream.close(); | ||||
|             inputStream = null; | ||||
|             //断开连接 | ||||
|             httpUrlConn.disconnect(); | ||||
|  | ||||
|   | ||||
| @@ -0,0 +1,110 @@ | ||||
| package com.ruoyi.system.domain_yada; | ||||
|  | ||||
| /** | ||||
|  * @Author: JinSheng Song | ||||
|  * @Date: 2022/6/24 9:51 | ||||
|  */ | ||||
| public class CityVo extends SysBaseEntity | ||||
| { | ||||
|     private  String id; | ||||
|  | ||||
|     private  String city; | ||||
|  | ||||
|     private  String area; | ||||
|  | ||||
|     private  String year; | ||||
|  | ||||
|     private  Double imperviousSurfaceArea; | ||||
|  | ||||
|     private  Double imperviousSurfaceCoverage; | ||||
|  | ||||
|     public Double getImperviousSurfaceExpansionSpeed() { | ||||
|         return imperviousSurfaceExpansionSpeed; | ||||
|     } | ||||
|  | ||||
|     public void setImperviousSurfaceExpansionSpeed(Double imperviousSurfaceExpansionSpeed) { | ||||
|         this.imperviousSurfaceExpansionSpeed = imperviousSurfaceExpansionSpeed; | ||||
|     } | ||||
|  | ||||
|     private  Double imperviousSurfaceExpansionSpeed; | ||||
|  | ||||
|     private  Double imperviousSurfaceExpansionStrength; | ||||
|  | ||||
|     private  Double imperviousSurfaceExpansionCntribution ; | ||||
|  | ||||
|     private  String countryIdentification; | ||||
|  | ||||
|     public String getId() { | ||||
|         return id; | ||||
|     } | ||||
|  | ||||
|     public void setId(String id) { | ||||
|         this.id = id; | ||||
|     } | ||||
|  | ||||
|     public String getCity() { | ||||
|         return city; | ||||
|     } | ||||
|  | ||||
|     public void setCity(String city) { | ||||
|         this.city = city; | ||||
|     } | ||||
|  | ||||
|  | ||||
|     public String getYear() { | ||||
|         return year; | ||||
|     } | ||||
|  | ||||
|     public void setYear(String year) { | ||||
|         this.year = year; | ||||
|     } | ||||
|  | ||||
|  | ||||
|     public String getArea() { | ||||
|         return area; | ||||
|     } | ||||
|  | ||||
|     public void setArea(String area) { | ||||
|         this.area = area; | ||||
|     } | ||||
|  | ||||
|     public Double getImperviousSurfaceArea() { | ||||
|         return imperviousSurfaceArea; | ||||
|     } | ||||
|  | ||||
|     public void setImperviousSurfaceArea(Double imperviousSurfaceArea) { | ||||
|         this.imperviousSurfaceArea = imperviousSurfaceArea; | ||||
|     } | ||||
|  | ||||
|     public Double getImperviousSurfaceCoverage() { | ||||
|         return imperviousSurfaceCoverage; | ||||
|     } | ||||
|  | ||||
|     public void setImperviousSurfaceCoverage(Double imperviousSurfaceCoverage) { | ||||
|         this.imperviousSurfaceCoverage = imperviousSurfaceCoverage; | ||||
|     } | ||||
|  | ||||
|     public Double getImperviousSurfaceExpansionStrength() { | ||||
|         return imperviousSurfaceExpansionStrength; | ||||
|     } | ||||
|  | ||||
|     public void setImperviousSurfaceExpansionStrength(Double imperviousSurfaceExpansionStrength) { | ||||
|         this.imperviousSurfaceExpansionStrength = imperviousSurfaceExpansionStrength; | ||||
|     } | ||||
|  | ||||
|     public Double getImperviousSurfaceExpansionCntribution() { | ||||
|         return imperviousSurfaceExpansionCntribution; | ||||
|     } | ||||
|  | ||||
|     public void setImperviousSurfaceExpansionCntribution(Double imperviousSurfaceExpansionCntribution) { | ||||
|         this.imperviousSurfaceExpansionCntribution = imperviousSurfaceExpansionCntribution; | ||||
|     } | ||||
|  | ||||
|     public String getCountryIdentification() { | ||||
|         return countryIdentification; | ||||
|     } | ||||
|  | ||||
|     public void setCountryIdentification(String countryIdentification) { | ||||
|         this.countryIdentification = countryIdentification; | ||||
|     } | ||||
| } | ||||
| @@ -26,4 +26,6 @@ public interface AorestCoverageMapper { | ||||
|  | ||||
|     List<Dictionary> selectDic(@Param("codingType") String codingType,@Param("codingType1") String codingType1, | ||||
|                                @Param("codingType2") String codingType2); | ||||
|  | ||||
|     List<Dictionary> selectNow(@Param("codingType2") String codingType2); | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,16 @@ | ||||
| package com.ruoyi.system.mapper_yada; | ||||
|  | ||||
|  | ||||
| import com.ruoyi.system.domain_yada.CityVo; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * @Author: JinSheng Song | ||||
|  * @Date: 2022/6/24 10:06 | ||||
|  */ | ||||
| public interface CityMapper { | ||||
|  | ||||
|     List<CityVo> selectCity(String city,String gj); | ||||
|  | ||||
| } | ||||
| @@ -28,4 +28,5 @@ public interface IAorestCoverageService { | ||||
|  | ||||
|     List<Dictionary> selectDic(String codingType,String codingType1, | ||||
|                                 String codingType2); | ||||
|     List<Dictionary> selectNow(String codingType2); | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,14 @@ | ||||
| package com.ruoyi.system.service_yada; | ||||
|  | ||||
| import com.ruoyi.system.domain_yada.CityVo; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * @Author: JinSheng Song | ||||
|  * @Date: 2022/6/24 10:11 | ||||
|  */ | ||||
| public interface ICityService { | ||||
|  | ||||
|     List<CityVo> selectCity(String city, String gj); | ||||
| } | ||||
| @@ -55,4 +55,9 @@ public class AorestCoverageServiceimpl implements IAorestCoverageService { | ||||
|                                       String codingType2) { | ||||
|         return  coverageMapper.selectDic(codingType,codingType1,codingType2); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<Dictionary> selectNow(String codingType2) { | ||||
|         return  coverageMapper.selectNow(codingType2); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,23 @@ | ||||
| package com.ruoyi.system.service_yada.impl; | ||||
|  | ||||
| import com.ruoyi.system.domain_yada.CityVo; | ||||
| import com.ruoyi.system.mapper_yada.AorestCoverageMapper; | ||||
| import com.ruoyi.system.mapper_yada.CityMapper; | ||||
| import com.ruoyi.system.service_yada.ICityService; | ||||
|  | ||||
| import javax.annotation.Resource; | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * @Author: JinSheng Song | ||||
|  * @Date: 2022/6/24 10:12 | ||||
|  */ | ||||
| public class CityServiceimpl implements ICityService { | ||||
|  | ||||
|     @Resource | ||||
|     private CityMapper cityMapper; | ||||
|     @Override | ||||
|     public List<CityVo> selectCity(String city, String gj) { | ||||
|         return cityMapper.selectCity(city,gj); | ||||
|     } | ||||
| } | ||||
| @@ -143,4 +143,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|                 </if> | ||||
|                           ) | ||||
|     </select> | ||||
|  | ||||
|  | ||||
|     <select id="selectNow" resultMap="RM_Dictionary"> | ||||
|         select <include refid="columnsdic"/> from dictionary | ||||
|         where coding_type =#{codingType2}; | ||||
|     </select> | ||||
| </mapper>  | ||||
							
								
								
									
										31
									
								
								ruoyi-system/src/main/resources/mapper/system/CityMapper.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								ruoyi-system/src/main/resources/mapper/system/CityMapper.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| <?xml version="1.0" encoding="UTF-8" ?> | ||||
| <!DOCTYPE mapper | ||||
|         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|         "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
| <mapper namespace="com.ruoyi.system.mapper_yada.CityMapper"> | ||||
|  | ||||
|     <resultMap id="RM_City" type="com.ruoyi.system.domain_yada.CityVo"> | ||||
|         <result property="id" column="id"/> | ||||
|         <result property="year" column="year"/> | ||||
|         <result property="city" column="city"/> | ||||
|         <result property="area" column="area"/> | ||||
|         <result property="imperviousSurfaceArea" column="Impervious_surface_area"/> | ||||
|         <result property="imperviousSurfaceCoverage" column="Impervious_surface_coverage"/> | ||||
|         <result property="imperviousSurfaceExpansionSpeed" column="Impervious_surface_expansion_speed"/> | ||||
|         <result property="imperviousSurfaceExpansionStrength" column="Impervious_surface_expansion_strength"/> | ||||
|         <result property="imperviousSurfaceExpansionCntribution" column="Impervious_surface_expansion_Contribution "/> | ||||
|         <result property="countryIdentification" column="country_identification"/> | ||||
|     </resultMap> | ||||
|  | ||||
|     <sql id="columns"> | ||||
| 	    <![CDATA[ | ||||
|         id,year,city,area,Impervious_surface_area,Impervious_surface_coverage,Impervious_surface_expansion_speed,Impervious_surface_expansion_strength,Impervious_surface_expansion_Contribution,country_identification | ||||
|         ]]> | ||||
| 	</sql> | ||||
|  | ||||
|     <select id="selectCity" resultMap="RM_City"> | ||||
|         SELECT  <include refid="columns"/>  FROM  urban_impervious_surface | ||||
|     </select> | ||||
|  | ||||
|  | ||||
| </mapper> | ||||
		Reference in New Issue
	
	Block a user