package com.matrix.system.hive.action; import com.matrix.core.pojo.AjaxResult; import com.matrix.core.pojo.PaginationVO; import com.matrix.core.tools.WebUtil; import com.matrix.system.constance.Dictionary; import com.matrix.system.hive.bean.ServiceRecord; import com.matrix.system.hive.bean.SysVipInfo; import com.matrix.system.hive.service.ServiceRecordService; import com.matrix.system.hive.service.SysVipInfoService; 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.ResponseBody; import javax.annotation.Resource; import java.util.Date; /** * 服务记录 * * @author 姜友瑶 * @date 2016-08-06 16:15 */ @Controller @RequestMapping(value = "admin/serviceRecord") public class ServiceRecordController extends BaseController { @Resource private ServiceRecordService currentService; @RequestMapping(value = "/showAllList") public @ResponseBody AjaxResult showAllList(ServiceRecord serviceRecord, PaginationVO pageVo) { if (!getMe().getShopRole().equals(Dictionary.FLAG_YES_Y)) { serviceRecord.setShopId(getMe().getShopId()); } pageVo.setSort("createTime"); pageVo.setOrder("desc"); return showList(currentService, serviceRecord, pageVo); } /** * 列表显示 */ @RequestMapping(value = "/showList") public @ResponseBody AjaxResult showList(ServiceRecord serviceRecord, PaginationVO pageVo) { serviceRecord.setVipId(getLookViP().getId()); pageVo.setSort("createTime"); pageVo.setOrder("desc"); return showList(currentService, serviceRecord, pageVo); } /** * 新增或者修改页面 */ @RequestMapping(value = "/addOrModify") public @ResponseBody AjaxResult addOrModify(ServiceRecord serviceRecord) { if (serviceRecord.getId() != null) { return modify(currentService, serviceRecord, "跟进记录"); } else { serviceRecord.setStaffId(getMe().getSuId()); serviceRecord.setVipId(getLookViP().getId()); serviceRecord.setCreateTime(new Date()); serviceRecord.setShopId(getMe().getShopId()); return add(currentService, serviceRecord, "跟进记录"); } } /** * 进入修改界面 */ @RequestMapping(value = "/editForm") public String editForm(Long id) { ServiceRecord serviceRecord; if (id != null) { serviceRecord = currentService.findById(id); WebUtil.getRequest().setAttribute("obj", serviceRecord); } return "admin/hive/mobile/CRM-account-follow-add"; } @RequestMapping(value = "/editFormPC") public String editFormPC(Long id) { ServiceRecord serviceRecord; if (id != null) { serviceRecord = currentService.findById(id); WebUtil.getRequest().setAttribute("obj", serviceRecord); } return "admin/hive/vip/servicefollow-form"; } /** * 删除 */ @RequestMapping(value = "/del") public @ResponseBody AjaxResult del(String keys) { return remove(currentService, keys); } @Autowired SysVipInfoService vipInfoService; @RequestMapping(value = "/toServicefollowList") public String toServicefollowList(Long id) { SysVipInfo info = vipInfoService.findById(id); WebUtil.getSession().setAttribute("lookVipInfo", info); return "admin/hive/vip/servicefollow-list"; } @RequestMapping(value = "/toServicefollowListForZd") public String toServicefollowListForZd(Long id) { SysVipInfo info = vipInfoService.findById(id); WebUtil.getSession().setAttribute("lookVipInfo", info); return "admin/hive-erp/vip/servicefollow-list"; } /** * 获取当前查询的会员信息 * * @return * @author 姜友瑶 * @time 2016年8月6日 */ private SysVipInfo getLookViP() { return (SysVipInfo) (WebUtil.getSession().getAttribute("lookVipInfo")); } }