首页>代码>SSM+MySQL开发java CRM客户关系管理系统>/ShiTou_CRM/src/com/oaec/shitou/controller/AssistantController.java
package com.oaec.shitou.controller; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; 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 com.oaec.shitou.entity.ConsultItem; import com.oaec.shitou.entity.Customer; import com.oaec.shitou.entity.Employee; import com.oaec.shitou.entity.Item; import com.oaec.shitou.entity.Page; import com.oaec.shitou.service.AssistantService; /** * 电销助理 */ @Controller @RequestMapping(value="/assistantHandle") public class AssistantController { @Autowired AssistantService assistantService; Log log=LogFactory.getLog(SuperController.class); /** * 为电销员工 分配 客户信息 分页打印 */ @RequestMapping(value="customerList01",method=RequestMethod.GET) public String customerList01(Integer pageNo,HttpServletRequest request){ HashMap<String,Object> map=new HashMap<String, Object>(); List<Customer> customerList01 = assistantService.customerList(map); int totalNum=0; if(customerList01!=null){ totalNum=customerList01.size(); Page page =new Page(pageNo,10,totalNum); map.put("page", page); //获得未分配的客户信息 List<Customer> customerList = assistantService.customerList(map); //获得 所有电销员工 List<Employee> selectTelemark = assistantService.selectTelemark(); request.setAttribute("page", page); request.setAttribute("customerList", customerList); request.setAttribute("selectTelemark", selectTelemark); return "01AssistantPage/ElectricitySales"; }else{ return "01AssistantPage/ElectricitySales"; } } /** * 助理给电销员工分配客户 */ @RequestMapping(value="distrCust",method=RequestMethod.POST) public String distrCust(Integer pageNo,Integer employeeId,HttpServletRequest request){ String[] custIdList = request.getParameterValues("customerId"); log.info("选中的客户Id"+custIdList); log.info("要分配给那个员工的Id"+employeeId); /*ArrayList<Item> listItem=new ArrayList<Item>();*/ List<Item> listItem=new ArrayList<Item>(); for (String custId : custIdList) { Item item=new Item(); Employee employee =new Employee(); Customer customer =new Customer(); int customerId = Integer.parseInt(custId); customer.setCustomerId(customerId); employee.setEmployeeId(employeeId); item.setCustomer(customer); item.setEmployee(employee); item.setItemType("电销"); listItem.add(item); } boolean insertItem = assistantService.insertItem(listItem); if(insertItem){ request.setAttribute("result", "分配成功!!"); }else{ request.setAttribute("result", "分配失败!!"); } return customerList01(1,request); } /** * 查询 电销跟单表 为咨询师 分配 客户信息 分页打印 */ @RequestMapping(value="itemList01",method=RequestMethod.GET) public String itemList01(Integer pageNo,HttpServletRequest request){ //页数 //状态为上门 //未分配的 HashMap<String,Object> map=new HashMap<String, Object>(); List<Item> itemList = assistantService.itemList(map); int totalNum=0; if(itemList!=null){ totalNum=itemList.size(); Page page =new Page(pageNo,10,totalNum); map.put("page", page); //获得未分配的客户信息 List<Item> itemList02 = assistantService.itemList(map); //获得 所有在职 咨询师 List<Employee> counselor = assistantService.selectCounselor(); request.setAttribute("page", page); request.setAttribute("itemList02", itemList02); request.setAttribute("counselor", counselor); return "01AssistantPage/Counselor"; }else{ return "01AssistantPage/Counselor"; } } /** * 助理给咨询师 分配客户 */ @RequestMapping(value="counselorCust",method=RequestMethod.POST) public String counselorCust(Integer pageNo,Integer employeeId,HttpServletRequest request){ String[] custIdList = request.getParameterValues("customerId"); log.info("选中的客户Id"+custIdList); log.info("要分配给的咨询师Id"+employeeId); /*ArrayList<Item> listItem=new ArrayList<Item>();*/ List<ConsultItem> listConsultItem=new ArrayList<ConsultItem>(); for (String custId : custIdList) { System.out.println("客户ID"+custId); ConsultItem consultItem=new ConsultItem(); Employee employee =new Employee(); Customer customer =new Customer(); int customerId = Integer.parseInt(custId); customer.setCustomerId(customerId); employee.setEmployeeId(employeeId); consultItem.setCustomer(customer); consultItem.setEmployee(employee); consultItem.setConsultType("0"); listConsultItem.add(consultItem); } boolean insertItem = assistantService.insertConsultItem(listConsultItem); if(insertItem){ request.setAttribute("result", "分配成功!!"); }else{ request.setAttribute("result", "分配失败!!"); } return itemList01(1,request); } /** * 对 电销员工分配客户的报表 (查询出 Item 表中的所有数据 得到 员工ID 客户ID * Item 中 item_type="电销") */ @RequestMapping(value="telemStatement",method=RequestMethod.GET) public String telemStatement(Integer pageNo,HttpServletRequest request){ HashMap<String,Object> map=new HashMap<String, Object>(); List<Item> telemStatement = assistantService.telemStatement(map); int totalNum=0; if(telemStatement!=null){ totalNum=telemStatement.size(); Page page =new Page(pageNo,10,totalNum); map.put("page", page); List<Item> telemStatement2 = assistantService.telemStatement(map); request.setAttribute("page", page); request.setAttribute("telemStatement2", telemStatement2); return "01AssistantPage/sortConsultItemLIst"; }else{ return "01AssistantPage/sortConsultItemLIst"; } } /** * 对 咨询师分配客户的报表 (查询出 .ConsultItem 表中的所有数据 得到 员工ID 客户ID */ @RequestMapping(value="consultantReport",method=RequestMethod.GET) public String consultantReport(Integer pageNo,HttpServletRequest request){ HashMap<String,Object> map=new HashMap<String, Object>(); List<ConsultItem> consultantReport = assistantService.ConsultantReport(map); int totalNum=0; if(consultantReport!=null){ totalNum=consultantReport.size(); Page page =new Page(pageNo,10,totalNum); map.put("page", page); List<ConsultItem> consultantReport2 = assistantService.ConsultantReport(map); request.setAttribute("page", page); request.setAttribute("consultantReport2", consultantReport2); return "01AssistantPage/ConsultantReport"; }else{ return "01AssistantPage/ConsultantReport"; } } }
最近下载更多
2036495585 LV9
2023年9月25日
wcm2003 LV1
2023年6月3日
lwp011 LV27
2022年9月19日
brucega LV3
2022年6月1日
yuqi886 LV5
2022年4月16日
大水池 LV2
2022年4月8日
Yee. LV5
2022年3月13日
刘123456789 LV8
2022年2月24日
wanglinddad LV55
2022年1月7日
1211366946 LV3
2021年12月27日