当前位置:网站首页>internship:接口案例实现
internship:接口案例实现
2022-06-30 04:18:00 【ahyo】
继上一次的demo完成之后 给了两份数据,两者都是json格式。要求编写两个接口 返回json格式数据。
实质:两个接口可同写于一个类下,运行输入url输出json格式数据。
package com.hyd.daring.api;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hyd.daring.common.response.ResponseData;
import com.hyd.daring.model.module.ModuleScheduleInfo;
import com.hyd.daring.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/** * * demo 接口案例 * * @author yyp */
@RequestMapping("/Demo")
@RestController
@Api(tags = "demo 1/2")
@Validated
@Slf4j
public class Demo {
@Resource
private IBizTunnelService iBizTunnelService;
@RequestMapping(value = "/arg",method = RequestMethod.GET)
@ApiOperation(value = "获取各个参数设置")
@ApiOperationSupport(order = 1)
public ResponseData<List<ModuleScheduleInfo>> moduleScheduleInfo ()
{
return new ResponseData<>(iBizTunnelService.moduleScheduleInfo());
}
@RequestMapping(value = "/arg1",method = RequestMethod.GET)
@ApiOperation(value = "详细坐标参数")
@ApiOperationSupport(order=2)
public ResponseData<List<Map>> listResponseData()
{
return new ResponseData<>(iBizTunnelService.arg2());
}
}
public List<Map> arg2() {
List<Map> list=new ArrayList<>();
String[] str=new String[5];
str[0]="ybgg";
str[1]="zfxjj";
str[2]="gyzcjy";
str[3]="shbzjj";
str[4]="total";
Double[] doubles=new Double[5];
doubles[0]=137631.17;
doubles[1]=1404.3;
doubles[2]=0.29;
doubles[3]=0.0;
doubles[4]=139035.76;
Map<String,Object[]> map=new HashMap<>();
Map<String,Double>[] maps=new Map[3];
for (int i = 0; i < 3; i++) {
maps[i]=new HashMap<>();
}
for (int i = 0; i < 3; i++) {
if(i==0)
{
for (int j = 0; j <5; j++) {
maps[i].put(str[j],doubles[j]);
}
}
else
{
for (int k = 0; k <5; k++) {
maps[i].put(str[k],0.0);
}
}
}
Integer[] integers=new Integer[3];
integers[0]=2022;
integers[1]=2021;
integers[2]=2020;
map.put("xaxis",integers);
map.put("yaxis1",maps);
map.put("yaxis2",maps);
list.add(map);
return list;
}
}
边栏推荐
- The new paradigm of AI landing is "hidden" in the next major upgrade of software infrastructure
- Myrpc version 2
- FortiGate firewall quick initialization administrator password
- Error encountered in SQL statement, solve
- JS import and export
- Everyone, Flink 1.13.6, mysql-cdc2.2.0, the datetime (6) class extracted
- Titanic(POJ2361)
- Myrpc version 4
- base64.c
- Clients accessing the daytime service (TCP)
猜你喜欢
Implementation of aut, a self-developed transport layer protocol for sound network -- dev for dev column
[Thesis reading | deep reading] role2vec:role based graph embeddings
Huawei cloud native - data development and datafactory
A solution to the problem of "couldn't open file /mnt/repodata/repomd.xml"
基于ROS的SLAM建图、自动导航、避障(冰达机器人)
Cloud native -- websocket of Web real-time communication technology
The school training needs to make a registration page. It needs to open the database and save the contents entered on the registration page into the database
El upload Upload file (Manual upload, Automatic upload, upload progress)
Myrpc version 0
El upload upload file (manual upload, automatic upload, upload progress)
随机推荐
dotnet-exec 0.5.0 released
OneNote software
(04). Net Maui actual MVVM
Day 11 script and game AI
Graduation project EMS office management system (b/s structure) +j2ee+sqlserver8.0
深度融合云平台,对象存储界的“学霸”ObjectScale来了
Explain the underlying principles of JVM garbage collection in simple terms
管道实现进程间通信之命名管道
Error in conditional filter (if) syntax in sum function in SQL Server2005
【WEBRTC】ADM: rtc_include_internal_audio_device 触发 RTC_DCHECK(adm) 断言
Anonymous pipeline for interprocess communication
Project safety and quality
7-3 打怪升级 单源最短路
I get n offers in two months. I don't have any difficult interviewers here
After the win10 system uses the browser to download, the content is moved or deleted without reason
win10系统使用浏览器下载后,内容无故移动或删除
El upload upload file (manual upload, automatic upload, upload progress)
Ananagrams(UVA156)
Myrpc version 3
JS static method