fanli/src/main/java/com/yeshi/fanli/controller/client/BrandController.java
@@ -164,6 +164,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); } } @@ -215,7 +231,20 @@ if (taoBaoShop == null) { out.print(JsonUtil.loadFalseResult("店铺信息获取失败")); } 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", taoBaoShop); } fanli/src/main/java/com/yeshi/fanli/dao/mybatis/brand/BrandClassShopMapper.java
@@ -25,7 +25,7 @@ * @param cid * @return */ List<BrandClassShop> listEffective(@Param("start") long start, @Param("count") int count, @Param("cid") Long cid); List<BrandClassShop> listEffective(@Param("cid") Long cid); long countEffective(@Param("cid") Long cid); fanli/src/main/java/com/yeshi/fanli/dao/mybatis/taobao/TaoBaoShopMapper.java
@@ -1,8 +1,28 @@ package com.yeshi.fanli.dao.mybatis.taobao; import java.util.List; import org.apache.ibatis.annotations.Param; import com.yeshi.fanli.dao.BaseMapper; import com.yeshi.fanli.entity.taobao.TaoBaoShop; import com.yeshi.fanli.vo.brand.TaoBaoShopVO; public interface TaoBaoShopMapper extends BaseMapper<TaoBaoShop> { /** * 根据分类查询店铺信息、同时返回商品 * @param start * @param count * @param cid * @return */ List<TaoBaoShopVO> listBrandShopinfo(@Param("start") long start, @Param("count") int count, @Param("cid") Long cid); /** * 统计:分类统并商品数量大于3 * @param cid * @return */ long countBrandShopinfo(@Param("cid") Long cid); } fanli/src/main/java/com/yeshi/fanli/entity/brand/BrandClass.java
@@ -1,5 +1,6 @@ package com.yeshi.fanli.entity.brand; import java.io.Serializable; import java.util.Date; import org.yeshi.utils.mybatis.Column; @@ -15,7 +16,12 @@ * */ @Table("yeshi_ec_brand_class") public class BrandClass { public class BrandClass implements Serializable{ /** * */ private static final long serialVersionUID = 1L; @Expose @Column(name = "bc_id") private Long id; fanli/src/main/java/com/yeshi/fanli/entity/taobao/TaoBaoShop.java
@@ -1,5 +1,6 @@ package com.yeshi.fanli.entity.taobao; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; @@ -15,7 +16,12 @@ * */ @Table("yeshi_ec_taobao_shop_info") public class TaoBaoShop { public class TaoBaoShop implements Serializable { /** * */ private static final long serialVersionUID = 1L; @Expose @Column(name = "tsi_id") private Long id;// 卖家ID @@ -34,6 +40,10 @@ @Column(name = "tsi_seller_nick") private String sellerNick;// 卖家昵 @Expose @Column(name = "tsi_shop_name_custom") private String shopNameCustom;// 自定义店铺名称 @Expose @Column(name = "tsi_shop_icon") @@ -71,8 +81,9 @@ @Column(name = "tsi_update_time") private Date updateTime; // 店铺链接 private String shopLink; @Expose @Column(name = "tsi_shop_link") private String shopLink; // 店铺链接 public TaoBaoShop() {} @@ -211,4 +222,12 @@ this.shopLink = shopLink; } public String getShopNameCustom() { return shopNameCustom; } public void setShopNameCustom(String shopNameCustom) { this.shopNameCustom = shopNameCustom; } } fanli/src/main/java/com/yeshi/fanli/mapping/brand/BrandClassShopMapper.xml
@@ -95,7 +95,6 @@ AND b.`bcs_cid` = #{cid} </if> ORDER BY b.`bcs_top`,b.`bcs_create_time` DESC LIMIT ${start},${count} </select> <select id="countEffective" resultType="Long"> fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoShopMapper.xml
@@ -7,8 +7,9 @@ <result column="tsi_user_type" property="userType" jdbcType="INTEGER" /> <result column="tsi_shop_id" property="shopId" jdbcType="BIGINT" /> <result column="tsi_shop_name" property="shopName" jdbcType="VARCHAR" /> <result column="tsi_seller_nick" property="sellerNick" jdbcType="VARCHAR" /> <result column="tsi_shop_name_custom" property="shopNameCustom" jdbcType="VARCHAR" /> <result column="tsi_seller_nick" property="sellerNick" jdbcType="VARCHAR" /> <result column="tsi_shop_link" property="shopLink" jdbcType="VARCHAR" /> <result column="tsi_shop_icon" property="shopIcon" jdbcType="VARCHAR" /> <result column="tsi_shop_icon_custom" property="shopIconCustom" jdbcType="VARCHAR" /> @@ -29,7 +30,42 @@ <result column="tsi_good_rate_percentage" property="goodRatePercentage" jdbcType="DECIMAL" /> </resultMap> <sql id="Base_Column_List">tsi_id,tsi_user_type,tsi_shop_id,tsi_shop_name,tsi_seller_nick,tsi_shop_icon,tsi_shop_icon_custom,tsi_score_goods,tsi_score_seller,tsi_score_logistics,tsi_score_goods_d,tsi_score_seller_d,tsi_score_logistics_d,tsi_update_time,tsi_good_rate_percentage <resultMap id="BaseResultVOMap" type="com.yeshi.fanli.vo.brand.TaoBaoShopVO"> <id column="tsi_id" property="id" jdbcType="BIGINT" /> <result column="tsi_user_type" property="userType" jdbcType="INTEGER" /> <result column="tsi_shop_id" property="shopId" jdbcType="BIGINT" /> <result column="tsi_shop_name" property="shopName" jdbcType="VARCHAR" /> <result column="tsi_shop_name_custom" property="shopNameCustom" jdbcType="VARCHAR" /> <result column="tsi_seller_nick" property="sellerNick" jdbcType="VARCHAR" /> <result column="tsi_shop_link" property="shopLink" jdbcType="VARCHAR" /> <result column="tsi_shop_icon" property="shopIcon" jdbcType="VARCHAR" /> <result column="tsi_shop_icon_custom" property="shopIconCustom" jdbcType="VARCHAR" /> <result column="tsi_score_goods" property="scoreGoods" jdbcType="DECIMAL" /> <result column="tsi_score_seller" property="scoreSeller" jdbcType="DECIMAL" /> <result column="tsi_score_logistics" property="scoreLogistics" jdbcType="DECIMAL" /> <result column="tsi_score_goods_d" property="scoreGoodsD" jdbcType="DECIMAL" /> <result column="tsi_score_seller_d" property="scoreSellerD" jdbcType="DECIMAL" /> <result column="tsi_score_logistics_d" property="scoreLogisticsD" jdbcType="DECIMAL" /> <result column="tsi_update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="tsi_good_rate_percentage" property="goodRatePercentage" jdbcType="DECIMAL" /> <collection property="listGoodsBrief" column="id" resultMap="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper.BaseResultMap"/> </resultMap> <sql id="Base_Column_List">tsi_id,tsi_user_type,tsi_shop_id,tsi_shop_name,tsi_shop_name_custom,tsi_seller_nick,tsi_shop_link,tsi_shop_icon,tsi_shop_icon_custom,tsi_score_goods,tsi_score_seller,tsi_score_logistics,tsi_score_goods_d,tsi_score_seller_d,tsi_score_logistics_d,tsi_update_time,tsi_good_rate_percentage </sql> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long"> @@ -43,9 +79,9 @@ <insert id="insert" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoShop" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_taobao_shop_info (tsi_id,tsi_user_type,tsi_shop_id,tsi_shop_name,tsi_seller_nick,tsi_shop_icon,tsi_shop_icon_custom,tsi_score_goods,tsi_score_seller,tsi_score_logistics,tsi_score_goods_d,tsi_score_seller_d,tsi_score_logistics_d,tsi_update_time,tsi_good_rate_percentage) (tsi_id,tsi_user_type,tsi_shop_id,tsi_shop_name,tsi_shop_name_custom,tsi_seller_nick,tsi_shop_link,tsi_shop_icon,tsi_shop_icon_custom,tsi_score_goods,tsi_score_seller,tsi_score_logistics,tsi_score_goods_d,tsi_score_seller_d,tsi_score_logistics_d,tsi_update_time,tsi_good_rate_percentage) values (#{id,jdbcType=BIGINT},#{userType,jdbcType=INTEGER},#{shopId,jdbcType=BIGINT},#{shopName,jdbcType=VARCHAR},#{sellerNick,jdbcType=VARCHAR},#{shopIcon,jdbcType=VARCHAR},#{shopIconCustom,jdbcType=VARCHAR},#{scoreGoods,jdbcType=DECIMAL},#{scoreSeller,jdbcType=DECIMAL},#{scoreLogistics,jdbcType=DECIMAL},#{scoreGoodsD,jdbcType=DECIMAL},#{scoreSellerD,jdbcType=DECIMAL},#{scoreLogisticsD,jdbcType=DECIMAL},#{updateTime,jdbcType=TIMESTAMP},#{goodRatePercentage,jdbcType=DECIMAL}) (#{id,jdbcType=BIGINT},#{userType,jdbcType=INTEGER},#{shopId,jdbcType=BIGINT},#{shopName,jdbcType=VARCHAR},#{shopNameCustom,jdbcType=VARCHAR},#{sellerNick,jdbcType=VARCHAR},#{shopLink,jdbcType=VARCHAR},#{shopIcon,jdbcType=VARCHAR},#{shopIconCustom,jdbcType=VARCHAR},#{scoreGoods,jdbcType=DECIMAL},#{scoreSeller,jdbcType=DECIMAL},#{scoreLogistics,jdbcType=DECIMAL},#{scoreGoodsD,jdbcType=DECIMAL},#{scoreSellerD,jdbcType=DECIMAL},#{scoreLogisticsD,jdbcType=DECIMAL},#{updateTime,jdbcType=TIMESTAMP},#{goodRatePercentage,jdbcType=DECIMAL}) </insert> <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoShop" useGeneratedKeys="true" keyProperty="id"> @@ -55,7 +91,9 @@ <if test="userType != null">tsi_user_type,</if> <if test="shopId != null">tsi_shop_id,</if> <if test="shopName != null">tsi_shop_name,</if> <if test="shopNameCustom != null">tsi_shop_name_custom,</if> <if test="sellerNick != null">tsi_seller_nick,</if> <if test="shopLink != null">tsi_shop_link,</if> <if test="shopIcon != null">tsi_shop_icon,</if> <if test="shopIconCustom != null">tsi_shop_icon_custom,</if> <if test="scoreGoods != null">tsi_score_goods,</if> @@ -73,7 +111,9 @@ <if test="userType != null">#{userType,jdbcType=INTEGER},</if> <if test="shopId != null">#{shopId,jdbcType=BIGINT},</if> <if test="shopName != null">#{shopName,jdbcType=VARCHAR},</if> <if test="shopNameCustom != null">#{shopNameCustom,jdbcType=VARCHAR},</if> <if test="sellerNick != null">#{sellerNick,jdbcType=VARCHAR},</if> <if test="shopLink != null">#{shopLink,jdbcType=VARCHAR},</if> <if test="shopIcon != null">#{shopIcon,jdbcType=VARCHAR},</if> <if test="shopIconCustom != null">#{shopIconCustom,jdbcType=VARCHAR},</if> <if test="scoreGoods != null">#{scoreGoods,jdbcType=DECIMAL},</if> @@ -87,45 +127,69 @@ </trim> </insert> <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoShop">update yeshi_ec_taobao_shop_info set tsi_user_type = #{userType,jdbcType=INTEGER},tsi_shop_id = #{shopId,jdbcType=BIGINT},tsi_shop_name = #{shopName,jdbcType=VARCHAR},tsi_seller_nick = #{sellerNick,jdbcType=VARCHAR},tsi_shop_icon = #{shopIcon,jdbcType=VARCHAR},tsi_shop_icon_custom = #{shopIconCustom,jdbcType=VARCHAR},tsi_score_goods = #{scoreGoods,jdbcType=DECIMAL},tsi_score_seller = #{scoreSeller,jdbcType=DECIMAL},tsi_score_logistics = #{scoreLogistics,jdbcType=DECIMAL},tsi_score_goods_d = #{scoreGoodsD,jdbcType=DECIMAL},tsi_score_seller_d = #{scoreSellerD,jdbcType=DECIMAL},tsi_score_logistics_d = #{scoreLogisticsD,jdbcType=DECIMAL},tsi_update_time = #{updateTime,jdbcType=TIMESTAMP} ,tsi_good_rate_percentage =#{goodRatePercentage,jdbcType=DECIMAL} where tsi_id = #{id,jdbcType=BIGINT}</update> yeshi_ec_taobao_shop_info set tsi_user_type = #{userType,jdbcType=INTEGER}, tsi_shop_id = #{shopId,jdbcType=BIGINT}, tsi_shop_name = #{shopName,jdbcType=VARCHAR}, tsi_shop_name_custom = #{shopNameCustom,jdbcType=VARCHAR}, tsi_seller_nick = #{sellerNick,jdbcType=VARCHAR}, tsi_shop_link = #{shopLink,jdbcType=VARCHAR}, tsi_shop_icon = #{shopIcon,jdbcType=VARCHAR}, tsi_shop_icon_custom = #{shopIconCustom,jdbcType=VARCHAR}, tsi_score_goods = #{scoreGoods,jdbcType=DECIMAL}, tsi_score_seller = #{scoreSeller,jdbcType=DECIMAL}, tsi_score_logistics = #{scoreLogistics,jdbcType=DECIMAL}, tsi_score_goods_d = #{scoreGoodsD,jdbcType=DECIMAL}, tsi_score_seller_d = #{scoreSellerD,jdbcType=DECIMAL}, tsi_score_logistics_d = #{scoreLogisticsD,jdbcType=DECIMAL}, tsi_update_time = #{updateTime,jdbcType=TIMESTAMP} , tsi_good_rate_percentage = #{goodRatePercentage,jdbcType=DECIMAL} where tsi_id = #{id,jdbcType=BIGINT} </update> <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoShop"> update yeshi_ec_taobao_shop_info <set> <if test="userType != null">tsi_user_type=#{userType,jdbcType=INTEGER},</if> <if test="shopId != null">tsi_shop_id=#{shopId,jdbcType=BIGINT},</if> <if test="shopName != null">tsi_shop_name=#{shopName,jdbcType=VARCHAR},</if> <if test="shopNameCustom != null">tsi_shop_name_custom=#{shopNameCustom,jdbcType=VARCHAR},</if> <if test="sellerNick != null">tsi_seller_nick=#{sellerNick,jdbcType=VARCHAR},</if> <if test="shopLink != null">tsi_shop_link=#{shopLink,jdbcType=VARCHAR},</if> <if test="shopIcon != null">tsi_shop_icon=#{shopIcon,jdbcType=VARCHAR},</if> <if test="shopIconCustom != null">tsi_shop_icon_custom=#{shopIconCustom,jdbcType=VARCHAR}, </if> <if test="shopIconCustom != null">tsi_shop_icon_custom=#{shopIconCustom,jdbcType=VARCHAR},</if> <if test="scoreGoods != null">tsi_score_goods=#{scoreGoods,jdbcType=DECIMAL},</if> <if test="scoreSeller != null">tsi_score_seller=#{scoreSeller,jdbcType=DECIMAL},</if> <if test="scoreLogistics != null">tsi_score_logistics=#{scoreLogistics,jdbcType=DECIMAL}, </if> <if test="scoreLogistics != null">tsi_score_logistics=#{scoreLogistics,jdbcType=DECIMAL},</if> <if test="scoreGoodsD != null">tsi_score_goods_d=#{scoreGoodsD,jdbcType=DECIMAL},</if> <if test="scoreSellerD != null">tsi_score_seller_d=#{scoreSellerD,jdbcType=DECIMAL},</if> <if test="scoreLogisticsD != null">tsi_score_logistics_d=#{scoreLogisticsD,jdbcType=DECIMAL}, </if> <if test="scoreLogisticsD != null">tsi_score_logistics_d=#{scoreLogisticsD,jdbcType=DECIMAL},</if> <if test="updateTime != null">tsi_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> <if test="id !=null">tsi_id =#{id,jdbcType=BIGINT},</if> <if test="goodRatePercentage !=null">tsi_good_rate_percentage =#{goodRatePercentage,jdbcType=DECIMAL},</if> <if test="goodRatePercentage !=null">tsi_good_rate_percentage=#{goodRatePercentage,jdbcType=DECIMAL},</if> </set> where tsi_id = #{id,jdbcType=BIGINT} </update> <select id="listBrandShopinfo" resultMap="BaseResultVOMap" > SELECT tt.*,tg.* FROM (SELECT COUNT(t.`id`) AS totalGoods,t.`sellerId` FROM `yeshi_ec_taobao_goods` t LEFT JOIN `yeshi_ec_brand_class_shop` p ON t.`sellerId` = p.bcs_shop_id WHERE p.`bcs_id` IS NOT NULL AND p.`bcs_state` = 1 <if test="cid != null">AND p.`bcs_cid` =#{cid}</if> GROUP BY t.`sellerId` HAVING totalGoods<![CDATA[>]]> 2 ORDER BY p.`bcs_top`,p.`bcs_create_time` DESC LIMIT ${start},${count} )a LEFT JOIN `yeshi_ec_brand_class_shop` pp ON a.sellerId = pp.bcs_shop_id LEFT JOIN `yeshi_ec_taobao_shop_info` tt ON tt.`tsi_id` = pp.bcs_shop_id LEFT JOIN `yeshi_ec_taobao_goods` tg ON tg.`sellerId` = a.sellerId WHERE (SELECT COUNT(DISTINCT(e1.id)) FROM yeshi_ec_taobao_goods AS e1 WHERE e1.sellerId = tg.sellerId AND e1.biz30day <![CDATA[ >]]> tg.biz30day)<![CDATA[ <]]> 3 ORDER BY pp.`bcs_top`,pp.`bcs_create_time` DESC,tg.`biz30day` DESC </select> <select id="countBrandShopinfo" resultType="Long"> SELECT IFNULL(COUNT(*),0) FROM (SELECT COUNT(t.`id`) AS totalGoods FROM `yeshi_ec_taobao_goods` t LEFT JOIN `yeshi_ec_brand_class_shop` p ON t.`sellerId` = p.bcs_shop_id WHERE p.`bcs_id` IS NOT NULL AND p.`bcs_state` = 1 <if test="cid != null">AND p.`bcs_cid` =#{cid}</if> GROUP BY t.`sellerId` HAVING totalGoods<![CDATA[>]]> 2)a </select> </mapper> fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassShopServiceImpl.java
@@ -7,7 +7,6 @@ import javax.annotation.Resource; import org.apache.commons.beanutils.PropertyUtils; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -61,16 +60,6 @@ private TaoBaoGoodsBriefService taoBaoGoodsBriefService; @Override public List<BrandClassShop> listEffective(long start, int count, Long cid) { return brandClassShopMapper.listEffective(start, count, cid); } @Override public long countEffective(Long cid) { return brandClassShopMapper.countEffective(cid); } @Override public List<BrandClassShop> getExistByShopIds(List<Long> list){ @@ -183,7 +172,15 @@ long couponNum = commonGoodsService.countBySellerIdAndHasCoupon(shop.getId()); brandClassShop.setCouponNum(couponNum); String shopLink = shop.getShopLink(); if (StringUtil.isNullOrEmpty(shopLink)) { shop.setShopLink(TaoBaoUtil.getShopLink(shop.getId())); } String shopNameCustom = shop.getShopNameCustom(); if (!StringUtil.isNullOrEmpty(shopNameCustom)) { shop.setShopName(shopNameCustom); } String shopIconCustom = shop.getShopIconCustom(); if (!StringUtil.isNullOrEmpty(shopIconCustom)) { @@ -259,108 +256,86 @@ @Override @Cacheable(value = "brandCache", key = "'listEffectiveCache-'+#page+'-'+#cid") public JSONObject listEffectiveCache(int page, Long cid) { long count = 0; int pageSize = Constant.PAGE_SIZE; List<BrandClassShop> list = brandClassShopMapper.listEffective((page - 1) * pageSize, pageSize, cid); long countShop = 0; List<TaoBaoShop> listShop = new ArrayList<TaoBaoShop>(); // 第一页 查询全部分类下店铺 if (page == 1 && cid != null && cid > 0 ) { List<BrandClassShop> list = brandClassShopMapper.listEffective(cid); if (list == null) { list = new ArrayList<BrandClassShop>(); } else if (list.size() > 0) { count = brandClassShopMapper.countEffective(cid); countShop = brandClassShopMapper.countEffective(cid); } for (BrandClassShop brandClassShop : list) { TaoBaoShop shop = brandClassShop.getShop(); if (shop != null) { String shopLink = shop.getShopLink(); if (StringUtil.isNullOrEmpty(shopLink)) { shop.setShopLink(TaoBaoUtil.getShopLink(shop.getId())); } String shopNameCustom = shop.getShopNameCustom(); if (!StringUtil.isNullOrEmpty(shopNameCustom)) { shop.setShopName(shopNameCustom); } String shopIconCustom = shop.getShopIconCustom(); if (!StringUtil.isNullOrEmpty(shopIconCustom)) { shop.setShopIcon(shopIconCustom); } listShop.add(shop); } } } JSONObject data = new JSONObject(); if (page == 1 && cid != null && cid > 0 && count > pageSize) { List<TaoBaoShop> listShop = new ArrayList<TaoBaoShop>(); List<BrandClassShop> listBrand = brandClassShopMapper.listEffective(0, Integer.MAX_VALUE, cid); for (BrandClassShop brandClassShop : listBrand) { TaoBaoShop shop = brandClassShop.getShop(); if (shop != null) { String shopIconCustom = shop.getShopIconCustom(); if (!StringUtil.isNullOrEmpty(shopIconCustom)) { shop.setShopIcon(shopIconCustom); } listShop.add(shop); } } data.put("countShop", countShop); data.put("listShop", JsonUtil.getApiCommonGson().toJson(listShop)); } else if (page == 1 && cid != null && cid > 0) { List<TaoBaoShop> listShop = new ArrayList<TaoBaoShop>(); for (BrandClassShop brandClassShop : list) { TaoBaoShop shop = brandClassShop.getShop(); if (shop != null) { String shopIconCustom = shop.getShopIconCustom(); if (!StringUtil.isNullOrEmpty(shopIconCustom)) { shop.setShopIcon(shopIconCustom); } listShop.add(shop); } } data.put("listShop", JsonUtil.getApiCommonGson().toJson(listShop)); } List<TaoBaoShopVO> listVO = new ArrayList<TaoBaoShopVO>(); for (BrandClassShop brandClassShop : list) { TaoBaoShop shop = brandClassShop.getShop(); if (shop == null) { continue; long count = 0; List<TaoBaoShopVO> listInfo = taoBaoShopService.listBrandShopinfo((page-1)*Constant.PAGE_SIZE, Constant.PAGE_SIZE, cid); if (listInfo == null) { listInfo = new ArrayList<TaoBaoShopVO>(); } else if (listInfo.size() > 0) { count = taoBaoShopService.countBrandShopinfo(cid); } String shopIconCustom = shop.getShopIconCustom(); if (!StringUtil.isNullOrEmpty(shopIconCustom)) { shop.setShopIcon(shopIconCustom); } List<Long> listgid = new ArrayList<Long>(); listgid.add(543572782962L); listgid.add(578504974101L); listgid.add(530275132249L); BigDecimal proportion = manageService.getFanLiRate(); for (TaoBaoShopVO taoBaoShopVO : listInfo) { String shopLink = taoBaoShopVO.getShopLink(); if (StringUtil.isNullOrEmpty(shopLink)) { taoBaoShopVO.setShopLink(TaoBaoUtil.getShopLink(taoBaoShopVO.getId())); } String shopNameCustom = taoBaoShopVO.getShopNameCustom(); if (!StringUtil.isNullOrEmpty(shopNameCustom)) { taoBaoShopVO.setShopName(shopNameCustom); } String shopIconCustom = taoBaoShopVO.getShopIconCustom(); if (!StringUtil.isNullOrEmpty(shopIconCustom)) { taoBaoShopVO.setShopIcon(shopIconCustom); } List<TaoBaoGoodsBriefExtra> listGoods = new ArrayList<TaoBaoGoodsBriefExtra>(); List<TaoBaoGoodsBrief> listgd = taoBaoGoodsBriefService.listQueryByAuctionId(listgid); for (TaoBaoGoodsBrief taoBaoGoodsBrief : listgd) { List<TaoBaoGoodsBrief> listGoodsBrief = taoBaoShopVO.getListGoodsBrief(); for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoodsBrief) { listGoods.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)); } // List<QualityFactory> listFactory = qualityGoodsService.listByShopId(0, 3, shop.getId()); // if (listFactory == null || listFactory.size() < 3) { // count --; // continue; // } // // List<TaoBaoGoodsBriefExtra> listGoods = new ArrayList<TaoBaoGoodsBriefExtra>(); // BigDecimal proportion = manageService.getFanLiRate(); // for (QualityFactory selectionGoods : listFactory) { // TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief(); // if (taoBaoGoodsBrief == null) { // break; // } // listGoods.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)); // } // // if (listGoods == null || listGoods.size() < 3) { // count --; // continue; // } // TaoBaoShopVO vo = new TaoBaoShopVO(); try { PropertyUtils.copyProperties(vo, shop); } catch (Exception e) { e.printStackTrace(); } vo.setListGoods(listGoods); listVO.add(vo); taoBaoShopVO.setListGoods(listGoods); } data.put("count", count); data.put("list", JsonUtil.getApiCommonGson().toJson(listVO)); data.put("list", JsonUtil.getApiCommonGson().toJson(listInfo)); return data; } @Override public void addClick(Long shopId) { BrandClassShop brandClassShop = brandClassShopMapper.getByShopId(shopId); fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoShopServiceImpl.java
@@ -1,6 +1,7 @@ package com.yeshi.fanli.service.impl.taobao; import java.io.InputStream; import java.util.List; import java.util.UUID; import javax.annotation.Resource; @@ -18,6 +19,7 @@ import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.db.MongoDBManager; import com.yeshi.fanli.util.taobao.TaoBaoShopUtil; import com.yeshi.fanli.vo.brand.TaoBaoShopVO; @Service public class TaoBaoShopServiceImpl implements TaoBaoShopService { @@ -99,8 +101,13 @@ } } if (StringUtil.isNullOrEmpty(shopName) || "null".equalsIgnoreCase(shopName)) { shopName = null; } updateShop.setId(id); updateShop.setShopName(shopName); updateShop.setShopNameCustom(shopName); taoBaoShopMapper.updateByPrimaryKeySelective(updateShop); } @@ -126,5 +133,17 @@ } @Override public List<TaoBaoShopVO> listBrandShopinfo(long start, int count, Long cid) { return taoBaoShopMapper.listBrandShopinfo(start, count, cid); } @Override public long countBrandShopinfo(Long cid) { return taoBaoShopMapper.countBrandShopinfo(cid); } } fanli/src/main/java/com/yeshi/fanli/service/inter/brand/BrandClassShopService.java
@@ -17,14 +17,6 @@ */ public interface BrandClassShopService { /** * 查询有效分类 * * @return */ public List<BrandClassShop> listEffective(long start, int count, Long cid); public long countEffective(Long cid); /** * 是否存在 fanli/src/main/java/com/yeshi/fanli/service/inter/taobao/TaoBaoShopService.java
@@ -1,10 +1,13 @@ package com.yeshi.fanli.service.inter.taobao; import java.util.List; import org.springframework.web.multipart.MultipartFile; import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; import com.yeshi.fanli.entity.taobao.TaoBaoShop; import com.yeshi.fanli.entity.taobao.TaoBaoShopInfo; import com.yeshi.fanli.vo.brand.TaoBaoShopVO; public interface TaoBaoShopService { @@ -37,4 +40,16 @@ */ public void changeInfo(MultipartFile file, Long id, String shopName); /** * 查询店铺信息、并返回钱3个商品数量 * @param start * @param count * @param cid * @return */ public List<TaoBaoShopVO> listBrandShopinfo(long start, int count, Long cid); long countBrandShopinfo(Long cid); } fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoBaoUtil.java
@@ -1786,6 +1786,8 @@ else shop.setUserType(0); shop.setShopLink(TaoBaoUtil.getShopLink(shop.getId())); return shop; } fanli/src/main/java/com/yeshi/fanli/vo/brand/TaoBaoShopVO.java
@@ -1,28 +1,35 @@ package com.yeshi.fanli.vo.brand; import java.io.Serializable; import java.util.List; import com.google.gson.annotations.Expose; import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra; import com.yeshi.fanli.entity.taobao.TaoBaoShop; public class TaoBaoShopVO extends TaoBaoShop{ public class TaoBaoShopVO extends TaoBaoShop implements Serializable{ /** * */ private static final long serialVersionUID = 1L; @Expose private String shopLink; private List<TaoBaoGoodsBrief> listGoodsBrief; @Expose private List<TaoBaoGoodsBriefExtra> listGoods; public String getShopLink() { return shopLink; } public void setShopLink(String shopLink) { this.shopLink = shopLink; } public List<TaoBaoGoodsBriefExtra> getListGoods() { return listGoods; } public void setListGoods(List<TaoBaoGoodsBriefExtra> listGoods) { this.listGoods = listGoods; } public List<TaoBaoGoodsBrief> getListGoodsBrief() { return listGoodsBrief; } public void setListGoodsBrief(List<TaoBaoGoodsBrief> listGoodsBrief) { this.listGoodsBrief = listGoodsBrief; } }