首页>代码>SSM+MySQL开发java CRM客户关系管理系统>/ShiTou_CRM/src/com/oaec/shitou/controller/CounselorController.java
package com.oaec.shitou.controller;

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.Employee;
import com.oaec.shitou.entity.Page;
import com.oaec.shitou.entity.QueryCondition;
import com.oaec.shitou.service.CounselorService;
import com.oaec.shitou.util.ControllerUtil;

@Controller
@RequestMapping(value="/counselorHandle")
public class CounselorController {

	@Autowired
	CounselorService counselorService;
	/**
	 *咨询师控制层
	 */
	Log log=LogFactory.getLog(CounselorController.class);
	//咨询师 客户信息  //本员工 employeeId    ConsultItem 表   consult_status=null //pageNo 页数
	@RequestMapping(value="counselorClient",method=RequestMethod.GET)
	public String counselorClient(Integer pageNo,HttpServletRequest request){
		
		Employee employee=(Employee)request.getSession().getAttribute("employee");
		int employeeId = employee.getEmployeeId();
		log.info("员工信息"+employee);
		
		HashMap<String, Object> map=new HashMap<String, Object>();
		map.put("employeeId", employeeId);
		
		List<ConsultItem> counselorClient = counselorService.counselorClient(map);
		
		int totalNum=0;
		if(counselorClient!=null){
			totalNum = counselorClient.size();
			Page page =new Page(pageNo,10,totalNum);
			map.put("page", page);
			List<ConsultItem> counselorClient2 = counselorService.counselorClient(map);
			request.setAttribute("page", page);
			request.setAttribute("counselorClient", counselorClient2);
			
			return "02Counselor/CustomerInfo";
		}
			return "02Counselor/CustomerInfo";
	}
	//咨询师 咨询客户  填写 咨询师踪单
	@RequestMapping(value="advisoryCounselor",method=RequestMethod.POST)
	public String advisoryCounselor(Integer pageNo,ConsultItem consultItem,HttpServletRequest request){
		
		System.out.println("+--------------------------"+pageNo);
		
		System.out.println(consultItem);
		boolean counselor = counselorService.advisoryCounselor(consultItem);
		if(counselor){
			request.setAttribute("advisory", "咨询完成");
		}else{
			request.setAttribute("advisory", "咨询失败");
		}
		return counselorClient(pageNo,request);
	}
	
	/**
	 * 点击咨询师  查询出所有报表数据
	 */
	@RequestMapping(value="counselorReport",method=RequestMethod.GET)
	public String  counselorReport(int pageNo,HttpServletRequest request){
		QueryCondition qc=new QueryCondition();
		return limitList(qc, pageNo,request);
	}
	
	/**
	 * (根据条件) 查询出指定报表
	 */
	@RequestMapping(value="limitCounselorReport",method=RequestMethod.POST)
	public String  limitCounselorReport(QueryCondition qc,Integer pageNo,HttpServletRequest request){
		return limitList(qc,pageNo,request);
	}
	/**
	 * (根据条件)  下一页 上一页 数据的打印
	 */
	@RequestMapping(value="limitListItem03",method=RequestMethod.GET)
	public String  limitListItem03(QueryCondition qc,Integer pageNo,HttpServletRequest request){
        qc=(QueryCondition)request.getSession().getAttribute("qc");
        log.info(qc);
        return limitList(qc,pageNo,request);
	}
	
	/**
	 *  报表查询的公用方法 
	 */
	public String  limitList(QueryCondition qc,Integer pageNo,HttpServletRequest request){
		log.info("查询条件"+qc);
		//获得   跟用户
		Employee employee =(Employee)request.getSession().getAttribute("employee");
		int employeeId = employee.getEmployeeId();
		log.info("员工Id"+employeeId);
		
		//获得总数据数量
		HashMap<String, Object> map =new HashMap<String, Object>();
		qc=ControllerUtil.queryConditionNull(qc);
		map.put("qc", qc);
		map.put("employeeId", employeeId);
		
		List<ConsultItem> counselorReport = counselorService.counselorReport(map);
		int totalNum=0;
		if(counselorReport!=null){
			totalNum=counselorReport.size();
		}else{
			totalNum=0;
		}
		log.info("数据总数"+totalNum);
		//获得Page对象
		if(null==pageNo){
			pageNo=1;
		}
		Page page=new Page(pageNo,10,totalNum);
		log.info("Page对象"+page);
		// HashMap对象   
		map.put("page", page);
		List<ConsultItem> counselorReport2 = counselorService.counselorReport(map);
		
		request.getSession().setAttribute("qc", qc);
		request.setAttribute("page", page);
		request.setAttribute("counselorReport", counselorReport2);
		return "02Counselor/ViewReport";
	}
	
	
	
	
}






























最近下载更多
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  LV54 2022年1月7日
1211366946  LV3 2021年12月27日
最近浏览更多
m5433661  LV2 3月28日
森sdfgf  LV8 3月26日
vluobo  LV1 3月19日
爱丽淇  LV5 3月18日
shenghaer  LV1 2月9日
阿凡达  LV9 1月29日
admin_z  LV22 1月29日
PSSDZH  LV3 1月22日
binlong520 1月11日
暂无贡献等级
晴曛  LV6 2023年12月29日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友