|
@@ -817,6 +817,17 @@ public class ApmacController extends SimpleController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * wifi热点分布查询
|
|
|
+ * @param model
|
|
|
+ * @param cn
|
|
|
+ * @param cnCity
|
|
|
+ * @param placeId
|
|
|
+ * @param placeName
|
|
|
+ * @param page
|
|
|
+ * @param searchValue
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@RequestMapping("/wifisum")
|
|
|
public String queryWifiSumList(Model model,String cn,String cnCity,Integer placeId,
|
|
|
String placeName,@RequestParam(defaultValue = "1") int page,String searchValue){
|
|
@@ -834,15 +845,16 @@ public class ApmacController extends SimpleController {
|
|
|
model.addAttribute("cnCity", "市");
|
|
|
}
|
|
|
if(placeId != null && !"".equals(placeId)){
|
|
|
- condition.put("place", placeId);
|
|
|
+ condition.put("placeId", placeId);
|
|
|
model.addAttribute("placeId", placeId);
|
|
|
model.addAttribute("placeName", placeName);
|
|
|
}else{
|
|
|
model.addAttribute("placeName", "数据场景");
|
|
|
}
|
|
|
if(searchValue != null && !"".equals(searchValue)){
|
|
|
+ model.addAttribute("searchValue", searchValue);
|
|
|
searchValue = "%"+searchValue+"%";
|
|
|
- condition.put("searchValue", searchValue);
|
|
|
+ condition.put("searchValue", searchValue);
|
|
|
}
|
|
|
Integer count = this.wifiSumService.queryWifiSumCountByCondition(condition);
|
|
|
Pager pager = new Pager();
|
|
@@ -856,46 +868,97 @@ public class ApmacController extends SimpleController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 数据导出
|
|
|
- * @param model
|
|
|
+ *wifi热点分布导出
|
|
|
+ * 创建人:zhoujun
|
|
|
+ * 创建时间:2015.12.18 11:43
|
|
|
+ * 注意:前端get请求提交,参数要转码 如:String str = new String(str.getBytes("ISO-8859-1"),"UTF-8");
|
|
|
+ * @param response
|
|
|
* @param cn
|
|
|
* @param cnCity
|
|
|
* @param placeId
|
|
|
* @param placeName
|
|
|
- * @param page
|
|
|
* @param searchValue
|
|
|
*/
|
|
|
@RequestMapping("/exportWifiSumExcel")
|
|
|
- public void queryWifiSumExport(Model model,String cn,String cnCity,Integer placeId,
|
|
|
- String placeName,@RequestParam(defaultValue = "1") int page,String searchValue){
|
|
|
- Map<String,Object>condition = new HashMap<String,Object>();
|
|
|
+ public void queryWifiSumExport(HttpServletResponse response,String cn,String cnCity,Integer placeId,
|
|
|
+ String placeName,String searchValue){
|
|
|
+ Map<String,Object>condition = new HashMap<String,Object>();//存放查询条件
|
|
|
+ Map<String,Object>map = new HashMap<String,Object>();//存放导出excel显示的参数
|
|
|
if(cn != null && !"".equals(cn)){
|
|
|
+ try {
|
|
|
+ cn = new String(cn.getBytes("ISO-8859-1"),"UTF-8");
|
|
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
condition.put("cn", cn);
|
|
|
- model.addAttribute("cn", cn);
|
|
|
+ map.put("cn", cn);
|
|
|
}else{
|
|
|
- model.addAttribute("cn", "省");
|
|
|
+ map.put("cn", "全部");
|
|
|
}
|
|
|
if(cnCity != null && !"".equals(cnCity)){
|
|
|
+ try {
|
|
|
+ cnCity = new String(cnCity.getBytes("ISO-8859-1"),"UTF-8");
|
|
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
condition.put("cnCity", cnCity);
|
|
|
- model.addAttribute("cnCity", cnCity);
|
|
|
+ map.put("cnCity", cnCity);
|
|
|
}else{
|
|
|
- model.addAttribute("cnCity", "市");
|
|
|
+ map.put("cnCity", "全部");
|
|
|
}
|
|
|
if(placeId != null && !"".equals(placeId)){
|
|
|
- condition.put("place", placeId);
|
|
|
- model.addAttribute("placeId", placeId);
|
|
|
- model.addAttribute("placeName", placeName);
|
|
|
+ condition.put("placeId", placeId);
|
|
|
+ try {
|
|
|
+ placeName = new String(placeName.getBytes("ISO-8859-1"),"UTF-8");
|
|
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ map.put("placeName", placeName);
|
|
|
}else{
|
|
|
- model.addAttribute("placeName", "数据场景");
|
|
|
+ map.put("placeName", "全部");
|
|
|
}
|
|
|
if(searchValue != null && !"".equals(searchValue)){
|
|
|
+ try {
|
|
|
+ searchValue = new String(searchValue.getBytes("ISO-8859-1"),"UTF-8");
|
|
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ map.put("searchValue", searchValue);
|
|
|
searchValue = "%"+searchValue+"%";
|
|
|
condition.put("searchValue", searchValue);
|
|
|
+ }else{
|
|
|
+ map.put("searchValue", "请输入查询条件");
|
|
|
}
|
|
|
|
|
|
List<WifiSum> wifiSumList = this.wifiSumService.queryWifiSumByExport(condition);
|
|
|
|
|
|
- model.addAttribute("wifiSumList", wifiSumList);
|
|
|
+ map.put("dataList", wifiSumList);
|
|
|
+ response.reset();
|
|
|
+ // Content-Type:application/vnd.ms-excel;charset=utf8或者text/xml;charset=utf8
|
|
|
+ response.setContentType("application/vnd.ms-excel;charset=utf8");
|
|
|
+ // 设置excel文件名称
|
|
|
+ SimpleDateFormat df2 = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
+ String fileName = "report" + df2.format(new Date());
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename="+ fileName + ".xls");
|
|
|
+ // 需要对excel的列的总数进行指定
|
|
|
+ int column = 4;
|
|
|
+ map.put("dataSize", (wifiSumList.size() + 100));
|
|
|
+ map.put("column", column);
|
|
|
+
|
|
|
+ String excelTemplate = templateProcessor.processTemplate("excel/wifiSumList.ftl", map);
|
|
|
+ try {
|
|
|
+ PrintWriter out = response.getWriter();
|
|
|
+ out.write(excelTemplate);
|
|
|
+ out.flush();
|
|
|
+ out.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
}
|