| | |
| | | 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.Question; |
| | | import com.matrix.system.hive.bean.SysVipInfo; |
| | |
| | | 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; |
| | | |
| | | |
| | | /** |
| | |
| | | @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); |
| | | |
| | | } |