Demo entry 5958966

UsershaftController.java

   

Submitted by anonymous on Sep 09, 2016 at 08:24
Language: Java. Code size: 13.7 kB.

package cn.qtone.bosp.shaft.usershaft.controller;

import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import cn.qtone.bosp.base.Const;
import cn.qtone.bosp.base.ControllerBase;
import cn.qtone.bosp.common.kpi.vo.KpiVo;
import cn.qtone.bosp.common.shaft.domain.ShaftItem;
import cn.qtone.bosp.common.shaft.domain.YwInfo;
import cn.qtone.bosp.common.shaft.service.ShaftService;
import cn.qtone.bosp.common.vo.Paging;
import cn.qtone.bosp.index.service.IndexService;
import cn.qtone.bosp.index.vo.ShaftItemVo;
import cn.qtone.bosp.score.domain.UserScore;
import cn.qtone.bosp.score.service.ScoreService;
import cn.qtone.bosp.shaft.usershaft.po.UserVisitDayStat;
import cn.qtone.bosp.shaft.usershaft.service.UsershaftService;
import cn.qtone.bosp.shaft.usershaft.vo.SubStudentDetailVo;
import cn.qtone.bosp.shaft.usershaft.vo.UserShaftVo;
import cn.qtone.bosp.shaft.usershaft.vo.UserVisitHistoryVo;
import cn.qtone.bosp.shaft.usershaft.vo.UserVisitMapVo;
import cn.qtone.bosp.util.BospDateUtil;
import cn.qtone.bosp.util.BospLogUtil;
import cn.qtone.bosp.util.BospOrgUtil;
import cn.qtone.ngap.orgstruct.NgapDeptService;
import cn.qtone.ngap.orgstruct.domain.NgapDept;
import cn.qtone.ngap.orgstruct.domain.NgapUser;
@Controller
@RequestMapping("/usershaft.do")
public class UsershaftController extends ControllerBase {
	@Autowired
	@Qualifier("cn.qtone.bosp.common.shaft.service.ShaftService")
	private ShaftService sService;
	
	@Autowired
	@Qualifier("cn.qtone.bosp.shaft.usershaft.service.UsershaftService")
	private UsershaftService usService;
	
	
	@Resource(name="indexService")
	private IndexService indexService;
	
	@Resource(name="scoreService")
	private ScoreService scoreService;
	
	/**
	 * 首页 
	 */
	@RequestMapping(params = "action=index")
	public ModelAndView index(HttpServletRequest request,ShaftItemVo svo){
		//取当前用户
		Map<String, Object> map = new HashMap<String, Object>();
		NgapUser user=this.getCurrentUser(request);
		UserShaftVo vo=this.usService.getOpenShaftVo(svo.getUserCode(),user);
		map.put("vo", vo);
		map.put("svo", svo);
		return new ModelAndView("/shaft/usershaft/userShaft", map);
	}
	
	@RequestMapping(params = "action=indexWx")
	public ModelAndView indexWx(HttpServletRequest request,String userCode,String beginDate,String endDate){
		//取当前用户
		Map<String, Object> map = new HashMap<String, Object>();
		NgapUser user=this.getCurrentUser(request);
		UserShaftVo vo=this.usService.getOpenShaftVo(userCode,user);
		vo.setBeginDate(beginDate);
		vo.setEndDate(endDate);
		map.put("vo", vo);
		return new ModelAndView("/shaft/usershaft/wxUserShaft", map);
	}
	
	
	@RequestMapping(params = "action=loadWxItems")
	public ModelAndView loadWxItems(HttpServletRequest request,ShaftItemVo vo){
		Map<String, Object> map = new HashMap<String, Object>();
		NgapUser user=this.getCurrentUser(request);
		vo.setUser(user);
		vo.setQueryItemType(String.valueOf(Const.SHAFTITEM_TYPE_拜访历史));
		vo.setIsIneffective(Const.FLAG_是);
		map.put("itemVo", vo);
		return new ModelAndView("/shaft/shaftItems", map);
	}
	
	/**
	 * 打开用户轴信息动态
	 * @param request
	 * @return
	 */
	@RequestMapping(params = "action=loadUserItems")
	public ModelAndView loadUserItems(HttpServletRequest request,ShaftItemVo vo){
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("itemVo", vo);
		return new ModelAndView("/shaft/shaftItems", map);
	}
	
	
	/**
	 * 加载用户信息以及用户业务信息
	 * @param request
	 * @param vo
	 * @return
	 */
	@RequestMapping(params = "action=loadUserData")
	public ModelAndView loadUserData(HttpServletRequest request,String userCode){
		//取当前用户
		Map<String, Object> map = new HashMap<String, Object>();
		UserShaftVo vo=this.usService.getUserDataVo(userCode);
		UserScore scoreVo = this.scoreService.getUserScore(userCode, null, null);
		map.put("vo", vo);
		map.put("scoreVo", scoreVo);
		map.put("seeDeptKpi", BospOrgUtil.checkHaveRole(userCode, Const.ROLE_高客,Const.ROLE_区域经理,Const.ROLE_区域项目负责人,Const.ROLE_大区总经理,Const.ROLE_BOSP管理员,Const.ROLE_营销总监));
		return new ModelAndView("/shaft/usershaft/userData", map);
	}
	
	/**
	 * 加载用户拜访记录
	 * @param request
	 * @param vo
	 * @return
	 */
	@RequestMapping(params = "action=loadVisitHistory")
	public ModelAndView loadVisitHistory(HttpServletRequest request,UserVisitHistoryVo vo){
		//取当前用户
		Map<String, Object> map = new HashMap<String, Object>();
		Paging<UserVisitHistoryVo> paging=this.usService.getUserVisitHistory(vo);
		map.put("paging", paging);
		return new ModelAndView("/shaft/usershaft/userVisitHistory", map);
	}
	
	
	
	@RequestMapping(params = "action=loadVisitMap")
	public ModelAndView loadVisitMap(HttpServletRequest request,UserVisitMapVo vo){
		//取当前用户
		Map<String, Object> map = new HashMap<String, Object>();
		UserVisitMapVo mapVo=this.usService.getUserVisitMap(vo);
		map.put("vo", mapVo);
		return new ModelAndView("/shaft/usershaft/userVisitMap", map);
	}
	///////////////////////////////////////////////////////////////////////////////////////////////
	/**
	 * 由itemId 取出页面 
	 * @return
	 */
	@RequestMapping(params = "action=indexbyid")
	public ModelAndView index(HttpServletRequest request,Integer itemId){
		//取当前用户
		NgapUser user=this.getCurrentUser(request);
		Map<String, Object> map = new HashMap<String, Object>();
		ShaftItem item = sService.getShaftItem(itemId);
		map.put("userCode", item.getCreateUser());
		map.put("itemId", itemId);
		map.put("user", user);
		return new ModelAndView("/usershaft/user_shaft", map);
	}
	
	/**
	 * 加载用户基础数据
	 */
	@RequestMapping(params = "action=profile")
	public ModelAndView profile(HttpServletRequest request,String userCode){
		Map<String, Object> map = new HashMap<String, Object>();
		NgapUser base = BospOrgUtil.getUser(userCode);
		String deptName = "";
		String ownDept = base.getOwnDept();
		if(ownDept != null){
			NgapDept dept = NgapDeptService.getNgapDeptInfo(ownDept.split(",")[0]);
			if(dept != null){
				deptName = dept.getDeptName();
			}
		}
		YwInfo yw = usService.getUserYwInfo(base.getUserCode());
		KpiVo kpiVo=indexService.getKpiVo(base.getUserCode());
		map.put("base", base);
		map.put("deptName", deptName);
		map.put("yw", yw);
		map.put("kpiVo", kpiVo);
		
		return new ModelAndView("/usershaft/user_shaft_profile", map);
	}
	
	
	
	
	/**
	 * 打开部门人员业绩情况
	 * @return
	 */
	@RequestMapping(params = "action=deptUserKpi")
	public ModelAndView deptUserKpi(HttpServletRequest request,String userCode){
		NgapUser user = this.getCurrentUser(request);
		BospLogUtil.addUsageLog(user, Const.BOSP_FUNC_TYPE_业绩查看, "");
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("deptCode", BospOrgUtil.getUserDeptCode(userCode));
		return new ModelAndView("/shaft/usershaft/deptUserKpi", map);
	}

	
	/**
	 * 打开部门人员业绩情况
	 * @return
	 */
	@RequestMapping(params = "action=deptUserKpiDetail")
	public ModelAndView deptUserKpiDetail(HttpServletRequest request,String deptCode){
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("deptName", BospOrgUtil.getDeptName(deptCode));
		map.put("deptCode", deptCode);
		map.put("yws", this.sService.getTransactions());
		return new ModelAndView("/shaft/usershaft/deptUserKpiDetail", map);
	}
	
	/**
	 * 打开部门业绩人员
	 * @return
	 */
	@RequestMapping(params = "action=loadDeptKpiUsers")
	public ModelAndView loadDeptKpiUsers(HttpServletRequest request,String deptCode,Integer ywId){
		Map<String, Object> map = new HashMap<String, Object>();
		
		map.put("users", this.usService.getDeptKpiUsers(deptCode,ywId));
		return new ModelAndView("/shaft/usershaft/deptUserKpiUsers", map);
	}
	
	/**
	 * 打开日拜访统计
	 * @return
	 */
	@RequestMapping(params = "action=userVisitDayStat")
	public ModelAndView userVisitDayStat(HttpServletRequest request){
		NgapUser user = this.getCurrentUser(request);
		BospLogUtil.addUsageLog(user, Const.BOSP_FUNC_TYPE_拜访与业绩日统计, "");
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("deptCode", BospOrgUtil.getUserDeptCode(user.getUserCode()));
		map.put("seeAllFlag", BospOrgUtil.checkHaveRole(user.getUserCode(), Const.ROLE_BOSP管理员,Const.ROLE_网服));
		map.put("userCode", user.getUserCode());
		return new ModelAndView("/shaft/usershaft/userVisitDayStat", map);
	}
	
	
	/**
	 * 打开日拜访统计人员
	 * @return
	 */
	@RequestMapping(params = "action=userVisitDayStatUsers")
	public ModelAndView userVisitDayStatUsers(HttpServletRequest request,String deptCode){
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("deptName", BospOrgUtil.getDeptName(deptCode));
		map.put("deptCode", deptCode);
		map.put("users", this.sService.getUserVo(deptCode));
		map.put("nowUser", this.getCurrentUser(request));
		return new ModelAndView("/shaft/usershaft/userVisitDayStatUsers", map);
	}
	
	
	/**
	 * 打开学校状态部门人员
	 * @return
	 */
	@RequestMapping(params = "action=userVisitDayStatDetail")
	public ModelAndView userVisitDayStatDetail(HttpServletRequest request,UserVisitDayStat dstat){
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("dstat", dstat);
		return new ModelAndView("/shaft/usershaft/userVisitDayStatDetail",map);
	}
	
	/**
	 * 打开学校状态部门人员
	 * @return
	 */
	@RequestMapping(params = "action=userVisitDayStatList")
	public ModelAndView userVisitDayStatList(HttpServletRequest request,UserVisitDayStat dstat){
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("page", this.usService.getUserDayStats(dstat,request));
		return new ModelAndView("/shaft/usershaft/userVisitDayStatList", map);
	}
	
	/**
	 * 查询新增退订明细
	 * @return
	 */
	@RequestMapping(params = "action=querySubStudentDetail")
	public ModelAndView querySubStudentDetail(HttpServletRequest request,SubStudentDetailVo vo){
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("page", this.usService.querySubStudentDetail(vo,request));
		map.put("vo", vo);
		return new ModelAndView("/shaft/usershaft/userSubStudentDetail", map);
	}
	
	
	
	/**
	 * 打开用户增长明细
	 * @return
	 */
	@RequestMapping(params = "action=userUserAddIndex")
	public ModelAndView userUserAddIndex(HttpServletRequest request){
		NgapUser user = this.getCurrentUser(request);
		BospLogUtil.addUsageLog(user, Const.BOSP_FUNC_TYPE_用户增长明细, "");
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("deptCode", BospOrgUtil.getUserDeptCode(user.getUserCode()));
		map.put("seeAllFlag", BospOrgUtil.checkHaveRole(user.getUserCode(), Const.ROLE_BOSP管理员,Const.ROLE_网服));
		return new ModelAndView("/shaft/usershaft/userAddDetailIndex", map);
	}
	
	/**
	 * 打开用户退订明细
	 * @return
	 */
	@RequestMapping(params = "action=userUserDownIndex")
	public ModelAndView userUserDownIndex(HttpServletRequest request){
		NgapUser user = this.getCurrentUser(request);
		BospLogUtil.addUsageLog(user, Const.BOSP_FUNC_TYPE_用户退订明细, "");
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("deptCode", BospOrgUtil.getUserDeptCode(user.getUserCode()));
		map.put("seeAllFlag", BospOrgUtil.checkHaveRole(user.getUserCode(), Const.ROLE_BOSP管理员,Const.ROLE_网服));
		return new ModelAndView("/shaft/usershaft/userDownDetailIndex", map);
	}
	
	
	
	/**
	 * 打开用户增长明细人员
	 * @return
	 */
	@RequestMapping(params = "action=userAddDetailUsers")
	public ModelAndView userAddDetailUsers(HttpServletRequest request,String deptCode){
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("deptName", BospOrgUtil.getDeptName(deptCode));
		map.put("deptCode", deptCode);
		map.put("users", this.sService.getUserVo(deptCode));
		map.put("nowUser", this.getCurrentUser(request));
		return new ModelAndView("/shaft/usershaft/userAddDetailUsers", map);
	}
	
	
	
	/**
	 * 打开用户退订明细人员
	 * @return
	 */
	@RequestMapping(params = "action=userDownDetailUsers")
	public ModelAndView userDownDetailUsers(HttpServletRequest request,String deptCode){
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("deptName", BospOrgUtil.getDeptName(deptCode));
		map.put("deptCode", deptCode);
		map.put("users", this.sService.getUserVo(deptCode));
		map.put("nowUser", this.getCurrentUser(request));
		return new ModelAndView("/shaft/usershaft/userDownDetailUsers", map);
	}
	
	
	/**
	 * 用户增长明细条件页
	 * @param request
	 * @param userCode
	 * @return
	 */
	@RequestMapping(params = "action=userAddDetail")
	public ModelAndView userAddDetail(HttpServletRequest request,String userCode){
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("userCode", userCode);
		map.put("nowDay", BospDateUtil.getDateStr(Calendar.getInstance(), "yyyyMMdd"));
		return new ModelAndView("/shaft/usershaft/userAddDetail",map);
	}
	
	/**
	 * 用户退订明细条件页
	 * @param request
	 * @param userCode
	 * @return
	 */
	@RequestMapping(params = "action=userDownDetail")
	public ModelAndView userDownDetail(HttpServletRequest request,String userCode){
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("userCode", userCode);
		map.put("nowDay", BospDateUtil.getDateStr(Calendar.getInstance(), "yyyyMMdd"));
		return new ModelAndView("/shaft/usershaft/userDownDetail",map);
	}
	
	
	
	
	

	
	
}

This snippet took 0.02 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).