83 lines
2.5 KiB
Plaintext
83 lines
2.5 KiB
Plaintext
package com.nationalelectric.greenH5;
|
||
|
||
import java.text.SimpleDateFormat;
|
||
import java.util.ArrayList;
|
||
import java.util.Date;
|
||
import java.util.HashMap;
|
||
import java.util.Iterator;
|
||
import java.util.List;
|
||
import java.util.Map;
|
||
import java.util.UUID;
|
||
|
||
import javax.annotation.Resource;
|
||
|
||
import org.codehaus.jackson.map.ObjectMapper;
|
||
import org.codehaus.jackson.type.TypeReference;
|
||
import org.springframework.beans.factory.annotation.Autowired;
|
||
import org.springframework.stereotype.Controller;
|
||
import org.springframework.web.bind.annotation.RequestBody;
|
||
import org.springframework.web.bind.annotation.RequestMapping;
|
||
import org.springframework.web.bind.annotation.RequestMethod;
|
||
import org.springframework.web.bind.annotation.ResponseBody;
|
||
|
||
import com.jysoft.weChat.service.WechatService;
|
||
import com.nationalelectirc.Constant.Constant;
|
||
import com.nationalelectirc.utils.RestResult;
|
||
import com.nationalelectric.greenH5.bizc.BaseServiceImpl;
|
||
import com.nationalelectric.greenH5.po.GreenUserInfo;
|
||
import com.sgcc.uap.persistence.IHibernateDao;
|
||
|
||
|
||
|
||
|
||
|
||
|
||
/**
|
||
* <b>概述</b>:<br>
|
||
* <p>
|
||
* <b>功能</b>:<br>
|
||
*
|
||
* @author dell
|
||
*/
|
||
@Controller
|
||
@RequestMapping("/greenStatistics")
|
||
public class GreenStatisticsController extends GreenBaseController {
|
||
/**
|
||
* HibernateDao逻辑构件
|
||
*/
|
||
@Autowired
|
||
IHibernateDao hibernateDao;
|
||
@Autowired
|
||
private BaseServiceImpl baseService;
|
||
@Resource
|
||
private WechatService wService;
|
||
|
||
/**
|
||
* 查询处理人
|
||
* @param requestBody
|
||
* @return
|
||
*/
|
||
@RequestMapping(value = "/getYuyueStatistics", method = RequestMethod.POST)
|
||
@ResponseBody
|
||
public RestResult getYuyueStatistics(@RequestBody Map<String, Object> map) {
|
||
|
||
try {
|
||
String startDate = map.get("startDate").toString();
|
||
String endDate = map.get("endDate").toString();
|
||
String sql = "SELECT type as \"type\", sum( CASE satisfied_level WHEN 0 THEN 1 ELSE 0 END ) AS \"level1\", "
|
||
+ " sum( CASE satisfied_level WHEN 1 THEN 1 ELSE 0 END ) AS \"level2\","
|
||
+ " sum( CASE satisfied_level WHEN 2 THEN 1 ELSE 0 END ) AS \"level3\","
|
||
+ " count(type) FROM green_haircut_comment WHERE to_char(gmt_created,'YYYY-MM-DD')>='"+startDate+"'"
|
||
+ " and to_char(gmt_created,'YYYY-MM-DD')<='"+endDate+"' "
|
||
|
||
+ " GROUP BY type";
|
||
List<Map<String,Object>> list = hibernateDao.queryForListWithSql(sql.toString());
|
||
return new RestResult(Constant.SUCCESS,"成功",list);
|
||
} catch (Exception e) {
|
||
return new RestResult(Constant.FAILED, "查询失败");
|
||
}
|
||
|
||
}
|
||
|
||
}
|