iT邦幫忙

2021 iThome 鐵人賽

DAY 26
0
永豐金融APIs

視覺化跨平台Client與永豐金融證券APIs系列 第 26

視覺化KBARS(4)-controller

今天要來寫controller的部分,

(1)controller新稱showOneMinKbar方法,
並從url取得start_date、end_date、stock_code的值,
帶入後呼叫service oneMinKbar的方法,
最後將值傳回client,回到showKbar頁面

@RequestMapping(value = "/showOneMinKbar" , method = {RequestMethod.GET})
	public String oneMin(Model model, HttpServletRequest pRequest) throws Exception {
		String start_date = pRequest.getParameter("start_date") == null ? "" : pRequest.getParameter("start_date");
		String end_date = pRequest.getParameter("end_date") == null ? "" : pRequest.getParameter("end_date");
		String stock_code = pRequest.getParameter("stock_code") == null ? "" : pRequest.getParameter("stock_code");
		
		String kbar_data = shioajiService.oneMinKbar(start_date, end_date, stock_code);
		JSONObject jsonArray = new JSONObject(kbar_data);
		Gson gson  = new Gson();

		model.addAttribute("kbar_data", gson.toJson(jsonArray));

		return "showKbar";
	}

明天要寫client的部分,
要依照controller的回傳結果顯示畫面。

今天回傳到前台的資料格式如下:
{map:{High:{myArrayList:[596.0,595.0,595.0,595.0,595.0,594.0,595.0,595.0,595.0,595.0,595.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,595.0,595.0,595.0,595.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,595.0,595.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,594.0]},Low:{myArrayList:[593.0,594.0,594.0,594.0,593.0,593.0,593.0,594.0,594.0,594.0,593.0,594.0,594.0,593.0,594.0,593.0,593.0,593.0,594.0,594.0,594.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,594.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,594.0,594.0,595.0,594.0,595.0,594.0,595.0,594.0,595.0,594.0,594.0,594.0,594.0,594.0,595.0,594.0,594.0,594.0,595.0,595.0,593.0,593.0,593.0,593.0,593.0,594.0,594.0,594.0,593.0,593.0,594.0,594.0,594.0,594.0,593.0,593.0,593.0,593.0,594.0,593.0,594.0,592.0,592.0,592.0,593.0,592.0,592.0,592.0,593.0,592.0,592.0,592.0,592.0,592.0,593.0,593.0,593.0,594.0,594.0,593.0,593.0,593.0,594.0,593.0,593.0,593.0,593.0,593.0,593.0,594.0,593.0,593.0,593.0,593.0,594.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,594.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,594.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,594.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,594.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,593.0,594.0,593.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,595.0,594.0,594.0,594.0,594.0,593.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0]},Volume:{myArrayList:[2040,212,319,121,336,236,179,51,174,68,143,20,17,227,70,27,37,53,52,19,75,212,16,17,8,22,34,53,19,84,62,38,158,119,180,16,4,31,44,12,28,159,27,7,70,8,27,31,15,28,92,62,431,32,16,15,88,22,39,19,58,19,23,14,12,67,39,18,17,13,23,14,67,423,23,33,18,53,27,17,7,14,27,30,48,28,18,53,59,25,155,17,58,6,625,32,12,6,21,19,111,7,13,259,19,191,30,11,9,3,3,6,15,11,7,9,11,9,19,70,20,6,6,13,7,18,14,5,20,9,13,14,10,19,18,14,15,110,21,8,13,16,19,6,13,12,7,15,13,19,17,15,20,13,16,7,12,8,14,10,9,55,12,13,14,38,9,11,9,11,14,14,6,16,26,13,13,20,15,14,27,17,14,17,15,288,29,8,8,11,12,19,12,11,14,11,9,13,12,9,16,19,11,21,15,11,15,18,19,25,17,21,18,26,22,60,34,35,43,40,21,185,75,21,24,23,15,26,29,28,39,45,302,9,14,11,19,9,29,12,20,48,17,14,19,55,27,25,110,34,24,27,33,206,313,25,12,13,15,26,166,21,55,79,104,2369]},Close:{myArrayList:[594.0,595.0,594.0,595.0,593.0,594.0,595.0,594.0,594.0,594.0,594.0,594.0,594.0,593.0,594.0,594.0,594.0,594.0,595.0,595.0,594.0,594.0,594.0,593.0,594.0,594.0,594.0,594.0,594.0,593.0,594.0,594.0,594.0,594.0,594.0,593.0,594.0,594.0,593.0,594.0,594.0,594.0,593.0,594.0,594.0,593.0,594.0,594.0,594.0,594.0,593.0,594.0,594.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,594.0,595.0,595.0,595.0,594.0,595.0,595.0,595.0,595.0,595.0,595.0,593.0,593.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,593.0,594.0,594.0,594.0,594.0,594.0,594.0,593.0,593.0,592.0,593.0,593.0,593.0,592.0,593.0,593.0,594.0,593.0,594.0,593.0,594.0,593.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,593.0,593.0,593.0,594.0,594.0,594.0,594.0,593.0,594.0,594.0,594.0,593.0,594.0,594.0,594.0,594.0,594.0,594.0,593.0,594.0,594.0,594.0,594.0,593.0,594.0,594.0,593.0,593.0,594.0,594.0,594.0,593.0,594.0,594.0,593.0,594.0,593.0,594.0,594.0,593.0,594.0,593.0,594.0,593.0,594.0,593.0,594.0,593.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,593.0,593.0,594.0,593.0,594.0,593.0,594.0,594.0,593.0,594.0,594.0,593.0,594.0,593.0,594.0,594.0,594.0,594.0,593.0,593.0,594.0,593.0,594.0,594.0,593.0,594.0,593.0,593.0,594.0,593.0,594.0,593.0,594.0,594.0,593.0,594.0,593.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,593.0,594.0,594.0,594.0,594.0,593.0,594.0,594.0,595.0,595.0,595.0,594.0,595.0,595.0,594.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,594.0,595.0,595.0,595.0,593.0,595.0,594.0,594.0,594.0,595.0,595.0,595.0,594.0,595.0,594.0,594.0]},ts:{myArrayList:[1632819660000000000,1632819720000000000,1632819780000000000,1632819840000000000,1632819900000000000,1632819960000000000,1632820020000000000,1632820080000000000,1632820140000000000,1632820200000000000,1632820260000000000,1632820320000000000,1632820380000000000,1632820440000000000,1632820500000000000,1632820560000000000,1632820620000000000,1632820680000000000,1632820740000000000,1632820800000000000,1632820860000000000,1632820920000000000,1632820980000000000,1632821040000000000,1632821100000000000,1632821160000000000,1632821220000000000,1632821280000000000,1632821340000000000,1632821400000000000,1632821460000000000,1632821520000000000,1632821580000000000,1632821640000000000,1632821700000000000,1632821760000000000,1632821820000000000,1632821880000000000,1632821940000000000,1632822000000000000,1632822060000000000,1632822120000000000,1632822180000000000,1632822240000000000,1632822300000000000,1632822360000000000,1632822420000000000,1632822480000000000,1632822540000000000,1632822600000000000,1632822660000000000,1632822720000000000,1632822780000000000,1632822840000000000,1632822900000000000,1632822960000000000,1632823020000000000,1632823080000000000,1632823140000000000,1632823200000000000,1632823260000000000,1632823320000000000,1632823380000000000,1632823440000000000,1632823500000000000,1632823560000000000,1632823620000000000,1632823680000000000,1632823740000000000,1632823800000000000,1632823860000000000,1632823920000000000,1632823980000000000,1632824040000000000,1632824100000000000,1632824160000000000,1632824220000000000,1632824280000000000,1632824340000000000,1632824400000000000,1632824460000000000,1632824520000000000,1632824580000000000,1632824640000000000,1632824700000000000,1632824760000000000,1632824820000000000,1632824880000000000,1632824940000000000,1632825000000000000,1632825060000000000,1632825120000000000,1632825180000000000,1632825240000000000,1632825300000000000,1632825360000000000,1632825420000000000,1632825480000000000,1632825540000000000,1632825600000000000,1632825660000000000,1632825720000000000,1632825780000000000,1632825840000000000,1632825900000000000,1632825960000000000,1632826020000000000,1632826080000000000,1632826140000000000,1632826200000000000,1632826260000000000,1632826320000000000,1632826380000000000,1632826440000000000,1632826500000000000,1632826560000000000,1632826620000000000,1632826680000000000,1632826740000000000,1632826800000000000,1632826860000000000,1632826920000000000,1632826980000000000,1632827040000000000,1632827100000000000,1632827160000000000,1632827220000000000,1632827280000000000,1632827340000000000,1632827400000000000,1632827460000000000,1632827520000000000,1632827580000000000,1632827640000000000,1632827700000000000,1632827760000000000,1632827820000000000,1632827880000000000,1632827940000000000,1632828000000000000,1632828060000000000,1632828120000000000,1632828180000000000,1632828240000000000,1632828300000000000,1632828360000000000,1632828420000000000,1632828480000000000,1632828540000000000,1632828600000000000,1632828660000000000,1632828720000000000,1632828780000000000,1632828840000000000,1632828900000000000,1632828960000000000,1632829020000000000,1632829080000000000,1632829140000000000,1632829200000000000,1632829260000000000,1632829320000000000,1632829380000000000,1632829440000000000,1632829500000000000,1632829560000000000,1632829620000000000,1632829680000000000,1632829740000000000,1632829800000000000,1632829860000000000,1632829920000000000,1632829980000000000,1632830040000000000,1632830100000000000,1632830160000000000,1632830220000000000,1632830280000000000,1632830340000000000,1632830400000000000,1632830460000000000,1632830520000000000,1632830580000000000,1632830640000000000,1632830700000000000,1632830760000000000,1632830820000000000,1632830880000000000,1632830940000000000,1632831000000000000,1632831060000000000,1632831120000000000,1632831180000000000,1632831240000000000,1632831300000000000,1632831360000000000,1632831420000000000,1632831480000000000,1632831540000000000,1632831600000000000,1632831660000000000,1632831720000000000,1632831780000000000,1632831840000000000,1632831900000000000,1632831960000000000,1632832020000000000,1632832080000000000,1632832140000000000,1632832200000000000,1632832260000000000,1632832320000000000,1632832380000000000,1632832440000000000,1632832500000000000,1632832560000000000,1632832620000000000,1632832680000000000,1632832740000000000,1632832800000000000,1632832860000000000,1632832920000000000,1632832980000000000,1632833040000000000,1632833100000000000,1632833160000000000,1632833220000000000,1632833280000000000,1632833340000000000,1632833400000000000,1632833460000000000,1632833520000000000,1632833580000000000,1632833640000000000,1632833700000000000,1632833760000000000,1632833820000000000,1632833880000000000,1632833940000000000,1632834000000000000,1632834060000000000,1632834120000000000,1632834180000000000,1632834240000000000,1632834300000000000,1632834360000000000,1632834420000000000,1632834480000000000,1632834540000000000,1632834600000000000,1632834660000000000,1632834720000000000,1632834780000000000,1632834840000000000,1632834900000000000,1632834960000000000,1632835020000000000,1632835080000000000,1632835140000000000,1632835200000000000,1632835260000000000,1632835320000000000,1632835380000000000,1632835440000000000,1632835500000000000,1632835800000000000]},Open:{myArrayList:[595.0,594.0,595.0,594.0,595.0,594.0,594.0,595.0,594.0,595.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,595.0,595.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,593.0,593.0,593.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,593.0,594.0,594.0,594.0,594.0,594.0,594.0,593.0,594.0,594.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,594.0,594.0,594.0,593.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,593.0,594.0,594.0,594.0,594.0,594.0,594.0,593.0,592.0,593.0,593.0,592.0,593.0,593.0,593.0,593.0,593.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,593.0,594.0,594.0,594.0,594.0,594.0,594.0,593.0,594.0,594.0,594.0,593.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,593.0,594.0,593.0,593.0,593.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,593.0,594.0,594.0,593.0,594.0,593.0,594.0,593.0,594.0,594.0,594.0,594.0,593.0,594.0,593.0,593.0,594.0,594.0,594.0,594.0,594.0,594.0,593.0,594.0,593.0,594.0,594.0,593.0,594.0,593.0,594.0,594.0,593.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,593.0,594.0,594.0,594.0,594.0,594.0,593.0,594.0,593.0,594.0,594.0,594.0,594.0,594.0,593.0,594.0,593.0,594.0,594.0,594.0,594.0,593.0,593.0,594.0,594.0,594.0,593.0,594.0,593.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,594.0,595.0,595.0,594.0,595.0,595.0,595.0,594.0,595.0,594.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,595.0,594.0,594.0,594.0,595.0,595.0,594.0,595.0,595.0,595.0,595.0,595.0,594.0,595.0,595.0,595.0,594.0]}}}


上一篇
視覺化KBARS(3)-service、serviceImpl
下一篇
視覺化KBARS(5)-1分k展示
系列文
視覺化跨平台Client與永豐金融證券APIs30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言