|  |  |  | 
|---|
|  |  |  | import com.matrix.core.tools.excl.ExcelSheetPO; | 
|---|
|  |  |  | import com.matrix.core.tools.excl.ExcelUtil; | 
|---|
|  |  |  | import com.matrix.core.tools.excl.ExcelVersion; | 
|---|
|  |  |  | import com.matrix.system.common.bean.CustomerDataDictionary; | 
|---|
|  |  |  | import com.matrix.system.common.bean.SystemDictionary; | 
|---|
|  |  |  | import com.matrix.system.common.bean.SysUsers; | 
|---|
|  |  |  | import com.matrix.system.common.bean.SystemDictionary; | 
|---|
|  |  |  | import com.matrix.system.common.constance.AppConstance; | 
|---|
|  |  |  | import com.matrix.system.common.dao.CustomerDataDictionaryDao; | 
|---|
|  |  |  | import com.matrix.system.common.service.SystemDictionaryService; | 
|---|
|  |  |  | import com.matrix.system.common.service.SysUsersService; | 
|---|
|  |  |  | import com.matrix.system.common.service.SystemDictionaryService; | 
|---|
|  |  |  | import com.matrix.system.common.tools.ResponseHeadUtil; | 
|---|
|  |  |  | import com.matrix.system.constance.Dictionary; | 
|---|
|  |  |  | import com.matrix.system.constance.SystemConstance; | 
|---|
|  |  |  | import com.matrix.system.hive.action.util.QueryUtil; | 
|---|
|  |  |  | import com.matrix.system.hive.bean.*; | 
|---|
|  |  |  | import com.matrix.system.hive.bean.Question; | 
|---|
|  |  |  | import com.matrix.system.hive.bean.SysVipInfo; | 
|---|
|  |  |  | import com.matrix.system.hive.bean.SysVipLevel; | 
|---|
|  |  |  | import com.matrix.system.hive.bean.VipAnswer; | 
|---|
|  |  |  | import com.matrix.system.hive.dao.MoneyCardUseDao; | 
|---|
|  |  |  | import com.matrix.system.hive.dao.SysVipLabelDao; | 
|---|
|  |  |  | import com.matrix.system.hive.dao.VipAnswerDao; | 
|---|
|  |  |  | import com.matrix.system.hive.plugin.util.DateUtils; | 
|---|
|  |  |  | import com.matrix.system.hive.pojo.RegisterInfo; | 
|---|
|  |  |  | import com.matrix.system.hive.service.*; | 
|---|
|  |  |  | import com.matrix.system.score.dao.ScoreVipDetailDao; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Controller; | 
|---|
|  |  |  | import org.springframework.ui.ModelMap; | 
|---|
|  |  |  | 
|---|
|  |  |  | import java.net.URLDecoder; | 
|---|
|  |  |  | import java.net.URLEncoder; | 
|---|
|  |  |  | import java.security.NoSuchAlgorithmException; | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.Arrays; | 
|---|
|  |  |  | import java.util.Calendar; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | private MoneyCardUseDao moneyCardUseDao; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SysVipLabelDao sysVipLabelDao; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemDictionaryService dataDictionaryService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private CustomerDataDictionaryDao customerDataDictionaryDao; | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private SysOrderService sysOrderService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ScoreVipDetailDao scoreVipDetailDao; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/showVipLevel") | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/showVipInfo") | 
|---|
|  |  |  | public @ResponseBody | 
|---|
|  |  |  | AjaxResult findByModel(String keyWord) { | 
|---|
|  |  |  | LinkedList<SysVipInfo> userList = null; | 
|---|
|  |  |  | // 获取最近查询客户 | 
|---|
|  |  |  | if (WebUtil.getSession().getAttribute(SystemConstance.HISTORY_CUSTOMER) == null) { | 
|---|
|  |  |  | userList = new LinkedList<SysVipInfo>(); | 
|---|
|  |  |  | WebUtil.getSession().setAttribute(SystemConstance.HISTORY_CUSTOMER, userList); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | userList = (LinkedList<SysVipInfo>) WebUtil.getSession().getAttribute(SystemConstance.HISTORY_CUSTOMER); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<SysVipInfo> vips = vipInfoService.findByVipNoOrTel(keyWord); | 
|---|
|  |  |  | if (vips.size() > 0) { | 
|---|
|  |  |  | // 在session存放当前查询的客户 | 
|---|
|  |  |  | vips.get(0).setPointAll(scoreVipDetailDao.selectUserTotalScore(vips.get(0).getId())); | 
|---|
|  |  |  | vips.get(0).setSysOrder(sysOrderService.findSysOrderTjByVipId(vips.get(0).getId())); | 
|---|
|  |  |  | vips.get(0).setLevelCard(cardUseService.findByVipId(vips.get(0).getId())); | 
|---|
|  |  |  | WebUtil.getSession().setAttribute(SystemConstance.CURRENT_CUSTOMER, vips.get(0)); | 
|---|
|  |  |  | // 满20后删除一个 | 
|---|
|  |  |  | if (userList.size() == 20) { | 
|---|
|  |  |  | userList.poll(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 去重标志 | 
|---|
|  |  |  | boolean isNoRepeat = true; | 
|---|
|  |  |  | for (SysVipInfo sysVipInfo : userList) { | 
|---|
|  |  |  | if (vips.get(0).getPhone().equals(sysVipInfo.getPhone())) { | 
|---|
|  |  |  | isNoRepeat = false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (isNoRepeat) { | 
|---|
|  |  |  | userList.add(vips.get(0)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | vips.get(0).setLabels(sysVipLabelDao.selectByVipId(vips.get(0).getId())); | 
|---|
|  |  |  | vips.get(0).setAge(DateUtil.getAgeForBirthDay(vips.get(0).getBirthday1())); | 
|---|
|  |  |  | vips.get(0).setBalance(moneyCardUseDao.selectVipCardTotalMoney(vips.get(0).getId())); | 
|---|
|  |  |  | AjaxResult result=  new AjaxResult(AjaxResult.STATUS_SUCCESS, vips, 0); | 
|---|
|  |  |  | return result; | 
|---|
|  |  |  | 
|---|
|  |  |  | public @ResponseBody | 
|---|
|  |  |  | AjaxResult register(RegisterInfo vipInfo) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | vipInfo.setBirthday1(DateUtils.stringToDate(vipInfo.getVoBirthday(), "yyyy-MM-dd")); | 
|---|
|  |  |  | vipInfo.setBirthday1(DateUtil.stringToDate(vipInfo.getVoBirthday(), "yyyy-MM-dd")); | 
|---|
|  |  |  | vipInfo.setVipState(Dictionary.VIP_STATE_HY); | 
|---|
|  |  |  | vipInfo.setStaffId(getMe().getSuId()); | 
|---|
|  |  |  | vipInfo.setShopId(getMe().getShopId()); | 
|---|
|  |  |  | vipInfo.setCompanyId(getMe().getCompanyId()); | 
|---|
|  |  |  | vipInfo.setVipType(Dictionary.VIP_TYPE_NOCARD); | 
|---|
|  |  |  | vipInfoService.add(vipInfo); | 
|---|
|  |  |  | return new AjaxResult(AjaxResult.STATUS_SUCCESS, "会员信息注册成功"); | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/findUserByPhoneOrNo") | 
|---|
|  |  |  | public @ResponseBody | 
|---|
|  |  |  | AjaxResult findUserByPhoneOrNo(String keyWord) { | 
|---|
|  |  |  | LinkedList<SysVipInfo> userList = null; | 
|---|
|  |  |  | // 获取最近查询客户 | 
|---|
|  |  |  | if (WebUtil.getSession().getAttribute(SystemConstance.HISTORY_CUSTOMER) == null) { | 
|---|
|  |  |  | userList = new LinkedList<SysVipInfo>(); | 
|---|
|  |  |  | WebUtil.getSession().setAttribute(SystemConstance.HISTORY_CUSTOMER, userList); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | userList = (LinkedList<SysVipInfo>) WebUtil.getSession().getAttribute(SystemConstance.HISTORY_CUSTOMER); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<SysVipInfo> vips = vipInfoService.findByVipNoOrTel(keyWord); | 
|---|
|  |  |  | if (vips.size() > 0) { | 
|---|
|  |  |  | // 在session存放当前查询的客户 | 
|---|
|  |  |  | WebUtil.getSession().setAttribute(SystemConstance.CURRENT_CUSTOMER, vips.get(0)); | 
|---|
|  |  |  | // 满20后删除一个 | 
|---|
|  |  |  | if (userList.size() == 20) { | 
|---|
|  |  |  | userList.poll(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 去重标志 | 
|---|
|  |  |  | boolean isNoRepeat = true; | 
|---|
|  |  |  | for (SysVipInfo sysVipInfo : userList) { | 
|---|
|  |  |  | if (vips.get(0).getPhone().equals(sysVipInfo.getPhone())) { | 
|---|
|  |  |  | isNoRepeat = false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (isNoRepeat) { | 
|---|
|  |  |  | userList.add(vips.get(0)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return new AjaxResult(AjaxResult.STATUS_SUCCESS, vips, 0); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | int month = c.get(Calendar.MONTH) + 1; | 
|---|
|  |  |  | //获取日 | 
|---|
|  |  |  | int day = c.get(Calendar.DATE); | 
|---|
|  |  |  | //生肖 | 
|---|
|  |  |  | String sx = DateUtils.getYear(year); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //星座 | 
|---|
|  |  |  | String xz = DateUtils.getConstellation(month, day); | 
|---|
|  |  |  | String xz = DateUtil.getConstellation(month, day); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SysVipInfo vip = new SysVipInfo(); | 
|---|
|  |  |  | vip.setConstell(xz); | 
|---|
|  |  |  | vip.setAnimalSign(sx); | 
|---|
|  |  |  | List<SysVipInfo> vipList = new ArrayList<SysVipInfo>(); | 
|---|
|  |  |  | vipList.add(vip); | 
|---|
|  |  |  | return new AjaxResult(AjaxResult.STATUS_SUCCESS, vipList, 0); | 
|---|