当前位置:网站首页>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;
}
}
边栏推荐
- 两个月拿到N个offer,什么难搞的面试官在我这里都不算事
- About manipulator on Intelligent Vision Group
- Redis cache avalanche, breakdown and penetration
- Splicing strings with custom functions
- 网络层详解
- 数据链路层详解
- Clients accessing the daytime service (TCP)
- . Net 7 JWT configuration is too convenient!
- SQL追加字段
- Interface testing -- how to analyze an interface?
猜你喜欢

With the deep integration of cloud platform, the "Xueba" objectscale in the object storage industry is coming

【模糊神经网络预测】基于模糊神经网络实现水质预测含Matlab源码

How to use FME to create your own functional software

iMile 利用 Zadig 多云环境周部署千次,跨云跨地域持续交付全球业务

FortiGate firewall quick initialization administrator password

Day 11 script and game AI

Redis sentry, persistence, master-slave, hand tear LRU

尝试链接数据库时出现链接超时报错,如何解决?

进程间通信之匿名管道

Redis cache avalanche, breakdown and penetration
随机推荐
The new paradigm of AI landing is "hidden" in the next major upgrade of software infrastructure
idea灰屏问题
base64.c
Technology sharing | broadcast function design in integrated dispatching
How to analyze and solve the problem of easycvr kernel port error through process startup?
How to use FME to create your own functional software
How to write a conditional statement to obtain the value of the maximum time in a table using a MySQL statement
Huawei cloud native - data development and datafactory
Errno and PERROR
第九天 脚本與資源管理
Everyone, Flink 1.13.6, mysql-cdc2.2.0, the datetime (6) class extracted
el-upload上传文件(手动上传,自动上传,上传进度)
节点CODE相同会导致数据重复
2021-11-04
2021-07-14
lego_ Reading and summary of loam code
Concatenation of Languages(UVA10887)
Pytorch Profiler+ Tensorboard + VS Code
errno和perror
I get n offers in two months. I don't have any difficult interviewers here