fanli/src/main/java/com/yeshi/fanli/controller/client/v2/BrandControllerV2.java
@@ -15,6 +15,7 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.yeshi.fanli.entity.accept.AcceptData; import com.yeshi.fanli.entity.brand.TaoBaoShopHistory; import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; import com.yeshi.fanli.entity.taobao.TaoBaoShop; import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail; @@ -27,6 +28,7 @@ import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService; import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService; import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsService; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.ThreadUtil; import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory; @@ -56,15 +58,11 @@ @Resource private HongBaoManageService hongBaoManageService; @Resource private TaoBaoGoodsBriefService taoBaoGoodsBriefService; @Resource private DaTaoKeGoodsService daTaoKeGoodsService; /** * 店铺列表 @@ -74,16 +72,91 @@ */ @RequestMapping(value = "getShopList", method = RequestMethod.POST) public void getShopList(AcceptData acceptData, Integer page, Long cid, PrintWriter out) { try { if (page == null || page < 1) { page = 1; } JSONObject data = brandClassShopService.listEffectiveCacheV2(page, cid); out.print(JsonUtil.loadTrueResult(data)); } catch (Exception e) { e.printStackTrace(); out.print(JsonUtil.loadFalseResult("查询失败")); if (page == null || page < 1) { page = 1; } JSONObject data = brandClassShopService.listEffectiveCacheV2(page, cid); out.print(JsonUtil.loadTrueResult(data)); } /** * 店铺足迹 * * @param acceptData * @param type 精选1, 足迹列表2 * @param out */ @RequestMapping(value = "getHistory", method = RequestMethod.POST) public void getHistory(AcceptData acceptData, Integer page, Long uid, Integer type, PrintWriter out) { if (type == null) { out.print(JsonUtil.loadFalseResult("类型不正确")); return; } if (page == null || page < 1) { page = 1; } int pageSize; if (type == 1) { pageSize = 4; } else { pageSize = Constant.PAGE_SIZE; } long count = 0; List<TaoBaoShopHistory> listHistory = null; if (uid == null || uid == 0) { String device = acceptData.getDevice(); count = taoBaoShopHistoryService.countByDevice(device); if (count > 0) { listHistory = taoBaoShopHistoryService.listByDevice((page - 1) * pageSize, pageSize, device); } } else { count = taoBaoShopHistoryService.countByUid(uid); if (count > 0) { listHistory = taoBaoShopHistoryService.listByUid((page - 1) * pageSize, pageSize, uid); } } List<TaoBaoShop> list = new ArrayList<TaoBaoShop>(); if (listHistory != null && listHistory.size() > 0) { for (TaoBaoShopHistory history : listHistory) { TaoBaoShop taoBaoShop = history.getTaoBaoShop(); if (taoBaoShop != null) { Integer userType = taoBaoShop.getUserType(); if (userType == null || userType == 0) { taoBaoShop.setUserType(10); } else { taoBaoShop.setUserType(11); } String shopLink = taoBaoShop.getShopLink(); if (StringUtil.isNullOrEmpty(shopLink)) { taoBaoShop.setShopLink(TaoBaoUtil.getShopLink(taoBaoShop.getId())); } String shopNameCustom = taoBaoShop.getShopNameCustom(); if (!StringUtil.isNullOrEmpty(shopNameCustom)) { taoBaoShop.setShopName(shopNameCustom); } String shopIconCustom = taoBaoShop.getShopIconCustom(); if (!StringUtil.isNullOrEmpty(shopIconCustom)) { taoBaoShop.setShopIcon(shopIconCustom); } list.add(taoBaoShop); } } } JSONObject data = new JSONObject(); data.put("count", count); data.put("list", JsonUtil.getApiCommonGson().toJson(list)); out.print(JsonUtil.loadTrueResult(data)); } /** @@ -94,138 +167,138 @@ */ @RequestMapping(value = "getShopInfo", method = RequestMethod.POST) public void getShopInfo(AcceptData acceptData, Integer page, Long sid, Long uid, PrintWriter out) { try { if (sid == null) { out.print(JsonUtil.loadFalseResult("缺失店铺id")); if (sid == null) { out.print(JsonUtil.loadFalseResult("缺失店铺id")); return; } JSONObject data = new JSONObject(); if (page == 1) { TaoBaoShop taoBaoShop = taoBaoShopService.selectByPrimaryKey(sid); if (taoBaoShop == null) { out.print(JsonUtil.loadFalseResult("店铺信息获取失败")); return; } JSONObject data = new JSONObject(); if (page == 1) { TaoBaoShop taoBaoShop = taoBaoShopService.selectByPrimaryKey(sid); if (taoBaoShop == null) { out.print(JsonUtil.loadFalseResult("店铺信息获取失败")); return; } String shopLink = taoBaoShop.getShopLink(); if (StringUtil.isNullOrEmpty(shopLink)) { taoBaoShop.setShopLink(TaoBaoUtil.getShopLink(taoBaoShop.getId())); } String shopNameCustom = taoBaoShop.getShopNameCustom(); if (!StringUtil.isNullOrEmpty(shopNameCustom)) { taoBaoShop.setShopName(shopNameCustom); } String shopIconCustom = taoBaoShop.getShopIconCustom(); if (!StringUtil.isNullOrEmpty(shopIconCustom)) { taoBaoShop.setShopIcon(shopIconCustom); } data.put("shop", JsonUtil.getApiCommonGson().toJson(taoBaoShop)); ThreadUtil.run(new Runnable() { public void run() { // 添加足迹 taoBaoShopHistoryService.addHistory(sid, uid, acceptData.getDevice()); } }); String shopLink = taoBaoShop.getShopLink(); if (StringUtil.isNullOrEmpty(shopLink)) { taoBaoShop.setShopLink(TaoBaoUtil.getShopLink(taoBaoShop.getId())); } // 商品列表信息 int pageSize = 50; List<TaoBaoGoodsBrief> listGoodsBrief = new ArrayList<TaoBaoGoodsBrief>(); // 先查询大淘客数据 List<DaTaoKeDetail> listDaTaoKe = daTaoKeGoodsService.listBySellerId(0, pageSize, sid); if (listDaTaoKe != null && listDaTaoKe.size() > 0) { for (DaTaoKeDetail daTaoKe: listDaTaoKe) { listGoodsBrief.add(TaoBaoUtil.convert(daTaoKe)); } String shopNameCustom = taoBaoShop.getShopNameCustom(); if (!StringUtil.isNullOrEmpty(shopNameCustom)) { taoBaoShop.setShopName(shopNameCustom); } // 不足50条数据、查询精选库 if (listGoodsBrief.size() < pageSize) { int needCount = pageSize- listGoodsBrief.size(); List<TaoBaoGoodsBrief> listGoods = taoBaoGoodsBriefService.listByShopId(0, needCount, sid); if (listGoods != null && listGoods.size() > 0) { if (listGoodsBrief.size() > 0) { for (int i = 0; i< listGoods.size(); i ++) { long id = listGoods.get(i).getAuctionId(); boolean isRepeat = false; for (TaoBaoGoodsBrief goodsBrief: listGoodsBrief) { long auctionId = goodsBrief.getAuctionId(); if (auctionId == id) { isRepeat = true; break; } } if(isRepeat) { listGoods.remove(i); i--; } } } listGoodsBrief.addAll(listGoods); } String shopIconCustom = taoBaoShop.getShopIconCustom(); if (!StringUtil.isNullOrEmpty(shopIconCustom)) { taoBaoShop.setShopIcon(shopIconCustom); } JSONArray array = new JSONArray(); if (listGoodsBrief.size() > 0) { List<Long> listGid = new ArrayList<Long>(); for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoodsBrief) { listGid.add(taoBaoGoodsBrief.getAuctionId()); } // API网络接口验证是否在售 List<TaoBaoGoodsBrief> listTaoKeGoods = null; try { listTaoKeGoods = TaoKeApiUtil.getBatchGoodsInfo(listGid); } catch (TaoKeApiException e) { e.printStackTrace(); } catch (TaobaoGoodsDownException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } Integer userType = taoBaoShop.getUserType(); if (userType == null || userType == 0) { taoBaoShop.setUserType(10); } else { taoBaoShop.setUserType(11); } Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create(); BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoodsBrief) { if (listTaoKeGoods != null && listTaoKeGoods.size() > 0) { boolean stateSale = false; // 默认停售 Long goodsId = taoBaoGoodsBrief.getAuctionId(); for (TaoBaoGoodsBrief taoKeGoods : listTaoKeGoods) { Long auctionId = taoKeGoods.getAuctionId(); if (goodsId == auctionId || goodsId.equals(auctionId)) { stateSale = true; // 在售 data.put("shop", JsonUtil.getApiCommonGson().toJson(taoBaoShop)); ThreadUtil.run(new Runnable() { public void run() { // 添加足迹 taoBaoShopHistoryService.addHistory(sid, uid, acceptData.getDevice()); } }); } // 商品列表信息 int pageSize = 50; List<TaoBaoGoodsBrief> listGoodsBrief = new ArrayList<TaoBaoGoodsBrief>(); // 先查询大淘客数据 List<DaTaoKeDetail> listDaTaoKe = daTaoKeGoodsService.listBySellerId(0, pageSize, sid); if (listDaTaoKe != null && listDaTaoKe.size() > 0) { for (DaTaoKeDetail daTaoKe : listDaTaoKe) { listGoodsBrief.add(TaoBaoUtil.convert(daTaoKe)); } } // 不足50条数据、查询精选库 if (listGoodsBrief.size() < pageSize) { int needCount = pageSize - listGoodsBrief.size(); List<TaoBaoGoodsBrief> listGoods = taoBaoGoodsBriefService.listByShopId(0, needCount, sid); if (listGoods != null && listGoods.size() > 0) { if (listGoodsBrief.size() > 0) { for (int i = 0; i < listGoods.size(); i++) { long id = listGoods.get(i).getAuctionId(); boolean isRepeat = false; for (TaoBaoGoodsBrief goodsBrief : listGoodsBrief) { long auctionId = goodsBrief.getAuctionId(); if (auctionId == id) { isRepeat = true; break; } } if (!stateSale) { continue; if (isRepeat) { listGoods.remove(i); i--; } } GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate); array.add(gson.toJson(goodsDetailVO)); } listGoodsBrief.addAll(listGoods); } data.put("count", array.size()); data.put("list", array); out.print(JsonUtil.loadTrueResult(data)); } catch (Exception e) { e.printStackTrace(); out.print(JsonUtil.loadFalseResult("查询失败")); } JSONArray array = new JSONArray(); if (listGoodsBrief.size() > 0) { List<Long> listGid = new ArrayList<Long>(); for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoodsBrief) { listGid.add(taoBaoGoodsBrief.getAuctionId()); } // API网络接口验证是否在售 List<TaoBaoGoodsBrief> listTaoKeGoods = null; try { listTaoKeGoods = TaoKeApiUtil.getBatchGoodsInfo(listGid); } catch (TaoKeApiException e) { e.printStackTrace(); } catch (TaobaoGoodsDownException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create(); BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoodsBrief) { if (listTaoKeGoods != null && listTaoKeGoods.size() > 0) { boolean stateSale = false; // 默认停售 Long goodsId = taoBaoGoodsBrief.getAuctionId(); for (TaoBaoGoodsBrief taoKeGoods : listTaoKeGoods) { Long auctionId = taoKeGoods.getAuctionId(); if (goodsId == auctionId || goodsId.equals(auctionId)) { stateSale = true; // 在售 break; } } if (!stateSale) { continue; } } GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate); array.add(gson.toJson(goodsDetailVO)); } } data.put("count", array.size()); data.put("list", array); out.print(JsonUtil.loadTrueResult(data)); } } fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsClassControllerV2.java
@@ -221,7 +221,7 @@ } // 统计点击量 if (page == 0) { if (page == 1) { goodsSubClassService.countClick(acceptData, goodsSubClass); } fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
@@ -28,6 +28,7 @@ import com.yeshi.fanli.entity.taobao.TaoBaoShop; import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig; import com.yeshi.fanli.entity.taobao.TaoKeAppInfo; import com.yeshi.fanli.exception.taobao.TaoKeApiException; import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException; import com.yeshi.fanli.exception.taobao.TaobaoGoodsUpdateException; import com.yeshi.fanli.log.LogHelper; @@ -797,5 +798,112 @@ } }); } /** * 商品详情推荐(猜你喜欢 + 推荐) * * @param acceptData * @param id * @param out */ @RequestMapping(value = "getRecommendGoods", method = RequestMethod.POST) public void getRecommendGoods(AcceptData acceptData, long id, Integer goodsType, PrintWriter out) { if (goodsType == null) { goodsType = Constant.SOURCE_TYPE_TAOBAO; } // 京东 if (goodsType == Constant.SOURCE_TYPE_JD) { JSONObject data = new JSONObject(); data.put("listQuality", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>())); data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>())); out.print(JsonUtil.loadTrueResult(data)); return; } // 拼多多 if (goodsType == Constant.SOURCE_TYPE_PDD) { JSONObject data = new JSONObject(); data.put("listQuality", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>())); data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>())); out.print(JsonUtil.loadTrueResult(data)); return; } List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.getRelationGoodsRecommend(id, 10); // 初始化 if (goodsList == null) { goodsList = new ArrayList<TaoBaoGoodsBrief>(); } List<GoodsDetailVO> listExtra = new ArrayList<GoodsDetailVO>(); TaoKeAppInfo app = new TaoKeAppInfo(); app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY); app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET); app.setAdzoneId(TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT.split("_")[3]); app.setPid(TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT); List<Long> ids = new ArrayList<>(); for (TaoBaoGoodsBrief goods : goodsList) ids.add(goods.getAuctionId()); try { goodsList = TaoKeApiUtil.getBatchGoodsInfo(ids); } catch (TaoKeApiException e1) { e1.printStackTrace(); } catch (TaobaoGoodsDownException e1) { e1.printStackTrace(); } if (goodsList != null && goodsList.size() > 0) { BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); goodsList.parallelStream().forEach(goods -> { if (goods != null) { // 获取详情 TaoBaoGoodsBrief taoBaoGoodsBrief = null; try { taoBaoGoodsBrief = taoBaoGoodsCacheUtil.getCommonTaoBaoGoodsInfo(goods.getAuctionId()); } catch (Exception e) { e.printStackTrace(); } if (taoBaoGoodsBrief == null) { TaoBaoGoodsBrief newGoods = TaoKeApiUtil.specialConvertCoupon(goods.getAuctionId(), app); goods.setCouponInfo(newGoods.getCouponInfo()); goods.setCouponLink(newGoods.getCouponLink()); goods.setTkRate(newGoods.getTkRate()); taoBaoGoodsBrief = goods; } if (taoBaoGoodsBrief != null) { listExtra.add(GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate)); } } }); } List<GoodsDetailVO> listQuality = new ArrayList<GoodsDetailVO>(); // 取偶数个数据 if (listExtra.size() % 2 != 0) { listExtra.remove(listExtra.size() - 1); } if (listQuality.size() % 2 != 0) { listQuality.remove(listQuality.size() - 1); } JSONObject data = new JSONObject(); data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listExtra)); data.put("listGuess", JsonUtil.getApiCommonGson().toJson(listQuality)); out.print(JsonUtil.loadTrueResult(data)); } } fanli/src/main/java/com/yeshi/fanli/controller/client/v2/HotSellControllerV2.java
@@ -15,7 +15,6 @@ import com.yeshi.fanli.dto.dataoke.DaTaoKeGoodsResult; import com.yeshi.fanli.entity.accept.AcceptData; import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra; import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.common.JumpDetailV2Service; fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RecommendControllerV2.java
@@ -28,7 +28,6 @@ import com.yeshi.fanli.entity.taobao.SearchFilter; import com.yeshi.fanli.entity.taobao.TLJBuyGoods; 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.entity.taobao.dataoke.DaTaoKeDetail; import com.yeshi.fanli.log.LogHelper; fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java
@@ -181,7 +181,7 @@ // 获取推荐词 List<String> listRecommendWords = new ArrayList<String>(); // 综合 查询第一页时获取候选词 if (page == 0) { if (page == 1) { listRecommendWords = TaoBaoUtil.getSuguestSearch(kw); if (listRecommendWords == null || listRecommendWords.size() == 0) { listRecommendWords = new ArrayList<String>(); @@ -439,7 +439,6 @@ */ private JSONObject searchDaTaoKeGoods(String key, int page, String filter, String order, String startprice, String endprice) { page = page + 1; int sort = DaTaoKeApiUtil.SORT_DEFAULT; if ("5".equalsIgnoreCase(order)) { sort = DaTaoKeApiUtil.SORT_COMMISSION; fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java
@@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletRequest; import org.springframework.core.task.TaskExecutor; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.yeshi.utils.DateUtil; @@ -76,6 +77,8 @@ import net.sf.json.JSONArray; import net.sf.json.JSONObject; @Controller @RequestMapping("api/v2/share") public class ShareControllerV2 { @@ -147,7 +150,7 @@ * @param recordId * @param out */ @RequestMapping(value = "getShareGoods", method = RequestMethod.POST) @RequestMapping(value = "getShareGoods") public void getShareGoods(AcceptData acceptData, Long recordId, PrintWriter out) { if (recordId == null) { fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareStorageControllerV2.java
@@ -54,22 +54,20 @@ @Resource private UserGoodsStorageService userGoodsStorageService; /** * 批量添加选品库 * * @param acceptData * @param uid * 用户id * @param ids * 简版商品id * @param uid 用户id * @param ids 简版商品id * @param out */ @RequestMapping(value = "addStorage", method = RequestMethod.POST) public void addStorage(AcceptData acceptData, Long uid, String ids, PrintWriter out) { try { Gson gson = new Gson(); Set<Long> set = gson.fromJson(ids, new TypeToken<HashSet<Long>>() {}.getType()); Set<Long> set = gson.fromJson(ids, new TypeToken<HashSet<Long>>() { }.getType()); if (set == null || set.size() == 0) { out.print(JsonUtil.loadFalseResult("未选择商品")); return; @@ -79,11 +77,9 @@ out.print(JsonUtil.loadTrueResult("添加成功")); } catch (UserGoodsStorageException e) { out.print(JsonUtil.loadFalseResult(e.getMsg())); } } } /** * 查询用户选品库数据 * @@ -104,113 +100,107 @@ out.print(JsonUtil.loadFalseResult("平台类型不能为空")); return; } if (page == null || page < 1) { page = 1; } try { int pageSize = Constant.PAGE_SIZE; JSONArray array = new JSONArray(); JSONObject data = new JSONObject(); if (goodsType == Constant.SOURCE_TYPE_JD) { String open = configService.get("share_jd_open"); if (!"1".equals(open.trim())) { data.put("count", 0); data.put("result_list", array); out.print(JsonUtil.loadTrueResult(data)); return; } } List<UserGoodsStorage> listStorage = userGoodsStorageService.listQueryByUid((page - 1) * pageSize, pageSize, uid, goodsType); if (listStorage == null || listStorage.size() == 0) { int pageSize = Constant.PAGE_SIZE; JSONArray array = new JSONArray(); JSONObject data = new JSONObject(); if (goodsType == Constant.SOURCE_TYPE_JD) { String open = configService.get("share_jd_open"); if (!"1".equals(open.trim())) { data.put("count", 0); data.put("result_list", array); out.print(JsonUtil.loadTrueResult(data)); return; } } // API网络接口验证是否在售 List<TaoBaoGoodsBrief> listTaoKeGoods = null; if (goodsType == Constant.SOURCE_TYPE_TAOBAO) { List<Long> listGid = new ArrayList<Long>(); for (UserGoodsStorage userGoodsStorage : listStorage) { CommonGoods commonGoods = userGoodsStorage.getCommonGoods(); if (commonGoods == null) { continue; } listGid.add(commonGoods.getGoodsId()); } List<UserGoodsStorage> listStorage = userGoodsStorageService.listQueryByUid((page - 1) * pageSize, pageSize, uid, goodsType); if (listStorage == null || listStorage.size() == 0) { data.put("count", 0); data.put("result_list", array); out.print(JsonUtil.loadTrueResult(data)); return; } try { listTaoKeGoods = TaoKeApiUtil.getBatchGoodsInfo(listGid); } catch (TaoKeApiException e) { e.printStackTrace(); } catch (TaobaoGoodsDownException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create(); BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); // API网络接口验证是否在售 List<TaoBaoGoodsBrief> listTaoKeGoods = null; if (goodsType == Constant.SOURCE_TYPE_TAOBAO) { List<Long> listGid = new ArrayList<Long>(); for (UserGoodsStorage userGoodsStorage : listStorage) { CommonGoods commonGoods = userGoodsStorage.getCommonGoods(); if (commonGoods == null) { continue; } // 淘宝商品验证在售 if (goodsType == Constant.SOURCE_TYPE_TAOBAO) { if (listTaoKeGoods != null && listTaoKeGoods.size() > 0) { int state = 1; // 默认停售 Long goodsId = commonGoods.getGoodsId(); for (TaoBaoGoodsBrief taoKeGoods : listTaoKeGoods) { Long auctionId = taoKeGoods.getAuctionId(); if (goodsId == auctionId || goodsId.equals(auctionId)) { state = 0; // 在售 break; } } commonGoods.setState(state); } } // 判断是否已分享, 已分享显示已下架 Integer storageState = userGoodsStorage.getState(); if (storageState != null && storageState == UserGoodsStorage.STATE_SHARED) { Integer goodsState = commonGoods.getState(); if (goodsState != null && goodsState != 1) { commonGoods.setState(2); } } GoodsDetailVO detailVO = GoodsDetailVOFactory.convertCommonGoods(commonGoods, null, fanLiRate, shareRate); detailVO.setId(commonGoods.getId()); JSONObject dataObject = new JSONObject(); dataObject.put("storageId", userGoodsStorage.getId()); dataObject.put("goods", gson.toJson(detailVO)); array.add(dataObject); listGid.add(commonGoods.getGoodsId()); } long count = userGoodsStorageService.countQueryByUid(uid, goodsType); data.put("count", count); data.put("result_list", array); out.print(JsonUtil.loadTrueResult(data)); } catch (Exception e) { out.print(JsonUtil.loadFalseResult("加载列表失败")); e.printStackTrace(); try { listTaoKeGoods = TaoKeApiUtil.getBatchGoodsInfo(listGid); } catch (TaoKeApiException e) { e.printStackTrace(); } catch (TaobaoGoodsDownException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create(); BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); for (UserGoodsStorage userGoodsStorage : listStorage) { CommonGoods commonGoods = userGoodsStorage.getCommonGoods(); if (commonGoods == null) { continue; } // 淘宝商品验证在售 if (goodsType == Constant.SOURCE_TYPE_TAOBAO) { if (listTaoKeGoods != null && listTaoKeGoods.size() > 0) { int state = 1; // 默认停售 Long goodsId = commonGoods.getGoodsId(); for (TaoBaoGoodsBrief taoKeGoods : listTaoKeGoods) { Long auctionId = taoKeGoods.getAuctionId(); if (goodsId == auctionId || goodsId.equals(auctionId)) { state = 0; // 在售 break; } } commonGoods.setState(state); } } // 判断是否已分享, 已分享显示已下架 Integer storageState = userGoodsStorage.getState(); if (storageState != null && storageState == UserGoodsStorage.STATE_SHARED) { Integer goodsState = commonGoods.getState(); if (goodsState != null && goodsState != 1) { commonGoods.setState(2); } } GoodsDetailVO detailVO = GoodsDetailVOFactory.convertCommonGoods(commonGoods, null, fanLiRate, shareRate); detailVO.setId(commonGoods.getId()); JSONObject dataObject = new JSONObject(); dataObject.put("storageId", userGoodsStorage.getId()); dataObject.put("goods", gson.toJson(detailVO)); array.add(dataObject); } long count = userGoodsStorageService.countQueryByUid(uid, goodsType); data.put("count", count); data.put("result_list", array); out.print(JsonUtil.loadTrueResult(data)); } } fanli/src/main/java/com/yeshi/fanli/controller/client/v2/TaoLiJinControllerV2.java
@@ -740,6 +740,7 @@ out.print(JsonUtil.loadTrueResult(data)); } /** * 分享爆款商品-限于淘礼金 * @@ -775,11 +776,13 @@ continue; } GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, proportion, proportion); // 去掉标签 detailVO.setLabels(null); MoneyInfoVO moneyInfo = detailVO.getMoneyInfo(); moneyInfo.setMoneyType(2); detailVO.setMoneyInfo(moneyInfo); @@ -795,6 +798,8 @@ OtherInfo otherInfo = new OtherInfo(); otherInfo.setReduceHongBao(vo); detailVO.setOtherInfo(otherInfo); array.add(gson.toJson(detailVO)); } if (page > 1) fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassShopServiceImpl.java
@@ -361,6 +361,14 @@ for (BrandClassShop brandClassShop : list) { TaoBaoShop shop = brandClassShop.getShop(); if (shop != null) { Integer userType = shop.getUserType(); if (userType == null || userType == 0) { shop.setUserType(10); } else { shop.setUserType(11); } String shopLink = shop.getShopLink(); if (StringUtil.isNullOrEmpty(shopLink)) { shop.setShopLink(TaoBaoUtil.getShopLink(shop.getId())); @@ -398,6 +406,13 @@ BigDecimal shareRate = hongBaoManageService.getShareRate(); for (TaoBaoShopVO taoBaoShopVO : listInfo) { Integer userType = taoBaoShopVO.getUserType(); if (userType == null || userType == 0) { taoBaoShopVO.setUserType(10); } else { taoBaoShopVO.setUserType(11); } String shopLink = taoBaoShopVO.getShopLink(); if (StringUtil.isNullOrEmpty(shopLink)) { taoBaoShopVO.setShopLink(TaoBaoUtil.getShopLink(taoBaoShopVO.getId())); fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/DynamicInfoServiceImpl.java
@@ -901,6 +901,19 @@ BigDecimal shareRate = hongBaoManageService.getShareRate(); for (DynamicInfo dynamicInfo: list) { TaoBaoShop shop = dynamicInfo.getShop(); if (shop != null) { Integer userType = shop.getUserType(); if (userType == null || userType == 0) { shop.setUserType(10); } else { shop.setUserType(11); } dynamicInfo.setShop(shop); } List<GoodsPicture> imgs = dynamicInfo.getImgs(); if (imgs != null && imgs.size() > 0) { for (GoodsPicture goodsPicture: imgs) {