ajax获取java后台数据_Ajax获取到的数据如何展示在HTML

@RequestMapping("/getListByIdAndYear1")

@ResponseBody

public Object getListByIdAndYear1(@RequestBody InvestVo investVo) {

if (ToolUtil.isEmpty(investVo)){

return null;

}

if (investVo.getInvestYear() == null){

SimpleDateFormat sdf = new SimpleDateFormat("yyyy");

Date date = new Date();

String investYear = sdf.format(date);

System.out.println("今年是:"+investYear);

investVo.setInvestYear(investYear);

}

List yearInvestVoList = null;

List total = new ArrayList();

List projectList = investVo.getProjectId();

System.out.println(projectList);

String arr[]=new String[12]; //计划投资数组

String arr1[]=new String[12]; //计划投资数组

yearInvestVoList = yearInvestService.getListByIdAndYear(projectList,investVo.getInvestYear());

System.out.println(yearInvestVoList);

if(yearInvestVoList.get(0) != null && !yearInvestVoList.isEmpty() && yearInvestVoList.size()>0){

arr[0] = yearInvestVoList.get(0).getPlanJanuary().toString();

arr[1] = yearInvestVoList.get(0).getPlanFebruary().toString();

arr[2] = yearInvestVoList.get(0).getPlanMarch().toString();

arr[3] = yearInvestVoList.get(0).getPlanApril().toString();

arr[4] = yearInvestVoList.get(0).getPlanMay().toString();

arr[5] = yearInvestVoList.get(0).getPlanJune().toString();

arr[6] = yearInvestVoList.get(0).getPlanJuly().toString();

arr[7] = yearInvestVoList.get(0).getPlanAugust().toString();

arr[8] = yearInvestVoList.get(0).getPlanSeptember().toString();

arr[9] = yearInvestVoList.get(0).getPlanOctober().toString();

arr[10] = yearInvestVoList.get(0).getPlanNovember().toString();

arr[11] = yearInvestVoList.get(0).getPlanDecember().toString();

arr1[0] = yearInvestVoList.get(0).getRealJanuary().toString();

arr1[1] = yearInvestVoList.get(0).getRealFebruary().toString();

arr1[2] = yearInvestVoList.get(0).getRealMarch().toString();

arr1[3] = yearInvestVoList.get(0).getRealApril().toString();

arr1[4] = yearInvestVoList.get(0).getRealMay().toString();

arr1[5] = yearInvestVoList.get(0).getRealJune().toString();

arr1[6] = yearInvestVoList.get(0).getRealJuly().toString();

arr1[7] = yearInvestVoList.get(0).getRealAugust().toString();

arr1[8] = yearInvestVoList.get(0).getRealSeptember().toString();

arr1[9] = yearInvestVoList.get(0).getRealOctober().toString();

arr1[10] = yearInvestVoList.get(0).getRealNovember().toString();

arr1[11] = yearInvestVoList.get(0).getRealDecember().toString();

}

List plan = Arrays.asList(arr);

System.out.println("计划投资数据:"+plan);

List real = Arrays.asList(arr1);

System.out.println("实际投资数据:"+real);

List yearList ;

List plist = new ArrayList<>();

List oneProject = new ArrayList<>();

String condition = null;

for (int i = 0;i

ProjectInfoVo projectInfoVo = projectInfoService.getProListById1(condition, Integer.parseInt(projectList.get(i).toString().trim()));

oneProject.add(projectList.get(i));

System.out.println(oneProject);

yearList = yearInvestService.getListByIdAndYear(oneProject,investVo.getInvestYear());

System.out.println("投资信息:"+yearList);

if(yearList.size()==1&&null==yearList.get(0)||yearList.size()==0){

}else{

projectInfoVo.setInvestTotal(yearList.get(0).getPlanYearTotal());

plist.add(projectInfoVo);

}

}

System.out.println("投资信息:"+plist);

JSONArray array= JSONArray.fromObject(yearInvestVoList.get(0));

System.out.println(array);

Map map = new HashMap();

map.put("result",200);

map.put("plist",plist);

map.put("plan",plan);

map.put("real",real);

map.put("item",yearInvestVoList);

return map;

}

@RequestMapping("/getListByIdAndYear1")

@ResponseBody

public Object getListByIdAndYear1(@RequestBody InvestVo investVo) {

if (ToolUtil.isEmpty(investVo)){

return null;

}

if (investVo.getInvestYear() == null){

SimpleDateFormat sdf = new SimpleDateFormat("yyyy");

Date date = new Date();

String investYear = sdf.format(date);

System.out.println("今年是:"+investYear);

investVo.setInvestYear(investYear);

}

List yearInvestVoList = null;

List total = new ArrayList();

List projectList = investVo.getProjectId();

System.out.println(projectList);

String arr[]=new String[12]; //计划投资数组

String arr1[]=new String[12]; //计划投资数组

yearInvestVoList = yearInvestService.getListByIdAndYear(projectList,investVo.getInvestYear());

System.out.println(yearInvestVoList);

if(yearInvestVoList.get(0) != null && !yearInvestVoList.isEmpty() && yearInvestVoList.size()>0){

arr[0] = yearInvestVoList.get(0).getPlanJanuary().toString();

arr[1] = yearInvestVoList.get(0).getPlanFebruary().toString();

arr[2] = yearInvestVoList.get(0).getPlanMarch().toString();

arr[3] = yearInvestVoList.get(0).getPlanApril().toString();

arr[4] = yearInvestVoList.get(0).getPlanMay().toString();

arr[5] = yearInvestVoList.get(0).getPlanJune().toString();

arr[6] = yearInvestVoList.get(0).getPlanJuly().toString();

arr[7] = yearInvestVoList.get(0).getPlanAugust().toString();

arr[8] = yearInvestVoList.get(0).getPlanSeptember().toString();

arr[9] = yearInvestVoList.get(0).getPlanOctober().toString();

arr[10] = yearInvestVoList.get(0).getPlanNovember().toString();

arr[11] = yearInvestVoList.get(0).getPlanDecember().toString();

arr1[0] = yearInvestVoList.get(0).getRealJanuary().toString();

arr1[1] = yearInvestVoList.get(0).getRealFebruary().toString();

arr1[2] = yearInvestVoList.get(0).getRealMarch().toString();

arr1[3] = yearInvestVoList.get(0).getRealApril().toString();

arr1[4] = yearInvestVoList.get(0).getRealMay().toString();

arr1[5] = yearInvestVoList.get(0).getRealJune().toString();

arr1[6] = yearInvestVoList.get(0).getRealJuly().toString();

arr1[7] = yearInvestVoList.get(0).getRealAugust().toString();

arr1[8] = yearInvestVoList.get(0).getRealSeptember().toString();

arr1[9] = yearInvestVoList.get(0).getRealOctober().toString();

arr1[10] = yearInvestVoList.get(0).getRealNovember().toString();

arr1[11] = yearInvestVoList.get(0).getRealDecember().toString();

}

List plan = Arrays.asList(arr);

System.out.println("计划投资数据:"+plan);

List real = Arrays.asList(arr1);

System.out.println("实际投资数据:"+real);

List yearList ;

List plist = new ArrayList<>();

List oneProject = new ArrayList<>();

String condition = null;

for (int i = 0;i

ProjectInfoVo projectInfoVo = projectInfoService.getProListById1(condition, Integer.parseInt(projectList.get(i).toString().trim()));

oneProject.add(projectList.get(i));

System.out.println(oneProject);

yearList = yearInvestService.getListByIdAndYear(oneProject,investVo.getInvestYear());

System.out.println("投资信息:"+yearList);

if(yearList.size()==1&&null==yearList.get(0)||yearList.size()==0){

}else{

projectInfoVo.setInvestTotal(yearList.get(0).getPlanYearTotal());

plist.add(projectInfoVo);

}

}

System.out.println("投资信息:"+plist);

JSONArray array= JSONArray.fromObject(yearInvestVoList.get(0));

System.out.println(array);

Map map = new HashMap();

map.put("result",200);

map.put("plist",plist);

map.put("plan",plan);

map.put("real",real);

map.put("item",yearInvestVoList);

return map;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值