cy
2022-06-21 129904537f66509f97b285e7eb4f42b3dc349dd0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
package cn.ksource.web.controller.wechat.ewyw.stats;
 
import java.util.List;
import java.util.Map;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
 
import cn.ksource.beans.SC_PARTNER_CUSTOMER_INFO;
import cn.ksource.core.util.JsonUtil;
import cn.ksource.core.util.StringUtil;
import cn.ksource.core.web.WebUtil;
import cn.ksource.web.facade.customermanage.CustomerManageFacade;
import cn.ksource.web.facade.tj.CiStatisFacade;
 
@Controller
@RequestMapping("/ewyw/stats/ewConfigStats")
public class EwConfigStatsController {
    
    @Resource
    private CustomerManageFacade customerFacade;
    
    @Resource
    private CiStatisFacade ciStatisFacade;
    
    /**
     * 配置统计首页
     * @param request
     * @return
     */
    @RequestMapping("/ewconfigStatsIndex.html")
    public String ewconfigStatsIndex(HttpServletRequest request){
        return "/business/wechat/ewyw/stats/ewConfigStats/ewconfigStatsIndex";
    }
    
    /**
     * 查询条件
     * @param request
     * @return
     */
    @RequestMapping("/configSearchIndex.html")
    public String configSearchIndex(Model model,HttpServletRequest request){
        List<Map> customers = customerFacade.getCusList();
        model.addAttribute("customers",customers);
        List lv1List = ciStatisFacade.getCiCategoryList( null);
        model.addAttribute("lv1List", lv1List);
        return "/business/wechat/ewyw/stats/ewConfigStats/configSearchIndex";
    }
    
    /**
     * 获取设备分类下拉列表
     * @param request
     * @param response
     */
    @RequestMapping("/getCategotyList.html")
    public void getCategotyList(HttpServletRequest request,HttpServletResponse response){
        String lv1Id = request.getParameter("lv1Id");
        List list = ciStatisFacade.getCiCategoryList(lv1Id);
        WebUtil.write(response, JsonUtil.list2Json(list));
    }
    
    @RequestMapping("/configStatsJump.html")
    public String configStatsJump(HttpServletRequest request){
        String statsType = request.getParameter("statsType");
        if(statsType.equals("type")){
            return "forward:/ewyw/stats/ewConfigStats/ewconfigTypePie.html";
        }else if(statsType.equals("flreport")){
            return "forward:/ewyw/stats/ewConfigStats/ewciTypeTable.html?queryType=TABLE";
        }else if(statsType.equals("csreport")){
            return "forward:/ewyw/stats/ewConfigStats/ewciMainufacturerTable.html";
        }else if(statsType.equals("pzreport")){
            return "forward:/ewyw/stats/ewConfigStats/ewciCountTable.html";
        }
        return "forward:/ewyw/stats/ewConfigStats/ewconfigStatsIndex.html";
    }
    
    /**
     * 
     * @param model
     * @param request
     * @param response
     */
    @RequestMapping("/ewconfigTypePie.html")
    public String ewconfigTypePie(Model model,HttpServletRequest request,HttpServletResponse response){
        String cusId = request.getParameter("cusId");
        String lv1Id = request.getParameter("lv1Id");
        String lv2Id = request.getParameter("lv2Id");
        String queryType = request.getParameter("queryType");
        if(!StringUtil.isEmpty(cusId)){
            Map resMap = ciStatisFacade.getCiTypeChart(cusId,lv1Id,lv2Id,queryType);
            model.addAttribute("chartJsonStr", JsonUtil.map2Json(resMap));
        }
        return "/business/wechat/ewyw/stats/ewConfigStats/ewconfigTypePie";
    }
    
    @RequestMapping("/ewciTypeTable.html")
    public String ewciTypeTable(Model model,HttpServletRequest request,HttpServletResponse response){
        String cusId = request.getParameter("cusId");
        String lv1Id = request.getParameter("lv1Id");
        String lv2Id = request.getParameter("lv2Id");
        String queryType = request.getParameter("queryType");
        if(!StringUtil.isEmpty(cusId)){
            Map resMap = ciStatisFacade.getCiTypeChart(cusId,lv1Id,lv2Id,queryType);
            model.addAttribute("resMap", resMap);
            
            SC_PARTNER_CUSTOMER_INFO cus = new SC_PARTNER_CUSTOMER_INFO(cusId).getInstanceById();
            model.addAttribute("cusName",cus.getShort_name());
        }
        //System.out.println("---------------"+JsonUtil.map2Json(rootMap));
        return "/business/wechat/ewyw/stats/ewConfigStats/ewciTypeTable";
    }
    
    @RequestMapping("/ewciMainufacturerTable.html")
    public String ciMainufacturerTable(Model model,HttpServletRequest request,HttpServletResponse response){
        String queryType = request.getParameter("queryType");
        String cusId = request.getParameter("cusId");
        if(!StringUtil.isEmpty(queryType)){
            Map resMap = ciStatisFacade.getCiMainufacturerChart(cusId,queryType);
            Map rootMap = (Map)resMap.get("rootMap");
            List<Map> lebalList = (List<Map>)resMap.get("lebalList");
            model.addAttribute("rootMap",rootMap);
            model.addAttribute("lebalList",lebalList);
            
            SC_PARTNER_CUSTOMER_INFO cus = new SC_PARTNER_CUSTOMER_INFO(cusId).getInstanceById();
            model.addAttribute("cusName",cus.getShort_name());
        }
        return "/business/wechat/ewyw/stats/ewConfigStats/ewciMainufacturerTable";
    }
    
    @RequestMapping("/ewciCountTable.html")
    public String ciCountTable(Model model,HttpServletRequest request,HttpServletResponse response){
        String cusId = request.getParameter("cusId");
        if(!StringUtil.isEmpty(cusId)){
            Map resMap = ciStatisFacade.getCiCountChart(cusId);
            Map rootMap = (Map)resMap.get("rootMap");
            model.addAttribute("rootMap",rootMap);
            
            SC_PARTNER_CUSTOMER_INFO cus = new SC_PARTNER_CUSTOMER_INFO(cusId).getInstanceById();
            model.addAttribute("cusName",cus.getShort_name());
        }
        //System.out.println("---------------"+JsonUtil.map2Json(rootMap));
        return "/business/wechat/ewyw/stats/ewConfigStats/ewciCountTable";
    }
    
}