package com.datav.bigscreen.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import org.springframework.web.util.UriComponentsBuilder;
import java.io.*;
/**
* 返回json格式
* @author user
*
*/
@RestController
@RequestMapping(value = {"/map_china_map", "/line_area_chart", "/pie_source"})
public class Process {
@RequestMapping("/{filename}.json")
public String json(@PathVariable("filename") String filename) throws Exception {
UriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentRequest();
String requestedValue = builder.buildAndExpand().getPath();
System.out.println(requestedValue);
System.out.println(filename);
ChangeJSON("./src/main/resources/static" + requestedValue);
String jsonStr = readJSON("./src/main/resources/static" + requestedValue);
System.out.println(jsonStr);
return jsonStr;
}
public void ChangeJSON(String filename) throws Exception {
System.out.println("正在访问:" + filename);
if (filename.contains("map_china_map.json"))
{
int max=800, min=300;
String objectStr = String.format("[{\"name\": \"上海\", \"confirmAdd\": %d, \"confirm\": %d, \"nowConfirm\": %d}, {\"name\": \"云南\", \"confirmAdd\": %d, \"confirm\": %d, \"nowConfirm\": %d}, {\"name\": \"内蒙古\", \"confirmAdd\": %d, \"confirm\": %d, \"nowConfirm\": %d}, {\"name\": \"北京\", \"confirmAdd\": 373, \"confirm\": 568, \"nowConfirm\": 600}, {\"name\": \"吉林\", \"confirmAdd\": 646, \"confirm\": 396, \"nowConfirm\": 512}, {\"name\": \"四川\", \"confirmAdd\": 749, \"confirm\": 455, \"nowConfirm\": 146}, {\"name\": \"天津\", \"confirmAdd\": 233, \"confirm\": 596, \"nowConfirm\": 878}, {\"name\": \"安徽\", \"confirmAdd\": 595, \"confirm\": 637, \"nowConfirm\": 746}, {\"name\": \"山东\", \"confirmAdd\": 148, \"confirm\": 201, \"nowConfirm\": 850}, {\"name\": \"山西\", \"confirmAdd\": 211, \"confirm\": 481, \"nowConfirm\": 228}, {\"name\": \"广东\", \"confirmAdd\": 136, \"confirm\": 360, \"nowConfirm\": 191}, {\"name\": \"广西\", \"confirmAdd\": 387, \"confirm\": 319, \"nowConfirm\": 324}, {\"name\": \"江苏\", \"confirmAdd\": 870, \"confirm\": 573, \"nowConfirm\": 435}, {\"name\": \"江西\", \"confirmAdd\": 576, \"confirm\": 323, \"nowConfirm\": 124}, {\"name\": \"河北\", \"confirmAdd\": 405, \"confirm\": 542, \"nowConfirm\": 878}, {\"name\": \"河南\", \"confirmAdd\": 210, \"confirm\": 550, \"nowConfirm\": 188}, {\"name\": \"浙江\", \"confirmAdd\": 336, \"confirm\": 549, \"nowConfirm\": 764}, {\"name\": \"海南\", \"confirmAdd\": 758, \"confirm\": 411, \"nowConfirm\": 251}, {\"name\": \"湖北\", \"confirmAdd\": 814, \"confirm\": 264, \"nowConfirm\": 113}, {\"name\": \"湖南\", \"confirmAdd\": 872, \"confirm\": 337, \"nowConfirm\": 181}, {\"name\": \"福建\", \"confirmAdd\": 378, \"confirm\": 749, \"nowConfirm\": 741}, {\"name\": \"贵州\", \"confirmAdd\": 823, \"confirm\": 100, \"nowConfirm\": 603}, {\"name\": \"辽宁\", \"confirmAdd\": 173, \"confirm\": 140, \"nowConfirm\": 589}, {\"name\": \"陕西\", \"confirmAdd\": 546, \"confirm\": 206, \"nowConfirm\": 855}, {\"name\": \"青海\", \"confirmAdd\": 688, \"confirm\": 614, \"nowConfirm\": 480}, {\"name\": \"黑龙江\", \"confirmAdd\": 193, \"confirm\": 220, \"nowConfirm\": 666}]",
(int) (Math.random()*(max-min)+min),
(int) (Math.random()*(max-min)+min),
(int) (Math.random()*(max-min)+min),
(int) (Math.random()*(max-min)+min),
(int) (Math.random()*(max-min)+min),
(int) (Math.random()*(max-min)+min),
(int) (Math.random()*(max-min)+min),
(int) (Math.random()*(max-min)+min),
(int) (Math.random()*(max-min)+min));
System.out.println(objectStr);
StringWrite(filename, objectStr);
}else if (filename.contains("line_area_chart.json"))
{
int max=1000, min=100;
String objectStr = String.format("{\"xAxis\": {\"data\": [\"9:00\", \"10:00\", \"11:00\", \"12:00\", \"13:00\", \"14:00\", \"15:00\", \"16:00\", \"17:00\", \"18:00\", \"19:00\", \"20:00\"]}, \"series\": [{\"data\": [%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d]}]}",
(int)(Math.random()*(max-min)+min),
(int)(Math.random()*(max-min)+min),
(int)(Math.random()*(max-min)+min),
(int)(Math.random()*(max-min)+min),
(int)(Math.random()*(max-min)+min),
(int)(Math.random()*(max-min)+min),
(int)(Math.random()*(max-min)+min),
(int)(Math.random()*(max-min)+min),
(int)(Math.random()*(max-min)+min),
(int)(Math.random()*(max-min)+min),
(int)(Math.random()*(max-min)+min),
(int)(Math.random()*(max-min)+min));
System.out.println(objectStr);
StringWrite(filename, objectStr);
}else if (filename.contains("pie_source.json"))
{
int max=1000, min=100;
String objectStr = String.format("[{\"name\": \"盈利企业\", \"value\": %d}, {\"name\": \"亏损企业\", \"value\": %d}, {\"name\": \"亏损(>50%%)\", \"value\": %d}, {\"name\": \"盈利(>50%%)\", \"value\": %d}]",
(int)(Math.random()*(max-min)+min),
(int)(Math.random()*(max-min)+min),
(int)(Math.random()*(max-min)+min),
(int)(Math.random()*(max-min)+min));
System.out.println(objectStr);
StringWrite(filename, objectStr);
}
//其它json请自行增加相关代码
}
public void StringWrite(String filename, String content) throws Exception {
File jsonFile = new File(filename);
FileOutputStream outputStream = new FileOutputStream(jsonFile);
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new OutputStreamWriter(outputStream, "UTF-8"));
bw.write("");
bw.write(content);
bw.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
bw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static String readJSON(String fileName) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(fileName)));
StringBuilder sb = new StringBuilder();
String line = "";
while ((line = reader.readLine()) != null) {
sb.append(line);
}
String result = sb.toString().replaceAll("\r\n", "").replaceAll(" +", "");
return result;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
基于JavaScript的数据可视化银行监管系统源码(课程设计).zip

共208个文件
js:66个
png:61个
map:29个

1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 192 浏览量
2023-08-21
11:41:07
上传
评论
收藏 86.71MB ZIP 举报
温馨提示
【资源说明】 基于JavaScript的数据可视化银行监管系统源码(课程设计).zip 1、该资源内项目代码都是经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载使用,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能。 欢迎下载,欢迎交流,互相学习进步! 基于JavaScript的数据可视化银行监管系统源码(课程设计).zip基于JavaScript的数据可视化银行监管系统源码(课程设计).zip基于JavaScript的数据可视化银行监管系统源码(课程设计).zip基于JavaScript的数据可视化银行监管系统源码(课程设计).zip基于JavaScript的数据可视化银行监管系统源码(课程设计).zip
资源推荐
资源详情
资源评论

















收起资源包目录





































































































共 208 条
- 1
- 2
- 3
资源评论


onnx
- 粉丝: 1w+
- 资源: 5803
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- weixin071汽车预约维修系统+ssm(文档+源码)_kaic
- weixin072会议发布与预约系统的设计与开发+ssm(文档+源码)_kaic
- weixin073智慧旅游平台开发微信小程序+ssm(文档+源码)_kaic
- weixin074儿童预防接种预约微信小程序+springboot(文档+源码)_kaic
- weixin076亿家旺生鲜云订单零售系统的设计与实现+ssm(文档+源码)_kaic
- weixin075家政服务管理系统+ssm(文档+源码)_kaic
- Python数据科学中Pandas的数据处理核心功能与高级应用解析
- 基于PLECS采用坐标反变换和锁相环的三相逆变器PWM开环控制示例
- Pandas 的安装部署方法以及基本操作介绍
- HCIA-AI课程及试验
- 光伏发电功率预测数据集.zip
- 信息系统项目中人力资源与成本管理的最佳实践及其应用
- electron-v22.3.27-linux-loong64.zip
- Windows时间计算器
- TMC5240步进电机驱动芯片原理图
- 基于Matlab实现语音识别算法(源码+数据).rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
