package cn.ksource.web.controller.business.pages.delivery; 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.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import cn.ksource.beans.GG_USER; 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.SysInfo; import cn.ksource.core.web.WebUtil; import cn.ksource.web.facade.deliverMent.DeliverMentFacade; import cn.ksource.web.facade.incident.IncidentFacade; /** * 交付管理 * @author 高发展 *2018-03-19 */ @Controller @RequestMapping("/business/pages/deliver") public class DeliveryMentController { @Autowired private DeliverMentFacade deliverMentFacade; @Autowired private IncidentFacade incidentFacade; /** * 交付管理页面 * @param request * @return */ @SuppressWarnings("rawtypes") @RequestMapping("deliverMentList.html") public ModelAndView deliverMentList(HttpServletRequest request){ ModelAndView view=new ModelAndView("business/pages/deliver/deliverMentList"); //客户列表 List cusList = incidentFacade.getCustomerList(); view.addObject("customers", cusList); return view; } /** * 交付管理数据 * @param model * @param request * @return */ @SuppressWarnings("rawtypes") @RequestMapping("deliverMentData.html") public ModelAndView dutyPlanListData(Model model,HttpServletRequest request,PageInfo pageInfo){ ModelAndView view=new ModelAndView("business/pages/deliver/deliverMentData"); Map param=ParamsMapUtil.getParameterMap(request); PageInfo info=deliverMentFacade.getDeliverMentData(param, pageInfo); view.addObject("info", info); return view; } /** * 交付管理数据数量 * @param model * @param request * @param response */ @SuppressWarnings("rawtypes") @RequestMapping("deliverMentCount.html") public void dutyPlanListCount(Model model,HttpServletRequest request,HttpServletResponse response){ Map param=ParamsMapUtil.getParameterMap(request); Integer count = deliverMentFacade.getDeliverMentCount(param); WebUtil.write(response, count.toString()); } /** * 增加页面 * @param request * @return */ @SuppressWarnings({ "rawtypes", "unchecked" }) @RequestMapping("addDeliverMent.html") public ModelAndView addDeliverMent(HttpServletRequest request){ ModelAndView view=new ModelAndView("business/pages/deliver/addDeliverMent"); Map param=ParamsMapUtil.getParameterMap(request); Map info=new HashMap(); String id=request.getParameter("id"); if(StringUtil.notEmpty(id)){ info=deliverMentFacade.getDeliverMent(param); info.put("PLAN_YEAR", ConvertUtil.obj2StrBlank(info.get("PLAN_YEAR"))+"01"); } //客户列表 List cusList = incidentFacade.getCustomerList(); view.addObject("customers", cusList); view.addObject("info", info); return view; } /** * 增加交付管理 * @param dutyPlan * @param request * @return */ @SuppressWarnings({ "unchecked", "rawtypes" }) @RequestMapping("saveDeliverMent.html") public ModelAndView saveDeliverMent(HttpServletRequest request){ Map param=ParamsMapUtil.getParameterMap(request); param.put("userId", WebUtil.getLoginedUserId(request)); GG_USER user=new GG_USER(WebUtil.getLoginedUserId(request)).getInstanceById(); param.put("userName", user.getZsxm()); String id=request.getParameter("id"); if(StringUtil.notEmpty(id)){ deliverMentFacade.updateDeliverMent(param); }else{ deliverMentFacade.saveDeliverMent(param); } return WebUtil.sysInfoPage(request, "操作成功!", "window.top.query();window.top.hideDialog('0');", SysInfo.Success,""); } /** * 增加页面 * @param request * @return */ @SuppressWarnings({ "rawtypes"}) @RequestMapping("addDeliverReport.html") public ModelAndView addDeliverReport(HttpServletRequest request){ ModelAndView view=new ModelAndView("business/pages/deliver/addDeliverReport"); Map param=ParamsMapUtil.getParameterMap(request); Map info=deliverMentFacade.getDeliverMent(param); Map ment=deliverMentFacade.getMent(param); view.addObject("info", info); view.addObject("ment", ment); return view; } /** * 增加交付管理 * @param dutyPlan * @param request * @return */ @SuppressWarnings({ "unchecked", "rawtypes" }) @RequestMapping("saveDeliverReport.html") public ModelAndView saveDeliverReport(HttpServletRequest request){ Map param=ParamsMapUtil.getParameterMap(request); param.put("userId", WebUtil.getLoginedUserId(request)); GG_USER user=new GG_USER(WebUtil.getLoginedUserId(request)).getInstanceById(); param.put("userName", user.getZsxm()); String id=request.getParameter("id"); if(StringUtil.notEmpty(id)){ deliverMentFacade.updateDeliverReport(param); }else{ deliverMentFacade.saveDeliverReport(param); } return WebUtil.sysInfoPage(request, "操作成功!", "window.top.query();window.top.hideDialog('0');", SysInfo.Success,""); } /** * 删除交付管理 * * @param request * @param response */ @SuppressWarnings("rawtypes") @RequestMapping("delPlan.html") public void delSeller(HttpServletRequest request, HttpServletResponse response) { Map param = ParamsMapUtil.getParameterMap(request); deliverMentFacade.delEmergencyPlan(param); WebUtil.write(response, String.valueOf("1")); } /** * 交付管理详情 * @param request * @return */ @SuppressWarnings("rawtypes") @RequestMapping("deliverDetail.html") public ModelAndView deliverDetail(HttpServletRequest request){ ModelAndView view=new ModelAndView("business/pages/deliver/deliverDetail"); Map param=ParamsMapUtil.getParameterMap(request); Map info=deliverMentFacade.getDeliverReport(param); view.addObject("info", info); return view; } }