admin
2019-04-15 debb3a579f798d71072f037f74e3e6b43b5fe0ee
Merge remote-tracking branch 'origin/master'
5个文件已修改
219 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/RecommendController.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/UserMsgController.java 164 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SpecialServiceImpl.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserLotteryRecordServiceImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/homemodule/SpecialService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/RecommendController.java
@@ -1572,9 +1572,8 @@
    public void getRecommendIndex(AcceptData acceptData, Long uid, PrintWriter out) {
        try {
            //  1、专题模块
            JSONObject root = specialService.listCacheSpecialToIndex();
            JSONObject root = specialService.listCacheSpecialToIndex(acceptData);
            // 2、顶部轮播图
            List<SwiperPicture> topPicList = getSwiperByCard("index_top");
            if (topPicList == null) {
@@ -1696,16 +1695,24 @@
        nextTime.set(Calendar.SECOND, 0);
        nextTime.set(Calendar.MILLISECOND, 0);
        
        JSONObject root = new JSONObject();
        root.put("time", nextTime.getTimeInMillis());
        JSONArray array = null;
        String timekey = "spikeGoods_hour";
        String cachekey = "spikeGoodsList";
        
        JSONArray array = new JSONArray();
        String cachekey = "spikeGoodsList" ;
        String cacheValue = redisManager.getCommonString(cachekey);
        if (!StringUtil.isNullOrEmpty(cacheValue)) {
            array = JSONArray.fromObject(cacheValue);
        String timeValue = redisManager.getCommonString(timekey);
        if (timeValue == null || !timeValue.equals(hour+"")) {
            redisManager.cacheCommonString(timekey, hour+"", 60 * 30);
        } else {
            String cacheValue = redisManager.getCommonString(cachekey);
            if (!StringUtil.isNullOrEmpty(cacheValue)) {
                array = JSONArray.fromObject(cacheValue);
            }
        }
        if (array == null) {
            array = new JSONArray();
            BigDecimal proportion = manageService.getFanLiRate();
            Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                    .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
@@ -1715,6 +1722,7 @@
            if (listGoods == null) {
                listGoods = new ArrayList<QualityFactory>();
            }
            /* 遍历列表数据 */
            for (QualityFactory qualityFactory : listGoods) {
                    
@@ -1724,9 +1732,13 @@
                }
                array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
            }
            // 缓存半个小时
            redisManager.cacheCommonString(cachekey, array.toString(), 60 * 30);
        }
        JSONObject root = new JSONObject();
        root.put("time", nextTime.getTimeInMillis());
        root.put("listgoods", array);
        out.print(JsonUtil.loadTrueResult(root));
    }
fanli/src/main/java/com/yeshi/fanli/controller/client/UserMsgController.java
@@ -40,9 +40,9 @@
import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail;
import com.yeshi.fanli.entity.bus.msg.UserMsgUnReadNum;
import com.yeshi.fanli.entity.bus.msg.UserSystemMsg;
import com.yeshi.fanli.entity.common.JumpDetailV2;
import com.yeshi.fanli.entity.goods.CommonGoods;
import com.yeshi.fanli.entity.goods.RecommendUserGoods;
import com.yeshi.fanli.entity.system.BusinessSystem;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
import com.yeshi.fanli.exception.goods.CommonGoodsException;
@@ -535,98 +535,97 @@
     */
    @RequestMapping(value = "getHomeMsgListNew", method = RequestMethod.POST)
    public void getHomeMsgListNew(AcceptData acceptData, Long uid, PrintWriter out) {
        if (uid == null) {
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
                acceptData.getPackages());
        if (system == null) {
            out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
            return;
        }
        int page = 1;
        List<UserMsgVO> list = new ArrayList<>();
        List<MsgOrderDetail> detailList = msgOrderDetailService.listMsgOrderDetail(uid, page);
        if (detailList != null && detailList.size() > 0) {
            for (MsgOrderDetail detail : detailList) {
                UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
                userMsgVO.setType(MSG_TYPE_ORDER);
                list.add(userMsgVO);
            }
        }
        List<MsgMoneyDetail> detailList1 = msgMoneyDetailService.listMsgMoneyDetail(uid, page);
        if (detailList1 != null && detailList1.size() > 0) {
            for (MsgMoneyDetail detail : detailList1) {
                UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
                userMsgVO.setType(MSG_TYPE_MONEY);
                list.add(userMsgVO);
            }
        }
        List<MsgAccountDetail> detailList2 = msgAccountDetailService.listMsgAccountDetail(uid, page);
        if (detailList2 != null && detailList2.size() > 0) {
            for (MsgAccountDetail detail : detailList2) {
                UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
                userMsgVO.setType(MSG_TYPE_ACCOUNT);
                list.add(userMsgVO);
            }
        }
        List<MsgInviteDetail> detailList3 = msgInviteDetailService.listMsgInviteDetail(uid, page);
        if (detailList3 != null && detailList3.size() > 0) {
            for (MsgInviteDetail detail : detailList3) {
                UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
                if (userMsgVO != null) {
                    userMsgVO.setType(MSG_TYPE_INVITE);
                    list.add(userMsgVO);
                }
            }
        }
        List<MsgOtherDetail> detailList4 = msgOtherDetailService.listMsgOtherDetail(uid, page);
        if (detailList4 != null && detailList4.size() > 0) {
            for (MsgOtherDetail detail : detailList4) {
                UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
                if (userMsgVO != null) {
                    userMsgVO.setType(MSG_TYPE_OTHER);
                    list.add(userMsgVO);
                }
            }
        }
        
        List<UserMsgCenter> listCenter = new ArrayList<>();
        
        // 1、活动区域
        List<Special> listSpecial = specialService.listByPlaceKey("msg_activities");
        if (listSpecial != null && listSpecial.size() > 0) {
            for (Special special: listSpecial) {
                boolean needLogin = special.isJumpLogin();
                JumpDetailV2 jumpDetail = special.getJumpDetail();
                if (jumpDetail != null) {
                    jumpDetail.setNeedLogin(needLogin);
                    special.setJumpDetail(jumpDetail);
                }
                UserMsgCenter msgCenter = new UserMsgCenter();
                msgCenter.setSpecial(special);
                listCenter.add(msgCenter);
            }
        }
        
        if (list.size() > 0 ) {
            // 时间排序
            listSort(list);
            if (list.size() >= 20 ) {
                list = list.subList(0, 19);
        // 2、消息区域
        if (uid != null && uid > 0) {
            int page = 1;
            List<UserMsgVO> list = new ArrayList<>();
            List<MsgOrderDetail> detailList = msgOrderDetailService.listMsgOrderDetail(uid, page);
            if (detailList != null && detailList.size() > 0) {
                for (MsgOrderDetail detail : detailList) {
                    UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
                    userMsgVO.setType(MSG_TYPE_ORDER);
                    list.add(userMsgVO);
                }
            }
            List<MsgMoneyDetail> detailList1 = msgMoneyDetailService.listMsgMoneyDetail(uid, page);
            if (detailList1 != null && detailList1.size() > 0) {
                for (MsgMoneyDetail detail : detailList1) {
                    UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
                    userMsgVO.setType(MSG_TYPE_MONEY);
                    list.add(userMsgVO);
                }
            }
            List<MsgAccountDetail> detailList2 = msgAccountDetailService.listMsgAccountDetail(uid, page);
            if (detailList2 != null && detailList2.size() > 0) {
                for (MsgAccountDetail detail : detailList2) {
                    UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
                    userMsgVO.setType(MSG_TYPE_ACCOUNT);
                    list.add(userMsgVO);
                }
            }
            List<MsgInviteDetail> detailList3 = msgInviteDetailService.listMsgInviteDetail(uid, page);
            if (detailList3 != null && detailList3.size() > 0) {
                for (MsgInviteDetail detail : detailList3) {
                    UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
                    if (userMsgVO != null) {
                        userMsgVO.setType(MSG_TYPE_INVITE);
                        list.add(userMsgVO);
                    }
                }
            }
            List<MsgOtherDetail> detailList4 = msgOtherDetailService.listMsgOtherDetail(uid, page);
            if (detailList4 != null && detailList4.size() > 0) {
                for (MsgOtherDetail detail : detailList4) {
                    UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
                    if (userMsgVO != null) {
                        userMsgVO.setType(MSG_TYPE_OTHER);
                        list.add(userMsgVO);
                    }
                }
            }
            
            for (UserMsgVO userMsgVO: list) {
                UserMsgCenter userMsgCenter = new UserMsgCenter();
                userMsgCenter.setUserMsg(userMsgVO);
                listCenter.add(userMsgCenter);
            if (list.size() > 0 ) {
                // 时间排序
                listSort(list);
                if (list.size() >= 20 ) {
                    list = list.subList(0, 19);
                }
                for (UserMsgVO userMsgVO: list) {
                    UserMsgCenter userMsgCenter = new UserMsgCenter();
                    userMsgCenter.setUserMsg(userMsgVO);
                    listCenter.add(userMsgCenter);
                }
            }
        }
        
        // 添加欢迎语
        // 3、添加欢迎语
        Long time = (uid == null ? System.currentTimeMillis() : userInfoService.selectByPKey(uid).getCreatetime());
        // 创建时间在28号后的才有新人欢迎
        if ((time > TimeUtil.convertToTimeTemp("2019-01-28", "yyyy-MM-dd") || uid == null)) {
@@ -641,14 +640,15 @@
        
        GsonBuilder builder = new GsonBuilder();
        builder = getTimeDescJsonBuilder(builder);
        JSONObject root = new JSONObject();
        
        UserMsgUnReadNum num = userMsgReadStateService.getReadStateByUid(uid);
        UserSystemMsg usm = userSystemMsgService.getLatestUserSystemMsg(uid);
        if (usm != null) {
            root.put("systemMsg", new UserSystemMsgVO(usm.getId(), usm.getType().name(), usm.getSolved(), "系统消息", usm.getTitle(),
                usm.getTimeTag() == 1 ? "http://img.flqapp.com/resource/msg/icon_emergent.png" : "", "http://img.flqapp.com/resource/msg/icon_msg_system.png",getTimeDesc(new Date(), usm.getCreateTime()), num.getTypeSystem()));
        if (uid != null && uid > 0) {
            UserMsgUnReadNum num = userMsgReadStateService.getReadStateByUid(uid);
            UserSystemMsg usm = userSystemMsgService.getLatestUserSystemMsg(uid);
            if (usm != null) {
                root.put("systemMsg", new UserSystemMsgVO(usm.getId(), usm.getType().name(), usm.getSolved(), "系统消息", usm.getTitle(),
                    usm.getTimeTag() == 1 ? "http://img.flqapp.com/resource/msg/icon_emergent.png" : "", "http://img.flqapp.com/resource/msg/icon_msg_system.png",getTimeDesc(new Date(), usm.getCreateTime()), num.getTypeSystem()));
            }
        }
        
        root.put("list", builder.create().toJson(listCenter));
fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SpecialServiceImpl.java
@@ -16,10 +16,13 @@
import org.yeshi.utils.tencentcloud.COSManager;
import com.yeshi.fanli.dao.mybatis.homemodule.SpecialMapper;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.homemodule.Special;
import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
import com.yeshi.fanli.entity.common.JumpDetailV2;
import com.yeshi.fanli.exception.homemodule.SpecialException;
import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.homemodule.SpecialCardService;
import com.yeshi.fanli.service.inter.homemodule.SpecialPlaceService;
import com.yeshi.fanli.service.inter.homemodule.SpecialService;
@@ -42,6 +45,9 @@
    
    @Resource
    private JumpDetailV2Service jumpDetailV2Service;
    @Resource
    private ConfigService configService;
    
    @Override
@@ -334,7 +340,7 @@
    
    @Override
    @Cacheable(value = "configCache", key = "'listCacheSpecialToIndex'")
    public JSONObject listCacheSpecialToIndex() throws Exception{
    public JSONObject listCacheSpecialToIndex(AcceptData acceptData) throws Exception{
        
        // 首页-5圆形2排区域
        JSONObject arcMap = new JSONObject();
@@ -355,7 +361,14 @@
        
        // 首页-活动区域(女王节)
        JSONObject activityMap = new JSONObject();
        List<Special> listActivity = specialMapper.listByPlaceKey("index_activity");
        List<Special> listActivity = null;
        if ("ios".equalsIgnoreCase(acceptData.getPlatform())
                && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()))) {
            // 如果IOS当前版本处于审核状态就不返回
        } else {
             listActivity = specialMapper.listByPlaceKey("index_activity");
        }
        if (listActivity == null) {
            listActivity = new ArrayList<Special>();
        } else if(listActivity.size() > 0){
@@ -370,6 +383,7 @@
        activityMap.put("list", JsonUtil.getApiCommonGson().toJson(listActivity));
        
        
        // 首页-方形专题(品牌券、母婴...)
        JSONObject blockJsonMap = new JSONObject();
        List<Special> listBlock = specialMapper.listByPlaceKey("index_block");
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserLotteryRecordServiceImpl.java
@@ -92,6 +92,8 @@
            record.setUid(uid);
            record.setType(type);
            record.setCount(num);
        } else {
            record.setCount(num);
        }
        return record;
    }
fanli/src/main/java/com/yeshi/fanli/service/inter/homemodule/SpecialService.java
@@ -4,6 +4,7 @@
import org.springframework.web.multipart.MultipartFile;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.homemodule.Special;
import com.yeshi.fanli.exception.homemodule.SpecialException;
@@ -85,7 +86,7 @@
     * @return
     * @throws Exception
     */
    public JSONObject listCacheSpecialToIndex() throws Exception;
    public JSONObject listCacheSpecialToIndex(AcceptData acceptData) throws Exception;
    /**