| | |
| | | return builder;
|
| | | }
|
| | |
|
| | | private void addRecommendGoods(Long uid, String imei, String idfa) {
|
| | | private void addRecommendGoods(Long uid, String device, String imei, String idfa) {
|
| | | TaoBaoSearchResult result = TaoKeApiUtil.guessDeviceLike(1, 50, imei, idfa);
|
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null) {
|
| | | for (int i = 0; i < result.getTaoBaoGoodsBriefs().size(); i++) {
|
| | |
| | | }
|
| | | }
|
| | | try {
|
| | | recommendUserGoodsService.addRecommend(uid, "", goodsList);
|
| | | recommendUserGoodsService.addRecommend(uid, device, "", goodsList);
|
| | | } catch (RecommendUserGoodsException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void addRecommendGoods(Long uid) {
|
| | | private void addRecommendGoods(Long uid, String device) {
|
| | | List<QualityFactory> qfList = qualityFactoryService.listByMinSalesCountOrderByCreateTimeDesc(10000, 1, 20);
|
| | | if (qfList != null && qfList != null) {
|
| | | for (int i = 0; i < qfList.size(); i++) {
|
| | |
| | | }
|
| | | }
|
| | | try {
|
| | | recommendUserGoodsService.addRecommend(uid, "", goodsList);
|
| | | recommendUserGoodsService.addRecommend(uid, device, "", goodsList);
|
| | | } catch (RecommendUserGoodsException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | */
|
| | | @RequestMapping(value = "getHomeMsgList", method = RequestMethod.POST)
|
| | | public void getHomeMsgList(AcceptData acceptData, Long uid, int page, HttpSession session, PrintWriter out) {
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | |
| | | String device = acceptData.getDevice();
|
| | | if (device == null || device.trim().length() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult("设备号不能为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | |
| | | if (page == 1) {
|
| | | boolean canAdd = false;
|
| | | int hour = Calendar.getInstance().get(Calendar.HOUR);
|
| | | RecommendUserGoods goods = recommendUserGoodsService.getLatestRecommendUserGoods(uid);
|
| | | 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))) {
|
| | | if (Constant.IS_OUTNET)
|
| | | redisManager.cacheCommonString(key, "1", 20);
|
| | | if (hour < 12)
|
| | | addRecommendGoods(uid);
|
| | | addRecommendGoods(uid, device);
|
| | | else
|
| | | addRecommendGoods(uid, acceptData.getImei(), acceptData.getIdfa());
|
| | | addRecommendGoods(uid, device, acceptData.getImei(), acceptData.getIdfa());
|
| | | session.removeAttribute("recommendgoods");
|
| | | }
|
| | | } else {
|
| | | if (canAdd) {
|
| | | if (hour < 12)
|
| | | addRecommendGoods(uid);
|
| | | addRecommendGoods(uid, device);
|
| | | else
|
| | | addRecommendGoods(uid, acceptData.getImei(), acceptData.getIdfa());
|
| | | addRecommendGoods(uid, device, acceptData.getImei(), acceptData.getIdfa());
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | List<UserHomeMsgVO> volist = new ArrayList<>();
|
| | | List<RecommendUserGoods> list = recommendUserGoodsService.listRecommend(uid, page, Constant.PAGE_SIZE);
|
| | | long count = recommendUserGoodsService.countRecommend(uid);//
|
| | | |
| | | List<RecommendUserGoods> list = recommendUserGoodsService.listRecommendGoodsByDevice(device, page, Constant.PAGE_SIZE);
|
| | | long count = recommendUserGoodsService.countRecommendGoodsByDevice(device);
|
| | |
|
| | | Date now = new Date();
|
| | | for (RecommendUserGoods goods : list) {
|
| | |
| | | volist.add(vo);
|
| | | }
|
| | |
|
| | | Long time = userInfoService.selectByPKey(uid).getCreatetime();
|
| | | Long time = System.currentTimeMillis();//userInfoService.selectByPKey(uid).getCreatetime();
|
| | | if (time > TimeUtil.convertToTimeTemp("2019-01-28", "yyyy-MM-dd"))
|
| | | count++;// 计算欢迎语的数量
|
| | |
|
| | |
| | |
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("msgList", new Gson().toJson(volist));
|
| | | if (page == 1) {
|
| | | if (page == 1 && uid != null) {
|
| | | UserMsgUnReadNum num = userMsgReadStateService.getReadStateByUid(uid);
|
| | | UserSystemMsg usm = userSystemMsgService.getLatestUserSystemMsg(uid);
|
| | | if (usm != null)
|