记得上下班打卡 | git大法好,push需谨慎

Commit a3955b51 authored by GaoHu's avatar GaoHu

读取省市区json文件

parent 8f765960
package com.liquidnet.client.admin.web.controller.zhengzai.smile; package com.liquidnet.client.admin.web.controller.zhengzai.smile;
import com.alibaba.druid.support.json.JSONUtils;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.liquidnet.client.admin.common.core.controller.BaseController; import com.liquidnet.client.admin.common.core.controller.BaseController;
import com.liquidnet.client.admin.common.core.domain.AjaxResult; import com.liquidnet.client.admin.common.core.domain.AjaxResult;
...@@ -107,7 +108,9 @@ public class SmileUserController extends BaseController { ...@@ -107,7 +108,9 @@ public class SmileUserController extends BaseController {
public AjaxResult getAreaJson(){ public AjaxResult getAreaJson(){
String jsonStr = ""; String jsonStr = "";
try { try {
File jsonFile = ResourceUtils.getFile("classpath:static/area.json"); String path = JSONUtils.class.getClassLoader().getResource("static/area.json").getPath();
File jsonFile = ResourceUtils.getFile(path);
// File jsonFile = ResourceUtils.getFile("classpath:static/area.json");
Reader reader = new InputStreamReader(new FileInputStream(jsonFile), "utf-8"); Reader reader = new InputStreamReader(new FileInputStream(jsonFile), "utf-8");
int ch = 0; int ch = 0;
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment