package cn.ksource.web.controller.business.pages.cfg;
|
|
import java.io.*;
|
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.core.util.*;
|
import cn.ksource.core.web.SysInfoMsg;
|
import cn.ksource.web.service.sl.SlaProjectService;
|
import org.apache.poi.hssf.usermodel.*;
|
import org.apache.poi.hssf.util.CellRangeAddress;
|
import org.apache.poi.hssf.util.CellRangeAddressList;
|
import org.apache.poi.hssf.util.HSSFColor;
|
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 org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
import org.springframework.web.servlet.ModelAndView;
|
|
import cn.ksource.beans.CMDB_CI_BASE;
|
import cn.ksource.beans.FlowRecord;
|
import cn.ksource.core.page.PageInfo;
|
import cn.ksource.core.web.SysInfo;
|
import cn.ksource.core.web.WebUtil;
|
import cn.ksource.web.Constants;
|
import cn.ksource.web.facade.cfg.CfgFacade;
|
import cn.ksource.web.facade.cfgcate.CfgcateFacade;
|
import cn.ksource.web.facade.customermanage.CustomerManageFacade;
|
|
@Controller
|
@RequestMapping("/business/pages/cfg")
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
public class CfgController {
|
@Resource
|
private CfgFacade cfgFacade;
|
@Resource
|
private CfgcateFacade cfgcateFacade;
|
@Resource
|
private CustomerManageFacade customerFacade;
|
|
|
|
/**
|
* 配置管理
|
*
|
* @param model
|
* @param request
|
* @return
|
* @author chenlong
|
*/
|
@RequestMapping("cfgmanageList.html")
|
public String cfgmanageList(Model model, HttpServletRequest request) {
|
List<Map> cusList = customerFacade.getCusList();
|
model.addAttribute("cusList", cusList);
|
return "/business/pages/cfg/cfgmanageList";
|
}
|
|
@RequestMapping("cfgmanageData.html")
|
public String cfgmanageData(PageInfo pageInfo, Model model, HttpServletRequest request) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
params.put("fstate_wc", Constants.CFG_FLOW_WC.toString());
|
pageInfo = cfgFacade.getCfgData(pageInfo, params);
|
model.addAttribute("pageInfo", pageInfo);
|
return "/business/pages/cfg/cfgmanageData";
|
}
|
|
@RequestMapping("cfgmanageCount.html")
|
public void cfgmanageCount(Model model, HttpServletRequest request, HttpServletResponse response) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
params.put("fstate_wc", Constants.CFG_FLOW_WC.toString());
|
params.put("wc_flag", "1");
|
WebUtil.write(response, cfgFacade.getCfgCount(params).toString());
|
}
|
|
@RequestMapping("updateStatus.html")
|
public void updateStatus(HttpServletRequest request, HttpServletResponse response) {
|
String id = request.getParameter("id");
|
String state = request.getParameter("state");
|
CMDB_CI_BASE base = new CMDB_CI_BASE(id).getInstanceById();
|
base.setState(ConvertUtil.obj2Integer(state)).update();
|
WebUtil.write(response, "1");
|
}
|
|
|
/**
|
* 配置管理
|
*
|
* @param model
|
* @param request
|
* @return
|
* @author chenlong
|
*/
|
@RequestMapping("cfgmainList.html")
|
public String cfgmainList(Model model, HttpServletRequest request) {
|
//客户列表
|
List<Map> cusList = customerFacade.getCusList();
|
model.addAttribute("cusList", cusList);
|
return "/business/pages/cfg/cfgmainList";
|
}
|
|
@RequestMapping("cfgmainData.html")
|
public String cfgmainData(PageInfo pageInfo, Model model, HttpServletRequest request) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
params.put("createId", WebUtil.getLoginedUserId(request));
|
pageInfo = cfgFacade.getCfgData(pageInfo, params);
|
model.addAttribute("pageInfo", pageInfo);
|
return "/business/pages/cfg/cfgmainData";
|
}
|
|
@RequestMapping("cfgmainCount.html")
|
public void cfgmainCount(Model model, HttpServletRequest request, HttpServletResponse response) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
params.put("createId", WebUtil.getLoginedUserId(request));
|
WebUtil.write(response, cfgFacade.getCfgCount(params).toString());
|
}
|
|
/**
|
* 配置审核
|
*
|
* @param model
|
* @param request
|
* @return
|
* @author chenlong
|
*/
|
@RequestMapping("cfgshList.html")
|
public String cfgshList(Model model, HttpServletRequest request) {
|
//客户列表
|
List<Map> cusList = customerFacade.getCusList();
|
model.addAttribute("cusList", cusList);
|
return "/business/pages/cfg/cfgshList";
|
}
|
|
@RequestMapping("cfgshData.html")
|
public String cfgshData(PageInfo pageInfo, Model model, HttpServletRequest request) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
params.put("dealId", WebUtil.getUserId(request));
|
if (params.get("flag").equals("1")) {
|
params.put("fstate", Constants.CFG_FLOW_DSH.toString());
|
} else if(params.get("flag").equals("2")){
|
params.put("templateKey", Constants.CFG_FLOW_DSH.toString());
|
}
|
pageInfo = cfgFacade.getCfgData(pageInfo, params);
|
model.addAttribute("pageInfo", pageInfo);
|
return "/business/pages/cfg/cfgshData";
|
}
|
|
@RequestMapping("cfgshCount.html")
|
public void cfgshCount(Model model, HttpServletRequest request, HttpServletResponse response) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
params.put("dealId", WebUtil.getUserId(request));
|
if (params.get("flag").equals("1")) {
|
params.put("fstate", Constants.CFG_FLOW_DSH.toString());
|
} else {
|
params.put("templateKey", Constants.CFG_FLOW_DSH.toString());
|
}
|
WebUtil.write(response, cfgFacade.getCfgCount(params).toString());
|
}
|
|
/**
|
* 编辑配置
|
*
|
* @param model
|
* @param request
|
* @return
|
* @author chenlong
|
*/
|
@RequestMapping(value = "editCfg.html", method = RequestMethod.GET)
|
public String editCfg(Model model, HttpServletRequest request) {
|
String id = request.getParameter("id");
|
Map info = new HashMap();
|
Map params = new HashMap<String, String>();
|
params.put("lv", "1");
|
List lv1List = cfgcateFacade.getCfgcateList(params);
|
params.clear();
|
model.addAttribute("lv1List", lv1List);
|
if (StringUtil.isNotBlank(id)) {
|
info = cfgFacade.getCfgById(id);
|
params.put("pid", info.get("lv1_id"));
|
List lv2List = cfgcateFacade.getCfgcateList(params);
|
model.addAttribute("lv2List", lv2List);
|
params.put("pid", info.get("lv2_id"));
|
List lv3List = cfgcateFacade.getCfgcateList(params);
|
model.addAttribute("lv3List", lv3List);
|
List groupProps = cfgcateFacade.getPropTemplate(ConvertUtil.obj2StrBlank(info.get("lv3_id")), ConvertUtil.obj2StrBlank(info.get("id")));
|
model.addAttribute("groupProps", groupProps);
|
List mftList = cfgFacade.getMftList(info.get("cus_id").toString(), "1");
|
model.addAttribute("mftList", mftList);
|
List igtList = cfgFacade.getMftList(info.get("cus_id").toString(), "2");
|
model.addAttribute("igtList", igtList);
|
}
|
model.addAttribute("info", info);
|
List<Map> cusList = customerFacade.getCusList();
|
model.addAttribute("cusList", cusList);
|
return "/business/pages/cfg/editCfg";
|
}
|
|
@RequestMapping(value = "editCfg.html", method = RequestMethod.POST)
|
public ModelAndView doEditCfg(HttpServletRequest request) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
Map user = WebUtil.getLoginUser(request).getLoginUser();
|
params.put("create_id", user.get("ID").toString());
|
params.put("create_name", user.get("ZSXM").toString());
|
cfgFacade.saveCfg(params, request);
|
String js = "window.top.query();"
|
+ "window.top.hideDialog('0');";
|
return WebUtil.sysInfoPage(request, "操作成功!",
|
js,
|
SysInfo.Success, "");
|
}
|
|
/**
|
* 获取配置分类
|
*
|
* @param request
|
* @param response
|
* @author chenlong
|
*/
|
@RequestMapping(value = "getCfgcate.html", method = RequestMethod.POST)
|
public void getCfgcate(HttpServletRequest request, HttpServletResponse response) {
|
Map params = ParamsMapUtil.getParameterMap(request);
|
List list = cfgcateFacade.getCfgcateList(params);
|
WebUtil.write(response, JsonUtil.list2Json(list));
|
}
|
|
/**
|
* 配置模板
|
*
|
* @param model
|
* @param request
|
* @return
|
* @author chenlong
|
*/
|
@RequestMapping(value = "cfgTemplate.html")
|
public String cfgTemplate(Model model, HttpServletRequest request) {
|
String linkId = request.getParameter("linkId");
|
List groupProps = cfgcateFacade.getPropTemplate(linkId, null);
|
model.addAttribute("info", new HashMap());
|
model.addAttribute("groupProps", groupProps);
|
List<Map> cusList = customerFacade.getCusList();
|
model.addAttribute("cusList", cusList);
|
return "/business/pages/cfg/cfgTemplate";
|
}
|
|
/**
|
* 配置详情
|
*
|
* @param model
|
* @param request
|
* @return
|
* @author chenlong
|
*/
|
@RequestMapping("cfgDetail.html")
|
public String cfgDetail(Model model, HttpServletRequest request) {
|
String id = request.getParameter("id");
|
Map info = cfgFacade.getCfgById(id);
|
List groupProps = cfgcateFacade.getPropTemplate(ConvertUtil.obj2StrBlank(info.get("lv3_id")), ConvertUtil.obj2StrBlank(info.get("id")));
|
model.addAttribute("groupProps", groupProps);
|
model.addAttribute("info", info);
|
return "/business/pages/cfg/cfgDetail";
|
}
|
|
/**
|
* 跳转到过保查询
|
*
|
* @param model
|
* @param request
|
*/
|
@RequestMapping("cfgGbcxList.html")
|
public String cfgGbcxList(Model model, HttpServletRequest request) {
|
List<Map> gbState = new ArrayList<Map>();
|
for (Integer key : Constants.CFG_GB_STATE_MAP.keySet()) {
|
Map map = new HashMap();
|
map.put("DATAKEY", key);
|
map.put("DATAVALUE", Constants.getCFG_GB_STATE(key));
|
if(key!=5) {
|
gbState.add(map);
|
}
|
}
|
model.addAttribute("gbState", gbState);
|
//获取客户列表
|
List<Map> cusList = customerFacade.getCusList();
|
model.addAttribute("cusList", cusList);
|
return "/business/pages/cfg/cfgGbcxList";
|
}
|
|
/**
|
* 过保查询数据查询
|
*
|
* @param pageInfo
|
* @param model
|
* @param request
|
* @return
|
*/
|
@RequestMapping("cfgGbcxData.html")
|
public String cfgGbcxData(PageInfo pageInfo, Model model, HttpServletRequest request) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
pageInfo = cfgFacade.getCfgData(pageInfo, params);
|
model.addAttribute("pageInfo", pageInfo);
|
return "/business/pages/cfg/cfgGbcxData";
|
}
|
|
/**
|
* 过保查询数据总数
|
*
|
* @param model
|
* @param request
|
* @param response
|
*/
|
@RequestMapping("cfgGbcxCount.html")
|
public void cfgGbcxCount(Model model, HttpServletRequest request, HttpServletResponse response) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
WebUtil.write(response, cfgFacade.getCfgCount(params).toString());
|
}
|
|
/**
|
* 提交审核
|
*
|
* @param model
|
* @param request
|
* @return
|
* @author chenlong
|
*/
|
@RequestMapping(value = "comitSh.html", method = RequestMethod.GET)
|
public String comitSh(Model model, HttpServletRequest request) {
|
String cfgId = request.getParameter("cfgId");
|
Map info = cfgFacade.getCfgById(cfgId);
|
List groupProps = cfgcateFacade.getPropTemplate(ConvertUtil.obj2StrBlank(info.get("lv3_id")), ConvertUtil.obj2StrBlank(info.get("id")));
|
model.addAttribute("groupProps", groupProps);
|
model.addAttribute("info", info);
|
return "/business/pages/cfg/comitSh";
|
}
|
|
@RequestMapping(value = "comitSh.html", method = RequestMethod.POST)
|
public ModelAndView doComitSh(FlowRecord flowRecord, Model model, HttpServletRequest request) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
flowRecord.setDealId(WebUtil.getUserId(request));
|
flowRecord.setDealName(WebUtil.getUserName(request));
|
flowRecord.setTemplateKey(Constants.CFG_FLOW_XZ);
|
if (params.get("isNext").equals("1")) {
|
params.put("state", Constants.CFG_FLOW_DSH.toString());
|
} else {
|
params.put("state", Constants.CFG_FLOW_WC.toString());
|
}
|
cfgFacade.doToNext(params, flowRecord);
|
String js = "window.top.query();"
|
+ "window.top.hideDialog('do');";
|
return WebUtil.sysInfoPage(request, "操作成功!",
|
js,
|
SysInfo.Success, "");
|
}
|
|
|
/**
|
* 提交审核
|
*
|
* @param model
|
* @param request
|
* @return
|
* @author chenlong
|
*/
|
@RequestMapping(value = "cfgShTab.html", method = RequestMethod.GET)
|
public String cfgShTab(Model model, HttpServletRequest request) {
|
return "/business/pages/cfg/cfgShTab";
|
}
|
|
@RequestMapping(value = "cfgSh.html", method = RequestMethod.GET)
|
public String cfgSh(Model model, HttpServletRequest request) {
|
String cfgId = request.getParameter("cfgId");
|
Map info = cfgFacade.getCfgById(cfgId);
|
List groupProps = cfgcateFacade.getPropTemplate(ConvertUtil.obj2StrBlank(info.get("lv3_id")), ConvertUtil.obj2StrBlank(info.get("id")));
|
model.addAttribute("groupProps", groupProps);
|
model.addAttribute("info", info);
|
return "/business/pages/cfg/cfgSh";
|
}
|
|
@RequestMapping(value = "cfgSh.html", method = RequestMethod.POST)
|
public ModelAndView doCfgSh(FlowRecord flowRecord, Model model, HttpServletRequest request) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
flowRecord.setDealId(WebUtil.getUserId(request));
|
flowRecord.setDealName(WebUtil.getUserName(request));
|
flowRecord.setTemplateKey(Constants.CFG_FLOW_DSH);
|
if (params.get("flag").equals("1")) {
|
if (params.get("isNext").equals("1")) {
|
params.put("state", Constants.CFG_FLOW_DSH.toString());
|
} else {
|
params.put("state", Constants.CFG_FLOW_WC.toString());
|
}
|
} else {
|
params.put("state", Constants.CFG_FLOW_SB.toString());
|
}
|
cfgFacade.doToNext(params, flowRecord);
|
String js = "window.top.query();"
|
+ "window.top.hideDialog('do');";
|
return WebUtil.sysInfoPage(request, "操作成功!",
|
js,
|
SysInfo.Success, "");
|
}
|
|
|
@RequestMapping(value = "cfgDetailTab.html")
|
public String cfgDetailTab(Model model, HttpServletRequest request) {
|
return "/business/pages/cfg/cfgDetailTab";
|
}
|
|
/**
|
* 配置管理
|
*
|
* @param model
|
* @param request
|
* @return
|
* @author chenlong
|
*/
|
@RequestMapping("cfgcxList.html")
|
public String cfgcxList(Model model, HttpServletRequest request) {
|
//获取客户列表
|
List<Map> cusList = customerFacade.getCusList();
|
model.addAttribute("cusList", cusList);
|
return "/business/pages/cfg/cfgcxList";
|
}
|
|
@RequestMapping("cfgcxData.html")
|
public String cfgcxData(PageInfo pageInfo, Model model, HttpServletRequest request) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
params.put("fstate_wc", Constants.CFG_FLOW_WC.toString());
|
//查询状态是正常的(0未启用 1正常;2废弃;3维护中; 4备用;)
|
params.put("state","1");
|
pageInfo = cfgFacade.getCfgData(pageInfo, params);
|
model.addAttribute("pageInfo", pageInfo);
|
return "/business/pages/cfg/cfgcxData";
|
}
|
|
@RequestMapping("cfgcxCount.html")
|
public void cfgcxCount(Model model, HttpServletRequest request, HttpServletResponse response) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
params.put("fstate_wc", Constants.CFG_FLOW_WC.toString());
|
params.put("state","1");
|
WebUtil.write(response, cfgFacade.getCfgCount(params).toString());
|
}
|
|
@RequestMapping("cfgInfoIndex.html")
|
public String cfgInfoIndex(Model model, HttpServletRequest request) {
|
String id = request.getParameter("id");
|
Map info = cfgFacade.getCfgByIdTwo(id,request);
|
List groupProps = cfgcateFacade.getPropTemplate(ConvertUtil.obj2StrBlank(info.get("lv3_id")), ConvertUtil.obj2StrBlank(info.get("id")));
|
model.addAttribute("groupProps", groupProps);
|
model.addAttribute("info", info);
|
return "/business/pages/cfg/cfgInfoIndex";
|
}
|
|
/**
|
* 配置关联工单
|
*
|
* @param model
|
* @param request
|
* @return
|
* @author chenlong
|
*/
|
@RequestMapping("cfgLinkOrder.html")
|
public String cfgLinkOrder(Model model, HttpServletRequest request) {
|
String id = request.getParameter("id");
|
Map info = cfgFacade.getCfgById(id);
|
model.addAttribute("info", info);
|
return "/business/pages/cfg/cfgLinkOrder";
|
}
|
|
@RequestMapping("cfgLinkOrderData.html")
|
public String cfgLinkOrderData(PageInfo pageInfo, Model model, HttpServletRequest request) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
pageInfo = cfgFacade.getCfgLinkOrderData(pageInfo, params);
|
model.addAttribute("pageInfo", pageInfo);
|
return "/business/pages/cfg/cfgLinkOrderData";
|
}
|
|
@RequestMapping("cfgLinkOrderCount.html")
|
public void cfgLinkOrderCount(Model model, HttpServletRequest request, HttpServletResponse response) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
WebUtil.write(response, cfgFacade.getCfgLinkOrderCount(params).toString());
|
}
|
|
|
/**
|
* 配置关联工单
|
*
|
* @param model
|
* @param request
|
* @return
|
* @author chenlong
|
*/
|
@RequestMapping("cfgLinkKnow.html")
|
public String cfgLinkKnow(Model model, HttpServletRequest request) {
|
String id = request.getParameter("id");
|
Map info = cfgFacade.getCfgById(id);
|
model.addAttribute("info", info);
|
return "/business/pages/cfg/cfgLinkKnow";
|
}
|
|
@RequestMapping("cfgLinkKnowData.html")
|
public String cfgLinkKnowData(PageInfo pageInfo, Model model, HttpServletRequest request) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
pageInfo = cfgFacade.getCfgLinkKnowData(pageInfo, params);
|
model.addAttribute("pageInfo", pageInfo);
|
return "/business/pages/cfg/cfgLinkKnowData";
|
}
|
|
@RequestMapping("cfgLinkKnowCount.html")
|
public void cfgLinkKnowCount(Model model, HttpServletRequest request, HttpServletResponse response) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
WebUtil.write(response, cfgFacade.getCfgLinkKnowCount(params).toString());
|
}
|
|
/**
|
* 配置文档
|
*
|
* @param model
|
* @param request
|
* @return
|
* @author chenlong
|
*/
|
@RequestMapping("cfgDoc.html")
|
public String cfgDoc(Model model, HttpServletRequest request) {
|
String id = request.getParameter("id");
|
Map info = cfgFacade.getCfgById(id);
|
model.addAttribute("info", info);
|
return "/business/pages/cfg/cfgDoc";
|
}
|
|
@RequestMapping("cfgDocData.html")
|
public String cfgDocData(PageInfo pageInfo, Model model, HttpServletRequest request) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
pageInfo = cfgFacade.getCfgDocData(pageInfo, params);
|
model.addAttribute("pageInfo", pageInfo);
|
return "/business/pages/cfg/cfgDocData";
|
}
|
|
@RequestMapping("cfgDocCount.html")
|
public void cfgDocCount(Model model, HttpServletRequest request, HttpServletResponse response) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
WebUtil.write(response, cfgFacade.getCfgDocCount(params).toString());
|
}
|
|
/**
|
* 日常巡检指标
|
*
|
* @param model
|
* @param request
|
* @return
|
* @author chenlong
|
*/
|
@RequestMapping("cfgDailyItem.html")
|
public String cfgDailyItem(Model model, HttpServletRequest request) {
|
model.addAttribute("type",1);
|
return "/business/pages/cfg/cfgDailyItem";
|
}
|
|
@RequestMapping("cfgDailyItemData.html")
|
public String cfgDailyItemData(PageInfo pageInfo, Model model, HttpServletRequest request) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
pageInfo = cfgFacade.getCfgDailyItemData(pageInfo, params);
|
model.addAttribute("pageInfo", pageInfo);
|
return "/business/pages/cfg/cfgDailyItemData";
|
}
|
|
@RequestMapping("cfgDailyItemCount.html")
|
public void cfgDailyItemCount(Model model, HttpServletRequest request, HttpServletResponse response) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
WebUtil.write(response, cfgFacade.getCfgDailyItemCount(params).toString());
|
}
|
|
|
/**
|
* 例行维护指标
|
*
|
* @param model
|
* @param request
|
* @return
|
* @author chenlong
|
*/
|
@RequestMapping("cfgRemindItem.html")
|
public String cfgRemindItem(Model model, HttpServletRequest request) {
|
model.addAttribute("type",2);
|
return "/business/pages/cfg/cfgRemindItem";
|
}
|
|
@RequestMapping("cfgRemindItemData.html")
|
public String cfgRemindItemData(PageInfo pageInfo, Model model, HttpServletRequest request) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
pageInfo = cfgFacade.getCfgRemindItemData(pageInfo, params);
|
model.addAttribute("pageInfo", pageInfo);
|
return "/business/pages/cfg/cfgRemindItemData";
|
}
|
|
@RequestMapping("cfgRemindItemCount.html")
|
public void cfgRemindItemCount(Model model, HttpServletRequest request, HttpServletResponse response) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
WebUtil.write(response, cfgFacade.getCfgRemindItemCount(params).toString());
|
}
|
|
/**
|
* 健康检查
|
*
|
* @param model
|
* @param request
|
* @return
|
* @author chenlong
|
*/
|
@RequestMapping("cfgHealthItem.html")
|
public String cfgHealthItem(Model model, HttpServletRequest request) {
|
model.addAttribute("type",3);
|
return "/business/pages/cfg/cfgHealthItem";
|
}
|
|
@RequestMapping("cfgHealthItemData.html")
|
public String cfgHealthItemData(PageInfo pageInfo, Model model, HttpServletRequest request) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
pageInfo = cfgFacade.getCfgHealthItemData(pageInfo, params);
|
model.addAttribute("pageInfo", pageInfo);
|
return "/business/pages/cfg/cfgHealthItemData";
|
}
|
|
@RequestMapping("cfgHealthItemCount.html")
|
public void cfgHealthItemCount(Model model, HttpServletRequest request, HttpServletResponse response) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
WebUtil.write(response, cfgFacade.getCfgHealthItemCount(params).toString());
|
}
|
|
/**
|
* 配置关系
|
*
|
* @param model
|
* @param request
|
* @return
|
* @author chenlong
|
*/
|
@RequestMapping("cfgRelationList.html")
|
public String cfgRelationList(Model model, HttpServletRequest request) {
|
return "/business/pages/cfg/cfgRelationList";
|
}
|
|
@RequestMapping("cfgRelationData.html")
|
public String cfgRelationData(PageInfo pageInfo, Model model, HttpServletRequest request) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
pageInfo = cfgFacade.getCfgRelationData(pageInfo, params);
|
model.addAttribute("pageInfo", pageInfo);
|
return "/business/pages/cfg/cfgRelationData";
|
}
|
|
@RequestMapping("cfgRelationCount.html")
|
public void cfgRelationCount(Model model, HttpServletRequest request, HttpServletResponse response) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
WebUtil.write(response, cfgFacade.getCfgRelationCount(params).toString());
|
}
|
|
@RequestMapping("relationci.html")
|
public String relationci(Model model, HttpServletRequest request) {
|
Map<Integer, String> links = Constants.CFG_RELATION_Map;
|
List<Map> list = new ArrayList<Map>();
|
for (int key : links.keySet()) {
|
Map map = new HashMap();
|
map.put("id", key);
|
map.put("text", Constants.CFG_RELATION_Map.get(key));
|
list.add(map);
|
}
|
model.addAttribute("links", list);
|
return "/business/pages/cfg/relationci";
|
}
|
|
/**
|
* 添加配置关联关系列表数据
|
*/
|
@RequestMapping("selectrelationLink.html")
|
public ModelAndView selectrelationLink(HttpServletRequest request) {
|
ModelAndView modelAndView = new ModelAndView("/business/pages/cfg/selectrelationLink");
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
List<Map> relation = cfgFacade.queryRelationLink(params);
|
modelAndView.addObject("devices", relation);
|
return modelAndView;
|
}
|
|
/**
|
* 保存关联信息
|
*/
|
@RequestMapping(value = "saveRelation.html", method = RequestMethod.POST)
|
public void saveRelation(HttpServletRequest request, HttpServletResponse response) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
params.put("userId", WebUtil.getUserId(request));
|
params.put("userName", WebUtil.getUserName(request));
|
String result = cfgFacade.saveRelation(params);
|
WebUtil.write(response, result);
|
}
|
|
/**
|
* 跳转到修改配置关系页面
|
*/
|
@RequestMapping(value = "updateRelation.html", method = RequestMethod.GET)
|
public ModelAndView updateRelation(HttpServletRequest request) {
|
ModelAndView modelAndView = new ModelAndView("/business/pages/cfg/updateRelation");
|
String id = request.getParameter("id");
|
Map relation = cfgFacade.getRelationById(id);
|
modelAndView.addObject("relationing", relation);
|
Map<Integer, String> links = Constants.CFG_RELATION_Map;
|
List<Map> list = new ArrayList<Map>();
|
for (int key : links.keySet()) {
|
Map map = new HashMap();
|
map.put("id", key);
|
map.put("text", Constants.CFG_RELATION_Map.get(key));
|
list.add(map);
|
}
|
modelAndView.addObject("links", list);
|
return modelAndView;
|
}
|
|
/**
|
* 保存关联信息
|
*/
|
@RequestMapping(value = "updateRelation.html", method = RequestMethod.POST)
|
public void doUpdateRelation(HttpServletRequest request, HttpServletResponse response) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
String result = cfgFacade.updateRelation(params);
|
WebUtil.write(response, result);
|
}
|
|
/**
|
* 删除关联关系
|
*
|
* @param request
|
* @param response
|
* @author chenlong
|
*/
|
@RequestMapping("delrelation.html")
|
public void delrelation(HttpServletRequest request, HttpServletResponse response) {
|
String id = request.getParameter("id");
|
cfgFacade.delRelationById(id);
|
WebUtil.write(response, "1");
|
}
|
|
|
/**
|
* 健康检查
|
*
|
* @param model
|
* @param request
|
* @return
|
* @author chenlong
|
*/
|
@RequestMapping("cfgLink.html")
|
public String cfgRelation(Model model, HttpServletRequest request) {
|
String id = request.getParameter("id");
|
Map info = cfgFacade.getCfgById(id);
|
model.addAttribute("info", info);
|
return "/business/pages/cfg/cfgLink";
|
}
|
|
@RequestMapping("cfgLinkData.html")
|
public String cfgLinkData(PageInfo pageInfo, Model model, HttpServletRequest request) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
pageInfo = cfgFacade.getCfgLinkData(pageInfo, params);
|
model.addAttribute("pageInfo", pageInfo);
|
return "/business/pages/cfg/cfgLinkData";
|
}
|
|
@RequestMapping("cfgLinkCount.html")
|
public void cfgLinkCount(Model model, HttpServletRequest request, HttpServletResponse response) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
WebUtil.write(response, cfgFacade.getCfgLinkCount(params).toString());
|
}
|
|
@RequestMapping("getMftList.html")
|
public void getMftList(HttpServletRequest request, HttpServletResponse response) {
|
String cusId = request.getParameter("cusId");
|
String type = request.getParameter("type");
|
List list = cfgFacade.getMftList(cusId, type);
|
WebUtil.write(response, JsonUtil.list2Json(list));
|
}
|
|
|
/**
|
* 打印二维码
|
*/
|
@RequestMapping("printCode.html")
|
public ModelAndView printCode(HttpServletRequest request) {
|
ModelAndView modelAndView = new ModelAndView("/business/pages/cfg/printCode");
|
String ciId = request.getParameter("ciId");
|
Map info = cfgFacade.getCfgById(ciId);
|
modelAndView.addObject("detail", info);
|
String url = Constants.QRCODE_URL + ciId;
|
modelAndView.addObject("QRKEY", url);
|
return modelAndView;
|
}
|
|
/**
|
* 维保方案制定
|
*
|
* @param model
|
* @param request
|
* @return
|
* @author chenlong
|
*/
|
@RequestMapping(value = "editItem.html", method = RequestMethod.GET)
|
public String editItem(Model model, HttpServletRequest request) {
|
Map<String, String> param = ParamsMapUtil.getParameterMap(request);
|
String id = param.get("id");
|
Map ci = cfgFacade.getCfgById(id);
|
List<Map> rcList = cfgFacade.getRcItemList(param);
|
List<Map> lxList = cfgFacade.getRemindItemList(param);
|
List<Map> jkList = cfgFacade.getHealthItemList(param);
|
model.addAttribute("rcList", rcList)
|
.addAttribute("lxList", lxList)
|
.addAttribute("jkList", jkList)
|
.addAttribute("ci", ci);
|
return "/business/pages/cfg/editItem";
|
}
|
|
@RequestMapping(value = "editItem.html", method = RequestMethod.POST)
|
public ModelAndView doEditItem(Model model, HttpServletRequest request) {
|
Map<String, String> param = ParamsMapUtil.getParameterMap(request);
|
cfgFacade.saveItem(param);
|
String js = "window.top.hideDialog('0');";
|
return WebUtil.sysInfoPage(request, "操作成功!",
|
js,
|
SysInfo.Success, "");
|
}
|
|
@RequestMapping("uploadBatch.html")
|
public ModelAndView uploadBatch() {
|
ModelAndView mv = new ModelAndView("/business/pages/cfg/uploadBatch");
|
return mv;
|
}
|
|
@RequestMapping("doUploadBatchCiInfo.html")
|
public ModelAndView doUploadBatchCiInfo(@RequestParam(value = "file", required = false) CommonsMultipartFile file, HttpServletRequest request) {
|
String flag = cfgFacade.doUploadBatchCiInfo(file, request);
|
if (flag == null) {
|
return WebUtil.sysInfoPage(request, "操作成功!",
|
"window.top.query();window.top.hideDialog('uploadBatch');",
|
SysInfo.Success, "");
|
} else {
|
SysInfoMsg msg = new SysInfoMsg();
|
msg.setText(flag);
|
return WebUtil.sysInfoPage(request, "操作失败!",
|
"window.top.hideDialog('uploadBatch');",
|
SysInfo.Error, "", msg);
|
}
|
|
}
|
|
|
/**
|
* 模板下载
|
*
|
* @param request
|
* @param response
|
*/
|
@RequestMapping(value = "downloadExecelTemplate.html")
|
public void excelTemplate(HttpServletRequest request,
|
HttpServletResponse response) {
|
String name = request.getParameter("full_cate_name");
|
String cate = request.getParameter("full_cate_id").split("-")[2];
|
//通用属性
|
Map props = cfgFacade.queryCommonProps();
|
//扩展属性
|
List<Map> groupProps = cfgFacade.queryGroupProps(cate);
|
// if(groupProps.size()>0){
|
// for(Map map:groupProps){
|
// String gname=ConvertUtil.obj2StrBlank(map.get("GROUP_NAME"));
|
// List<Map> list=(List<Map>)map.get("props1");
|
// if(list.size()>0){
|
// for(Map mapa:list){
|
// String nameTwo=ConvertUtil.obj2StrBlank(mapa.get("COLUMNNAME"));
|
// nameTwo=gname+"+"+nameTwo;
|
// mapa.put("COLUMNNAME", nameTwo);
|
// }
|
// }
|
// map.put("props1", list);
|
// }
|
// }
|
String basePath = request.getSession().getServletContext()
|
.getRealPath("");
|
FileInputStream fileIS = null;
|
HSSFWorkbook wb = null;
|
OutputStream os = null;
|
try {
|
fileIS = new FileInputStream(basePath + "/upload/template/template.xls");
|
wb = new HSSFWorkbook(fileIS);
|
HSSFSheet sheet = wb.getSheetAt(0);
|
|
HSSFCellStyle cellStyleRed = wb.createCellStyle();
|
HSSFFont fontStyleRed = wb.createFont();
|
fontStyleRed.setColor(HSSFColor.RED.index);
|
fontStyleRed.setFontHeightInPoints((short) 12);
|
cellStyleRed.setFont(fontStyleRed);
|
cellStyleRed.setAlignment(HSSFCellStyle.ALIGN_CENTER);
|
cellStyleRed.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
|
|
HSSFCellStyle cellStyleBlack = wb.createCellStyle();
|
HSSFFont fontStyleBlack = wb.createFont();
|
fontStyleBlack.setColor(HSSFColor.BLACK.index);
|
fontStyleBlack.setFontHeightInPoints((short) 12);
|
cellStyleBlack.setFont(fontStyleBlack);
|
cellStyleBlack.setAlignment(HSSFCellStyle.ALIGN_CENTER);
|
cellStyleBlack.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
|
|
HSSFRow row1 = sheet.getRow(1);
|
List<Map> textareaProp = (List<Map>) props.get("textareaProp");
|
if (null == row1) {
|
row1 = sheet.createRow(1);
|
}
|
//从第14列开始
|
int index = 14;
|
for (int i = 0; i < textareaProp.size(); i++) {
|
String value = textareaProp.get(i).get("COLUMNNAME").toString();
|
String dataType = textareaProp.get(i).get("DATATYPE").toString();
|
String allowNull = textareaProp.get(i).get("allowNull").toString();
|
HSSFCell cell = row1.getCell(index);
|
if (cell == null) {
|
cell = row1.createCell(index);
|
}
|
if ("6".equals(dataType)) {
|
String itemsValue = "";
|
List<Map> items = (List<Map>) textareaProp.get(i).get(
|
"items");
|
if (items != null) {
|
for (int j = 0; j < items.size(); j++) {
|
if (j == 0) {
|
itemsValue += "(多选:";
|
}
|
itemsValue += items.get(j).get("ITEMVALUE");
|
if (j < items.size() - 1) {
|
itemsValue += ",";
|
} else {
|
itemsValue += ")";
|
}
|
}
|
}
|
cell.setCellValue(value + itemsValue);
|
if ("2".equals(allowNull)) {
|
cell.setCellStyle(cellStyleRed);
|
} else {
|
cell.setCellStyle(cellStyleBlack);
|
}
|
index++;
|
} else if ("1".equals(dataType)) {
|
if ("2".equals(allowNull)) {
|
cell.setCellStyle(cellStyleRed);
|
} else {
|
cell.setCellStyle(cellStyleBlack);
|
}
|
String minvalues = "0";
|
String maxvalues = String.valueOf(Integer.MAX_VALUE);
|
if (textareaProp.get(i).get("MINVALUES") != null) {
|
minvalues = textareaProp.get(i).get("MINVALUES").toString();
|
}
|
if (textareaProp.get(i).get("MAXVALUES") != null) {
|
maxvalues = textareaProp.get(i).get("MAXVALUES").toString();
|
}
|
HSSFDataValidation dataValidation = setDataValidationNumber(2, 200, index, index, minvalues, maxvalues);
|
sheet.addValidationData(dataValidation);
|
cell.setCellValue(value + "[" + minvalues + "~" + maxvalues + "]");
|
index++;
|
} else {
|
if ("2".equals(allowNull)) {
|
cell.setCellStyle(cellStyleRed);
|
} else {
|
cell.setCellStyle(cellStyleBlack);
|
}
|
cell.setCellValue(value);
|
index++;
|
}
|
|
}
|
List<Map> commonProps = (List<Map>) props.get("commonProp");
|
for (int i = 0; i < commonProps.size(); i++) {
|
String value = commonProps.get(i).get("COLUMNNAME").toString();
|
String dataType = commonProps.get(i).get("DATATYPE").toString();
|
String allowNull = commonProps.get(i).get("allowNull").toString();
|
HSSFCell cell = row1.getCell(index);
|
if (cell == null) {
|
cell = row1.createCell(index);
|
}
|
if ("5".equals(dataType)) {
|
List<Map> list = (List<Map>) commonProps.get(i).get("items");
|
cell.setCellValue(value);
|
if (list != null) {
|
HSSFDataValidation dataValidationSelect = setDataValidationSelect(2, 200, index, index, (List<Map>) commonProps.get(i).get(
|
"items"));
|
sheet.addValidationData(dataValidationSelect);
|
}
|
if ("2".equals(allowNull)) {
|
cell.setCellStyle(cellStyleRed);
|
} else {
|
cell.setCellStyle(cellStyleBlack);
|
}
|
index++;
|
} else if ("1".equals(dataType)) {
|
if ("2".equals(allowNull)) {
|
cell.setCellStyle(cellStyleRed);
|
} else {
|
cell.setCellStyle(cellStyleBlack);
|
}
|
String minvalues = "0";
|
String maxvalues = String.valueOf(Integer.MAX_VALUE);
|
if (commonProps.get(i).get("MINVALUES") != null) {
|
minvalues = commonProps.get(i).get("MINVALUES").toString();
|
}
|
if (commonProps.get(i).get("MAXVALUES") != null) {
|
maxvalues = commonProps.get(i).get("MAXVALUES").toString();
|
}
|
HSSFDataValidation dataValidation = setDataValidationNumber(2, 200, index, index, minvalues, maxvalues);
|
sheet.addValidationData(dataValidation);
|
cell.setCellValue(value + "[" + minvalues + "~" + maxvalues + "]");
|
index++;
|
} else {
|
if ("2".equals(allowNull)) {
|
cell.setCellStyle(cellStyleRed);
|
} else {
|
cell.setCellStyle(cellStyleBlack);
|
}
|
cell.setCellValue(value);
|
index++;
|
}
|
|
}
|
HSSFCell cellBzsm = row1.getCell(index);
|
if (cellBzsm == null) {
|
cellBzsm = row1.createCell(index);
|
}
|
cellBzsm.setCellValue("备注说明");
|
cellBzsm.setCellStyle(cellStyleBlack);
|
index++;
|
|
for (int i = 0; i < groupProps.size(); i++) {
|
String gname=ConvertUtil.obj2StrBlank(((Map) groupProps.get(i)).get("GROUP_NAME"));
|
List<Map> props_1 = (List<Map>) ((Map) groupProps.get(i)).get("props1");//含有多选
|
List<Map> props_ = (List<Map>) ((Map) groupProps.get(i)).get("props");//含有单选
|
if (props_1 != null) {
|
for (int j = 0; j < props_1.size(); j++) {
|
HSSFCell cell = row1.getCell(index);
|
if (cell == null) {
|
cell = row1.createCell(index);
|
}
|
String dataType = props_1.get(j).get("DATATYPE").toString();
|
String allowNull = props_1.get(j).get("allowNull").toString();
|
String columnName = gname+"+"+props_1.get(j).get("COLUMNNAME").toString();
|
if ("6".equals(dataType)&&props_1.get(j).get("items")!=null) {
|
String itemsValue = "";
|
List<Map> items = (List<Map>) (props_1.get(j).get("items"));
|
for (int k = 0; k < items.size(); k++) {
|
if (k == 0) {
|
itemsValue += "(多选:";
|
}
|
itemsValue += items.get(k).get("ITEMVALUE");
|
if (k < items.size() - 1) {
|
itemsValue += ",";
|
} else {
|
itemsValue += ")";
|
}
|
}
|
cell.setCellValue(columnName + itemsValue);
|
if ("2".equals(allowNull)) {
|
cell.setCellStyle(cellStyleRed);
|
} else {
|
cell.setCellStyle(cellStyleBlack);
|
}
|
index++;
|
} else {
|
cell.setCellValue(columnName);
|
if ("2".equals(allowNull)) {
|
cell.setCellStyle(cellStyleRed);
|
} else {
|
cell.setCellStyle(cellStyleBlack);
|
}
|
index++;
|
}
|
}
|
}
|
if (props_ != null) {
|
for (int j = 0; j < props_.size(); j++) {
|
HSSFCell cell = row1.getCell(index);
|
if (cell == null) {
|
cell = row1.createCell(index);
|
}
|
String dataType = props_.get(j).get("DATATYPE").toString();
|
String allowNull = props_.get(j).get("allowNull").toString();
|
String columnName =gname+"+"+ props_.get(j).get("COLUMNNAME").toString();
|
if ("5".equals(dataType)) {
|
HSSFDataValidation dataValidation = setDataValidationSelect(2, 200, index, index, (List<Map>) props_.get(j).get(
|
"items"));
|
sheet.addValidationData(dataValidation);
|
cell.setCellValue(columnName);
|
if ("2".equals(allowNull)) {
|
cell.setCellStyle(cellStyleRed);
|
} else {
|
cell.setCellStyle(cellStyleBlack);
|
}
|
index++;
|
} else if ("1".equals(dataType)) {
|
if ("2".equals(allowNull)) {
|
cell.setCellStyle(cellStyleRed);
|
} else {
|
cell.setCellStyle(cellStyleBlack);
|
}
|
String minvalues = "0";
|
String maxvalues = String.valueOf(Integer.MAX_VALUE);
|
if (props_.get(j).get("MINVALUES") != null&&!ConvertUtil.obj2Str(props_.get(j).get("MINVALUES")).equals("")) {
|
minvalues = props_.get(j).get("MINVALUES").toString();
|
}
|
if (props_.get(j).get("MAXVALUES") != null&&!ConvertUtil.obj2Str(props_.get(j).get("MAXVALUES")).equals("")) {
|
maxvalues = props_.get(j).get("MAXVALUES").toString();
|
}
|
HSSFDataValidation dataValidation = setDataValidationNumber(2, 200, index, index, minvalues, maxvalues);
|
sheet.addValidationData(dataValidation);
|
cell.setCellValue(columnName + "[" + minvalues + "~" + maxvalues + "]");
|
index++;
|
} else {
|
cell.setCellValue(columnName);
|
if ("2".equals(allowNull)) {
|
cell.setCellStyle(cellStyleRed);
|
} else {
|
cell.setCellStyle(cellStyleBlack);
|
}
|
index++;
|
}
|
}
|
}
|
}
|
|
//第一行为提示信息
|
HSSFRow row0 = sheet.getRow(0);
|
if (null == row0) {
|
row0 = sheet.createRow(0);
|
}
|
CellRangeAddress hebingCell = new CellRangeAddress(0, 0, 0, index - 1);
|
sheet.addMergedRegion(hebingCell);
|
HSSFCell cell = row0.getCell(0);
|
if (cell == null) {
|
cell = row0.createCell(0);
|
}
|
cell.setCellValue("提示:1.红色字段为必填字段。 2.导入模板中,含有数据验证的,可以手动输入,但是输入的内容必须与数据验证中的数据一致,否则会有‘输入值非法’等提示。 3.多选文本,请用逗号隔开(中英文逗号均可)。 4.日期格式为:yyyyMMdd,例如19990101");
|
HSSFCellStyle cellStyleRed1 = wb.createCellStyle();
|
HSSFFont fontStyleRed1 = wb.createFont();
|
fontStyleRed1.setColor(HSSFColor.RED.index);
|
fontStyleRed1.setFontHeightInPoints((short) 12);
|
cellStyleRed1.setFont(fontStyleRed1);
|
cellStyleRed1.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
|
cellStyleRed1.setAlignment(HSSFCellStyle.ALIGN_LEFT);
|
cell.setCellStyle(cellStyleRed1);
|
|
|
int[] col = {};
|
List<HSSFDataValidation> dataValidationList = setHSSFDataValidationList(2, 200, col, col, request);
|
for (int i = 0; i < dataValidationList.size(); i++) {
|
sheet.addValidationData(dataValidationList.get(i));
|
}
|
|
for (int i = 0; i < index; i++) {
|
sheet.setColumnWidth(i, 25 * 256);
|
}
|
|
os = new FileOutputStream(basePath + "/upload/template/配置采集-配置资料模板.xls");
|
wb.write(os);
|
} catch (IOException e) {
|
e.printStackTrace();
|
} finally {
|
try {
|
if (null != fileIS) {
|
fileIS.close();
|
}
|
if (null != os) {
|
os.close();
|
}
|
} catch (IOException e) {
|
e.printStackTrace();
|
}
|
}
|
try {
|
DownloadUtil.download(response, new File(basePath + "/upload/template/配置采集-配置资料模板.xls"), name + ".xls", false);
|
} catch (IOException e) {
|
e.printStackTrace();
|
}
|
}
|
|
/**
|
* 扩展数据准备-下拉框
|
*
|
* @param startRow
|
* @param endRow
|
* @param startCol
|
* @param endCol
|
* @return
|
*/
|
private HSSFDataValidation setDataValidationSelect(int startRow, int endRow, int startCol, int endCol, List<Map> items) {
|
CellRangeAddressList regions = new CellRangeAddressList(startRow, endRow, startCol, endCol);
|
List<String> item = new ArrayList<String>();
|
if(items!=null) {
|
for (int i = 0; i < items.size(); i++) {
|
item.add(items.get(i).get("ITEMVALUE").toString());
|
}
|
}
|
DVConstraint constraint = DVConstraint.createExplicitListConstraint(item.toArray(new String[item.size()]));
|
HSSFDataValidation dataValidation = new HSSFDataValidation(regions, constraint);
|
return dataValidation;
|
}
|
|
/**
|
* 扩展数据准备-数字
|
*
|
* @param startRow
|
* @param endRow
|
* @param startCol
|
* @param endCol
|
* @return
|
*/
|
private HSSFDataValidation setDataValidationNumber(int startRow, int endRow, int startCol, int endCol, String start, String end) {
|
CellRangeAddressList regions = new CellRangeAddressList(startRow, endRow, startCol, endCol);
|
DVConstraint constraint = DVConstraint.createNumericConstraint(DVConstraint.ValidationType.INTEGER, DVConstraint.OperatorType.BETWEEN, start, end);
|
HSSFDataValidation dataValidation = new HSSFDataValidation(regions, constraint);
|
return dataValidation;
|
}
|
|
/**
|
* 获取基本信息中的下拉选项
|
*
|
* @param startRow 起始行
|
* @param endRow 终止行
|
* @param startCol 起始列
|
* @param endCol 终止列
|
* @param request
|
* @return
|
*/
|
private List<HSSFDataValidation> setHSSFDataValidationList(int startRow, int endRow, int[] startCol, int[] endCol, HttpServletRequest request) {
|
//项目名称
|
List statusList = customerFacade.getCusList();
|
List<String> status = new ArrayList<String>();
|
for (int i = 0; i < statusList.size(); i++) {
|
String value = ((Map) statusList.get(i)).get("name").toString();
|
status.add(value);
|
}
|
|
List<DVConstraint> constraints = new ArrayList<DVConstraint>();
|
DVConstraint constraintStatus = DVConstraint.createExplicitListConstraint(status.toArray(new String[status.size()]));
|
constraints.add(constraintStatus);
|
CellRangeAddressList regions = null;
|
List<HSSFDataValidation> dataValidationList = new ArrayList<HSSFDataValidation>();
|
for (int i = 0; i < startCol.length; i++) {
|
regions = new CellRangeAddressList(startRow, endRow, startCol[i], endCol[i]);
|
HSSFDataValidation dataValidation = new HSSFDataValidation(regions, constraints.get(i));
|
dataValidationList.add(dataValidation);
|
}
|
return dataValidationList;
|
}
|
|
|
/**
|
* 配置关系图
|
* @param request
|
* @param response
|
* @return
|
*/
|
@RequestMapping("relationImg.html")
|
public String relationImg(Model model,HttpServletRequest request,HttpServletResponse response){
|
String flowId = request.getParameter("flowId");
|
String ciId = request.getParameter("id");
|
CMDB_CI_BASE ci = new CMDB_CI_BASE(ciId).getInstanceById();
|
List<Map> mainlist = cfgFacade.getMainCiRelationDetail(ciId);
|
List<Map> sublist = cfgFacade.getSubCiRelationDetail(ciId);
|
model.addAttribute("mainlist", mainlist);
|
model.addAttribute("sublist", sublist);
|
model.addAttribute("ci", ci);
|
return "/business/pages/cfg/relationImg";
|
}
|
/**
|
* 配置审计
|
*
|
* @param model
|
* @param request
|
* @return
|
* @author 高发展
|
*/
|
@RequestMapping("cfgmanageSjList.html")
|
public String cfgmanageSjList(Model model, HttpServletRequest request) {
|
List<Map> cusList = customerFacade.getCusList();
|
model.addAttribute("cusList", cusList);
|
return "/business/pages/cfg/cfgmanageSjList";
|
}
|
|
@RequestMapping("cfgmanageSjData.html")
|
public String cfgmanageSjData(PageInfo pageInfo, Model model, HttpServletRequest request) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
params.put("fstate_wc", Constants.CFG_FLOW_WC.toString());
|
pageInfo = cfgFacade.getCfgData(pageInfo, params);
|
model.addAttribute("pageInfo", pageInfo);
|
return "/business/pages/cfg/cfgmanageSjData";
|
}
|
|
@RequestMapping("cfgmanageSjCount.html")
|
public void cfgmanageSjCount(Model model, HttpServletRequest request, HttpServletResponse response) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
params.put("fstate_wc", Constants.CFG_FLOW_WC.toString());
|
params.put("wc_flag", "1");
|
WebUtil.write(response, cfgFacade.getCfgCount(params).toString());
|
}
|
/**
|
* 提交审计
|
*
|
* @param model
|
* @param request
|
* @return
|
* @author gaofazhan
|
*/
|
@RequestMapping(value = "comitSj.html", method = RequestMethod.GET)
|
public String comitSj(Model model, HttpServletRequest request) {
|
String cfgId = request.getParameter("cfgId");
|
Map info = cfgFacade.getCfgById(cfgId);
|
List groupProps = cfgcateFacade.getPropTemplate(ConvertUtil.obj2StrBlank(info.get("lv3_id")), ConvertUtil.obj2StrBlank(info.get("id")));
|
model.addAttribute("groupProps", groupProps);
|
model.addAttribute("info", info);
|
return "/business/pages/cfg/comitSj";
|
}
|
/**
|
* 审计
|
* @param flowRecord
|
* @param model
|
* @param request
|
* @return
|
*/
|
@RequestMapping(value = "comitSj.html", method = RequestMethod.POST)
|
public ModelAndView doComitSj(FlowRecord flowRecord, Model model, HttpServletRequest request) {
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
params.put("user_id", WebUtil.getUserId(request));
|
params.put("user_name", WebUtil.getUserName(request));
|
params.put("sj_time", ConvertUtil.obj2Str(DateUtil.getCurrentDate14()));
|
cfgFacade.saveSj(params);
|
String js = "window.top.query();"
|
+ "window.top.hideDialog('do');";
|
return WebUtil.sysInfoPage(request, "操作成功!",
|
js,
|
SysInfo.Success, "");
|
}
|
|
}
|