| | |
| | | */
|
| | | @RequestMapping(value = "getHomeMsgList", method = RequestMethod.POST)
|
| | | public void getHomeMsgList(AcceptData acceptData, Long uid, int page, HttpSession session, PrintWriter out) {
|
| | | |
| | |
|
| | | String device = acceptData.getDevice();
|
| | | if (device == null || device.trim().length() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult("设备号不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (page == 1) {
|
| | | if (uid != null)
|
| | | recommendUserGoodsService.syncDeviceAndUid(uid, acceptData.getDevice());
|
| | |
|
| | | boolean canAdd = false;
|
| | | int hour = Calendar.getInstance().get(Calendar.HOUR);
|
| | | RecommendUserGoods goods = recommendUserGoodsService.getLatestRecommendUserGoodsByDevice(device);
|
| | | |
| | |
|
| | | if (goods == null) {
|
| | | canAdd = true;
|
| | | } else {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | //String key = "recommend-goods-user-" + uid;
|
| | | // String key = "recommend-goods-user-" + uid;
|
| | | String key = "recommend-goods-user-" + device;
|
| | | if (Constant.IS_OUTNET) {
|
| | | if (canAdd && StringUtil.isNullOrEmpty(redisManager.getCommonString(key))) {
|
| | |
| | | }
|
| | |
|
| | | List<UserHomeMsgVO> volist = new ArrayList<>();
|
| | | |
| | | List<RecommendUserGoods> list = recommendUserGoodsService.listRecommendGoodsByDevice(device, page, Constant.PAGE_SIZE);
|
| | |
|
| | | List<RecommendUserGoods> list = recommendUserGoodsService.listRecommendGoodsByDevice(device, page,
|
| | | Constant.PAGE_SIZE);
|
| | | long count = recommendUserGoodsService.countRecommendGoodsByDevice(device);
|
| | |
|
| | | Date now = new Date();
|
| | |
| | | volist.add(vo);
|
| | | }
|
| | |
|
| | | Long time = System.currentTimeMillis();//userInfoService.selectByPKey(uid).getCreatetime();
|
| | | if (time > TimeUtil.convertToTimeTemp("2019-01-28", "yyyy-MM-dd"))
|
| | | count++;// 计算欢迎语的数量
|
| | | Long time = (uid == null ? System.currentTimeMillis() : userInfoService.selectByPKey(uid).getCreatetime());
|
| | |
|
| | | if (volist.size() > 0 && volist.size() < Constant.PAGE_SIZE) {
|
| | | // 添加欢迎语
|
| | | // 创建时间在28号后的才有新人欢迎
|
| | | if (time > TimeUtil.convertToTimeTemp("2019-01-28", "yyyy-MM-dd")) {
|
| | | if ((time > TimeUtil.convertToTimeTemp("2019-01-28", "yyyy-MM-dd") || uid == null)) {
|
| | | UserHomeMsgVO vo = new UserHomeMsgVO();
|
| | | vo.setContent("恭喜你,成为返利券的用户\n独家优惠券帮你省钱;\n参与奖金活动帮你赚钱;\n让返利券成为你的省钱助手吧!");
|
| | | vo.setTitle("新人欢迎");
|
| | | vo.setCreateTime(getTimeDesc(now, new Date(time)));
|
| | | vo.setType(UserHomeMsgVO.TYPE_WELCOME);
|
| | | volist.add(vo);
|
| | | count++;
|
| | | }
|
| | | }
|
| | |
|