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;
|
|
}
|
|
|
|
}
|