|
@ -15,6 +15,7 @@ import com.lzbi.common.core.domain.entity.SysDept; |
|
|
import com.lzbi.common.utils.StringUtils; |
|
|
import com.lzbi.common.utils.StringUtils; |
|
|
import com.lzbi.system.service.impl.SysDeptServiceImpl; |
|
|
import com.lzbi.system.service.impl.SysDeptServiceImpl; |
|
|
import io.swagger.annotations.Api; |
|
|
import io.swagger.annotations.Api; |
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.lang.Nullable; |
|
|
import org.springframework.lang.Nullable; |
|
@ -31,6 +32,7 @@ import java.util.concurrent.atomic.AtomicReference; |
|
|
* @author : zhousq |
|
|
* @author : zhousq |
|
|
* @date : 2023-11-16 |
|
|
* @date : 2023-11-16 |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
@Slf4j |
|
|
@Api(tags = "主数据大屏的页面接口") |
|
|
@Api(tags = "主数据大屏的页面接口") |
|
|
@RestController |
|
|
@RestController |
|
|
@RequestMapping("/assetData/dataScreenMain") |
|
|
@RequestMapping("/assetData/dataScreenMain") |
|
@ -195,9 +197,11 @@ public class DcBusiDataScreenMainController extends BaseController{ |
|
|
String yikeapiAppsecret; |
|
|
String yikeapiAppsecret; |
|
|
@GetMapping("/weather/{areaCode}") |
|
|
@GetMapping("/weather/{areaCode}") |
|
|
public AjaxResult getWeather(@PathVariable String areaCode){ |
|
|
public AjaxResult getWeather(@PathVariable String areaCode){ |
|
|
|
|
|
JSONObject ret=new JSONObject(); |
|
|
String url=StrUtil.format("https://v1.yiketianqi.com/free/week?city=沈阳&unescape=1&appid={}&appsecret={}",yikeapiAppid,yikeapiAppsecret); |
|
|
String url=StrUtil.format("https://v1.yiketianqi.com/free/week?city=沈阳&unescape=1&appid={}&appsecret={}",yikeapiAppid,yikeapiAppsecret); |
|
|
JSONObject weather=JSONObject.parseObject(HttpUtil.get(url)); |
|
|
JSONObject weather=JSONObject.parseObject(HttpUtil.get(url)); |
|
|
JSONArray weatherInfo=Optional.ofNullable(weather.getJSONArray("data")).orElse(new JSONArray()); |
|
|
JSONArray weatherInfo=Optional.ofNullable(weather.getJSONArray("data")).orElse(new JSONArray()); |
|
|
|
|
|
if (null != weatherInfo && !weatherInfo.isEmpty()) { |
|
|
JSONArray we_date=new JSONArray(); |
|
|
JSONArray we_date=new JSONArray(); |
|
|
JSONArray we_name=new JSONArray(); |
|
|
JSONArray we_name=new JSONArray(); |
|
|
JSONArray tem_day=new JSONArray(); |
|
|
JSONArray tem_day=new JSONArray(); |
|
@ -218,9 +222,11 @@ public class DcBusiDataScreenMainController extends BaseController{ |
|
|
list.add(tem_day); |
|
|
list.add(tem_day); |
|
|
list.add(tem_night); |
|
|
list.add(tem_night); |
|
|
list.add(we_name); |
|
|
list.add(we_name); |
|
|
JSONObject ret=new JSONObject(); |
|
|
|
|
|
ret.put("source",list); |
|
|
ret.put("source",list); |
|
|
ret.put("realwe",weatherInfo.get(0)); |
|
|
ret.put("realwe",weatherInfo.get(0)); |
|
|
|
|
|
} else { |
|
|
|
|
|
log.error("天气接口未返回数据"); |
|
|
|
|
|
} |
|
|
return AjaxResult.success(ret); |
|
|
return AjaxResult.success(ret); |
|
|
} |
|
|
} |
|
|
/** |
|
|
/** |
|
|