From 5879fd8d7e0cc7cfb94a036545dd515381fc3e70 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期三, 01 一月 2020 10:21:31 +0800 Subject: [PATCH] Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div --- fanli/src/main/java/com/yeshi/fanli/controller/client/v1/BrandController.java | 74 +++++++++++++++++-------------------- 1 files changed, 34 insertions(+), 40 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/BrandController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/BrandController.java index 35b1859..6ce78e5 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/BrandController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/BrandController.java @@ -20,7 +20,7 @@ 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; +import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2; import com.yeshi.fanli.exception.taobao.TaoKeApiException; import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException; import com.yeshi.fanli.service.inter.brand.BrandClassService; @@ -31,7 +31,7 @@ import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService; import com.yeshi.fanli.service.inter.order.config.HongBaoManageService; import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService; -import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsService; +import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailV2Service; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.ThreadUtil; @@ -61,20 +61,18 @@ @Resource private HongBaoManageService manageService; - @Resource private TaoBaoGoodsBriefService taoBaoGoodsBriefService; @Resource - private DaTaoKeGoodsService daTaoKeGoodsService; - + private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service; + @Resource private BrandInfoRecordService brandInfoRecordService; - + @Resource private ConfigService configService; - - + /** * 鑾峰彇鍝佺墝鍒嗙被 * @@ -101,8 +99,6 @@ } } - - /** * 娣诲姞瓒宠抗 * @@ -116,7 +112,7 @@ out.print(JsonUtil.loadFalseResult("鏈�夋嫨鏁版嵁")); return; } - + // 鏂扮増鍒犻櫎 if ("ios".equalsIgnoreCase(acceptData.getPlatform())) { if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) { @@ -131,7 +127,7 @@ return; } } - + taoBaoShopHistoryService.deleteHistory(Arrays.asList(ids.split(",")), uid, acceptData.getDevice()); out.print(JsonUtil.loadTrueResult("鍒犻櫎鎴愬姛")); } catch (Exception e) { @@ -139,12 +135,13 @@ e.printStackTrace(); } } - + /** * 搴楅摵瓒宠抗 * * @param acceptData - * @param type 绮鹃��1锛� 瓒宠抗鍒楄〃2 + * @param type + * 绮鹃��1锛� 瓒宠抗鍒楄〃2 * @param out */ @RequestMapping(value = "getHistory", method = RequestMethod.POST) @@ -158,7 +155,7 @@ if (page == null || page < 1) { page = 1; } - + int pageSize; if (type == 1) { pageSize = 4; @@ -186,22 +183,22 @@ for (TaoBaoShopHistory history : listHistory) { TaoBaoShop taoBaoShop = history.getTaoBaoShop(); if (taoBaoShop != null) { - + 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); } } @@ -251,7 +248,7 @@ out.print(JsonUtil.loadFalseResult("缂哄け搴楅摵id")); return; } - + JSONObject data = new JSONObject(); if (page == 1) { TaoBaoShop taoBaoShop = taoBaoShopService.selectByPrimaryKey(sid); @@ -263,19 +260,18 @@ 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() { // 娣诲姞瓒宠抗 @@ -284,47 +280,45 @@ }); } - // 鍟嗗搧鍒楄〃淇℃伅 int pageSize = 50; List<TaoBaoGoodsBrief> listGoodsBrief = new ArrayList<TaoBaoGoodsBrief>(); - + // 鍏堟煡璇㈠ぇ娣樺鏁版嵁 - List<DaTaoKeDetail> listDaTaoKe = daTaoKeGoodsService.listBySellerId(0, pageSize, sid); + List<DaTaoKeDetailV2> listDaTaoKe = daTaoKeGoodsDetailV2Service.listBySellerId(0, pageSize, sid); if (listDaTaoKe != null && listDaTaoKe.size() > 0) { - for (DaTaoKeDetail daTaoKe: listDaTaoKe) { + for (DaTaoKeDetailV2 daTaoKe : listDaTaoKe) { listGoodsBrief.add(TaoBaoUtil.convert(daTaoKe)); } } - + // 涓嶈冻50鏉℃暟鎹�佹煡璇㈢簿閫夊簱 if (listGoodsBrief.size() < pageSize) { - int needCount = pageSize- listGoodsBrief.size(); + 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 ++) { + for (int i = 0; i < listGoods.size(); i++) { long id = listGoods.get(i).getAuctionId(); boolean isRepeat = false; - for (TaoBaoGoodsBrief goodsBrief: listGoodsBrief) { + for (TaoBaoGoodsBrief goodsBrief : listGoodsBrief) { long auctionId = goodsBrief.getAuctionId(); if (auctionId == id) { isRepeat = true; break; } } - if(isRepeat) { + if (isRepeat) { listGoods.remove(i); i--; } } } - + listGoodsBrief.addAll(listGoods); } } - JSONArray array = new JSONArray(); if (listGoodsBrief.size() > 0) { @@ -343,12 +337,11 @@ } catch (Exception e) { e.printStackTrace(); } - Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create(); BigDecimal proportion = manageService.getFanLiRate(); - + for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoodsBrief) { if (listTaoKeGoods != null && listTaoKeGoods.size() > 0) { boolean stateSale = false; // 榛樿鍋滃敭 @@ -364,10 +357,11 @@ continue; } } - array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null))); + array.add(gson.toJson( + TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null))); } } - + data.put("count", array.size()); data.put("list", array); out.print(JsonUtil.loadTrueResult(data)); -- Gitblit v1.8.0