package cn.ksource.web.controller.business.pages.incident;
|
|
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 cn.ksource.beans.SC_WORKFLOW_INCIDENT_TEMPLATE;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.ui.Model;
|
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.servlet.ModelAndView;
|
|
import cn.ksource.beans.SC_WORKFLOW_INCIDENT;
|
import cn.ksource.beans.WORKFLOW_BASE;
|
import cn.ksource.core.page.PageInfo;
|
import cn.ksource.core.util.ConvertUtil;
|
import cn.ksource.core.util.DateUtil;
|
import cn.ksource.core.util.JsonUtil;
|
import cn.ksource.core.util.NumberUtil;
|
import cn.ksource.core.util.ParamsMapUtil;
|
import cn.ksource.core.util.StringUtil;
|
import cn.ksource.core.web.SysInfo;
|
import cn.ksource.core.web.SysInfoMsg;
|
import cn.ksource.core.web.WebUtil;
|
import cn.ksource.web.Constants;
|
import cn.ksource.web.facade.customermanage.CustomerManageFacade;
|
import cn.ksource.web.facade.incident.IncidentFacade;
|
import cn.ksource.web.facade.order.OrderFacade;
|
import cn.ksource.web.service.DataDictionaryService;
|
|
/**
|
* 日常运维--事件管理控制器
|
*
|
* @author sxj
|
* @note:
|
* @date June 28, 2016 10:35:44 AM
|
*/
|
@Controller
|
@RequestMapping("/business/pages/incidentTemplate")
|
public class IncidentTemplateController {
|
|
@Autowired
|
private IncidentFacade incidentFacade;
|
|
@Autowired
|
private DataDictionaryService dataDictionaryService;
|
|
@Autowired
|
private OrderFacade orderFacade;
|
|
@Resource
|
private CustomerManageFacade customerFacade;
|
|
/**
|
* 跳转到我的事件列表
|
*/
|
@RequestMapping("myIncident.html")
|
public ModelAndView myIncident(HttpServletRequest request) {
|
ModelAndView view = new ModelAndView("/business/pages/incidentTemplate/myIncident");
|
|
Map num = orderFacade.queryOrderCountByCate(request, Constants.WORKFLOW_BASE_BUSINESS_TYPE_INCIDENT.toString());
|
|
view.addObject("num", num);
|
|
|
//查询事件类型数据字典
|
List types = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.INCIDENT_TYPE);
|
|
view.addObject("types", types);
|
//查询该加盟商的事件优先级
|
List<Map> eventPri = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.EVENT_PRI);
|
view.addObject("eventPri", eventPri);
|
//查询事件影响度数据字典
|
List<Map> eventDg = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.EVENT_EFFECT_DG);
|
view.addObject("eventDg", eventDg);
|
//客户列表
|
List<Map> cusList = incidentFacade.getCustomerList();
|
view.addObject("customers", cusList);
|
//查询事件来源数据字典
|
List<Map> froms = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.INCIDENT_SOURCE);
|
view.addObject("froms", froms);
|
|
//定义参数Map
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
params.put("userId", WebUtil.getLoginedUserId(request));
|
params.put("type", "2");
|
Map map = incidentFacade.getOrderNum(params);
|
|
view.addObject("data", map);
|
return view;
|
}
|
|
|
/**
|
* 查询我的事件列表
|
*/
|
@RequestMapping("myIncidentData.html")
|
public ModelAndView myIncidentData(HttpServletRequest request, PageInfo pageInfo) {
|
ModelAndView modelAndView = new ModelAndView("/business/pages/incidentTemplate/myIncidentData");
|
//定义参数Map
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
params.put("userId", WebUtil.getLoginedUserId(request));
|
PageInfo info = incidentFacade.queryMyIncidentData1(pageInfo, params);
|
modelAndView.addObject("orders", info);
|
return modelAndView;
|
}
|
|
/**
|
* 查询我的事件数量
|
*/
|
@RequestMapping("myIncidentCount.html")
|
public void myIncidentCount(HttpServletRequest request, HttpServletResponse response) {
|
//定义参数Map
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
params.put("userId", WebUtil.getLoginedUserId(request));
|
int count = incidentFacade.queryMyIncidentCount1(params);
|
WebUtil.write(response, String.valueOf(count));
|
}
|
|
/**
|
* 跳转到我的事件列表
|
*/
|
@RequestMapping("modelList.html")
|
public ModelAndView modelList(HttpServletRequest request) {
|
ModelAndView view = new ModelAndView("/business/pages/incidentTemplate/modelList");
|
|
Map num = orderFacade.queryOrderCountByCate(request, Constants.WORKFLOW_BASE_BUSINESS_TYPE_INCIDENT.toString());
|
|
view.addObject("num", num);
|
|
|
//查询事件类型数据字典
|
List types = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.INCIDENT_TYPE);
|
|
view.addObject("types", types);
|
//查询该加盟商的事件优先级
|
List<Map> eventPri = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.EVENT_PRI);
|
view.addObject("eventPri", eventPri);
|
//查询事件影响度数据字典
|
List<Map> eventDg = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.EVENT_EFFECT_DG);
|
view.addObject("eventDg", eventDg);
|
//客户列表
|
List<Map> cusList = incidentFacade.getCustomerList();
|
view.addObject("customers", cusList);
|
//查询事件来源数据字典
|
List<Map> froms = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.INCIDENT_SOURCE);
|
view.addObject("froms", froms);
|
|
//定义参数Map
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
params.put("userId", WebUtil.getLoginedUserId(request));
|
params.put("type", "2");
|
Map map = incidentFacade.getOrderNum(params);
|
|
view.addObject("data", map);
|
return view;
|
}
|
/**
|
* 查询我的事件列表
|
*/
|
@RequestMapping("incidentData.html")
|
public ModelAndView incidentData(HttpServletRequest request, PageInfo pageInfo) {
|
ModelAndView modelAndView = new ModelAndView("/business/pages/incidentTemplate/incidentData");
|
//定义参数Map
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
params.put("userId", WebUtil.getLoginedUserId(request));
|
PageInfo info = incidentFacade.queryMyIncidentData1(pageInfo, params);
|
modelAndView.addObject("orders", info);
|
return modelAndView;
|
}
|
/**
|
* 跳转到工程师添加事件页面
|
*/
|
@RequestMapping("engineerAddIncident.html")
|
public ModelAndView engineerAddIncident(HttpServletRequest request) {
|
ModelAndView view = new ModelAndView("/business/pages/incidentTemplate/engineerAddIncident");
|
String repair = request.getParameter("repair");
|
|
//查询事件类型数据字典
|
List<Map> types = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.INCIDENT_TYPE);
|
//取得事件类型的第一条数据
|
if (null != types && types.size() > 0) {
|
Map type = types.get(0);
|
view.addObject("typeId", type.get("DATAKEY"));
|
view.addObject("typeName", type.get("DATAVALUE"));
|
}
|
//查询申报方式数据字典
|
List<Map> ways = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.INCIDENT_APPLY_TYPE);
|
//取得申报方式的第一条数据
|
if (null != ways && ways.size() > 0) {
|
Map way = ways.get(0);
|
view.addObject("wayId", way.get("DATAKEY"));
|
view.addObject("wayName", way.get("DATAVALUE"));
|
}
|
//查询事件来源数据字典
|
List<Map> froms = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.INCIDENT_SOURCE);
|
//取得事件来源的第一条数据
|
if (null != froms && froms.size() > 0) {
|
Map from = froms.get(0);
|
view.addObject("fromId", from.get("DATAKEY"));
|
view.addObject("fromName", from.get("DATAVALUE"));
|
}
|
//事件来源为一键报修
|
if (!StringUtil.isEmpty(repair)) {
|
view.addObject("fromId", Constants.INCIDENT_SOURCE_REPAIR_KEY);
|
view.addObject("fromName", Constants.INCIDENT_SOURCE_REPAIR_VALUE);
|
}
|
|
//客户列表
|
List<Map> cusList = incidentFacade.getCustomerList();
|
view.addObject("customers", cusList);
|
view.addObject("customerId", (cusList.get(0)).get("ID"));
|
//查询事件优先级
|
List<Map> eventPri = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.EVENT_PRI);
|
view.addObject("eventPri", eventPri);
|
//查询事件影响度数据字典
|
List<Map> eventDg = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.EVENT_EFFECT_DG);
|
view.addObject("eventDg", eventDg);
|
|
view.addObject("types", types);
|
view.addObject("ways", ways);
|
view.addObject("froms", froms);
|
|
//定义参数Map
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
params.put("userId", WebUtil.getLoginedUserId(request));
|
params.put("type", "2");
|
Map map = incidentFacade.getOrderNum(params);
|
view.addObject("data", map);
|
|
return view;
|
}
|
|
/**
|
* 工程师保存事件
|
*/
|
@RequestMapping("engineerSaveIncident.html")
|
public ModelAndView engineerSaveIncident(HttpServletRequest request, HttpServletResponse response, SC_WORKFLOW_INCIDENT_TEMPLATE template) {
|
try {
|
incidentFacade.saveEngineerIncident1(request, template);
|
return WebUtil.sysInfoPage(request, "操作成功!",
|
"",
|
SysInfo.Success, "/business/pages/incidentTemplate/myIncident.html");
|
} catch (Exception e) {
|
e.printStackTrace();
|
return WebUtil.sysInfoPage(request, "操作失败!",
|
"",
|
SysInfo.Error, "");
|
}
|
|
}
|
|
/**
|
* 跳转到工程师添加事件页面
|
*/
|
@RequestMapping("engineerEditIncident.html")
|
public ModelAndView engineerEditIncident(HttpServletRequest request) {
|
ModelAndView view = new ModelAndView("/business/pages/incidentTemplate/engineerEditIncident");
|
String orderId = request.getParameter("orderId");
|
if (StringUtil.notEmpty(orderId)) {
|
view.addObject("info", incidentFacade.getemplate(orderId));
|
}
|
String repair = request.getParameter("repair");
|
|
//查询事件类型数据字典
|
List<Map> types = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.INCIDENT_TYPE);
|
//取得事件类型的第一条数据
|
if (null != types && types.size() > 0) {
|
Map type = types.get(0);
|
view.addObject("typeId", type.get("DATAKEY"));
|
view.addObject("typeName", type.get("DATAVALUE"));
|
}
|
//查询申报方式数据字典
|
List<Map> ways = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.INCIDENT_APPLY_TYPE);
|
//取得申报方式的第一条数据
|
if (null != ways && ways.size() > 0) {
|
Map way = ways.get(0);
|
view.addObject("wayId", way.get("DATAKEY"));
|
view.addObject("wayName", way.get("DATAVALUE"));
|
}
|
//查询事件来源数据字典
|
List<Map> froms = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.INCIDENT_SOURCE);
|
//取得事件来源的第一条数据
|
if (null != froms && froms.size() > 0) {
|
Map from = froms.get(0);
|
view.addObject("fromId", from.get("DATAKEY"));
|
view.addObject("fromName", from.get("DATAVALUE"));
|
}
|
//事件来源为一键报修
|
if (!StringUtil.isEmpty(repair)) {
|
view.addObject("fromId", Constants.INCIDENT_SOURCE_REPAIR_KEY);
|
view.addObject("fromName", Constants.INCIDENT_SOURCE_REPAIR_VALUE);
|
}
|
|
//客户列表
|
List<Map> cusList = incidentFacade.getCustomerList();
|
view.addObject("customers", cusList);
|
//查询事件优先级
|
List<Map> eventPri = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.EVENT_PRI);
|
view.addObject("eventPri", eventPri);
|
//查询事件影响度数据字典
|
List<Map> eventDg = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.EVENT_EFFECT_DG);
|
view.addObject("eventDg", eventDg);
|
|
view.addObject("types", types);
|
view.addObject("ways", ways);
|
view.addObject("froms", froms);
|
|
//定义参数Map
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
params.put("userId", WebUtil.getLoginedUserId(request));
|
params.put("type", "2");
|
Map map = incidentFacade.getOrderNum(params);
|
view.addObject("data", map);
|
|
return view;
|
}
|
|
/**
|
* 删除模板
|
*
|
* @param request
|
* @param response
|
*/
|
@RequestMapping(value = "delTemplate.html", method = RequestMethod.GET)
|
public void delTemplate(HttpServletRequest request, HttpServletResponse response) {
|
String id = request.getParameter("temp_id");
|
incidentFacade.doDelTemplate(id);
|
WebUtil.write(response, JsonUtil.obj2Json(1));
|
}
|
|
/**
|
* 事件模板详情
|
*/
|
@RequestMapping("templateDetail.html")
|
public ModelAndView templateDetail(HttpServletRequest request) {
|
ModelAndView view = new ModelAndView("/business/pages/incidentTemplate/templateDetail");
|
String orderId = request.getParameter("orderId");
|
view.addObject("info", incidentFacade.getemplate(orderId));
|
return view;
|
}
|
}
|