| | |
| | | import java.util.Calendar;
|
| | | import java.util.Collections;
|
| | | import java.util.Date;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
| | | import com.yeshi.fanli.entity.taobao.ClientTBPid;
|
| | | import com.yeshi.fanli.entity.taobao.PidUser;
|
| | | import com.yeshi.fanli.entity.taobao.SearchFilter;
|
| | | import com.yeshi.fanli.entity.taobao.TBPid;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
|
| | |
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.factory.MonitorFactory;
|
| | |
| | |
|
| | | @RequestMapping(value = "getHonestList")
|
| | | public void getHonestList(AcceptData acceptData, PrintWriter out) {
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | List<Honest> honestList = null;
|
| | | List<TaoBaoUnionConfig> configList = taoBaoUnionConfigService.getConfigByTypeCache(PidUser.TYPE_FANLI_ANDROID);
|
| | | if ((Integer.parseInt(acceptData.getVersion()) >= 20 && "android".equalsIgnoreCase(acceptData.getPlatform()))
|
| | |
| | | // 获取淘客参数
|
| | | ClientTBPid clientTBPid = null;
|
| | | if (simpleGoods.getMaterialLibType() != null && simpleGoods.getMaterialLibType() == 1) {
|
| | | String pid = Constant.TAOBAO_SPECIAL_PID_DEFAULT;
|
| | | clientTBPid = new ClientTBPid(Constant.TAOBAO_AUTH_APPKEY, Constant.TAOBAO_AUTH_APPSECRET,
|
| | | String pid = TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT;
|
| | | clientTBPid = new ClientTBPid(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET,
|
| | | pid.split("_")[2], pid.split("_")[3]);
|
| | | } else {
|
| | | if (acceptData.getPlatform().equalsIgnoreCase("android")) {
|
| | |
| | | ClientTBPid clientTBPid = null;
|
| | | // 用户已经登录
|
| | | if (!StringUtil.isNullOrEmpty(uid)) {
|
| | | TBPid tbPid = null;
|
| | | if (acceptData.getPlatform().equalsIgnoreCase("android")) {
|
| | | clientTBPid = tbPidService.getAndroidDefault();
|
| | | } else {
|
| | |
| | | // 从推荐来
|
| | | if (page <= 1) {
|
| | | array.clear();
|
| | | Map<String, String> map = hongBaoManageService.convertMap();
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | if (!StringUtil.isNullOrEmpty(imei) || !StringUtil.isNullOrEmpty(idfa)) {
|
| | | long startTime = java.lang.System.currentTimeMillis();
|
| | |
| | | proportion.toString());
|
| | | array.addAll(localArray);
|
| | | } else {// 从精选库来
|
| | | Map<String, String> map = hongBaoManageService.convertMap();
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | array = qualityGoodsService.getRecommendToIndex((page - 1) * pageSize, pageSize, proportion.toString());
|
| | | if (array == null) {
|
| | | out.print(JsonUtil.loadFalseResult("没有更多了"));
|
| | | return;
|
| | | }
|
| | | long count = qualityGoodsService.countRecommendToIndex(proportion.toString());
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | |
| | | root.put("invite", invite);
|
| | | }
|
| | | }
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
| | | */
|
| | | @RequestMapping(value = "getRecommendIndex")
|
| | | public void getRecommendIndex(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | |
|
| | | try {
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | JSONObject root = specialService.getSpecialListCache("native_index", system.getId());
|
| | | // 专题模块
|
| | | JSONObject root = specialService.listCacheSpecialToIndex();
|
| | |
|
| | | // 顶部轮播图
|
| | | List<SwiperPicture> topPicList = getSwiperByCard("weex_index");
|
| | | List<SwiperPicture> topPicList = getSwiperByCard("index_top");
|
| | | if (topPicList == null) {
|
| | | topPicList = new ArrayList<SwiperPicture>();
|
| | | }
|
| | | root.put("topPicList", JsonUtil.getApiCommonGson().toJson(topPicList));
|
| | |
|
| | | // 邀请有奖图片
|
| | | List<SwiperPicture> invitePicList = null;
|
| | | // if ("ios".equalsIgnoreCase(acceptData.getPlatform())
|
| | | // && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()))) {
|
| | | // // 如果IOS当前版本处于审核状态就不返回
|
| | | // } else {
|
| | | // if (uid == null) {
|
| | | // invitePicList = getSwiperByCard("invitePrizes"); |
| | | // } else {
|
| | | // try {
|
| | | // UserSettingsVO vo = userCustomSettingsService.getMySettings(uid);
|
| | | // if (vo == null || vo.getNoInvitationBonus() == null || vo.getNoInvitationBonus() == 0) {
|
| | | // invitePicList = getSwiperByCard("invitePrizes"); // 没有关闭邀请
|
| | | // }
|
| | | // } catch (UserCustomSettingsException e) {
|
| | | // e.printStackTrace();
|
| | | // }
|
| | | // }
|
| | | // }
|
| | | |
| | | invitePicList = getSwiperByCard("invitePrizes");
|
| | | // 邀请、分享轮播图
|
| | | List<SwiperPicture> invitePicList = getInvitePicList(uid, acceptData);
|
| | | if (invitePicList == null) {
|
| | | invitePicList = new ArrayList<SwiperPicture>();
|
| | | }
|
| | | |
| | | root.put("invitePicList", JsonUtil.getApiCommonGson().toJson(invitePicList));
|
| | |
|
| | | // 底部网页链接
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 邀请有奖是否需要返回
|
| | | * @param uid
|
| | | * @param acceptData
|
| | | * @return
|
| | | */
|
| | | public List<SwiperPicture> getInvitePicList(Long uid, AcceptData acceptData) {
|
| | | // 如果IOS当前版本处于审核状态就不返回
|
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform())
|
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()))) {
|
| | | return null;
|
| | | } |
| | | |
| | | List<SwiperPicture> invitePicList = getSwiperByCard("index_invite"); |
| | | |
| | | if (uid != null) {
|
| | | try {
|
| | | // 用户自定义:不看邀请有奖
|
| | | UserSettingsVO vo = userCustomSettingsService.getMySettings(uid);
|
| | | if (vo != null && vo.getNoInvitationBonus() != null && vo.getNoInvitationBonus() == 1 |
| | | && invitePicList != null && invitePicList.size() > 0) {
|
| | | Iterator<SwiperPicture> iterator = invitePicList.iterator();
|
| | | while (iterator.hasNext()) {
|
| | | SwiperPicture swiperPicture = iterator.next();
|
| | | JumpDetailV2 jumpDetail = swiperPicture.getJumpDetail();
|
| | | if (jumpDetail != null && "invite".equals(jumpDetail.getType())) {
|
| | | iterator.remove();
|
| | | }
|
| | | }
|
| | | }
|
| | | } catch (UserCustomSettingsException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | return invitePicList;
|
| | | }
|
| | | |
| | | |
| | | public List<SwiperPicture> getSwiperByCard(String card){
|
| | | List<SwiperPicture> swiperList = null;
|
| | | try {
|