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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
package cn.ksource.web.controller.uc;
 
import java.util.ArrayList;
import java.util.HashMap;
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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
 
import cn.ksource.core.page.PageInfo;
import cn.ksource.core.util.ConvertUtil;
import cn.ksource.core.util.ParamsMapUtil;
import cn.ksource.core.util.StringUtil;
import cn.ksource.core.web.WebUtil;
import cn.ksource.web.Constants;
import cn.ksource.web.facade.uc.ucsearch.UcSearchFacade;
import cn.ksource.web.service.DataDictionaryService;
 
/**
 * 用户中心--信息查询控制器
 * @author lixinag
 * 
 * */
@Controller
@RequestMapping("/uc/ucsearch")
public class UcSearchController {
    @Resource(name="ucSearchFacade")
    private UcSearchFacade ucSearchFacade;
    
    @Autowired
    private DataDictionaryService dataDictionaryService;
 
    
    /**
     * 查询厂商/集成商列表
     * @param model
     * @param request
     * @return
     */
    @RequestMapping("ucmainufacturerList.html")
    public String mainufacturerList(Model model,HttpServletRequest request){
        Map typeMap=Constants.CMDB_MAINUFACTURER_MAP;
        List<Map> typeList=new ArrayList<Map>();
        for(Object key : typeMap.keySet()){
            Map map = new HashMap();
            map.put("ID", key);
            map.put("VALUE", typeMap.get(key));
            typeList.add(map);
        }
        model.addAttribute("typeList",typeList);
        return "/uc/search/ucmainufacturerList";
    }
    /**
     * 查询厂商/集成商数据
     * @param request
     * @return
     */
    @RequestMapping("ucmainufacturerData.html")
    public String mainufacturerData(Model model,HttpServletRequest request,PageInfo pageInfo){
        Map<String, String> params = ParamsMapUtil.getParameterMap(request);
        //当前登录人的客户id
        params.put("cusId", WebUtil.getWebLoginUserCusId(request));
        PageInfo mainufacturerList=ucSearchFacade.queryMainufacturerData(pageInfo,params);
        model.addAttribute("info", mainufacturerList);
        return "/uc/search/ucmainufacturerData";
    }
    /**
     * 查询厂商/集成商总数
     * @param request
     * @param response
     */
    @RequestMapping("ucmainufacturerCoutn.html")
    public void mainufacturerCoutn(HttpServletRequest request,HttpServletResponse response){
        Map<String, String> params = ParamsMapUtil.getParameterMap(request);
        //当前登录人的客户id
        params.put("cusId", WebUtil.getWebLoginUserCusId(request));
        int count=ucSearchFacade.queryMainufacturerCount(params);
        WebUtil.write(response, String.valueOf(count));
    }
    
    /**
     * 查询厂商/集成商联系人列表
     * @param model
     * @param request
     * @return
     */
    @RequestMapping("uccontactPersonList.html")
    public String contactPersonList(Model model,HttpServletRequest request){
        Map typeMap=Constants.CMDB_MAINUFACTURER_MAP;
        List<Map> typeList=new ArrayList<Map>();
        for(Object key : typeMap.keySet()){
            Map map = new HashMap();
            map.put("ID", key);
            map.put("VALUE", typeMap.get(key));
            typeList.add(map);
        }
        model.addAttribute("typeList",typeList);
        return "/uc/search/uccontactPersonList";
    }
    /**
     * 查询厂商/集成商联系人数据
     * @param model
     * @param request
     * @return
     */
    @RequestMapping("uccontactPersonData.html")
    public String contactPersonData(Model model,HttpServletRequest request,PageInfo pageInfo){
        Map<String, String> params = ParamsMapUtil.getParameterMap(request);
        //当前登录人的客户id
        params.put("cusId", WebUtil.getWebLoginUserCusId(request));
        PageInfo contactPersonList=ucSearchFacade.queryContactPersonData(pageInfo,params);
        model.addAttribute("info", contactPersonList);
        return "/uc/search/uccontactPersonData";
    }
    /**
     * 查询厂商/集成商联系人总数
     * @param request
     * @param response
     */
    @RequestMapping("uccontactPersonCount.html")
    public void contactPersonCount(HttpServletRequest request,HttpServletResponse response){
        Map<String, String> params = ParamsMapUtil.getParameterMap(request);
        //当前登录人的客户id
        params.put("cusId", WebUtil.getWebLoginUserCusId(request));
        int count=ucSearchFacade.queryContactPersonCount(params);
        WebUtil.write(response, String.valueOf(count));
    }
    
    /**
     * 查询客户联系人列表
     * @param model
     * @param request
     * @return
     */
    @RequestMapping("uccontactsList.html")
    public String projectContactsList(Model model,HttpServletRequest request){
        List<Map> levelList=dataDictionaryService.getDataDictionaryByCategoryKey(Constants.PROJECT_CONSTACTS);
        model.addAttribute("levelList", levelList);
        return "/uc/search/uccontactsList";
    }
    /**
     * 查询客户联系人数据
     * @param model
     * @param request
     * @return
     */
    @RequestMapping("uccontactsData.html")
    public String projectContactsData(Model model,HttpServletRequest request,PageInfo pageInfo){
        Map<String, String> params = ParamsMapUtil.getParameterMap(request);
        //当前登录人的客户id
        params.put("cusId", WebUtil.getWebLoginUserCusId(request));
        PageInfo contactsList=ucSearchFacade.queryContactsData(pageInfo,params);
        model.addAttribute("info", contactsList);
        return "/uc/search/uccontactsData";
    }
    /**
     * 查询客户联系人总数
     * @param request
     * @param response
     */
    @RequestMapping("uccontactsCount.html")
    public void projectContactsCount(HttpServletRequest request,HttpServletResponse response){
        Map<String, String> params = ParamsMapUtil.getParameterMap(request);
        //当前登录人的客户id
        params.put("cusId", WebUtil.getWebLoginUserCusId(request));
        int count=ucSearchFacade.queryConttactsCount(params);
        WebUtil.write(response, String.valueOf(count));
    }
    
    /**
     * 知识查询
     * @param request
     * @param response
     * @return
     */
    @RequestMapping("ucsearchKnowList.html")
    public ModelAndView searchKnowList(HttpServletRequest request, HttpServletResponse response) {
        ModelAndView view = new ModelAndView("/uc/search/ucsearchKnowList");
        return view;
    }
    
    @RequestMapping("ucsearchKnowData.html")
    public ModelAndView myCreateKnowData(HttpServletRequest request, HttpServletResponse response,PageInfo pageInfo) {
        ModelAndView view = new ModelAndView("/uc/search/ucsearchKnowData");
        Map<String, String> params = ParamsMapUtil.getParameterMap(request);
        //得到当前登录用户id
        params.put("userId" ,WebUtil.getWebLoginUserId(request));
        System.out.println(WebUtil.getWebLoginUserId(request));
        PageInfo createKnow = ucSearchFacade.getsearchKnowData(pageInfo,params);
        view.addObject("info", createKnow);
        return view;
    }
    
    @RequestMapping("ucsearchKnowCount.html")
    public void myCreateKnowCount(HttpServletRequest request, HttpServletResponse response) {
        Map<String, String> params = ParamsMapUtil.getParameterMap(request);
        //得到当前登录用户id
        params.put("userId" ,WebUtil.getWebLoginUserId(request));
        int count = ucSearchFacade.getsearchKnowCount(params);
        WebUtil.write(response, ConvertUtil.obj2Str(count));
        
    }
    
    /**
     * 跳转到知识分类
     */
    @RequestMapping("ucorderknow.html")
    public ModelAndView knowListTree(HttpServletRequest request,HttpServletResponse response) {
        ModelAndView view = new ModelAndView("/uc/search/ucorderknow");
        Map trees = ucSearchFacade.categoryListTree(request);
        List tree = (List)trees.get("categoryList");
        Map<String,String> slMap = (Map<String,String>)trees.get("slMap");
        
        List checkSl = new ArrayList();
        if(null!=slMap && slMap.size()>0) {
            for (Map.Entry<String, String> entry : slMap.entrySet()) {  
                String key = entry.getKey();
                String value = entry.getValue();
                Map map = new HashMap();
                map.put("checkId", key);
                map.put("checkName", value);
                checkSl.add(map);
            }
        }
        view.addObject("trees", tree);
        view.addObject("checkSl", checkSl);
        return view;
    }
    
    /**
     * 跳转到设备分类
     */
    @RequestMapping("ucorderci.html")
    public ModelAndView ciListTree(HttpServletRequest request,HttpServletResponse response) {
        ModelAndView view = new ModelAndView("/uc/search/ucorderci");
        Map trees = ucSearchFacade.thirdlevelListTree(request);
        List tree = (List)trees.get("categoryList");
        Map<String,String> slMap = (Map<String,String>)trees.get("slMap");
        
        List checkSl = new ArrayList();
        if(null!=slMap && slMap.size()>0) {
            for (Map.Entry<String, String> entry : slMap.entrySet()) {  
                String key = entry.getKey();
                String value = entry.getValue();
                Map map = new HashMap();
                map.put("checkId", key);
                map.put("checkName", value);
                checkSl.add(map);
            }
        }
        view.addObject("trees", tree);
        view.addObject("checkSl", checkSl);
        return view;
    }
}