| | |
| | | package com.yeshi.fanli.controller.client;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.lang.reflect.Type;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | | import java.util.Collections;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | |
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.google.gson.JsonElement;
|
| | | import com.google.gson.JsonPrimitive;
|
| | | import com.google.gson.JsonSerializationContext;
|
| | | import com.google.gson.JsonSerializer;
|
| | | import com.yeshi.fanli.dao.mybatis.HongBaoManageMapper;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.Special;
|
| | |
| | | import com.yeshi.fanli.entity.goods.CollectionGoodsV2;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.goods.ScanHistoryV2;
|
| | | import com.yeshi.fanli.entity.system.System;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.system.SystemClientParams;
|
| | | import com.yeshi.fanli.entity.taobao.ClientTBPid;
|
| | | import com.yeshi.fanli.entity.taobao.PidUser;
|
| | |
| | | import com.yeshi.fanli.exception.goods.ScanHistoryException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsUpdateException;
|
| | | import com.yeshi.fanli.exception.user.UserCustomSettingsException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.config.BusinessSystemService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.JumpDetailService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemService;
|
| | | import com.yeshi.fanli.service.inter.goods.CollectionGoodsV2Service;
|
| | | import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendBannerService;
|
| | |
| | | import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
|
| | | import com.yeshi.fanli.service.inter.monitor.MonitorService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.order.ShareGoodsActivityOrderService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.service.inter.user.ShamUserService;
|
| | | import com.yeshi.fanli.service.inter.user.ShareManageService;
|
| | | import com.yeshi.fanli.service.inter.user.TBPidService;
|
| | | import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
|
| | | import com.yeshi.fanli.service.inter.user.UserGoodsStorageService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | |
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import com.yeshi.fanli.vo.user.UserSettingsVO;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | private RecommendBannerService recommendService;
|
| | |
|
| | | @Resource
|
| | | private SystemService systemService;
|
| | | private BusinessSystemService businessSystemService;
|
| | |
|
| | | @Resource
|
| | | private SuperRecommendBannerService superRecommendBannerService;
|
| | |
| | | @Resource
|
| | | private JumpDetailV2Service jumpDetailV2Service;
|
| | |
|
| | | @Resource
|
| | | private UserCustomSettingsService userCustomSettingsService;
|
| | |
|
| | | @Resource
|
| | | private ShareGoodsActivityOrderService shareGoodsActivityOrderService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | @RequestMapping(value = "getrecommendsection")
|
| | | public void getRecommendSection(AcceptData acceptData, int index, PrintWriter out) {
|
| | |
|
| | |
| | | index = 0;
|
| | | }
|
| | |
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | | return;
|
| | |
| | |
|
| | | @RequestMapping(value = "getHonestList")
|
| | | public void getHonestList(AcceptData acceptData, PrintWriter out) {
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | 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()))
|
| | |
| | | @RequestMapping(value = "getrecommendspecial")
|
| | | public void getRecommendSpecial(AcceptData acceptData, PrintWriter out) {
|
| | |
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | |
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | |
| | | @RequestMapping(value = "guessLike", method = RequestMethod.POST)
|
| | | public void guessLike(AcceptData acceptData, PrintWriter out) {
|
| | |
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | |
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | |
| | | @RequestMapping(value = "getrecommendbanner")
|
| | | public void getRecommendBanner(AcceptData acceptData, PrintWriter out) {
|
| | |
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | JSONObject json = new JSONObject();
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "请上传id"));
|
| | | return;
|
| | | }
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | // 淘特价
|
| | | if (system.getId() == 7) {
|
| | | system = systemService.getSystem("ANDROID", Constant.systemCommonConfig.getAndroidPackageName());
|
| | | }
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | |
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | | return;
|
| | | }
|
| | | // 获取淘客参数
|
| | | ClientTBPid clientTBPid = null;
|
| | | // 用户已经登录
|
| | | if (!StringUtil.isNullOrEmpty(uid) && Long.parseLong(uid) > 0) {
|
| | | TBPid tbPid = null;
|
| | | if (acceptData.getPlatform().equalsIgnoreCase("android")) {
|
| | | tbPid = tbPidService.getTBPid(Long.parseLong(uid), PidUser.TYPE_FANLI_ANDROID);
|
| | | if (tbPid != null) {
|
| | | String siteId = tbPid.getPid().split("_")[2];
|
| | | String adzoneId = tbPid.getPid().split("_")[3];
|
| | | TaoBaoUnionConfig config = taoBaoUnionConfigService.getConfigByAppIdCache(siteId);
|
| | | clientTBPid = new ClientTBPid(config.getAppKey(), tbPid.getPid(), siteId, adzoneId);
|
| | | } else {
|
| | | clientTBPid = tbPidService.getAndroidDefault();
|
| | | }
|
| | |
|
| | | } else {
|
| | | tbPid = tbPidService.getTBPid(Long.parseLong(uid), PidUser.TYPE_FANLI_IOS);
|
| | | if (tbPid != null) {
|
| | | String siteId = tbPid.getPid().split("_")[2];
|
| | | String adzoneId = tbPid.getPid().split("_")[3];
|
| | | TaoBaoUnionConfig config = taoBaoUnionConfigService.getConfigByAppIdCache(siteId);
|
| | | clientTBPid = new ClientTBPid(config.getAppKey(), tbPid.getPid(), siteId, adzoneId);
|
| | | } else {
|
| | | clientTBPid = tbPidService.getIOSDefault();
|
| | | }
|
| | | }
|
| | | } else {
|
| | | if (acceptData.getPlatform().equalsIgnoreCase("android"))
|
| | | clientTBPid = tbPidService.getAndroidDefault();
|
| | | else
|
| | | clientTBPid = tbPidService.getIOSDefault();
|
| | | // 获取会员推广位或者默认推广位
|
| | |
|
| | | TaoBaoGoodsBrief simpleGoods = null;
|
| | | try {
|
| | | simpleGoods = redisManager.getTaoBaoGoodsBrief(Long.parseLong(id));
|
| | | } catch (NumberFormatException e2) {
|
| | | e2.printStackTrace();
|
| | | } catch (TaobaoGoodsDownException e2) {
|
| | | e2.printStackTrace();
|
| | | }
|
| | |
|
| | | if (simpleGoods == null) {
|
| | | out.print(JsonUtil.loadFalseResult(2, "商品已下架"));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 获取淘客参数
|
| | | 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,
|
| | | pid.split("_")[2], pid.split("_")[3]);
|
| | | } else {
|
| | | if (acceptData.getPlatform().equalsIgnoreCase("android")) {
|
| | | clientTBPid = tbPidService.getAndroidDefault();
|
| | | } else {
|
| | | clientTBPid = tbPidService.getIOSDefault();
|
| | | }
|
| | | }
|
| | | |
| | | TaoBaoGoodsBrief tb = null;
|
| | | try {
|
| | | TaoKeAppInfo app = new TaoKeAppInfo();
|
| | |
| | | data.put("tbPidInfo", clientTBPid);
|
| | |
|
| | | JSONObject taobaoJson = JSONObject.fromObject(gson.toJson(taoBaoGoodsBriefExtra));
|
| | | if (taoBaoGoodsBriefExtra.getImgList() != null)
|
| | | taoBaoGoodsBriefExtra.getImgList().add(0, taoBaoGoodsBriefExtra.getPictUrl());
|
| | | taobaoJson.put("imgList", taoBaoGoodsBriefExtra.getImgList());
|
| | | taobaoJson.put("saleCount", taoBaoGoodsBriefExtra.getSalesCount());// 销量(和salesCount一致,此处处理兼容)
|
| | | if (taoBaoGoodsBriefExtra.getTaoBaoQuanInfo() != null)
|
| | | taobaoJson.put("coupon", true);
|
| | | else
|
| | | taobaoJson.put("coupon", false);
|
| | |
|
| | | // taoBaoGoodsBriefExtra.setAuctionUrl(null);
|
| | | data.put("taobao", taobaoJson);
|
| | | String info = configService.get("detail_prompt");
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "请上传id"));
|
| | | return;
|
| | | }
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | |
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | |
| | | // 根据商品获取推荐
|
| | | @RequestMapping(value = "getgoodsrecommend", method = RequestMethod.POST)
|
| | | public void getGoodsRecommend(final AcceptData acceptData, long id, PrintWriter out) {
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | | return;
|
| | |
| | | String[] orderArr = order.split(",");
|
| | | for (String tbOrder : orderArr) {
|
| | | Order or = new Order();
|
| | | or.setBeizhu("系统添加");
|
| | | or.setBeizhu("接口添加");
|
| | | or.setCreatetime(java.lang.System.currentTimeMillis());
|
| | | or.setDrawbackTime(0L);
|
| | | or.setOrderId(tbOrder.trim());
|
| | |
| | | return;
|
| | | }
|
| | | page = page + 1;
|
| | | System sys = systemService.getSystem(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem sys = businessSystemService.getBusinessSystem(acceptData.getPlatform(), acceptData.getPackages());
|
| | | if (sys == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "不存在该系统"));
|
| | | return;
|
| | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getApiCommonGson();
|
| | |
|
| | | GsonBuilder gsonBuilder = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder());
|
| | | gsonBuilder.excludeFieldsWithoutExposeAnnotation();
|
| | | gsonBuilder.registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
|
| | | @Override
|
| | | public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) {
|
| | | if (value == null) {
|
| | | return new JsonPrimitive("");
|
| | | } else {
|
| | | return new JsonPrimitive(value.getTime() + "");
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | Gson gson = gsonBuilder.create();
|
| | |
|
| | | if (list != null) {
|
| | | Map<String, String> map = hongBaoManageService.convertMap();
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | for (ScanHistoryV2 sh : list) {
|
| | | TaoBaoGoodsBrief goods = TaoBaoUtil.convert(sh.getCommonGoods());
|
| | | goods.setId(sh.getId());
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods, proportion.toString(), "")));
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods, proportion.toString(), "");
|
| | | extra.setCreatetime(sh.getCreateTime());
|
| | | array.add(gson.toJson(extra));
|
| | | }
|
| | | }
|
| | | data.put("data", array);
|
| | |
| | |
|
| | | @RequestMapping(value = "deletescanhistory", method = RequestMethod.POST)
|
| | | public void deleteScanHistory(AcceptData acceptData, String type, String uid, String ids, PrintWriter out) {
|
| | | System sys = systemService.getSystem(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem sys = businessSystemService.getBusinessSystem(acceptData.getPlatform(), acceptData.getPackages());
|
| | |
|
| | | if (sys == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | |
| | | @RequestMapping(value = "getRecommendInfo")
|
| | | public void getRecommendHomeInfo(AcceptData acceptData, PrintWriter out) {
|
| | |
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | | return;
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getNewRecommendInfo")
|
| | | public void getNewRecommendInfo(AcceptData acceptData, String specialCard, String swiperCard, PrintWriter out) {
|
| | | public void getNewRecommendInfo(AcceptData acceptData, Long uid, String specialCard, String swiperCard,
|
| | | PrintWriter out) {
|
| | |
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | | return;
|
| | |
| | |
|
| | | listswiper = swiperPictureService.getByBannerCard(swiperCard);
|
| | |
|
| | | if (listswiper != null && listswiper.size() > 0) {
|
| | | for (SwiperPicture swiperPicture : listswiper) {
|
| | | swiperPicture.setBannerId(null);
|
| | | swiperPicture.setCreatetime(null);
|
| | | swiperPicture.setUpdatetime(null);
|
| | | swiperPicture.setState(null);
|
| | | swiperPicture.setRemark(null);
|
| | | }
|
| | | if (listswiper == null) {
|
| | | listswiper = new ArrayList<SwiperPicture>();
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | |
| | |
|
| | | if (listSpecial != null && listSpecial.size() > 0) {
|
| | | for (Special special : listSpecial) {
|
| | | special.setCreatetime(null);
|
| | | special.setUpdatetime(null);
|
| | | special.setState(null);
|
| | | special.setRemark(null);
|
| | | special.setCard(null);
|
| | | special.setCardId(null);
|
| | |
|
| | | if ("限时秒杀".equals(special.getName())) {
|
| | | miaoShaSpecial = special;
|
| | |
| | | // 其他专题
|
| | | specialList.add(special);
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("banner", listswiper);
|
| | | root.put("honest", honestList);
|
| | | root.put("special", specialList);
|
| | |
|
| | | root.put("banner", JsonUtil.getApiCommonGson().toJson(listswiper));
|
| | | root.put("honest", JsonUtil.getApiCommonGson().toJson(honestList));
|
| | | root.put("special", JsonUtil.getApiCommonGson().toJson(specialList));
|
| | | root.put("miaoSha", msJSON);
|
| | |
|
| | | // 增加邀请有奖
|
| | | JSONObject invite = new JSONObject();
|
| | | JumpDetailV2 jumpDetail = jumpDetailV2Service.getByTypeCache("invite");
|
| | | invite.put("jumpDetail", jumpDetail);
|
| | | invite.put("picture", "http://ec-1255749512.file.myqcloud.com/resource/weex/img/invite_input_img.png");
|
| | | invite.put("picture", configService.get("home_invite_banner"));
|
| | |
|
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform())
|
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()))) {
|
| | |
| | | if (("android".equalsIgnoreCase(acceptData.getPlatform()) && Integer.parseInt(acceptData.getVersion()) > 30)
|
| | | || ("ios".equalsIgnoreCase(acceptData.getPlatform())
|
| | | && Integer.parseInt(acceptData.getVersion()) > 37)) {
|
| | | root.put("invite", invite);
|
| | | if (uid != null) {
|
| | | try {
|
| | | UserSettingsVO vo = userCustomSettingsService.getMySettings(uid);
|
| | | if (vo == null || vo.getNoInvitationBonus() == null || vo.getNoInvitationBonus() == 0)// 没有关闭邀请
|
| | | root.put("invite", invite);
|
| | | } catch (UserCustomSettingsException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | } else
|
| | | root.put("invite", invite);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | * @param acceptData
|
| | | * @param id
|
| | | * @param uid
|
| | | * @param pageSource
|
| | | * 页面来源
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getgoodsinfo", method = RequestMethod.POST)
|
| | | public void getGoodsInfo(AcceptData acceptData, String id, String uid, PrintWriter out) {
|
| | | public void getGoodsInfo(AcceptData acceptData, String id, String uid, String from, PrintWriter out) {
|
| | |
|
| | | if ("0".equalsIgnoreCase(uid)) {
|
| | | uid = "";
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | | return;
|
| | |
| | |
|
| | | List<String> finalImgList = new ArrayList<>();
|
| | | for (String img : tb.getImgList()) {
|
| | | finalImgList.add(img);
|
| | | finalImgList.add(TbImgUtil.getTBSizeImg(img, 600));
|
| | | }
|
| | |
|
| | | JSONObject goods = new JSONObject();
|
| | |
| | | goods.put("price", tb.getReservePrice().toString());
|
| | | goods.put("zkPrice", tb.getZkPrice().toString());
|
| | |
|
| | | // 红包
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | String hongBao = TaoBaoUtil.getGoodsHongBaoInfo(tb, proportion);
|
| | | goods.put("hongBao", hongBao);
|
| | | // 30天销量
|
| | | goods.put("saleCount", TaoBaoUtil.getSaleCount(tb.getBiz30day()));
|
| | |
|
| | |
| | | // 领券人列表
|
| | | List<ShamUser> listCouponUser = new ArrayList<ShamUser>();
|
| | |
|
| | | String hongBao = null;
|
| | |
|
| | | // 获取券信息
|
| | | if (!StringUtil.isNullOrEmpty(tb.getCouponInfo())) {
|
| | | BigDecimal quanPrice = TaoBaoUtil.getAfterUseCouplePrice(tb);
|
| | | JSONObject couponInfo = new JSONObject();
|
| | | couponInfo.put("couponPrice", quanPrice.toString());
|
| | |
|
| | | if (from != null && from.equals("miandan")) {
|
| | | // 免单商品
|
| | | hongBao = "¥" + quanPrice.toString();
|
| | | }
|
| | |
|
| | | // 服务端转链
|
| | | if (convertInServer && !StringUtil.isNullOrEmpty(tb.getCouponLink())) {
|
| | |
| | | listCouponUser = shamUserService.listRandCouponUser(5, 1, 300);
|
| | | }
|
| | | }
|
| | |
|
| | | // 红包
|
| | | if (hongBao == null) {
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | hongBao = TaoBaoUtil.getGoodsHongBaoInfo(tb, proportion);
|
| | | }
|
| | | goods.put("hongBao", hongBao);
|
| | |
|
| | | data.put("tbPidInfo", clientTBPid);
|
| | |
|
| | |
| | | data.put("goods", goods);
|
| | | data.put("shareUsers", listShareUser);
|
| | | data.put("couponUsers", listCouponUser);
|
| | | data.put("detailWebUrl", "http://apph5.yeshitv.com/apppage/goods_img.html?id=" + id);
|
| | |
|
| | | // 取消分享活动
|
| | | // if (!StringUtil.isNullOrEmpty(uid)
|
| | | // &&
|
| | | // shareGoodsActivityOrderService.countShareGoodsActivityOrder(Long.parseLong(uid))
|
| | | // > 0) {
|
| | | // } else if(!"miandan".equals(from)) {
|
| | | // // 非免单商品
|
| | | // JSONObject shareActivity = new JSONObject();
|
| | | // shareActivity.put("moneyDesc", "春节狂欢奖金:¥" +
|
| | | // TaoBaoUtil.getGoodsHongBaoMoney(tb,
|
| | | // new
|
| | | // BigDecimal(hongBaoManageService.get("share_activity_proportion"))));
|
| | | // shareActivity.put("ruleDescPicture",
|
| | | // "http://img.flqapp.com/resource/share_activity_img.png");
|
| | | //
|
| | | // data.put("shareActivity", shareActivity);
|
| | | // }
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
|
| | |
| | | @RequestMapping(value = "getgoodsderivation", method = RequestMethod.POST)
|
| | | public void getRecommendGoods(AcceptData acceptData, long id, PrintWriter out) {
|
| | |
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.getRelationGoodsRecommend(id, 10);
|
| | |
|
| | | // 重新做推荐
|
| | | if (goodsList == null || goodsList.size() == 0) {
|
| | |
|
| | | goodsList = new ArrayList<>();
|
| | |
|
| | | TaoBaoGoodsBrief goods = null;
|
| | |
|
| | | try {
|
| | | goods = redisManager.getTaoBaoGoodsBrief(id);
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | if (goods == null) {
|
| | | // 从我们的商品库搜索
|
| | | CommonGoods cgoods = commonGoodsService.getCommonGoodsByGoodsIdAndGoodsType(id,
|
| | | CommonGoods.GOODS_TYPE_TB);
|
| | | // 商品有本地缓存
|
| | | if (cgoods != null) {
|
| | | // 按名字搜索商品
|
| | | SearchFilter sf = new SearchFilter();
|
| | | sf.setKey(cgoods.getTitle().substring(0, cgoods.getTitle().length() / 2));
|
| | |
|
| | | TaoBaoSearchResult result = TaoBaoUtil.search(sf);
|
| | |
|
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null
|
| | | && result.getTaoBaoGoodsBriefs().size() > 0) {
|
| | |
|
| | | for (TaoBaoGoodsBrief gds : result.getTaoBaoGoodsBriefs()) {
|
| | | if (goodsList.size() == 10) {
|
| | | break;
|
| | | }
|
| | | goodsList.add(gds);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | // 需要另做推荐
|
| | | if (goodsList.size() < 2) {
|
| | | try {
|
| | | List<RecommendSectionGoods> list = recommendSectionGoodsService.getSectionGoods(10);
|
| | | if (list != null) {
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | if (i == 10) {
|
| | | break;
|
| | | }
|
| | | goodsList.add(list.get(i).getTaoBaoGoodsBrief());
|
| | | }
|
| | | }
|
| | | } catch (Exception e2) {
|
| | | e2.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | | // 初始化
|
| | | if (goodsList == null) {
|
| | | goodsList = new ArrayList<TaoBaoGoodsBrief>();
|
| | | }
|
| | |
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 活动列表
|
| | | * |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getSpecialActivities")
|
| | | public void getSpecialActivities(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | |
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | // 专题活动
|
| | | String specialCard = "special_activities";
|
| | |
|
| | | List<Special> listSpecial = specialService.listPageBySystemAndCard(0, Integer.MAX_VALUE, specialCard,
|
| | | system.getId());
|
| | |
|
| | | if (listSpecial == null) {
|
| | | listSpecial = new ArrayList<Special>();
|
| | | }
|
| | |
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("special", JsonUtil.getApiCommonGson().toJson(listSpecial));
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | |
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|