@RequestMapping(value="/getFundsCount",method=RequestMethod.POST)
public Result getFundsCount(HttpServletRequest request,String depcode) {
//获取用户信息
String tokenuser = redisTemplate.opsForValue().get(request.getHeader("usertoken"));
LoginUser user = (LoginUser) JSONUtil.toBean(tokenuser, LoginUser.class);
String usertype = user.getUsertype();
Map<String,Object> map = new HashMap<String,Object>();
//数量默认值是0
String Notmanagecount = "";
String Rejectcount = "";
String Projectcount = "";
String Fundsidcount = "";
//count返回值long
StringBuffer sqlNotmanagecount = new StringBuffer("SELECT count(*) notmanagecount FROM djjf_project_funds where status=");
StringBuffer sqlRejectcount = new StringBuffer("SELECT count(*) rejectcount FROM djjf_project_funds f LEFT JOIN djjf_review r "
+"ON f.fundsid = r.objectid WHERE f.status=05 AND r.status=02 AND r.creusertype=");
//查询总项目个数
String sqlProjectcount = "SELECT count(*) projectcount FROM djjf_project";
String sqlFundsidcount = "SELECT COUNT(*)fundsidcount FROM djjf_project_funds";
if("jdorg.user".equals(usertype)) {
/*String stq=sqlNotmanagecount.append("'01'").toString();*/
sqlNotmanagecount.append("'01'");
sqlRejectcount.append("'jdorg.user'");//可变参数字符串拼接
if(depcode!=null&&!"".equals(depcode)) {
sqlNotmanagecount.append(" and depcode=").append("'"+depcode+"'");
sqlRejectcount.append(" and f.depcode=").append("'"+depcode+"'");
}
List<Map<String,Object>> countNotmanagecount = baseServerImpi.findListObjectBySql(sqlNotmanagecount.toString());
Notmanagecount = String.valueOf(countNotmanagecount.get().get("notmanagecount"));
//被驳回
List<Map<String,Object>> countRejectcount = baseServerImpi.findListObjectBySql(sqlRejectcount.toString());
Rejectcount = String.valueOf(countRejectcount.get().get("rejectcount"));
}else if("jdleader.user".equals(usertype)) {
sqlNotmanagecount.append("'02'");
sqlRejectcount.append("'jdleader.user'");
if(depcode!=null&&!"".equals(depcode)) {
sqlNotmanagecount.append(" and depcode=").append("'"+depcode+"'");
sqlRejectcount.append(" and f.depcode=").append("'"+depcode+"'");
}
List<Map<String,Object>> countNotmanagecount = baseServerImpi.findListObjectBySql(sqlNotmanagecount.toString());
Notmanagecount = String.valueOf(countNotmanagecount.get().get("notmanagecount"));
//被驳回
List<Map<String,Object>> countRejectcount = baseServerImpi.findListObjectBySql(sqlRejectcount.toString());
Rejectcount = String.valueOf(countRejectcount.get().get("rejectcount"));
}
//项目总数
List<Map<String,Object>> countProjectcount = baseServerImpi.findListObjectBySql(sqlProjectcount);
Projectcount = String.valueOf(countProjectcount.get().get("projectcount"));
//经费总数
List<Map<String,Object>> countFundsidcount = baseServerImpi.findListObjectBySql(sqlFundsidcount);
Fundsidcount = String.valueOf(countFundsidcount.get().get("fundsidcount"));
//将数量放入map
map.put("notmanagecount",Notmanagecount);
map.put("rejectcount",Rejectcount);
map.put("projectcount", Projectcount);
map.put("fundsidcount", Fundsidcount);
return Result.ok().put("result", map);
}