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
package cn.ksource.web.controller.business.pages.customerconfig;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
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.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import cn.ksource.beans.CMDB_MAINUFACTURER;
import cn.ksource.beans.CMDB_MAINUFACTURER_CONTACTS;
import cn.ksource.beans.SC_PARTNER_CUSTOMER_INFO;
import cn.ksource.core.page.PageInfo;
import cn.ksource.core.util.ParamsMapUtil;
import cn.ksource.core.util.PinYinUtil;
import cn.ksource.core.util.StringUtil;
import cn.ksource.core.web.SysInfo;
import cn.ksource.core.web.WebUtil;
import cn.ksource.web.facade.customerconfig.CustomerCsFacade;
 
/**
 * 客户管理--厂商/集成商管理控制器
 * @note:
 * @version
 * @author sxj
 * @date June 28, 2016 10:35:44 AM
 */
@Controller
@RequestMapping("/business/pages/customerconfig/cuscs")
public class CusCsController {
    
    @Autowired
    private CustomerCsFacade customerCsFacade;
    
    /**
     * 查询该项目的厂商信息
     */
    @RequestMapping("cslist.html")
    public ModelAndView cslist(HttpServletRequest request) {
        ModelAndView modelAndView = new ModelAndView("/business/pages/customerconfig/cuscs/cslist");
        String customerId = request.getParameter("customerId");
        if(StringUtil.notEmpty(customerId)) {
            Map project = new SC_PARTNER_CUSTOMER_INFO(customerId).getBeanMapById();
            modelAndView.addObject("project", project);
        }
        
        return modelAndView;
    }
    
    /**
     * 查询厂商/集成商数据
     */
    @RequestMapping("csData.html")
    public ModelAndView csData(HttpServletRequest request,PageInfo pageInfo) {
        ModelAndView modelAndView = new ModelAndView("/business/pages/customerconfig/cuscs/csData");
        //定义参数Map
        Map<String,String> params = ParamsMapUtil.getParameterMap(request);
        PageInfo companys = customerCsFacade.queryCsJscList(pageInfo,params);
        modelAndView.addObject("companys", companys);
        return modelAndView;
    }
    /**
     * 查询厂商/集成商数量
     */
    @RequestMapping("csCount.html")
    public void csCount(HttpServletRequest request,HttpServletResponse response) {
        //定义参数Map
        Map<String,String> params = ParamsMapUtil.getParameterMap(request);
        int count = customerCsFacade.queryCsJscCount(params);
        WebUtil.write(response, String.valueOf(count));
    }
    
    /**
     * 跳转到联系人列表页面
     */
    @RequestMapping("contactList.html")
    public ModelAndView contactList(HttpServletRequest request,HttpServletResponse response) {
        ModelAndView modelAndView = new ModelAndView("/business/pages/customerconfig/cuscs/contactList");
        //定义参数Map
        Map<String,String> params = ParamsMapUtil.getParameterMap(request);
        List contacts = customerCsFacade.queryContacts(params);
        modelAndView.addObject("contacts", contacts);
        return modelAndView;
    }
    
    
    /**
     * 跳转到添加联系人页面
     */
    @RequestMapping(value="addCsContact.html",method=RequestMethod.GET)
    public ModelAndView addCsContact(HttpServletRequest request) {
        ModelAndView modelAndView = new ModelAndView("/business/pages/customerconfig/cuscs/addCsContact");
        String id = request.getParameter("id");
        if(StringUtil.isEmpty(id)){
            modelAndView.addObject("contact", new HashMap());
        }else{
            Map contact = new CMDB_MAINUFACTURER_CONTACTS(id).getBeanMapById();
            modelAndView.addObject("contact", contact);
        }
        
        return modelAndView;
    }
    
    /**
     * 添加联系人
     */
    @RequestMapping(value="addCsContact.html",method=RequestMethod.POST)
    public ModelAndView saveCsContact(HttpServletRequest request,CMDB_MAINUFACTURER_CONTACTS contact) {
        String result = customerCsFacade.saveContact(request,contact);
        return WebUtil.sysInfoPage(request, "操作成功!",
                "window.top.document.getElementById('dialogIframe0').contentWindow.location.reload(true);window.top.hideDialog('1');",
                SysInfo.Success,"");
    }
    
    /**
     * 删除联系人
     */
    @RequestMapping("delContact.html")
    public void delContact(HttpServletRequest request,HttpServletResponse response) {
        String result = customerCsFacade.deleteContact(request);
        WebUtil.write(response, result);
    }
    
    
    /**
     * 添加厂商或者集成商
     */
    @RequestMapping(value="addCsJcs.html",method=RequestMethod.GET)
    public ModelAndView addCsJsc(HttpServletRequest request,HttpServletResponse response) {
        ModelAndView modelAndView = new ModelAndView("/business/pages/customerconfig/cuscs/addCsJcs");
        String id = request.getParameter("id");
        if(StringUtil.isEmpty(id)){
            modelAndView.addObject("cs", new HashMap());
        }else{
            Map cs = new CMDB_MAINUFACTURER(id).getBeanMapById();
            modelAndView.addObject("cs", cs);
        }
        return modelAndView;
    }
    
    
    /**
     * 验证厂商或者集成商名称唯一性
     */
    @RequestMapping("checkCsJsc.html")
    public void checkCsJsc(HttpServletRequest request,HttpServletResponse response) {
        String result = customerCsFacade.checkCsJsc(request);
        if(result.equals("2")) {
            WebUtil.write(response, "false");
        } else {
            WebUtil.write(response, "true");
        }
    }
    
    
    /**
     * 添加厂商或者集成商
     */
    @RequestMapping(value="addCsJcs.html",method=RequestMethod.POST)
    public ModelAndView saveCsJcs(HttpServletRequest request,CMDB_MAINUFACTURER csjcs) {
        String result = customerCsFacade.saveCsJsc(request,csjcs);
        return WebUtil.sysInfoPage(request, "操作成功!",
                "window.top.query();window.top.hideDialog('1');",
                SysInfo.Success,"");
    }
    
    
    /**
     * 启用或者禁用厂商集成商信息
     */
    @RequestMapping("changeCsState.html")
    public void changeCsState(HttpServletRequest request,HttpServletResponse response) {
        String result = customerCsFacade.updateCsState(request);
        WebUtil.write(response, result);
    }
    
    /**
     * 查询厂商集成商报表
     */
    @RequestMapping("csreport.html")
    public ModelAndView csreport(HttpServletRequest request,HttpServletResponse response) {
        ModelAndView modelAndView = new ModelAndView("/business/pages/customerconfig/cuscs/csreport");
        String customerId = request.getParameter("customerId");
        if(StringUtil.notEmpty(customerId)) {
            List cs = customerCsFacade.queryCsreport(customerId);
            modelAndView.addObject("cs", cs);
            
            SC_PARTNER_CUSTOMER_INFO project = new SC_PARTNER_CUSTOMER_INFO(customerId).getInstanceById();
            String projectName = project.getCustomer_name();
            modelAndView.addObject("projectName", projectName);
        }
        return modelAndView;
        
    }
    
    
 
}