admin
2019-01-22 0e552c5dba18d27622116a7d7a6e04fc99f8e8a7
Merge branch 'dev-msg'
23个文件已修改
1个文件已添加
3120 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/UserMsgController.java 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/goods/RecommendUserGoodsMapMapper.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/goods/RecommendUserGoodsMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/lable/QualityFactoryMapper.java 256 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/accept/AcceptData.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/ExtractMapper.xml 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/goods/RecommendUserGoodsMapMapper.xml 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/goods/RecommendUserGoodsMapper.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/lable/QualityFactoryMapper.xml 2141 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/RecommendUserGoodsServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/lable/QualityFactoryServiceImpl.java 178 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgAccountDetailServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgInviteDetailServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgMoneyDetailServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOrderDetailServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserInviteMsgNotificationServiceImpl.java 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserSystemMsgServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/ExtractServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/goods/RecommendUserGoodsService.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/lable/QualityFactoryService.java 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgOrderDetailFactory.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/msg/UserMsgUnReadNumVO.java 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/UserMsgController.java
@@ -6,7 +6,9 @@
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.annotation.Resource;
@@ -24,6 +26,7 @@
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.lable.QualityFactory;
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail;
import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail;
@@ -33,8 +36,13 @@
import com.yeshi.fanli.entity.goods.CommonGoods;
import com.yeshi.fanli.entity.goods.RecommendUserGoods;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
import com.yeshi.fanli.exception.goods.CommonGoodsException;
import com.yeshi.fanli.exception.goods.RecommendUserGoodsException;
import com.yeshi.fanli.exception.msg.UserSystemMsgException;
import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
import com.yeshi.fanli.service.inter.goods.RecommendUserGoodsService;
import com.yeshi.fanli.service.inter.lable.QualityFactoryService;
import com.yeshi.fanli.service.inter.msg.MsgAccountDetailService;
import com.yeshi.fanli.service.inter.msg.MsgInviteDetailService;
import com.yeshi.fanli.service.inter.msg.MsgMoneyDetailService;
@@ -45,7 +53,9 @@
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.factory.CommonGoodsFactory;
import com.yeshi.fanli.util.factory.msg.UserMsgVOFactory;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
import com.yeshi.fanli.vo.msg.UserHomeMsgVO;
import com.yeshi.fanli.vo.msg.UserMsgVO;
import com.yeshi.fanli.vo.msg.UserSystemMsgVO;
@@ -79,6 +89,12 @@
    @Resource
    private UserSystemMsgService userSystemMsgService;
    @Resource
    private CommonGoodsService commonGoodsService;
    @Resource
    private QualityFactoryService qualityFactoryService;
    // 消息的类型
    final static String MSG_TYPE_ORDER = "order";
@@ -212,6 +228,84 @@
        return builder;
    }
    private void addRecommendGoods(Long uid, String imei, String idfa) {
        TaoBaoSearchResult result = TaoKeApiUtil.guessDeviceLike(1, 50, imei, idfa);
        if (result != null && result.getTaoBaoGoodsBriefs() != null) {
            for (int i = 0; i < result.getTaoBaoGoodsBriefs().size(); i++) {
                if (result.getTaoBaoGoodsBriefs().get(i).getCouponAmount() == null
                        || result.getTaoBaoGoodsBriefs().get(i).getCouponAmount().compareTo(new BigDecimal(0)) <= 0) {
                    result.getTaoBaoGoodsBriefs().remove(i);
                    i--;
                }
            }
            // 随机几个
            int count = (int) (Math.random() * 3) + 1;
            Set<Integer> positionList = new HashSet<>();
            for (int i = 0; i < count; i++)
                if (result.getTaoBaoGoodsBriefs().size() > 0) {
                    positionList.add((int) (result.getTaoBaoGoodsBriefs().size() * Math.random()));
                }
            if (positionList != null && positionList.size() > 0) {
                List<CommonGoods> goodsList = new ArrayList<>();
                for (Integer p : positionList) {
                    TaoBaoGoodsBrief goodsB = result.getTaoBaoGoodsBriefs().get(p);
                    try {
                        CommonGoods cgoods = commonGoodsService
                                .addOrUpdateCommonGoods(CommonGoodsFactory.create(goodsB));
                        goodsList.add(cgoods);
                    } catch (CommonGoodsException e) {
                        e.printStackTrace();
                    }
                }
                try {
                    recommendUserGoodsService.addRecommend(uid, "", goodsList);
                } catch (RecommendUserGoodsException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    private void addRecommendGoods(Long uid) {
        List<QualityFactory> qfList = qualityFactoryService.listByMinSalesCountOrderByCreateTimeDesc(10000, 1, 20);
        if (qfList != null && qfList != null) {
            for (int i = 0; i < qfList.size(); i++) {
                if (qfList.get(i).getTaoBaoGoodsBrief().getCouponAmount() == null
                        || qfList.get(i).getTaoBaoGoodsBrief().getCouponAmount().compareTo(new BigDecimal(0)) <= 0) {
                    qfList.remove(i);
                    i--;
                }
            }
            // 随机几个
            int count = (int) (Math.random() * 3) + 1;
            Set<Integer> positionList = new HashSet<>();
            for (int i = 0; i < count; i++)
                if (qfList.size() > 0) {
                    positionList.add((int) (qfList.size() * Math.random()));
                }
            if (positionList != null && positionList.size() > 0) {
                List<CommonGoods> goodsList = new ArrayList<>();
                for (Integer p : positionList) {
                    TaoBaoGoodsBrief goodsB = qfList.get(p).getTaoBaoGoodsBrief();
                    try {
                        CommonGoods cgoods = commonGoodsService
                                .addOrUpdateCommonGoods(CommonGoodsFactory.create(goodsB));
                        goodsList.add(cgoods);
                    } catch (CommonGoodsException e) {
                        e.printStackTrace();
                    }
                }
                try {
                    recommendUserGoodsService.addRecommend(uid, "", goodsList);
                } catch (RecommendUserGoodsException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    /**
     * 获取首页消息
     * 
@@ -225,6 +319,27 @@
        if (uid == null) {
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        if (page == 1) {
            boolean canAdd = false;
            int hour = Calendar.getInstance().get(Calendar.HOUR);
            RecommendUserGoods goods = recommendUserGoodsService.getLatestRecommendUserGoods(uid);
            if (goods == null) {
                canAdd = true;
            } else {
                // 是否和上次间隔时间足够
                if (System.currentTimeMillis() - goods.getCreateTime().getTime() >= 1000 * 60 * 60 * 8L) {
                    canAdd = true;
                }
            }
            if (canAdd) {
                if (hour < 12)
                    addRecommendGoods(uid);
                else
                    addRecommendGoods(uid, acceptData.getImei(), acceptData.getIdfa());
            }
        }
        List<UserHomeMsgVO> volist = new ArrayList<>();
@@ -286,8 +401,8 @@
                        new UserSystemMsgVO(usm.getId(), usm.getType().name(), usm.getSolved(), usm.getTitle(),
                                usm.getContent(),
                                usm.getTimeTag() == 1 ? "http://img.flqapp.com/resource/msg/icon_emergent.png" : "",
                                Constant.systemCommonConfig.getDefaultPortrait(), getTimeDesc(now, usm.getCreateTime()),
                                num.getTypeSystem()));
                                "http://img.flqapp.com/resource/msg/icon_msg_system.png",
                                getTimeDesc(now, usm.getCreateTime()), num.getTypeSystem()));
        }
        root.put("count", count);
        out.print(JsonUtil.loadTrueResult(root));
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/goods/RecommendUserGoodsMapMapper.java
@@ -1,9 +1,16 @@
package com.yeshi.fanli.dao.mybatis.goods;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.goods.RecommendUserGoodsMap;
public interface RecommendUserGoodsMapMapper extends BaseMapper<RecommendUserGoodsMap>{
public interface RecommendUserGoodsMapMapper extends BaseMapper<RecommendUserGoodsMap> {
    List<RecommendUserGoodsMap> listByUidAndCommonGoodsId(@Param("uid") Long uid,
            @Param("commonGoodsId") Long commonGoodsId);
    Long countByUidAndCommonGoodsId(@Param("uid") Long uid, @Param("commonGoodsId") Long commonGoodsId);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/goods/RecommendUserGoodsMapper.java
@@ -27,4 +27,12 @@
     * @return
     */
    Long countRecommendGoods(@Param("uid") Long uid);
    /**
     * 获取最近的推荐
     *
     * @param uid
     * @return
     */
    RecommendUserGoods getLatestRecommendUserGoods(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/lable/QualityFactoryMapper.java
@@ -20,132 +20,128 @@
    int updateByPrimaryKeySelective(QualityFactory record);
    int updateByPrimaryKey(QualityFactory record);
    /**
     * 批量插入
     *
     * @param list
     * @return
     */
    int insertBatch(List<QualityFactory> list);
    /**
     * 批量选择更新
     *
     * @param list
     * @return
     */
    int updateBatchSelective(List<QualityFactory> list);
    /**
     * 批量删除
     *
     * @param list
     * @return
     */
    int deleteBatchByPrimaryKey(List<Long> list);
    /**
     * 统计总行数
     *
     * @return
     */
    Long countTotalRows(@Param("days") Integer days);
    List<QualityFactory> queryByGoodsId(@Param("goodsId") Long goodsId);
    /**
     * 根据多个商品id 查询对应的商品信息
     *
     * @param list
     * @return
     */
    List<QualityFactory> listQueryGoodsByGoodsId(List<Long> list);
    Long queryCountByGoodsId(@Param("goodsId") Long goodsId);
    List<QualityFactory> listQueryByAuctionId(List<Long> list);
    // 精选库查询 -- 查询所有
    List<QualityFactory> queryAll(@Param("start") long start, @Param("count") int count,@Param("days") Integer days);
    List<QualityFactory> queryAll(@Param("start") long start, @Param("count") int count, @Param("days") Integer days);
    // 待更新精选商品id
    List<Long> queryNeedUpdate(@Param("start") long start, @Param("count") int count, @Param("hour") int hour);
    // 统计需更新商品数量
    long countQueryNeedUpdate();
    // 精选库查询
    List<QualityFactory> query(@Param("start") long start, @Param("count") int count, @Param("key") String key,
            // 排序字段 :销量、价格、佣金
            @Param("totalSales") Integer totalSales, @Param("price") Integer price, @Param("tkRate") Integer tkRate,
            // 商品来源、入库时间
            @Param("propor")Integer propor,@Param("goodsSource") Integer goodsSource, @Param("days") Integer days,
            @Param("propor") Integer propor, @Param("goodsSource") Integer goodsSource, @Param("days") Integer days,
            // 在售价范围
            @Param("startZkPrice") Integer startZkPrice, @Param("endZkPrice") Integer endZkPrice,
            // 月销量范围
            @Param("startBiz30day") Integer startBiz30day, @Param("endBiz30day") Integer endBiz30day,
            @Param("startZkPrice") Integer startZkPrice, @Param("endZkPrice") Integer endZkPrice,
            // 月销量范围
            @Param("startBiz30day") Integer startBiz30day, @Param("endBiz30day") Integer endBiz30day,
            // 权重范围
            @Param("startWeight") Integer startWeight, @Param("endWeight") Integer endWeight,
            @Param("startWeight") Integer startWeight, @Param("endWeight") Integer endWeight,
            // 佣金比例范围
            @Param("startTkRate") Integer startTkRate, @Param("endTkRate") Integer endTkRate,
            @Param("startTkRate") Integer startTkRate, @Param("endTkRate") Integer endTkRate,
            // 券面额:减多少
            @Param("startAmount") Integer startAmount, @Param("endAmount") Integer endAmount,
            @Param("startAmount") Integer startAmount, @Param("endAmount") Integer endAmount,
            // 是否: 优惠券 、包邮
            @Param("hasCoupon") Integer hasCoupon, @Param("freeShipment") Integer freeShipment,
            // 是否:消费者保障 、成交转化
            @Param("isPrepay") Integer isPrepay,@Param("payRate30") Integer payRate30,
            @Param("isPrepay") Integer isPrepay, @Param("payRate30") Integer payRate30,
            // 是否:好评率、 退款率
            @Param("goodRate") Integer goodRate,@Param("rfdRate") Integer rfdRate,
            @Param("goodRate") Integer goodRate, @Param("rfdRate") Integer rfdRate,
            // 券比例: 券面值/在售价
            @Param("startPropor") Integer startPropor, @Param("endPropor") Integer endPropor,
            // 类目id 搜索此类型
            @Param("gcid") Long gcid, @Param("keyType") Integer keyType);
    long queryCount( @Param("key") String key, @Param("goodsSource") Integer goodsSource, @Param("days") Integer days,
    long queryCount(@Param("key") String key, @Param("goodsSource") Integer goodsSource, @Param("days") Integer days,
            // 在售价范围
            @Param("startZkPrice") Integer startZkPrice, @Param("endZkPrice") Integer endZkPrice,
            // 月销量范围
            @Param("startBiz30day") Integer startBiz30day, @Param("endBiz30day") Integer endBiz30day,
            @Param("startZkPrice") Integer startZkPrice, @Param("endZkPrice") Integer endZkPrice,
            // 月销量范围
            @Param("startBiz30day") Integer startBiz30day, @Param("endBiz30day") Integer endBiz30day,
            // 权重范围
            @Param("startWeight") Integer startWeight, @Param("endWeight") Integer endWeight,
            @Param("startWeight") Integer startWeight, @Param("endWeight") Integer endWeight,
            // 佣金比例范围
            @Param("startTkRate") Integer startTkRate, @Param("endTkRate") Integer endTkRate,
            @Param("startTkRate") Integer startTkRate, @Param("endTkRate") Integer endTkRate,
            // 券面额:减多少
            @Param("startAmount") Integer startAmount, @Param("endAmount") Integer endAmount,
            @Param("startAmount") Integer startAmount, @Param("endAmount") Integer endAmount,
            // 是否: 优惠券 、包邮
            @Param("hasCoupon") Integer hasCoupon, @Param("freeShipment") Integer freeShipment,
            // 是否:消费者保障 、成交转化
            @Param("isPrepay") Integer isPrepay,@Param("payRate30") Integer payRate30,
            @Param("isPrepay") Integer isPrepay, @Param("payRate30") Integer payRate30,
            // 是否:好评率、 退款率
            @Param("goodRate") Integer goodRate,@Param("rfdRate") Integer rfdRate,
            @Param("goodRate") Integer goodRate, @Param("rfdRate") Integer rfdRate,
            // 券比例: 券面值/在售价
            @Param("startPropor") Integer startPropor, @Param("endPropor") Integer endPropor,
            // 类目id
            @Param("gcid") Long gcid, @Param("keyType") Integer keyType);
    /**
     * 统计商品数量
     *
     * @return
     */
    Map<String, Object> getCountAll();
    /**
     * 根据商品id移除精选库
     *
     * @param goodsId
     * @return
     */
    int deleteByGoodsId(Long goodsId);
    /**
     * 查询精选商品数据应用前端
     *
     * @param start
     * @param count
     * @param key
@@ -154,18 +150,18 @@
     * @return
     */
    List<QualityFactory> listQuery(@Param("start") long start, @Param("count") int count, @Param("key") String key,
            @Param("systemCid") Long systemCid, @Param("labId") Long labId, @Param("cids") String cids, @Param("hasQuan") Integer hasQuan);// 分类id、标签id
            @Param("systemCid") Long systemCid, @Param("labId") Long labId, @Param("cids") String cids,
            @Param("hasQuan") Integer hasQuan);// 分类id、标签id
    /**
     * 对应查询精选商品数据应用前端统计
     */
    long countQuery( @Param("key") String key, @Param("systemCid") Long systemCid,
            @Param("labId") Long labId, @Param("cids") String cids, @Param("hasQuan") Integer hasQuan);
     */
    long countQuery(@Param("key") String key, @Param("systemCid") Long systemCid, @Param("labId") Long labId,
            @Param("cids") String cids, @Param("hasQuan") Integer hasQuan);
    /**
     * 根据关键词 搜索商品标题和标签
     *
     * @param start
     * @param count
     * @param systemCid
@@ -175,30 +171,29 @@
     * @return
     */
    List<QualityFactory> listQueryByKeyAndlabIDs(@Param("start") long start, @Param("count") int count,
             @Param("key") String key, @Param("list") List<Long> list,
            @Param("sort") Integer sort,@Param("systemCid") Long systemCid,
            @Param("hasQuan") Integer hasQuan,  @Param("userType") Integer userType, @Param("biz30day") Integer biz30day,
            // 在售价范围
            @Param("startprice") Integer startprice, @Param("endprice") Integer endprice);
            @Param("key") String key, @Param("list") List<Long> list, @Param("sort") Integer sort,
            @Param("systemCid") Long systemCid, @Param("hasQuan") Integer hasQuan, @Param("userType") Integer userType,
            @Param("biz30day") Integer biz30day,
            // 在售价范围
            @Param("startprice") Integer startprice, @Param("endprice") Integer endprice);
    long countQueryKeyAndlabIDs(@Param("key") String key, @Param("list") List<Long> list, Long systemCid,
            @Param("hasQuan") Integer hasQuan, @Param("userType") Integer userType, @Param("biz30day") Integer biz30day,
            // 在售价范围
            @Param("startprice") Integer startprice, @Param("endprice") Integer endprice);
            @Param("startprice") Integer startprice, @Param("endprice") Integer endprice);
    /**
     * 根据类目id删除商品
     *
     * @param doTime
     * @param gcids
     * @return
     */
    int removeStorageGoods(String doTime, Long gcids);
    /**
     * 今日必抢 - 9k9
     *
     * @param start
     * @param count
     * @param systemCid
@@ -207,16 +202,15 @@
     * @return
     */
    List<QualityFactory> listQueryEverydayRob(@Param("start") long start, @Param("count") int count,
            @Param("systemCid")Long systemCid, @Param("labId")Long labId,
            @Param("sortField")Integer sortField,
            @Param("startCouponAmount")Double startCouponAmount, @Param("endCouponAmount")Double endCouponAmount);
    long countQueryEverydayRob(@Param("systemCid")Long systemCid, @Param("labId")Long labId,
            @Param("startCouponAmount")Double startCouponAmount, @Param("endCouponAmount")Double endCouponAmount);
            @Param("systemCid") Long systemCid, @Param("labId") Long labId, @Param("sortField") Integer sortField,
            @Param("startCouponAmount") Double startCouponAmount, @Param("endCouponAmount") Double endCouponAmount);
    long countQueryEverydayRob(@Param("systemCid") Long systemCid, @Param("labId") Long labId,
            @Param("startCouponAmount") Double startCouponAmount, @Param("endCouponAmount") Double endCouponAmount);
    /**
     * 子类查询
     *
     * @param start
     * @param count
     * @param key
@@ -224,25 +218,23 @@
     * @param labId
     * @return
     */
    List<QualityFactory> listQueryByKey(@Param("start") long start, @Param("count") int count,
            @Param("key") String key, @Param("sort") Integer sort, @Param("systemCid")Long systemCid,
            @Param("hasQuan") Integer hasQuan,  @Param("userType") Integer userType, @Param("biz30day") Integer biz30day,
            // 在售价范围
            @Param("startprice") Integer startprice, @Param("endprice") Integer endprice);
    List<QualityFactory> listQueryByKey(@Param("start") long start, @Param("count") int count, @Param("key") String key,
            @Param("sort") Integer sort, @Param("systemCid") Long systemCid, @Param("hasQuan") Integer hasQuan,
            @Param("userType") Integer userType, @Param("biz30day") Integer biz30day,
            // 在售价范围
            @Param("startprice") Integer startprice, @Param("endprice") Integer endprice);
    /**
     * 子类查询
     */
    long countQueryByKey( @Param("key") String key, @Param("systemCid")Long systemCid,
             @Param("hasQuan") Integer hasQuan,  @Param("userType") Integer userType, @Param("biz30day") Integer biz30day,
                // 在售价范围
             @Param("startprice") Integer startprice, @Param("endprice") Integer endprice);
     */
    long countQueryByKey(@Param("key") String key, @Param("systemCid") Long systemCid,
            @Param("hasQuan") Integer hasQuan, @Param("userType") Integer userType, @Param("biz30day") Integer biz30day,
            // 在售价范围
            @Param("startprice") Integer startprice, @Param("endprice") Integer endprice);
    /**
     * 券面额数据查询
     *
     * @param start
     * @param count
     * @param key
@@ -252,26 +244,25 @@
    List<QualityFactory> listQueryByCouponAmount(@Param("start") long start, @Param("count") int count,
            @Param("startAmount") Integer startAmount, @Param("endAmount") Integer endAmount,
            @Param("startPropor") Integer startPropor);
    long countQueryByCouponAmount(@Param("startAmount") Integer startAmount,
            @Param("endAmount") Integer endAmount, @Param("startPropor") Integer startPropor);
    long countQueryByCouponAmount(@Param("startAmount") Integer startAmount, @Param("endAmount") Integer endAmount,
            @Param("startPropor") Integer startPropor);
    /**
     * 限时抢购商品
     *
     * @param start
     * @param count
     * @param periodtime
     * @return
     */
    List<QualityFactory> listQueryByFlashSale(@Param("start") long start, @Param("count") int count);
    long countQueryByFlashSale();
    /**
     * 返利金额数据查询
     *
     * @param start
     * @param count
     * @param key
@@ -281,13 +272,13 @@
    List<QualityFactory> listQueryByRebateAmount(@Param("start") long start, @Param("count") int count,
            @Param("proportion") String proportion, @Param("startAmount") Integer startAmount,
            @Param("endAmount") Integer endAmount, @Param("tkRate") double tkRate);
    long countQueryByRebateAmount(@Param("proportion") String proportion, @Param("startAmount") Integer startAmount,
            @Param("endAmount") Integer endAmount,  @Param("tkRate") double tkRate);
    long countQueryByRebateAmount(@Param("proportion") String proportion, @Param("startAmount") Integer startAmount,
            @Param("endAmount") Integer endAmount, @Param("tkRate") double tkRate);
    /**
     * 返利金额数据查询 - 首页下方数据
     *
     * @param start
     * @param count
     * @param key
@@ -296,58 +287,73 @@
     */
    List<QualityFactory> listRecommendToIndex(@Param("start") long start, @Param("count") int count,
            @Param("proportion") Double proportion, @Param("commision") Integer commision,
            @Param("couponAmount") Integer couponAmount, @Param("tkRate") double tkRate, @Param("couponRatio") Double couponRatio);
    long countRecommendToIndex(@Param("proportion") Double proportion, @Param("commision") Integer commision,
            @Param("couponAmount") Integer couponAmount,  @Param("tkRate") double tkRate,  @Param("couponRatio") Double couponRatio);
            @Param("couponAmount") Integer couponAmount, @Param("tkRate") double tkRate,
            @Param("couponRatio") Double couponRatio);
    long countRecommendToIndex(@Param("proportion") Double proportion, @Param("commision") Integer commision,
            @Param("couponAmount") Integer couponAmount, @Param("tkRate") double tkRate,
            @Param("couponRatio") Double couponRatio);
    /**
     * 根据时间 获取dateTime时间之前创建的商品信息
     * @param systemCid 系统分类id
     * @param dateTime  筛选时间
     * @param goodsSource  商品来源
     *
     * @param systemCid
     *            系统分类id
     * @param dateTime
     *            筛选时间
     * @param goodsSource
     *            商品来源
     * @return
     */
    List<Long> getAuctionIdbyClassId(@Param("systemCid") Long systemCid, @Param("goodsSource") Integer goodsSource,
            @Param("beforeTime") String beforeTime);
    /**
     * 更新权重
     *
     * @param weight
     * @param time
     * @return
     */
    void updateWeight(@Param("weight") Integer weight, @Param("time") Integer time);
    // 查询优惠券-当日
    List<QualityFactory> queryToCouponColumn(@Param("start") long start, @Param("count") int count);
    long countQueryToCouponColumn();
    /**
     * 搜索-推荐商品
     *
     * @param start
     * @param count
     * @param key 关键词
     * @param key
     *            关键词
     * @return
     */
    List<QualityFactory> listRecommendBykey(@Param("start") long start, @Param("count") int count,
            @Param("key") String key,@Param("hasQuan") Integer hasQuan,  @Param("userType") Integer userType,
    List<QualityFactory> listRecommendBykey(@Param("start") long start, @Param("count") int count,
            @Param("key") String key, @Param("hasQuan") Integer hasQuan, @Param("userType") Integer userType,
            @Param("startprice") Double startprice, @Param("endprice") Double endprice,
            @Param("startTkRate") Double startTkRate, @Param("endTkRate") Double endTkRate,
            @Param("sort") Integer sort);
    long countRecommendBykey(@Param("key") String key, @Param("hasQuan") Integer hasQuan,
            @Param("userType") Integer userType,@Param("startprice") Double startprice,
            @Param("endprice") Double endprice,@Param("startTkRate") Double startTkRate,
    long countRecommendBykey(@Param("key") String key, @Param("hasQuan") Integer hasQuan,
            @Param("userType") Integer userType, @Param("startprice") Double startprice,
            @Param("endprice") Double endprice, @Param("startTkRate") Double startTkRate,
            @Param("endTkRate") Double endTkRate);
    List<QualityFactory> listQueryBylabIDs(@Param("start") long start, @Param("count") int count,
            @Param("list") List<Long> list, @Param("gid") Long gid, @Param("systemCid") Long systemCid);
    List<QualityFactory> listQueryBylabIDs(@Param("start") long start, @Param("count") int count,
            @Param("list") List<Long> list, @Param("gid") Long gid,@Param("systemCid") Long systemCid);
    /**
     * 按最低销量倒叙排列
     *
     * @param salesCount
     * @param start
     * @param count
     * @return
     */
    List<QualityFactory> listByMinSalesCountOrderByCreateTimeDesc(@Param("salesCount") int salesCount,
            @Param("start") long start, @Param("count") int count);
}
fanli/src/main/java/com/yeshi/fanli/entity/accept/AcceptData.java
@@ -14,6 +14,15 @@
    private String osVersion;
    private String network;
    private String imei;
    private String idfa;
    public String getIdfa() {
        return idfa;
    }
    public void setIdfa(String idfa) {
        this.idfa = idfa;
    }
    public String getImei() {
        return imei;
fanli/src/main/java/com/yeshi/fanli/mapping/ExtractMapper.xml
@@ -5,6 +5,8 @@
        <id column="id" property="id" jdbcType="BIGINT" />
        <result column="account" property="account" jdbcType="VARCHAR" />
        <result column="extractTime" property="extractTime" jdbcType="BIGINT" />
        <result column="receiveTime" property="receiveTime" jdbcType="TIMESTAMP" />
        <result column="ip" property="ip" jdbcType="VARCHAR" />
        <result column="money" property="money" jdbcType="DECIMAL" />
        <result column="name" property="name" jdbcType="VARCHAR" />
@@ -23,7 +25,7 @@
    </resultMap>
    <sql id="Base_Column_List">
        id,account,extractTime,ip,money,name,reason,state,type,uid,sid,adminId
        id,account,extractTime,ip,money,name,reason,state,type,uid,sid,adminId,receiveTime
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
@@ -52,7 +54,7 @@
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.Extract"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_extract (id,
        account,extractTime,ip,money,name,reason,state,type,uid,sid,adminId)
        account,extractTime,ip,money,name,reason,state,type,uid,sid,adminId,receiveTime)
        values
        (#{id,jdbcType=BIGINT},
        #{account,jdbcType=VARCHAR},
@@ -65,7 +67,8 @@
        #{type,jdbcType=INTEGER},
        #{userInfo.id,jdbcType=BIGINT},
        #{system.id,jdbcType=BIGINT}
        #{adminId,jdbcType=BIGINT}
        #{adminId,jdbcType=BIGINT},
        #{receiveTime,jdbcType=TIMESTAMP}
        )
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.Extract"
@@ -110,6 +113,14 @@
            <if test="system != null">
                adminId,
            </if>
            <if test="receiveTime != null">
                receiveTime,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -149,6 +160,12 @@
            <if test="system != null">
                #{adminId,jdbcType=BIGINT},
            </if>
            <if test="receiveTime != null">
                #{receiveTime,jdbcType=TIMESTAMP},
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.Extract">
@@ -194,6 +211,12 @@
            <if test="system != null">
                adminId = #{adminId,jdbcType=BIGINT},
            </if>
            <if test="receiveTime != null">
                #{receiveTime,jdbcType=TIMESTAMP},
            </if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
@@ -222,7 +245,9 @@
        =#{adminId,jdbcType=BIGINT},
        sid
        =
        #{system.id,jdbcType=BIGINT}
        #{system.id,jdbcType=BIGINT},
        receiveTime
        =#{receiveTime,jdbcType=TIMESTAMP}
        where id =
        #{id,jdbcType=BIGINT}
    </update>
fanli/src/main/java/com/yeshi/fanli/mapping/goods/RecommendUserGoodsMapMapper.xml
@@ -35,6 +35,21 @@
    </select>
    <select id="listByUidAndCommonGoodsId" resultMap="BaseResultMap">
        SELECT m.* FROM
        yeshi_ec_recommend_user_goods_map m LEFT JOIN
        yeshi_ec_recommend_user_goods g ON m.`rugm_recommend_id`=g.`rug_id`
        WHERE g.`rug_uid`=#{uid} AND m.`rugm_common_goods_id`=#{commonGoodsId}
    </select>
    <select id="countByUidAndCommonGoodsId" resultType="java.lang.Long">
        SELECT
        count(m.id) FROM yeshi_ec_recommend_user_goods_map m LEFT JOIN
        yeshi_ec_recommend_user_goods g ON m.`rugm_recommend_id`=g.`rug_id`
        WHERE g.`rug_uid`=#{uid} AND m.`rugm_common_goods_id`=#{commonGoodsId}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_recommend_user_goods_map where rugm_id =
        #{id,jdbcType=BIGINT}
fanli/src/main/java/com/yeshi/fanli/mapping/goods/RecommendUserGoodsMapper.xml
@@ -48,6 +48,18 @@
    </select>
    <select id="getLatestRecommendUserGoods" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        *
        from yeshi_ec_recommend_user_goods
        where rug_uid =
        #{0} order by rug_create_time desc limit 1
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_recommend_user_goods where rug_id = #{id,jdbcType=BIGINT}
fanli/src/main/java/com/yeshi/fanli/mapping/lable/QualityFactoryMapper.xml
@@ -2,650 +2,729 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.lable.QualityFactoryMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.lable.QualityFactory">
    <id column="sg_id" property="id" jdbcType="BIGINT"/>
    <result column="sg_class_id" property="systemCid" jdbcType="BIGINT"/>
    <result column="sg_entry_mode" property="entryMode" jdbcType="INTEGER"/>
    <result column="sg_goods_source" property="goodsSource" jdbcType="INTEGER"/>
    <result column="sg_source_calss" property="sourceCalss" jdbcType="VARCHAR"/>
    <result column="sg_weight" property="weight" jdbcType="INTEGER"/>
    <result column="sg_createtime" property="createtime" jdbcType="TIMESTAMP"/>
    <result column="sg_updatetime" property="updatetime" jdbcType="TIMESTAMP"/>
     <association property="taoBaoGoodsBrief" column="sg_goods_id"
         select="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper.selectByPrimaryKey">
    </association>
    <association property="boutiqueAutoRule" column="sg_rule_id"
        javaType="com.yeshi.fanli.entity.bus.lable.BoutiqueAutoRule">
    <resultMap id="BaseResultMap"
        type="com.yeshi.fanli.entity.bus.lable.QualityFactory">
        <id column="sg_id" property="id" jdbcType="BIGINT" />
        <result column="sg_class_id" property="systemCid" jdbcType="BIGINT" />
        <result column="sg_entry_mode" property="entryMode" jdbcType="INTEGER" />
        <result column="sg_goods_source" property="goodsSource"
            jdbcType="INTEGER" />
        <result column="sg_source_calss" property="sourceCalss"
            jdbcType="VARCHAR" />
        <result column="sg_weight" property="weight" jdbcType="INTEGER" />
        <result column="sg_createtime" property="createtime" jdbcType="TIMESTAMP" />
        <result column="sg_updatetime" property="updatetime" jdbcType="TIMESTAMP" />
        <association property="taoBaoGoodsBrief" column="sg_goods_id"
            select="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper.selectByPrimaryKey">
        </association>
        <association property="boutiqueAutoRule" column="sg_rule_id"
            javaType="com.yeshi.fanli.entity.bus.lable.BoutiqueAutoRule">
            <id column="sg_rule_id" property="id" jdbcType="BIGINT" />
    </association>
      <association property="createUser" column="sg_create_aid"
        javaType="com.yeshi.fanli.entity.common.AdminUser">
        </association>
        <association property="createUser" column="sg_create_aid"
            javaType="com.yeshi.fanli.entity.common.AdminUser">
            <id column="sg_create_aid" property="id" jdbcType="BIGINT" />
    </association>
    <association property="updateUser" column="sg_update_aid"
        </association>
        <association property="updateUser" column="sg_update_aid"
            javaType="com.yeshi.fanli.entity.common.AdminUser">
            <id column="sg_update_aid" property="id" jdbcType="BIGINT" />
    </association>
  </resultMap>
  <resultMap id="ResultMap" type="com.yeshi.fanli.entity.bus.lable.QualityFactory">
    <id column="sg_id" property="id" jdbcType="BIGINT"/>
    <result column="sg_class_id" property="systemCid" jdbcType="BIGINT"/>
    <result column="sg_entry_mode" property="entryMode" jdbcType="INTEGER"/>
    <result column="sg_goods_source" property="goodsSource" jdbcType="INTEGER"/>
    <result column="sg_source_calss" property="sourceCalss" jdbcType="VARCHAR"/>
    <result column="sg_weight" property="weight" jdbcType="INTEGER"/>
    <result column="sg_createtime" property="createtime" jdbcType="TIMESTAMP"/>
    <result column="sg_updatetime" property="updatetime" jdbcType="TIMESTAMP"/>
     <association property="boutiqueAutoRule" column="sg_rule_id"
         select="com.yeshi.fanli.dao.mybatis.lable.BoutiqueAutoRuleMapper.selectByPrimaryKey">
    </association>
     <association property="taoBaoGoodsBrief" column="sg_goods_id"
         select="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper.selectByPrimaryKey">
    </association>
      <association property="createUser" column="sg_create_aid"
        javaType="com.yeshi.fanli.entity.common.AdminUser">
        </association>
    </resultMap>
    <resultMap id="ResultMap"
        type="com.yeshi.fanli.entity.bus.lable.QualityFactory">
        <id column="sg_id" property="id" jdbcType="BIGINT" />
        <result column="sg_class_id" property="systemCid" jdbcType="BIGINT" />
        <result column="sg_entry_mode" property="entryMode" jdbcType="INTEGER" />
        <result column="sg_goods_source" property="goodsSource"
            jdbcType="INTEGER" />
        <result column="sg_source_calss" property="sourceCalss"
            jdbcType="VARCHAR" />
        <result column="sg_weight" property="weight" jdbcType="INTEGER" />
        <result column="sg_createtime" property="createtime" jdbcType="TIMESTAMP" />
        <result column="sg_updatetime" property="updatetime" jdbcType="TIMESTAMP" />
        <association property="boutiqueAutoRule" column="sg_rule_id"
            select="com.yeshi.fanli.dao.mybatis.lable.BoutiqueAutoRuleMapper.selectByPrimaryKey">
        </association>
        <association property="taoBaoGoodsBrief" column="sg_goods_id"
            select="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper.selectByPrimaryKey">
        </association>
        <association property="createUser" column="sg_create_aid"
            javaType="com.yeshi.fanli.entity.common.AdminUser">
            <id column="sg_create_aid" property="id" jdbcType="BIGINT" />
    </association>
    <association property="updateUser" column="sg_update_aid"
        </association>
        <association property="updateUser" column="sg_update_aid"
            javaType="com.yeshi.fanli.entity.common.AdminUser">
            <id column="sg_update_aid" property="id" jdbcType="BIGINT" />
    </association>
  </resultMap>
  <resultMap id="GoodsResultMap" type="com.yeshi.fanli.entity.bus.lable.QualityFactory">
    <id column="sg_id" property="id" jdbcType="BIGINT"/>
    <result column="sg_class_id" property="systemCid" jdbcType="BIGINT"/>
    <result column="sg_entry_mode" property="entryMode" jdbcType="INTEGER"/>
    <result column="sg_goods_source" property="goodsSource" jdbcType="INTEGER"/>
    <result column="sg_source_calss" property="sourceCalss" jdbcType="VARCHAR"/>
    <result column="sg_weight" property="weight" jdbcType="INTEGER"/>
    <result column="sg_createtime" property="createtime" jdbcType="TIMESTAMP"/>
    <result column="sg_updatetime" property="updatetime" jdbcType="TIMESTAMP"/>
      <association property="boutiqueAutoRule" column="sg_rule_id"
        javaType="com.yeshi.fanli.entity.bus.lable.BoutiqueAutoRule">
        </association>
    </resultMap>
    <resultMap id="GoodsResultMap"
        type="com.yeshi.fanli.entity.bus.lable.QualityFactory">
        <id column="sg_id" property="id" jdbcType="BIGINT" />
        <result column="sg_class_id" property="systemCid" jdbcType="BIGINT" />
        <result column="sg_entry_mode" property="entryMode" jdbcType="INTEGER" />
        <result column="sg_goods_source" property="goodsSource"
            jdbcType="INTEGER" />
        <result column="sg_source_calss" property="sourceCalss"
            jdbcType="VARCHAR" />
        <result column="sg_weight" property="weight" jdbcType="INTEGER" />
        <result column="sg_createtime" property="createtime" jdbcType="TIMESTAMP" />
        <result column="sg_updatetime" property="updatetime" jdbcType="TIMESTAMP" />
        <association property="boutiqueAutoRule" column="sg_rule_id"
            javaType="com.yeshi.fanli.entity.bus.lable.BoutiqueAutoRule">
            <id column="sg_rule_id" property="id" jdbcType="BIGINT" />
    </association>
     <association property="taoBaoGoodsBrief" column="sg_goods_id"
      resultMap="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper.BaseResultMap"/>
      <association property="createUser" column="sg_create_aid"
        javaType="com.yeshi.fanli.entity.common.AdminUser">
        </association>
        <association property="taoBaoGoodsBrief" column="sg_goods_id"
            resultMap="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper.BaseResultMap" />
        <association property="createUser" column="sg_create_aid"
            javaType="com.yeshi.fanli.entity.common.AdminUser">
            <id column="sg_create_aid" property="id" jdbcType="BIGINT" />
    </association>
    <association property="updateUser" column="sg_update_aid"
        </association>
        <association property="updateUser" column="sg_update_aid"
            javaType="com.yeshi.fanli.entity.common.AdminUser">
            <id column="sg_update_aid" property="id" jdbcType="BIGINT" />
    </association>
  </resultMap>
  <sql id="Base_Column_List">sg_id,sg_class_id,sg_goods_id,sg_entry_mode,sg_goods_source,sg_source_calss,sg_rule_id,sg_weight,sg_create_aid,sg_createtime,sg_update_aid,sg_updatetime</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_quality_factory where sg_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_quality_factory where sg_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFactory" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_quality_factory (sg_id,sg_class_id,sg_goods_id,sg_entry_mode,sg_goods_source,sg_source_calss,sg_rule_id,sg_weight,sg_create_aid,sg_createtime,sg_update_aid,sg_updatetime) values (#{id,jdbcType=BIGINT},#{systemCid,jdbcType=BIGINT},#{taoBaoGoodsBrief.id,jdbcType=BIGINT},#{entryMode,jdbcType=INTEGER},#{goodsSource,jdbcType=INTEGER},#{sourceCalss,jdbcType=VARCHAR},#{boutiqueAutoRule.id,jdbcType=BIGINT},#{weight,jdbcType=INTEGER},#{createUser.id,jdbcType=BIGINT},#{createtime,jdbcType=TIMESTAMP},#{updateUser.id,jdbcType=BIGINT},#{updatetime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFactory" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_quality_factory
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">sg_id,</if>
      <if test="systemCid != null">sg_class_id,</if>
      <if test="taoBaoGoodsBrief != null">sg_goods_id,</if>
      <if test="entryMode != null">sg_entry_mode,</if>
      <if test="goodsSource != null">sg_goods_source,</if>
      <if test="sourceCalss != null">sg_source_calss,</if>
      <if test="boutiqueAutoRule != null">sg_rule_id,</if>
      <if test="weight != null">sg_weight,</if>
      <if test="createUser != null">sg_create_aid,</if>
      <if test="createtime != null">sg_createtime,</if>
      <if test="updateUser != null">sg_update_aid,</if>
      <if test="updatetime != null">sg_updatetime,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="systemCid != null">#{systemCid,jdbcType=BIGINT},</if>
      <if test="taoBaoGoodsBrief != null">#{taoBaoGoodsBrief.id,jdbcType=BIGINT},</if>
      <if test="entryMode != null">#{entryMode,jdbcType=INTEGER},</if>
      <if test="goodsSource != null">#{goodsSource,jdbcType=INTEGER},</if>
      <if test="sourceCalss != null">#{sourceCalss,jdbcType=VARCHAR},</if>
      <if test="boutiqueAutoRule != null">#{boutiqueAutoRule.id,jdbcType=BIGINT},</if>
      <if test="weight != null">#{weight,jdbcType=INTEGER},</if>
      <if test="createUser != null">#{createUser.id,jdbcType=BIGINT},</if>
      <if test="createtime != null">#{createtime,jdbcType=TIMESTAMP},</if>
      <if test="updateUser != null">#{updateUser.id,jdbcType=BIGINT},</if>
      <if test="updatetime != null">#{updatetime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFactory">update yeshi_ec_quality_factory set sg_class_id = #{systemCid,jdbcType=BIGINT},sg_goods_id = #{taoBaoGoodsBrief.id,jdbcType=BIGINT},sg_entry_mode = #{entryMode,jdbcType=INTEGER},sg_goods_source = #{goodsSource,jdbcType=INTEGER},sg_source_calss = #{sourceCalss,jdbcType=VARCHAR},sg_rule_id = #{boutiqueAutoRule.id,jdbcType=BIGINT},sg_weight = #{weight,jdbcType=INTEGER},sg_create_aid = #{createUser.id,jdbcType=BIGINT},sg_createtime = #{createtime,jdbcType=TIMESTAMP},sg_update_aid = #{updateUser.id,jdbcType=BIGINT},sg_updatetime = #{updatetime,jdbcType=TIMESTAMP} where sg_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFactory">update yeshi_ec_quality_factory
    <set>
      <if test="systemCid != null">sg_class_id=#{systemCid,jdbcType=BIGINT},</if>
      <if test="taoBaoGoodsBrief != null">sg_goods_id=#{taoBaoGoodsBrief.id,jdbcType=BIGINT},</if>
      <if test="entryMode != null">sg_entry_mode=#{entryMode,jdbcType=INTEGER},</if>
      <if test="goodsSource != null">sg_goods_source=#{goodsSource,jdbcType=INTEGER},</if>
      <if test="sourceCalss != null">sg_source_calss=#{sourceCalss,jdbcType=VARCHAR},</if>
      <if test="boutiqueAutoRule != null">sg_rule_id=#{boutiqueAutoRule.id,jdbcType=BIGINT},</if>
      <if test="weight != null">sg_weight=#{weight,jdbcType=INTEGER},</if>
      <if test="createUser != null">sg_create_aid=#{createUser.id,jdbcType=BIGINT},</if>
      <if test="createtime != null">sg_createtime=#{createtime,jdbcType=TIMESTAMP},</if>
      <if test="updateUser != null">sg_update_aid=#{updateUser.id,jdbcType=BIGINT},</if>
      <if test="updatetime != null">sg_updatetime=#{updatetime,jdbcType=TIMESTAMP},</if>
    </set> where sg_id = #{id,jdbcType=BIGINT}
  </update>
    <delete id="deleteBatchByPrimaryKey"  parameterType="java.util.List">
        </association>
    </resultMap>
    <sql id="Base_Column_List">sg_id,sg_class_id,sg_goods_id,sg_entry_mode,sg_goods_source,sg_source_calss,sg_rule_id,sg_weight,sg_create_aid,sg_createtime,sg_update_aid,sg_updatetime
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_quality_factory where sg_id = #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_quality_factory where sg_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFactory"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_quality_factory
        (sg_id,sg_class_id,sg_goods_id,sg_entry_mode,sg_goods_source,sg_source_calss,sg_rule_id,sg_weight,sg_create_aid,sg_createtime,sg_update_aid,sg_updatetime)
        values
        (#{id,jdbcType=BIGINT},#{systemCid,jdbcType=BIGINT},#{taoBaoGoodsBrief.id,jdbcType=BIGINT},#{entryMode,jdbcType=INTEGER},#{goodsSource,jdbcType=INTEGER},#{sourceCalss,jdbcType=VARCHAR},#{boutiqueAutoRule.id,jdbcType=BIGINT},#{weight,jdbcType=INTEGER},#{createUser.id,jdbcType=BIGINT},#{createtime,jdbcType=TIMESTAMP},#{updateUser.id,jdbcType=BIGINT},#{updatetime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFactory"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_quality_factory
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">sg_id,</if>
            <if test="systemCid != null">sg_class_id,</if>
            <if test="taoBaoGoodsBrief != null">sg_goods_id,</if>
            <if test="entryMode != null">sg_entry_mode,</if>
            <if test="goodsSource != null">sg_goods_source,</if>
            <if test="sourceCalss != null">sg_source_calss,</if>
            <if test="boutiqueAutoRule != null">sg_rule_id,</if>
            <if test="weight != null">sg_weight,</if>
            <if test="createUser != null">sg_create_aid,</if>
            <if test="createtime != null">sg_createtime,</if>
            <if test="updateUser != null">sg_update_aid,</if>
            <if test="updatetime != null">sg_updatetime,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="systemCid != null">#{systemCid,jdbcType=BIGINT},</if>
            <if test="taoBaoGoodsBrief != null">#{taoBaoGoodsBrief.id,jdbcType=BIGINT},</if>
            <if test="entryMode != null">#{entryMode,jdbcType=INTEGER},</if>
            <if test="goodsSource != null">#{goodsSource,jdbcType=INTEGER},</if>
            <if test="sourceCalss != null">#{sourceCalss,jdbcType=VARCHAR},</if>
            <if test="boutiqueAutoRule != null">#{boutiqueAutoRule.id,jdbcType=BIGINT},</if>
            <if test="weight != null">#{weight,jdbcType=INTEGER},</if>
            <if test="createUser != null">#{createUser.id,jdbcType=BIGINT},</if>
            <if test="createtime != null">#{createtime,jdbcType=TIMESTAMP},</if>
            <if test="updateUser != null">#{updateUser.id,jdbcType=BIGINT},</if>
            <if test="updatetime != null">#{updatetime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFactory">update
        yeshi_ec_quality_factory set sg_class_id =
        #{systemCid,jdbcType=BIGINT},sg_goods_id =
        #{taoBaoGoodsBrief.id,jdbcType=BIGINT},sg_entry_mode =
        #{entryMode,jdbcType=INTEGER},sg_goods_source =
        #{goodsSource,jdbcType=INTEGER},sg_source_calss =
        #{sourceCalss,jdbcType=VARCHAR},sg_rule_id =
        #{boutiqueAutoRule.id,jdbcType=BIGINT},sg_weight =
        #{weight,jdbcType=INTEGER},sg_create_aid =
        #{createUser.id,jdbcType=BIGINT},sg_createtime =
        #{createtime,jdbcType=TIMESTAMP},sg_update_aid =
        #{updateUser.id,jdbcType=BIGINT},sg_updatetime =
        #{updatetime,jdbcType=TIMESTAMP} where sg_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFactory">
        update yeshi_ec_quality_factory
        <set>
            <if test="systemCid != null">sg_class_id=#{systemCid,jdbcType=BIGINT},</if>
            <if test="taoBaoGoodsBrief != null">sg_goods_id=#{taoBaoGoodsBrief.id,jdbcType=BIGINT},</if>
            <if test="entryMode != null">sg_entry_mode=#{entryMode,jdbcType=INTEGER},</if>
            <if test="goodsSource != null">sg_goods_source=#{goodsSource,jdbcType=INTEGER},</if>
            <if test="sourceCalss != null">sg_source_calss=#{sourceCalss,jdbcType=VARCHAR},</if>
            <if test="boutiqueAutoRule != null">sg_rule_id=#{boutiqueAutoRule.id,jdbcType=BIGINT},</if>
            <if test="weight != null">sg_weight=#{weight,jdbcType=INTEGER},</if>
            <if test="createUser != null">sg_create_aid=#{createUser.id,jdbcType=BIGINT},</if>
            <if test="createtime != null">sg_createtime=#{createtime,jdbcType=TIMESTAMP},</if>
            <if test="updateUser != null">sg_update_aid=#{updateUser.id,jdbcType=BIGINT},</if>
            <if test="updatetime != null">sg_updatetime=#{updatetime,jdbcType=TIMESTAMP},</if>
        </set>
        where sg_id = #{id,jdbcType=BIGINT}
    </update>
    <delete id="deleteBatchByPrimaryKey" parameterType="java.util.List">
        delete FROM yeshi_ec_quality_factory WHERE sg_id in
        <foreach collection="list" item="item" open="(" close=")"
            separator=",">#{item}</foreach>
    </delete>
    <insert id="insertBatch"  useGeneratedKeys="true" keyProperty="id"  parameterType="java.util.List">
          insert into yeshi_ec_quality_factory
         (<include refid="Base_Column_List" />)
        values
          <foreach collection="list" item="item" separator=",">
              (
                 #{item.id,jdbcType=BIGINT},
                 #{item.systemCid,jdbcType=BIGINT},
                 #{item.taoBaoGoodsBrief.id,jdbcType=BIGINT},
                 #{item.entryMode,jdbcType=INTEGER},
                 #{item.goodsSource,jdbcType=INTEGER},
                 #{item.sourceCalss,jdbcType=VARCHAR},
                 #{item.boutiqueAutoRule.id,jdbcType=BIGINT},
                 #{item.weight,jdbcType=INTEGER},
                 #{item.createUser.id,jdbcType=BIGINT},
                 #{item.createtime,jdbcType=TIMESTAMP},
                 #{item.updateUser.id,jdbcType=BIGINT},
                 #{item.updatetime,jdbcType=TIMESTAMP}
             )
          </foreach>
  </insert>
      <update id="updateBatchSelective" parameterType="java.util.List">
        update yeshi_ec_quality_factory
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="sg_weight =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                        <if test="item.weight !=null">
                     when sg_id=#{item.id} then #{item.weight}
                     </if>
                </foreach>
            </trim>
             <trim prefix="sg_goods_source =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                        <if test="item.goodsSource !=null">
                     when sg_id=#{item.id} then #{item.goodsSource}
                     </if>
                </foreach>
            </trim>
             <trim prefix="sg_rule_id =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                        <if test="item.boutiqueAutoRule !=null">
                     when sg_id=#{item.id} then #{item.boutiqueAutoRule.id}
                     </if>
                </foreach>
            </trim>
             <trim prefix="sg_source_calss =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                        <if test="item.sourceCalss !=null">
                     when sg_id=#{item.id} then #{item.sourceCalss}
                     </if>
                </foreach>
            </trim>
             <trim prefix="sg_createtime =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                        <if test="item.createtime !=null">
                     when sg_id=#{item.id} then #{item.createtime}
                     </if>
                </foreach>
            </trim>
             <trim prefix="sg_updatetime =case" suffix="end,">
                 <foreach collection="list" item="item" index="index">
                     <if test="item.updatetime !=null">
                      when sg_id=#{item.id} then #{item.updatetime}
                      </if>
                 </foreach>
    <insert id="insertBatch" useGeneratedKeys="true" keyProperty="id"
        parameterType="java.util.List">
        insert into yeshi_ec_quality_factory
        (
        <include refid="Base_Column_List" />
        )
        values
        <foreach collection="list" item="item" separator=",">
            (
            #{item.id,jdbcType=BIGINT},
            #{item.systemCid,jdbcType=BIGINT},
            #{item.taoBaoGoodsBrief.id,jdbcType=BIGINT},
            #{item.entryMode,jdbcType=INTEGER},
            #{item.goodsSource,jdbcType=INTEGER},
            #{item.sourceCalss,jdbcType=VARCHAR},
            #{item.boutiqueAutoRule.id,jdbcType=BIGINT},
            #{item.weight,jdbcType=INTEGER},
            #{item.createUser.id,jdbcType=BIGINT},
            #{item.createtime,jdbcType=TIMESTAMP},
            #{item.updateUser.id,jdbcType=BIGINT},
            #{item.updatetime,jdbcType=TIMESTAMP}
            )
        </foreach>
    </insert>
    <update id="updateBatchSelective" parameterType="java.util.List">
        update yeshi_ec_quality_factory
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="sg_weight =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.weight !=null">
                        when sg_id=#{item.id} then #{item.weight}
                    </if>
                </foreach>
            </trim>
        </trim>
        where sg_id in
        <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
            #{item.id,jdbcType=BIGINT}
        </foreach>
     </update>
       <!-- 查询所有商品信息  更新时间较早在前     -->
  <select id="queryAll" resultMap="BaseResultMap">
        SELECT  *  FROM  yeshi_ec_quality_factory
            <if test="days != null">
                 WHERE DATE_SUB(CURDATE(), INTERVAL ${days} DAY) > DATE(lab_updatetime);
            </if>
         order by sg_updatetime  LIMIT ${start},${count}
   </select>
       <!-- 查询超过hour个小时未更新商品,进行更新  -->
  <select id="queryNeedUpdate" resultType="java.lang.Long">
    SELECT h.sg_goods_id FROM `yeshi_ec_quality_factory` h
    LEFT JOIN `yeshi_ec_taobao_goods` tb ON h.`sg_goods_id` = tb.id
       WHERE <![CDATA[TO_DAYS(tb.`updatetime`) < TO_DAYS(NOW()) OR (HOUR(NOW()) -HOUR(tb.`updatetime`)) >=  #{hour}]]>
       order by h.`sg_updatetime`  LIMIT ${start},${count}
   </select>
        <!-- 查询超过5个小时未更新商品,进行更新  -->
  <select id="countQueryNeedUpdate" resultType="java.lang.Long">
        SELECT count(sg_id) FROM `yeshi_ec_quality_factory` h
    LEFT JOIN `yeshi_ec_taobao_goods` tb ON h.`sg_goods_id` = tb.id
       WHERE <![CDATA[TO_DAYS(tb.`updatetime`) < TO_DAYS(NOW()) OR (HOUR(NOW()) -HOUR(tb.`updatetime`)) >= 4]]>
   </select>
      <!-- 查询精选商品信息     -->
  <select id="query" resultMap="ResultMap">
           SELECT ts.* FROM (
            SELECT DISTINCT( tt.`sg_id`) AS id  FROM yeshi_ec_quality_factory tt
            LEFT JOIN yeshi_ec_taobao_goods tb ON tt.`sg_goods_id`= tb.`id`
            <if test='keyType == 3'>
                LEFT JOIN yeshi_ec_label_goods lg ON tt.`sg_goods_id` = lg.`lg_goods_id`
                LEFT JOIN yeshi_ec_label lab ON lg.`lg_label_id` = lab.`lab_id`
            </if>
             WHERE 1=1
                <if test="goodsSource != null">
                <!--  来源      -->
                    AND tt.`sg_goods_source` = ${goodsSource}
            </if>
                <if test="days != null">
                <!--  入库时间   -->
                    AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) >= tt.`sg_createtime`]]>
            </if>
               <!-- 在售价范围  -->
             <if test='startZkPrice != null'>
                    AND <![CDATA[  tb.`zkPrice` >= ${startZkPrice} ]]>
             </if>
              <if test='endZkPrice != null'>
                    AND <![CDATA[  tb.`zkPrice` <= ${endZkPrice} ]]>
            </if>
            <!-- 月销量 -->
            <if test='startBiz30day != null'>
                    AND <![CDATA[  tb.`biz30day` >= ${startBiz30day} ]]>
            </if>
             <if test='endBiz30day != null'>
                    AND <![CDATA[  tb.`biz30day` <= ${endBiz30day} ]]>
            </if>
            <!--  权重范围 -->
                <if test='startWeight != null'>
                    AND <![CDATA[   tt.`sg_weight` >= ${startWeight} ]]>
            </if>
            <if test='endWeight != null'>
                    AND <![CDATA[   tt.`sg_weight` <= ${endWeight} ]]>
            </if>
              <!--  佣金比例范围  -->
                <if test='startTkRate != null'>
                    AND <![CDATA[   tb.`tkRate` >= ${startTkRate} ]]>
            </if>
            <if test='endTkRate != null'>
                    AND <![CDATA[   tb.`tkRate` <= ${endTkRate} ]]>
            </if>
             <!--  券面额:减多少 -->
                <if test='startAmount != null'>
                    AND <![CDATA[   tb.`couponAmount` >= ${startAmount} ]]>
            </if>
            <if test='endAmount != null'>
                    AND <![CDATA[   tb.`couponAmount` <= ${endAmount} ]]>
            </if>
             <!-- 券比例    -->
             <if test='startPropor != null'>
                    AND <![CDATA[   ROUND(tb.couponAmount/tb.`zkPrice`*100,2) >= ${startPropor} ]]>
             </if>
             <!-- 券比例    -->
             <if test='endPropor != null'>
                    AND <![CDATA[  ROUND(tb.couponAmount/tb.`zkPrice`*100,2) <= ${endPropor} ]]>
             </if>
              <!-- 有优惠券    -->
             <if test='hasCoupon == 1'>
                    AND <![CDATA[  tb.`couponAmount` > 0 ]]>
             </if>
             <!-- 包邮    -->
             <if test='freeShipment == 1'>
                    AND tb.`freeShipment` = 1
             </if>
             <!-- 消费者保障    -->
             <if test='isPrepay == 1'>
                    AND tb.`isPrepay` = 1
             </if>
             <!-- 成交转化    -->
             <if test='payRate30 == 1'>
                    AND tb.`payRate30` = 1
             </if>
             <!-- 好评率    -->
             <if test='goodRate == 1'>
                    AND tb.`goodRate` = 1
             </if>
             <!-- 退款率    -->
             <if test='rfdRate == 1'>
                    AND tb.`rfdRate` = 1
             </if>
             <!-- 分类id    -->
             <if test='gcid != null'>
                    AND tt.sg_class_id = #{gcid}
             </if>
             <!--  搜索条件: 商品名称、商品id、标签名称  -->
             <if test='key != null and key != ""'>
                <if test='keyType == 1'>
                    AND tb.`auctionId` = '${key}'
                </if>
                <if test='keyType == 2'>
                    AND tb.`title` LIKE '%${key}%'
                </if>
                <if test='keyType == 3'>
                    AND lab.`lab_title` = '${key}'
                </if>
            </if>
             ORDER BY
             <!-- 销量    -->
             <if test='totalSales == 1'>
                    tb.`biz30day`,
             </if>
             <if test='totalSales == 2'>
                    tb.`biz30day` desc,
             </if>
             <!-- 价格    -->
             <if test='price == 1'>
                    tb.`zkPrice`,
             </if>
             <if test='price == 2'>
                    tb.`zkPrice` desc,
             </if>
             <!-- 价格    -->
             <if test='tkRate == 1'>
                    tb.`tkRate`,
             </if>
             <if test='tkRate == 2'>
                    tb.`tkRate` desc,
             </if>
                 <!-- 券比例   -->
             <if test='propor == 1'>
                    ROUND(tb.couponAmount/tb.`zkPrice` *100,2),
             </if>
             <if test='propor == 2'>
                    ROUND(tb.couponAmount/tb.`zkPrice` *100,2) desc,
             </if>
              tt.`sg_updatetime` desc
              LIMIT ${start},${count}
             ) a LEFT JOIN yeshi_ec_quality_factory ts ON ts.`sg_id`=a.id
   </select>
    <select id="queryCount" resultType="java.lang.Long">
       <!-- 根据条件统计所有标签数量 -->
       SELECT  count(ts.sg_id)  FROM (
            SELECT DISTINCT( tt.`sg_id`) AS id FROM yeshi_ec_quality_factory tt
            LEFT JOIN yeshi_ec_taobao_goods tb ON tt.`sg_goods_id`= tb.`id`
            <if test='keyType == 3'>
            LEFT JOIN yeshi_ec_label_goods lg ON tt.`sg_goods_id` = lg.`lg_goods_id`
            LEFT JOIN yeshi_ec_label lab ON lg.`lg_label_id` = lab.`lab_id`
            </if>
             WHERE 1=1
                <if test="goodsSource != null">
                <!--  来源      -->
                    AND tt.`sg_goods_source` = ${goodsSource}
            </if>
                <if test="days != null">
                <!--  入库时间   -->
                    AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) >= tt.`sg_createtime`]]>
            </if>
               <!-- 在售价范围  -->
             <if test='startZkPrice != null'>
                    AND <![CDATA[  tb.`zkPrice` >= ${startZkPrice} ]]>
             </if>
              <if test='endZkPrice != null'>
                    AND <![CDATA[  tb.`zkPrice` <= ${endZkPrice} ]]>
            </if>
            <!-- 月销量 -->
            <if test='startBiz30day != null'>
                    AND <![CDATA[  tb.`biz30day` >= ${startBiz30day} ]]>
            </if>
             <if test='endBiz30day != null'>
                    AND <![CDATA[  tb.`biz30day` <= ${endBiz30day} ]]>
            </if>
            <!--  权重范围 -->
                <if test='startWeight != null'>
                    AND <![CDATA[   tt.`sg_weight` >= ${startWeight} ]]>
            </if>
            <if test='endWeight != null'>
                    AND <![CDATA[   tt.`sg_weight` <= ${endWeight} ]]>
            </if>
              <!--  佣金比例范围  -->
                <if test='startTkRate != null'>
                    AND <![CDATA[   tb.`tkRate` >= ${startTkRate} ]]>
            </if>
            <if test='endTkRate != null'>
                    AND <![CDATA[   tb.`tkRate` <= ${endTkRate} ]]>
            </if>
             <!--  券面额:减多少 -->
                <if test='startAmount != null'>
                    AND <![CDATA[   tb.`couponAmount` >= ${startAmount} ]]>
            </if>
            <if test='endAmount != null'>
                    AND <![CDATA[   tb.`couponAmount` <= ${endAmount} ]]>
            </if>
            <!-- 券比例    -->
             <if test='startPropor != null'>
                    AND <![CDATA[   ROUND(tb.couponAmount/tb.`zkPrice`*100,2) >= ${startPropor} ]]>
             </if>
             <!-- 券比例    -->
             <if test='endPropor != null'>
                    AND <![CDATA[  ROUND(tb.couponAmount/tb.`zkPrice`*100,2) <= ${endPropor} ]]>
             </if>
              <!-- 有优惠券    -->
             <if test='hasCoupon == 1'>
                    AND <![CDATA[  tb.`couponAmount` > 0 ]]>
             </if>
             <!-- 包邮    -->
             <if test='freeShipment == 1'>
                    AND tb.`freeShipment` = 1
             </if>
             <!-- 消费者保障    -->
             <if test='isPrepay == 1'>
                    AND tb.`isPrepay` = 1
             </if>
             <!-- 成交转化    -->
             <if test='payRate30 == 1'>
                    AND tb.`payRate30` = 1
             </if>
             <!-- 好评率    -->
             <if test='goodRate == 1'>
                    AND tb.`goodRate` = 1
             </if>
             <!-- 退款率    -->
             <if test='rfdRate == 1'>
                    AND tb.`rfdRate` = 1
             </if>
            <!-- 分类id    -->
             <if test='gcid != null'>
                    AND tt.sg_class_id = #{gcid}
             </if>
             <!--  搜索条件: 商品名称、商品id、标签名称  -->
             <if test='key != null and key != ""'>
                <if test='keyType == 1'>
                    AND tb.`auctionId` = '${key}'
                </if>
                <if test='keyType == 2'>
                    AND tb.`title` LIKE '%${key}%'
                </if>
                <if test='keyType == 3'>
                    AND lab.`lab_title` = '${key}'
                </if>
            </if>
             ) a LEFT JOIN yeshi_ec_quality_factory ts ON ts.`sg_id`=a.id
            <trim prefix="sg_goods_source =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.goodsSource !=null">
                        when sg_id=#{item.id} then #{item.goodsSource}
                    </if>
                </foreach>
            </trim>
            <trim prefix="sg_rule_id =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.boutiqueAutoRule !=null">
                        when sg_id=#{item.id} then #{item.boutiqueAutoRule.id}
                    </if>
                </foreach>
            </trim>
            <trim prefix="sg_source_calss =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.sourceCalss !=null">
                        when sg_id=#{item.id} then #{item.sourceCalss}
                    </if>
                </foreach>
            </trim>
            <trim prefix="sg_createtime =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.createtime !=null">
                        when sg_id=#{item.id} then #{item.createtime}
                    </if>
                </foreach>
            </trim>
            <trim prefix="sg_updatetime =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.updatetime !=null">
                        when sg_id=#{item.id} then #{item.updatetime}
                    </if>
                </foreach>
            </trim>
        </trim>
        where sg_id in
        <foreach collection="list" index="index" item="item"
            separator="," open="(" close=")">
            #{item.id,jdbcType=BIGINT}
        </foreach>
    </update>
    <!-- 查询所有商品信息 更新时间较早在前 -->
    <select id="queryAll" resultMap="BaseResultMap">
        SELECT * FROM yeshi_ec_quality_factory
        <if test="days != null">
            WHERE DATE_SUB(CURDATE(), INTERVAL ${days} DAY) >
            DATE(lab_updatetime);
        </if>
        order by sg_updatetime LIMIT ${start},${count}
    </select>
      <!--查询精选商品信息-->
   <select id="queryByGoodsId" resultMap="BaseResultMap">
          SELECT <include refid="Base_Column_List" /> FROM  yeshi_ec_quality_factory WHERE  sg_goods_id = ${goodsId}
    <!-- 查询超过hour个小时未更新商品,进行更新 -->
    <select id="queryNeedUpdate" resultType="java.lang.Long">
        SELECT h.sg_goods_id FROM `yeshi_ec_quality_factory` h
        LEFT JOIN
        `yeshi_ec_taobao_goods` tb ON h.`sg_goods_id` = tb.id
        WHERE <![CDATA[TO_DAYS(tb.`updatetime`) < TO_DAYS(NOW()) OR (HOUR(NOW()) -HOUR(tb.`updatetime`)) >=  #{hour}]]>
        order by h.`sg_updatetime` LIMIT ${start},${count}
    </select>
    <!-- 查询超过5个小时未更新商品,进行更新 -->
    <select id="countQueryNeedUpdate" resultType="java.lang.Long">
        SELECT count(sg_id) FROM `yeshi_ec_quality_factory` h
        LEFT JOIN
        `yeshi_ec_taobao_goods` tb ON h.`sg_goods_id` = tb.id
        WHERE <![CDATA[TO_DAYS(tb.`updatetime`) < TO_DAYS(NOW()) OR (HOUR(NOW()) -HOUR(tb.`updatetime`)) >= 4]]>
    </select>
    <!-- 查询精选商品信息 -->
    <select id="query" resultMap="ResultMap">
        SELECT ts.* FROM (
        SELECT DISTINCT( tt.`sg_id`) AS id FROM
        yeshi_ec_quality_factory tt
        LEFT JOIN yeshi_ec_taobao_goods tb ON
        tt.`sg_goods_id`= tb.`id`
        <if test='keyType == 3'>
            LEFT JOIN yeshi_ec_label_goods lg ON tt.`sg_goods_id` =
            lg.`lg_goods_id`
            LEFT JOIN yeshi_ec_label lab ON lg.`lg_label_id` =
            lab.`lab_id`
        </if>
        WHERE 1=1
        <if test="goodsSource != null">
            <!-- 来源 -->
            AND tt.`sg_goods_source` = ${goodsSource}
        </if>
        <if test="days != null">
            <!-- 入库时间 -->
            AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) >= tt.`sg_createtime`]]>
        </if>
        <!-- 在售价范围 -->
        <if test='startZkPrice != null'>
            AND <![CDATA[  tb.`zkPrice` >= ${startZkPrice} ]]>
        </if>
        <if test='endZkPrice != null'>
            AND <![CDATA[  tb.`zkPrice` <= ${endZkPrice} ]]>
        </if>
        <!-- 月销量 -->
        <if test='startBiz30day != null'>
            AND <![CDATA[  tb.`biz30day` >= ${startBiz30day} ]]>
        </if>
        <if test='endBiz30day != null'>
            AND <![CDATA[  tb.`biz30day` <= ${endBiz30day} ]]>
        </if>
        <!-- 权重范围 -->
        <if test='startWeight != null'>
            AND <![CDATA[   tt.`sg_weight` >= ${startWeight} ]]>
        </if>
        <if test='endWeight != null'>
            AND <![CDATA[   tt.`sg_weight` <= ${endWeight} ]]>
        </if>
        <!-- 佣金比例范围 -->
        <if test='startTkRate != null'>
            AND <![CDATA[   tb.`tkRate` >= ${startTkRate} ]]>
        </if>
        <if test='endTkRate != null'>
            AND <![CDATA[   tb.`tkRate` <= ${endTkRate} ]]>
        </if>
        <!-- 券面额:减多少 -->
        <if test='startAmount != null'>
            AND <![CDATA[   tb.`couponAmount` >= ${startAmount} ]]>
        </if>
        <if test='endAmount != null'>
            AND <![CDATA[   tb.`couponAmount` <= ${endAmount} ]]>
        </if>
        <!-- 券比例 -->
        <if test='startPropor != null'>
            AND <![CDATA[   ROUND(tb.couponAmount/tb.`zkPrice`*100,2) >= ${startPropor} ]]>
        </if>
        <!-- 券比例 -->
        <if test='endPropor != null'>
            AND <![CDATA[  ROUND(tb.couponAmount/tb.`zkPrice`*100,2) <= ${endPropor} ]]>
        </if>
        <!-- 有优惠券 -->
        <if test='hasCoupon == 1'>
            AND <![CDATA[  tb.`couponAmount` > 0 ]]>
        </if>
        <!-- 包邮 -->
        <if test='freeShipment == 1'>
            AND tb.`freeShipment` = 1
        </if>
        <!-- 消费者保障 -->
        <if test='isPrepay == 1'>
            AND tb.`isPrepay` = 1
        </if>
        <!-- 成交转化 -->
        <if test='payRate30 == 1'>
            AND tb.`payRate30` = 1
        </if>
        <!-- 好评率 -->
        <if test='goodRate == 1'>
            AND tb.`goodRate` = 1
        </if>
        <!-- 退款率 -->
        <if test='rfdRate == 1'>
            AND tb.`rfdRate` = 1
        </if>
        <!-- 分类id -->
        <if test='gcid != null'>
            AND tt.sg_class_id = #{gcid}
        </if>
        <!-- 搜索条件: 商品名称、商品id、标签名称 -->
        <if test='key != null and key != ""'>
            <if test='keyType == 1'>
                AND tb.`auctionId` = '${key}'
            </if>
            <if test='keyType == 2'>
                AND tb.`title` LIKE '%${key}%'
            </if>
            <if test='keyType == 3'>
                AND lab.`lab_title` = '${key}'
            </if>
        </if>
        ORDER BY
        <!-- 销量 -->
        <if test='totalSales == 1'>
            tb.`biz30day`,
        </if>
        <if test='totalSales == 2'>
            tb.`biz30day` desc,
        </if>
        <!-- 价格 -->
        <if test='price == 1'>
            tb.`zkPrice`,
        </if>
        <if test='price == 2'>
            tb.`zkPrice` desc,
        </if>
        <!-- 价格 -->
        <if test='tkRate == 1'>
            tb.`tkRate`,
        </if>
        <if test='tkRate == 2'>
            tb.`tkRate` desc,
        </if>
        <!-- 券比例 -->
        <if test='propor == 1'>
            ROUND(tb.couponAmount/tb.`zkPrice` *100,2),
        </if>
        <if test='propor == 2'>
            ROUND(tb.couponAmount/tb.`zkPrice` *100,2) desc,
        </if>
        tt.`sg_updatetime` desc
        LIMIT ${start},${count}
        ) a LEFT JOIN
        yeshi_ec_quality_factory ts ON ts.`sg_id`=a.id
    </select>
    <select id="queryCount" resultType="java.lang.Long">
        <!-- 根据条件统计所有标签数量 -->
        SELECT count(ts.sg_id) FROM (
        SELECT DISTINCT( tt.`sg_id`) AS id FROM
        yeshi_ec_quality_factory tt
        LEFT JOIN yeshi_ec_taobao_goods tb ON
        tt.`sg_goods_id`= tb.`id`
        <if test='keyType == 3'>
            LEFT JOIN yeshi_ec_label_goods lg ON tt.`sg_goods_id` =
            lg.`lg_goods_id`
            LEFT JOIN yeshi_ec_label lab ON lg.`lg_label_id` =
            lab.`lab_id`
        </if>
        WHERE 1=1
        <if test="goodsSource != null">
            <!-- 来源 -->
            AND tt.`sg_goods_source` = ${goodsSource}
        </if>
        <if test="days != null">
            <!-- 入库时间 -->
            AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) >= tt.`sg_createtime`]]>
        </if>
        <!-- 在售价范围 -->
        <if test='startZkPrice != null'>
            AND <![CDATA[  tb.`zkPrice` >= ${startZkPrice} ]]>
        </if>
        <if test='endZkPrice != null'>
            AND <![CDATA[  tb.`zkPrice` <= ${endZkPrice} ]]>
        </if>
        <!-- 月销量 -->
        <if test='startBiz30day != null'>
            AND <![CDATA[  tb.`biz30day` >= ${startBiz30day} ]]>
        </if>
        <if test='endBiz30day != null'>
            AND <![CDATA[  tb.`biz30day` <= ${endBiz30day} ]]>
        </if>
        <!-- 权重范围 -->
        <if test='startWeight != null'>
            AND <![CDATA[   tt.`sg_weight` >= ${startWeight} ]]>
        </if>
        <if test='endWeight != null'>
            AND <![CDATA[   tt.`sg_weight` <= ${endWeight} ]]>
        </if>
        <!-- 佣金比例范围 -->
        <if test='startTkRate != null'>
            AND <![CDATA[   tb.`tkRate` >= ${startTkRate} ]]>
        </if>
        <if test='endTkRate != null'>
            AND <![CDATA[   tb.`tkRate` <= ${endTkRate} ]]>
        </if>
        <!-- 券面额:减多少 -->
        <if test='startAmount != null'>
            AND <![CDATA[   tb.`couponAmount` >= ${startAmount} ]]>
        </if>
        <if test='endAmount != null'>
            AND <![CDATA[   tb.`couponAmount` <= ${endAmount} ]]>
        </if>
        <!-- 券比例 -->
        <if test='startPropor != null'>
            AND <![CDATA[   ROUND(tb.couponAmount/tb.`zkPrice`*100,2) >= ${startPropor} ]]>
        </if>
        <!-- 券比例 -->
        <if test='endPropor != null'>
            AND <![CDATA[  ROUND(tb.couponAmount/tb.`zkPrice`*100,2) <= ${endPropor} ]]>
        </if>
        <!-- 有优惠券 -->
        <if test='hasCoupon == 1'>
            AND <![CDATA[  tb.`couponAmount` > 0 ]]>
        </if>
        <!-- 包邮 -->
        <if test='freeShipment == 1'>
            AND tb.`freeShipment` = 1
        </if>
        <!-- 消费者保障 -->
        <if test='isPrepay == 1'>
            AND tb.`isPrepay` = 1
        </if>
        <!-- 成交转化 -->
        <if test='payRate30 == 1'>
            AND tb.`payRate30` = 1
        </if>
        <!-- 好评率 -->
        <if test='goodRate == 1'>
            AND tb.`goodRate` = 1
        </if>
        <!-- 退款率 -->
        <if test='rfdRate == 1'>
            AND tb.`rfdRate` = 1
        </if>
        <!-- 分类id -->
        <if test='gcid != null'>
            AND tt.sg_class_id = #{gcid}
        </if>
        <!-- 搜索条件: 商品名称、商品id、标签名称 -->
        <if test='key != null and key != ""'>
            <if test='keyType == 1'>
                AND tb.`auctionId` = '${key}'
            </if>
            <if test='keyType == 2'>
                AND tb.`title` LIKE '%${key}%'
            </if>
            <if test='keyType == 3'>
                AND lab.`lab_title` = '${key}'
            </if>
        </if>
        ) a LEFT JOIN yeshi_ec_quality_factory ts ON ts.`sg_id`=a.id
    </select>
    <!--查询精选商品信息 -->
    <select id="queryByGoodsId" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List" />
        FROM yeshi_ec_quality_factory WHERE sg_goods_id = ${goodsId}
    </select>
    <select id="queryCountByGoodsId" resultType="java.lang.Long">
          SELECT COUNT(sg_id) FROM  yeshi_ec_quality_factory WHERE  sg_goods_id = ${goodsId}
        SELECT COUNT(sg_id)
        FROM yeshi_ec_quality_factory WHERE sg_goods_id =
        ${goodsId}
    </select>
      <select id="getCountAll" resultType="java.util.HashMap">
      <!-- 统计今日各种方式录入数量 -->
         SELECT  COUNT(sg_id) AS total, IFNULL(SUM(CASE WHEN sg_entry_mode = 1 THEN 1 ELSE 0 END),0) AS totalMANUAL,
            IFNULL(SUM(CASE WHEN sg_entry_mode = 2 THEN 1 ELSE 0 END),0) AS totalSYSTEM,
            IFNULL(SUM(CASE WHEN sg_entry_mode = 3 THEN 1 ELSE 0 END),0) AS totalSEARCH,
            IFNULL(SUM(CASE WHEN sg_goods_source = 1 THEN 1 ELSE 0 END),0) AS totalTB,
            IFNULL(SUM(CASE WHEN sg_goods_source = 2 THEN 1 ELSE 0 END),0) AS totalJD,
            IFNULL(SUM(CASE WHEN sg_goods_source = 3 THEN 1 ELSE 0 END),0) AS totalPDD,
            IFNULL(SUM(CASE WHEN sg_goods_source = 4 THEN 1 ELSE 0 END),0) AS totalWPH
    <select id="getCountAll" resultType="java.util.HashMap">
        <!-- 统计今日各种方式录入数量 -->
        SELECT COUNT(sg_id) AS total, IFNULL(SUM(CASE WHEN sg_entry_mode = 1
        THEN 1 ELSE 0 END),0) AS totalMANUAL,
        IFNULL(SUM(CASE WHEN
        sg_entry_mode = 2 THEN 1 ELSE 0 END),0) AS totalSYSTEM,
        IFNULL(SUM(CASE WHEN sg_entry_mode = 3 THEN 1 ELSE 0 END),0) AS
        totalSEARCH,
        IFNULL(SUM(CASE WHEN sg_goods_source = 1 THEN 1 ELSE 0
        END),0) AS totalTB,
        IFNULL(SUM(CASE WHEN sg_goods_source = 2 THEN 1
        ELSE 0 END),0) AS
        totalJD,
        IFNULL(SUM(CASE WHEN sg_goods_source = 3 THEN
        1 ELSE 0 END),0) AS totalPDD,
        IFNULL(SUM(CASE WHEN sg_goods_source = 4
        THEN 1 ELSE 0 END),0) AS
        totalWPH
        FROM yeshi_ec_quality_factory
    </select>
     <delete id="deleteByGoodsId" parameterType="java.lang.Long">
         delete from yeshi_ec_quality_factory where sg_goods_id = #{goodsId,jdbcType=BIGINT}
     </delete>
      <select id="countTotalRows" resultType="java.lang.Long">
          SELECT COUNT(sg_id) FROM  yeshi_ec_quality_factory
              <if test="days != null">
                    WHERE DATE_SUB(CURDATE(), INTERVAL ${days} DAY) > DATE(lab_updatetime);
                </if>
      </select>
      <select id="listQuery" resultMap="BaseResultMap">
          <!-- 移动查询 -->
           SELECT * FROM `yeshi_ec_quality_factory` h
               <if test="labId != null">
                LEFT JOIN `yeshi_ec_label_goods` g ON h.`sg_goods_id` = g.`lg_goods_id`
            </if>
                <!-- 商品关键词 -->
            LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
        WHERE 1=1
    <delete id="deleteByGoodsId" parameterType="java.lang.Long">
        delete from
        yeshi_ec_quality_factory where sg_goods_id =
        #{goodsId,jdbcType=BIGINT}
    </delete>
    <select id="countTotalRows" resultType="java.lang.Long">
        SELECT COUNT(sg_id) FROM yeshi_ec_quality_factory
        <if test="days != null">
            WHERE DATE_SUB(CURDATE(), INTERVAL ${days} DAY) >
            DATE(lab_updatetime);
        </if>
    </select>
    <select id="listQuery" resultMap="BaseResultMap">
        <!-- 移动查询 -->
        SELECT * FROM `yeshi_ec_quality_factory` h
        <if test="labId != null">
            LEFT JOIN `yeshi_ec_label_goods` g ON h.`sg_goods_id` =
            g.`lg_goods_id`
        </if>
        <!-- 商品关键词 -->
        LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
        WHERE
        1=1
        <!-- 商品关键词 -->
        <if test='key != null and key != ""'>
             AND tb.`title` LIKE '%${key}%'
            AND tb.`title` LIKE '%${key}%'
        </if>
        <!-- 分类id-->
        <!-- 分类id -->
        <if test="systemCid != null">
            AND h.`sg_class_id` = ${systemCid}
            AND h.`sg_class_id` = ${systemCid}
        </if>
        <!-- 标签id -->
        <if test="labId != null">
            AND g.`lg_label_id`= ${labId}
        </if>
         <!-- 多个分类id -->
        <!-- 多个分类id -->
        <if test='cids != null and cids != ""'>
                   AND h.`sg_class_id`  in (${cids})
            </if>
           <!-- 有券 -->
            AND h.`sg_class_id` in (${cids})
        </if>
        <!-- 有券 -->
        <if test="hasQuan == 1 ">
            AND <![CDATA[tb.couponInfo is not null AND tb.couponInfo <> '']]>
        </if>
        <!-- 排序:权重 销量 -->
        ORDER BY h.sg_weight desc,tb.`biz30day`desc
        LIMIT ${start},${count}
    </select>
    <select id="countQuery" resultType="java.lang.Long">
        <!-- 移动统计 -->
           SELECT IFNULL(COUNT( h.`sg_id`),0) FROM `yeshi_ec_quality_factory` h
               <if test="labId != null">
                LEFT JOIN `yeshi_ec_label_goods` g ON h.`sg_goods_id` = g.`lg_goods_id`
            </if>
            LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
        WHERE 1=1
        SELECT IFNULL(COUNT( h.`sg_id`),0) FROM `yeshi_ec_quality_factory` h
        <if test="labId != null">
            LEFT JOIN `yeshi_ec_label_goods` g ON h.`sg_goods_id` =
            g.`lg_goods_id`
        </if>
        LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
        WHERE
        1=1
        <!-- 商品关键词 -->
        <if test='key != null and key != ""'>
             AND tb.`title` LIKE '%${key}%'
            AND tb.`title` LIKE '%${key}%'
        </if>
        <!-- 分类id-->
        <!-- 分类id -->
        <if test="systemCid != null">
            AND h.`sg_class_id` = #{systemCid}
            AND h.`sg_class_id` = #{systemCid}
        </if>
        <!-- 标签id -->
        <if test="labId != null">
            AND g.`lg_label_id`= #{labId}
        </if>
        <if test='cids != null and cids != ""'>
               AND h.`sg_class_id`  in (#{cids})
            </if>
            <!-- 有券 -->
            AND h.`sg_class_id` in (#{cids})
        </if>
        <!-- 有券 -->
        <if test="hasQuan == 1 ">
            AND <![CDATA[tb.couponInfo is not null AND tb.couponInfo <>'']]>
        </if>
    </select>
    <select id="listQueryEverydayRob" resultMap="BaseResultMap">
          <!-- 移动查询每日必抢 -->
           SELECT * FROM `yeshi_ec_quality_factory` h
                LEFT JOIN `yeshi_ec_label_goods` g ON h.`sg_goods_id` = g.`lg_goods_id`
            LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
        WHERE  g.`lg_label_id`= #{labId} AND TO_DAYS(h.`sg_updatetime`) = TO_DAYS(NOW())
        <!-- 分类id-->
        <!-- 移动查询每日必抢 -->
        SELECT * FROM `yeshi_ec_quality_factory` h
        LEFT JOIN
        `yeshi_ec_label_goods` g ON h.`sg_goods_id` = g.`lg_goods_id`
        LEFT JOIN
        yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
        WHERE
        g.`lg_label_id`= #{labId} AND TO_DAYS(h.`sg_updatetime`) =
        TO_DAYS(NOW())
        <!-- 分类id -->
        <if test="systemCid != null">
            AND h.`sg_class_id` = #{systemCid}
            AND h.`sg_class_id` = #{systemCid}
        </if>
        <if test="startCouponAmount != null">
            <![CDATA[ AND tb.couponAmount > #{startCouponAmount} ]]>
        </if>
        <if test="endCouponAmount != null">
            <![CDATA[ AND tb.couponAmount <= #{endCouponAmount}]]>
            <![CDATA[ AND tb.couponAmount <= #{endCouponAmount}]]>
        </if>
        ORDER BY
        ORDER BY
        <if test="sortField == 1">
            h.sg_createtime,
        </if>
@@ -658,520 +737,592 @@
        <if test="sortField == 4">
            h.sg_updatetime desc,
        </if>
        h.sg_weight desc
        LIMIT ${start},${count}
    </select>
    <select id="countQueryEverydayRob" resultType="java.lang.Long">
            <!-- 移动查询每日必抢 -->
           SELECT IFNULL(COUNT( h.`sg_id`),0) FROM `yeshi_ec_quality_factory` h
                LEFT JOIN `yeshi_ec_label_goods` g ON h.`sg_goods_id` = g.`lg_goods_id`
            LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
        WHERE  g.`lg_label_id`= #{labId} AND TO_DAYS(h.`sg_updatetime`) = TO_DAYS(NOW())
        <!-- 移动查询每日必抢 -->
        SELECT IFNULL(COUNT( h.`sg_id`),0) FROM `yeshi_ec_quality_factory` h
        LEFT JOIN `yeshi_ec_label_goods` g ON h.`sg_goods_id` =
        g.`lg_goods_id`
        LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`=
        tb.`id`
        WHERE g.`lg_label_id`= #{labId} AND TO_DAYS(h.`sg_updatetime`)
        =
        TO_DAYS(NOW())
        <if test="systemCid != null">
            AND h.`sg_class_id` = #{systemCid}
            AND h.`sg_class_id` = #{systemCid}
        </if>
        <if test="startCouponAmount != null">
            <![CDATA[ AND tb.couponAmount > #{startCouponAmount} ]]>
        </if>
        <if test="endCouponAmount != null">
            <![CDATA[ AND tb.couponAmount <= #{endCouponAmount}]]>
            <![CDATA[ AND tb.couponAmount <= #{endCouponAmount}]]>
        </if>
    </select>
      <delete id="removeStorageGoods" parameterType="java.lang.Long">
            DELETE FROM yeshi_ec_quality_factory h
          WHERE h.`sg_class_id`= #{gcids} AND <![CDATA[ h.`sg_createtime` < #{doTime} ]]>
        AND h.`sg_goods_id` NOT extsts(SELECT DISTINCT lg.`lg_goods_id` FROM yeshi_ec_label_goods lg)
      </delete>
      <select id="listQueryGoodsByGoodsId" resultMap="BaseResultMap">
    <delete id="removeStorageGoods" parameterType="java.lang.Long">
        DELETE FROM yeshi_ec_quality_factory h
        WHERE h.`sg_class_id`= #{gcids}
        AND <![CDATA[ h.`sg_createtime` < #{doTime} ]]>
        AND h.`sg_goods_id` NOT extsts(SELECT DISTINCT lg.`lg_goods_id` FROM
        yeshi_ec_label_goods lg)
    </delete>
    <select id="listQueryGoodsByGoodsId" resultMap="BaseResultMap">
        <!-- 根据auctionId 查询商品信息 -->
        SELECT    <include refid="Base_Column_List" />FROM yeshi_ec_quality_factory
        SELECT
        <include refid="Base_Column_List" />
        FROM yeshi_ec_quality_factory
        WHERE sg_goods_id in
        <foreach collection="list" item="item" open="(" close=")"
            separator=",">#{item}</foreach>
    </select>
       <select id="listQueryByKey" resultMap="BaseResultMap">
          <!-- 移动查询 -->
           SELECT <include refid="Base_Column_List" /> FROM `yeshi_ec_quality_factory` h
            LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
        WHERE  tb.`title` LIKE '%${key}%'
             <if test="systemCid != null">
                AND h.`sg_class_id` = #{systemCid}
            </if>
            <!-- 有券 -->
            <if test="hasQuan == 1 ">
                AND <![CDATA[tb.couponInfo is not null AND tb.couponInfo <>'']]>
            </if>
            <!-- 天猫 -->
            <if test="userType == 1 ">
                AND tb.userType = #{userType}
            </if>
            <!-- 销量以上 -->
            <if test="biz30day != null ">
                AND <![CDATA[tb.biz30day >= #{biz30day} ]]>
            </if>
            <!-- 在售价范围  -->
             <if test='startprice != null'>
                    AND <![CDATA[  tb.`zkPrice` >= #{startprice} ]]>
             </if>
              <if test='endprice != null'>
                    AND <![CDATA[  tb.`zkPrice` <= #{endprice} ]]>
            </if>
            ORDER BY
            <!-- 销量高到低   -->
             <if test='sort == 1'>
                    tb.`biz30day` desc,
             </if>
             <!-- 价格    -->
             <if test='sort == 3'>
                    tb.`zkPrice`,
             </if>
             <if test='sort == 2'>
                    tb.`zkPrice` desc,
             </if>
              h.`sg_weight` desc
            LIMIT #{start},#{count}
    <select id="listQueryByKey" resultMap="BaseResultMap">
        <!-- 移动查询 -->
        SELECT
        <include refid="Base_Column_List" />
        FROM `yeshi_ec_quality_factory` h
        LEFT JOIN yeshi_ec_taobao_goods tb ON
        h.`sg_goods_id`= tb.`id`
        WHERE tb.`title` LIKE '%${key}%'
        <if test="systemCid != null">
            AND h.`sg_class_id` = #{systemCid}
        </if>
        <!-- 有券 -->
        <if test="hasQuan == 1 ">
            AND <![CDATA[tb.couponInfo is not null AND tb.couponInfo <>'']]>
        </if>
        <!-- 天猫 -->
        <if test="userType == 1 ">
            AND tb.userType = #{userType}
        </if>
        <!-- 销量以上 -->
        <if test="biz30day != null ">
            AND <![CDATA[tb.biz30day >= #{biz30day} ]]>
        </if>
        <!-- 在售价范围 -->
        <if test='startprice != null'>
            AND <![CDATA[  tb.`zkPrice` >= #{startprice} ]]>
        </if>
        <if test='endprice != null'>
            AND <![CDATA[  tb.`zkPrice` <= #{endprice} ]]>
        </if>
        ORDER BY
        <!-- 销量高到低 -->
        <if test='sort == 1'>
            tb.`biz30day` desc,
        </if>
        <!-- 价格 -->
        <if test='sort == 3'>
            tb.`zkPrice`,
        </if>
        <if test='sort == 2'>
            tb.`zkPrice` desc,
        </if>
        h.`sg_weight` desc
        LIMIT #{start},#{count}
    </select>
    <select id="countQueryByKey" resultType="java.lang.Long">
        <!-- 移动统计 -->
           SELECT IFNULL(COUNT( h.`sg_id`),0) FROM `yeshi_ec_quality_factory` h
                LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
        WHERE tb.`title` LIKE '%${key}%'
            <if test="systemCid != null">
                AND h.`sg_class_id` = #{systemCid}
            </if>
            <!-- 有券 -->
            <if test="hasQuan == 1 ">
                AND <![CDATA[tb.couponInfo is not null AND tb.couponInfo <>'']]>
            </if>
            <!-- 天猫 -->
            <if test="userType == 1 ">
                AND tb.userType = #{userType}
            </if>
            <!-- 销量以上 -->
            <if test="biz30day != null ">
                AND <![CDATA[tb.biz30day >= #{biz30day} ]]>
            </if>
            <!-- 在售价范围  -->
             <if test='startprice != null'>
                    AND <![CDATA[  tb.`zkPrice` >= #{startprice} ]]>
             </if>
              <if test='endprice != null'>
                    AND <![CDATA[  tb.`zkPrice` <= #{endprice} ]]>
            </if>
        SELECT IFNULL(COUNT( h.`sg_id`),0) FROM `yeshi_ec_quality_factory` h
        LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
        WHERE
        tb.`title` LIKE '%${key}%'
        <if test="systemCid != null">
            AND h.`sg_class_id` = #{systemCid}
        </if>
        <!-- 有券 -->
        <if test="hasQuan == 1 ">
            AND <![CDATA[tb.couponInfo is not null AND tb.couponInfo <>'']]>
        </if>
        <!-- 天猫 -->
        <if test="userType == 1 ">
            AND tb.userType = #{userType}
        </if>
        <!-- 销量以上 -->
        <if test="biz30day != null ">
            AND <![CDATA[tb.biz30day >= #{biz30day} ]]>
        </if>
        <!-- 在售价范围 -->
        <if test='startprice != null'>
            AND <![CDATA[  tb.`zkPrice` >= #{startprice} ]]>
        </if>
        <if test='endprice != null'>
            AND <![CDATA[  tb.`zkPrice` <= #{endprice} ]]>
        </if>
    </select>
      <select id="listQueryByAuctionId" resultMap="BaseResultMap">
          SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_quality_factory h
            left join  yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`   WHERE tb.auctionId in
            <foreach collection="list" item="item" open="(" close=")"
                separator=",">#{item}</foreach>
      </select>
    <select id="listQueryByCouponAmount" resultMap="BaseResultMap">
           SELECT <include refid="Base_Column_List" /> FROM `yeshi_ec_quality_factory` h
            LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
    <select id="listQueryByAuctionId" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List" />
        FROM yeshi_ec_quality_factory h
        left join yeshi_ec_taobao_goods tb ON
        h.`sg_goods_id`= tb.`id` WHERE
        tb.auctionId in
        <foreach collection="list" item="item" open="(" close=")"
            separator=",">#{item}</foreach>
    </select>
    <select id="listQueryByCouponAmount" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List" />
        FROM `yeshi_ec_quality_factory` h
        LEFT JOIN yeshi_ec_taobao_goods tb ON
        h.`sg_goods_id`= tb.`id`
        WHERE 1=1
        <if test="startAmount != null">
            AND <![CDATA[ tb.`couponAmount` >= #{startAmount}]]>
            AND <![CDATA[ tb.`couponAmount` >= #{startAmount}]]>
        </if>
        <if test="endAmount != null">
            AND <![CDATA[ tb.`couponAmount` < #{endAmount}]]>
        </if>
        <!-- 券比例    -->
         <if test='startPropor != null'>
                   AND <![CDATA[   ROUND(tb.couponAmount/tb.`zkPrice`*100,2) >= #{startPropor} ]]>
         </if>
        <!-- 券比例 -->
        <if test='startPropor != null'>
            AND <![CDATA[   ROUND(tb.couponAmount/tb.`zkPrice`*100,2) >= #{startPropor} ]]>
        </if>
        ORDER BY h.sg_weight desc,tb.`biz30day`desc
        LIMIT #{start},#{count}
    </select>
    <select id="countQueryByCouponAmount" resultType="java.lang.Long">
           SELECT IFNULL(COUNT( h.`sg_id`),0) FROM `yeshi_ec_quality_factory` h
                LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
        WHERE 1=1
        SELECT IFNULL(COUNT( h.`sg_id`),0) FROM `yeshi_ec_quality_factory` h
        LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
        WHERE
        1=1
        <if test="startAmount != null">
            AND <![CDATA[ tb.`couponAmount` >= #{startAmount}]]>
            AND <![CDATA[ tb.`couponAmount` >= #{startAmount}]]>
        </if>
        <if test="endAmount != null">
            AND <![CDATA[ tb.`couponAmount` < #{endAmount}]]>
        </if>
        <!-- 券比例    -->
         <if test='startPropor != null'>
                   AND <![CDATA[   ROUND(tb.couponAmount/tb.`zkPrice`*100,2) >= #{startPropor} ]]>
         </if>
        <!-- 券比例 -->
        <if test='startPropor != null'>
            AND <![CDATA[   ROUND(tb.couponAmount/tb.`zkPrice`*100,2) >= #{startPropor} ]]>
        </if>
    </select>
     <select id="listQueryByFlashSale" resultMap="BaseResultMap">
          SELECT <include refid="Base_Column_List" /> FROM  yeshi_ec_quality_factory  h
          RIGHT JOIN yeshi_ec_quality_flash_sale  s  ON h.`sg_id` = s.`fs_qfgoods_id`
          LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
    <select id="listQueryByFlashSale" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List" />
        FROM yeshi_ec_quality_factory h
        RIGHT JOIN yeshi_ec_quality_flash_sale
        s ON h.`sg_id` = s.`fs_qfgoods_id`
        LEFT JOIN yeshi_ec_taobao_goods tb
        ON h.`sg_goods_id`= tb.`id`
        WHERE <![CDATA[ tb.`couponTotalCount` > 0 AND tb.couponLeftCount<tb.couponTotalCount ]]>
        ORDER BY (tb.couponLeftCount/tb.couponTotalCount),s.fs_weight desc
        LIMIT ${start},${count}
    </select>
    <select id="countQueryByFlashSale" resultType="java.lang.Long">
        SELECT IFNULL(COUNT( h.`sg_id`),0) FROM  yeshi_ec_quality_factory  h
          RIGHT JOIN yeshi_ec_quality_flash_sale  s  ON h.`sg_id` = s.`fs_qfgoods_id`
          LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
        SELECT IFNULL(COUNT( h.`sg_id`),0) FROM yeshi_ec_quality_factory h
        RIGHT JOIN yeshi_ec_quality_flash_sale s ON h.`sg_id` =
        s.`fs_qfgoods_id`
        LEFT JOIN yeshi_ec_taobao_goods tb ON
        h.`sg_goods_id`= tb.`id`
        WHERE <![CDATA[ tb.`couponTotalCount` > 0  AND tb.couponLeftCount<tb.couponTotalCount]]>
    </select>
        <!-- 查询精选商品信息     -->
  <select id="listQueryByKeyAndlabIDs" resultMap="BaseResultMap">
           SELECT ts.* FROM (
            SELECT DISTINCT( tt.`sg_id`) AS id  FROM yeshi_ec_quality_factory tt
            LEFT JOIN yeshi_ec_taobao_goods tb ON tt.`sg_goods_id`= tb.`id`
            LEFT JOIN yeshi_ec_label_goods lg ON tt.`sg_goods_id` = lg.`lg_goods_id`
             WHERE (tb.`title` LIKE '%${key}%' OR lg.`lg_label_id` IN
                <foreach collection="list" item="item" open="(" close=")"
                    separator=",">#{item}</foreach>
                  )
             <if test="systemCid != null">
                AND tt.`sg_class_id` = #{systemCid}
            </if>
            <!-- 有券 -->
            <if test="hasQuan == 1 ">
                AND <![CDATA[tb.couponInfo is not null AND tb.couponInfo <>'']]>
            </if>
            <!-- 天猫 -->
            <if test="userType == 1 ">
                AND tb.userType = #{userType}
            </if>
            <!-- 销量以上 -->
            <if test="biz30day != null ">
                AND <![CDATA[tb.biz30day >= #{biz30day} ]]>
            </if>
            <!-- 在售价范围  -->
             <if test='startprice != null'>
                    AND <![CDATA[  tb.`zkPrice` >= #{startprice} ]]>
             </if>
              <if test='endprice != null'>
                    AND <![CDATA[  tb.`zkPrice` <= #{endprice} ]]>
            </if>
             ORDER BY
             <!-- 销量高到低   -->
             <if test='sort == 1'>
                    tb.`biz30day` desc,
             </if>
             <!-- 价格    -->
             <if test='sort == 3'>
                    tb.`zkPrice`,
             </if>
             <if test='sort == 2'>
                    tb.`zkPrice` desc,
             </if>
             <if test='sort == 4'>
                    tb.`tkRate` desc,
             </if>
              tt.`sg_weight` desc
              LIMIT ${start},${count}
             ) a LEFT JOIN yeshi_ec_quality_factory ts ON ts.`sg_id`=a.id
   </select>
    <select id="countQueryKeyAndlabIDs" resultType="java.lang.Long">
       <!-- 根据条件统计所有标签数量 -->
       SELECT  count(ts.sg_id)  FROM (
            SELECT DISTINCT(tt.`sg_id`) AS id FROM yeshi_ec_quality_factory tt
            LEFT JOIN yeshi_ec_taobao_goods tb ON tt.`sg_goods_id`= tb.`id`
            LEFT JOIN yeshi_ec_label_goods lg ON tt.`sg_goods_id` = lg.`lg_goods_id`
             WHERE (tb.`title` LIKE '%${key}%' OR lg.`lg_label_id` IN
                <foreach collection="list" item="item" open="(" close=")"
                    separator=",">#{item}</foreach>
                  )
            <if test="systemCid != null">
                AND tt.`sg_class_id` = #{systemCid}
            </if>
            <!-- 有券 -->
            <if test="hasQuan == 1 ">
                AND <![CDATA[tb.couponInfo is not null AND tb.couponInfo <>'']]>
            </if>
            <!-- 天猫 -->
            <if test="userType == 1 ">
                AND tb.userType = #{userType}
            </if>
            <!-- 销量以上 -->
            <if test="biz30day != null ">
                AND <![CDATA[tb.biz30day >= #{biz30day} ]]>
            </if>
            <!-- 在售价范围  -->
             <if test='startprice != null'>
                    AND <![CDATA[  tb.`zkPrice` >= #{startprice} ]]>
             </if>
              <if test='endprice != null'>
                    AND <![CDATA[  tb.`zkPrice` <= #{endprice} ]]>
            </if>
             ) a LEFT JOIN yeshi_ec_quality_factory ts ON ts.`sg_id`=a.id
    <!-- 查询精选商品信息 -->
    <select id="listQueryByKeyAndlabIDs" resultMap="BaseResultMap">
        SELECT ts.* FROM (
        SELECT DISTINCT( tt.`sg_id`) AS id FROM
        yeshi_ec_quality_factory tt
        LEFT JOIN yeshi_ec_taobao_goods tb ON
        tt.`sg_goods_id`= tb.`id`
        LEFT JOIN yeshi_ec_label_goods lg ON
        tt.`sg_goods_id` = lg.`lg_goods_id`
        WHERE (tb.`title` LIKE '%${key}%'
        OR lg.`lg_label_id` IN
        <foreach collection="list" item="item" open="(" close=")"
            separator=",">#{item}</foreach>
        )
        <if test="systemCid != null">
            AND tt.`sg_class_id` = #{systemCid}
        </if>
        <!-- 有券 -->
        <if test="hasQuan == 1 ">
            AND <![CDATA[tb.couponInfo is not null AND tb.couponInfo <>'']]>
        </if>
        <!-- 天猫 -->
        <if test="userType == 1 ">
            AND tb.userType = #{userType}
        </if>
        <!-- 销量以上 -->
        <if test="biz30day != null ">
            AND <![CDATA[tb.biz30day >= #{biz30day} ]]>
        </if>
        <!-- 在售价范围 -->
        <if test='startprice != null'>
            AND <![CDATA[  tb.`zkPrice` >= #{startprice} ]]>
        </if>
        <if test='endprice != null'>
            AND <![CDATA[  tb.`zkPrice` <= #{endprice} ]]>
        </if>
        ORDER BY
        <!-- 销量高到低 -->
        <if test='sort == 1'>
            tb.`biz30day` desc,
        </if>
        <!-- 价格 -->
        <if test='sort == 3'>
            tb.`zkPrice`,
        </if>
        <if test='sort == 2'>
            tb.`zkPrice` desc,
        </if>
        <if test='sort == 4'>
            tb.`tkRate` desc,
        </if>
        tt.`sg_weight` desc
        LIMIT ${start},${count}
        ) a LEFT JOIN
        yeshi_ec_quality_factory ts ON ts.`sg_id`=a.id
    </select>
     <select id="listQueryByRebateAmount" resultMap="BaseResultMap">
           SELECT <include refid="Base_Column_List" /> FROM `yeshi_ec_quality_factory` h
            LEFT JOIN
            (SELECT tb.`id`,tb.biz30day,(CASE WHEN<![CDATA[ tb.`zkPrice` < tb.`couponStartFee`]]>   THEN tb.`zkPrice` * tb.`tkRate`/10000*#{proportion}
                 ELSE (tb.`zkPrice`-tb.`couponAmount`) * tb.`tkRate`/10000*#{proportion} END)AS RateAmount FROM  yeshi_ec_taobao_goods tb
                 where tb.tkRate > #{tkRate})g
              ON h.`sg_goods_id`= g.`id`
    <select id="countQueryKeyAndlabIDs" resultType="java.lang.Long">
        <!-- 根据条件统计所有标签数量 -->
        SELECT count(ts.sg_id) FROM (
        SELECT DISTINCT(tt.`sg_id`) AS id FROM
        yeshi_ec_quality_factory tt
        LEFT JOIN yeshi_ec_taobao_goods tb ON
        tt.`sg_goods_id`= tb.`id`
        LEFT JOIN yeshi_ec_label_goods lg ON
        tt.`sg_goods_id` = lg.`lg_goods_id`
        WHERE (tb.`title` LIKE '%${key}%'
        OR lg.`lg_label_id` IN
        <foreach collection="list" item="item" open="(" close=")"
            separator=",">#{item}</foreach>
        )
        <if test="systemCid != null">
            AND tt.`sg_class_id` = #{systemCid}
        </if>
        <!-- 有券 -->
        <if test="hasQuan == 1 ">
            AND <![CDATA[tb.couponInfo is not null AND tb.couponInfo <>'']]>
        </if>
        <!-- 天猫 -->
        <if test="userType == 1 ">
            AND tb.userType = #{userType}
        </if>
        <!-- 销量以上 -->
        <if test="biz30day != null ">
            AND <![CDATA[tb.biz30day >= #{biz30day} ]]>
        </if>
        <!-- 在售价范围 -->
        <if test='startprice != null'>
            AND <![CDATA[  tb.`zkPrice` >= #{startprice} ]]>
        </if>
        <if test='endprice != null'>
            AND <![CDATA[  tb.`zkPrice` <= #{endprice} ]]>
        </if>
        ) a LEFT JOIN yeshi_ec_quality_factory ts ON ts.`sg_id`=a.id
    </select>
    <select id="listQueryByRebateAmount" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List" />
        FROM `yeshi_ec_quality_factory` h
        LEFT JOIN
        (SELECT
        tb.`id`,tb.biz30day,(CASE WHEN<![CDATA[ tb.`zkPrice` < tb.`couponStartFee`]]>
        THEN tb.`zkPrice` * tb.`tkRate`/10000*#{proportion}
        ELSE
        (tb.`zkPrice`-tb.`couponAmount`) * tb.`tkRate`/10000*#{proportion}
        END)AS RateAmount FROM yeshi_ec_taobao_goods tb
        where tb.tkRate >
        #{tkRate})g
        ON h.`sg_goods_id`= g.`id`
        WHERE 1=1
        <if test="startAmount != null">
            AND <![CDATA[ g.rateAmount >= #{startAmount} ]]>
            AND <![CDATA[ g.rateAmount >= #{startAmount} ]]>
        </if>
        <if test="endAmount != null">
            AND <![CDATA[ g.rateAmount < #{endAmount} ]]>
        </if>
        ORDER BY g.biz30day desc
        LIMIT #{start},#{count}
    </select>
    <select id="countQueryByRebateAmount" resultType="java.lang.Long">
           SELECT IFNULL(COUNT( h.`sg_id`),0) FROM `yeshi_ec_quality_factory` h
        LEFT JOIN
            (SELECT tb.`id`,(CASE WHEN <![CDATA[tb.`zkPrice` < tb.`couponStartFee`]]>  THEN tb.`zkPrice` * tb.`tkRate`/10000*#{proportion}
                 ELSE (tb.`zkPrice`-tb.`couponAmount`) * tb.`tkRate`/10000*#{proportion} END)AS RateAmount FROM  yeshi_ec_taobao_goods tb
                 where tb.tkRate > #{tkRate})g
              ON h.`sg_goods_id`= g.`id`
        SELECT IFNULL(COUNT( h.`sg_id`),0) FROM `yeshi_ec_quality_factory` h
        LEFT JOIN
        (SELECT tb.`id`,(CASE WHEN <![CDATA[tb.`zkPrice` < tb.`couponStartFee`]]>
        THEN tb.`zkPrice` * tb.`tkRate`/10000*#{proportion}
        ELSE
        (tb.`zkPrice`-tb.`couponAmount`) * tb.`tkRate`/10000*#{proportion}
        END)AS RateAmount FROM yeshi_ec_taobao_goods tb
        where tb.tkRate >
        #{tkRate})g
        ON h.`sg_goods_id`= g.`id`
        WHERE 1=1
        <if test="startAmount != null">
            AND <![CDATA[ g.rateAmount >= #{startAmount} ]]>
            AND <![CDATA[ g.rateAmount >= #{startAmount} ]]>
        </if>
        <if test="endAmount != null">
            AND <![CDATA[ g.rateAmount < #{endAmount} ]]>
        </if>
    </select>
     <select id="getAuctionIdbyClassId" resultType="java.lang.Long">
           SELECT tb.`id` FROM `yeshi_ec_quality_factory` h
        LEFT JOIN `yeshi_ec_taobao_goods` tb ON h.`sg_goods_id` = tb.`id`
        WHERE  h.`sg_class_id` = #{systemCid} AND h.`sg_goods_source` = #{goodsSource}
            AND <![CDATA[h.`sg_createtime` < '${beforeTime}']]>
            AND NOT EXISTS(SELECT lg_goods_id FROM `yeshi_ec_label_goods` lb WHERE lb.`lg_goods_id` = tb.`id`)
    <select id="getAuctionIdbyClassId" resultType="java.lang.Long">
        SELECT tb.`id` FROM `yeshi_ec_quality_factory` h
        LEFT JOIN
        `yeshi_ec_taobao_goods` tb ON h.`sg_goods_id` = tb.`id`
        WHERE
        h.`sg_class_id` = #{systemCid} AND h.`sg_goods_source` =
        #{goodsSource}
        AND <![CDATA[h.`sg_createtime` < '${beforeTime}']]>
        AND NOT EXISTS(SELECT lg_goods_id FROM `yeshi_ec_label_goods` lb WHERE
        lb.`lg_goods_id` = tb.`id`)
    </select>
         <!-- 查询超过4个小时未更新商品,进行更新  -->
  <select id="updateWeight">
     UPDATE yeshi_ec_quality_factory SET sg_weight = #{weight}
     WHERE <![CDATA[TO_DAYS(`sg_updatetime`) < TO_DAYS(NOW()) OR (HOUR(NOW()) -HOUR(`sg_updatetime`)) >= #{time} ]]>
   </select>
  <select id="listRecommendToIndex" resultMap="BaseResultMap">
           SELECT <include refid="Base_Column_List" /> FROM `yeshi_ec_quality_factory` h
        LEFT JOIN
            (SELECT tb.`id`,tb.tkRate,
    <!-- 查询超过4个小时未更新商品,进行更新 -->
    <select id="updateWeight">
        UPDATE yeshi_ec_quality_factory SET sg_weight = #{weight}
        WHERE <![CDATA[TO_DAYS(`sg_updatetime`) < TO_DAYS(NOW()) OR (HOUR(NOW()) -HOUR(`sg_updatetime`)) >= #{time} ]]>
    </select>
    <select id="listRecommendToIndex" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List" />
        FROM `yeshi_ec_quality_factory` h
        LEFT JOIN
        (SELECT tb.`id`,tb.tkRate,
                <![CDATA[(CASE WHEN  tb.`zkPrice` < tb.`couponStartFee`  THEN tb.`zkPrice` * tb.`tkRate`/10000*#{proportion}
                 ELSE (tb.`zkPrice`-tb.`couponAmount`) * tb.`tkRate`/10000*#{proportion} END)AS rateAmount 
                 FROM  yeshi_ec_taobao_goods tb
                 WHERE tb.tkRate >=  #{tkRate} 
                     AND tb.`couponAmount` >=  #{couponAmount}
                     AND (tb.`couponAmount`/ tb.zkPrice)*100 > #{couponRatio}
                 ]]> )g
          ON h.`sg_goods_id`= g.`id`
        WHERE  <![CDATA[ g.rateAmount >= #{commision} ]]>
                 ]]>
        )g
        ON h.`sg_goods_id`= g.`id`
        WHERE  <![CDATA[ g.rateAmount >= #{commision} ]]>
        ORDER BY h.sg_weight DESC
        LIMIT #{start},#{count}
    </select>
    <select id="countRecommendToIndex" resultType="java.lang.Long">
           SELECT IFNULL(COUNT( h.`sg_id`),0) FROM `yeshi_ec_quality_factory` h
        LEFT JOIN
            (SELECT tb.`id`,tb.tkRate,
        SELECT IFNULL(COUNT( h.`sg_id`),0) FROM `yeshi_ec_quality_factory` h
        LEFT JOIN
        (SELECT tb.`id`,tb.tkRate,
                 <![CDATA[(CASE WHEN  tb.`zkPrice` < tb.`couponStartFee`  THEN tb.`zkPrice` * tb.`tkRate`/10000*${proportion}
                 ELSE (tb.`zkPrice`-tb.`couponAmount`) * tb.`tkRate`/10000*${proportion} END)AS RateAmount 
                 FROM  yeshi_ec_taobao_goods tb
                 WHERE tb.tkRate >=  #{tkRate} 
                       AND tb.`couponAmount` >=  #{couponAmount}
                       AND (tb.`couponAmount`/ tb.zkPrice)*100 > #{couponRatio}
                 ]]> )g
          ON h.`sg_goods_id`= g.`id`
        WHERE  <![CDATA[ g.rateAmount >= #{commision} ]]>
                 ]]>
        )g
        ON h.`sg_goods_id`= g.`id`
        WHERE  <![CDATA[ g.rateAmount >= #{commision} ]]>
    </select>
    <select id="listRecommendBykey"  resultMap="BaseResultMap">
        SELECT   <include refid="Base_Column_List" />  FROM `yeshi_ec_quality_factory` h
        LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
        WHERE 1=1
        <!-- 关键词搜索  -->
    <select id="listRecommendBykey" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List" />
        FROM `yeshi_ec_quality_factory` h
        LEFT JOIN yeshi_ec_taobao_goods tb ON
        h.`sg_goods_id`= tb.`id`
        WHERE 1=1
        <!-- 关键词搜索 -->
        <if test='key != null and key != ""'> AND tb.`title` LIKE '%${key}%' </if>
        <!-- 在售价范围  -->
         <if test='startprice != null'>
               AND <![CDATA[  tb.`zkPrice` >= #{startprice}]]>
         </if>
          <if test='endprice != null'>
               AND <![CDATA[  tb.`zkPrice` <= #{endprice}]]>
        <!-- 在售价范围 -->
        <if test='startprice != null'>
            AND <![CDATA[  tb.`zkPrice` >= #{startprice}]]>
        </if>
        <!-- 返利比范围  -->
         <if test='startTkRate != null'>
               AND <![CDATA[  tb.`tkRate` >= #{startTkRate}]]>
         </if>
          <if test='endTkRate != null'>
               AND <![CDATA[  tb.`tkRate` <= #{endTkRate}]]>
        <if test='endprice != null'>
            AND <![CDATA[  tb.`zkPrice` <= #{endprice}]]>
        </if>
        <!-- 有券  -->
        <!-- 返利比范围 -->
        <if test='startTkRate != null'>
            AND <![CDATA[  tb.`tkRate` >= #{startTkRate}]]>
        </if>
        <if test='endTkRate != null'>
            AND <![CDATA[  tb.`tkRate` <= #{endTkRate}]]>
        </if>
        <!-- 有券 -->
        <if test='hasQuan != null'>
               AND <![CDATA[  tb.`couponLeftCount` > 1]]>
            AND <![CDATA[  tb.`couponLeftCount` > 1]]>
        </if>
        <!-- 天猫商品  -->
        <!-- 天猫商品 -->
        <if test='userType != null'>
               AND <![CDATA[  tb.`userType` = 1]]>
            AND <![CDATA[  tb.`userType` = 1]]>
        </if>
        ORDER BY
            <!-- 销量高到低   -->
             <if test='sort == 1'>
                    tb.`biz30day` desc,
             </if>
             <!-- 价格 低到高   -->
             <if test='sort == 3'>
                    tb.`zkPrice`,
             </if>
             <!-- 价格 高到低   -->
             <if test='sort == 2'>
                    tb.`zkPrice` desc,
             </if>
             <!-- 推广量 高到低   -->
             <if test='sort == 4'>
                    tb.`totalSales` desc,
             </if>
            <!-- 佣金比例  -->
             <if test='sort == 5'>
                    tb.`tkRate` desc,
             </if>
             <!-- 佣金比例 -->
             <if test='sort == 6'>
                    tb.`tkRate`,
             </if>
             <!-- 默认:权重高到低-->
            h.sg_weight DESC
        ORDER BY
        <!-- 销量高到低 -->
        <if test='sort == 1'>
            tb.`biz30day` desc,
        </if>
        <!-- 价格 低到高 -->
        <if test='sort == 3'>
            tb.`zkPrice`,
        </if>
        <!-- 价格 高到低 -->
        <if test='sort == 2'>
            tb.`zkPrice` desc,
        </if>
        <!-- 推广量 高到低 -->
        <if test='sort == 4'>
            tb.`totalSales` desc,
        </if>
        <!-- 佣金比例 -->
        <if test='sort == 5'>
            tb.`tkRate` desc,
        </if>
        <!-- 佣金比例 -->
        <if test='sort == 6'>
            tb.`tkRate`,
        </if>
        <!-- 默认:权重高到低 -->
        h.sg_weight DESC
        LIMIT #{start},#{count}
    </select>
    <select id="countRecommendBykey" resultType="java.lang.Long">
        SELECT IFNULL(COUNT(h.`sg_id`),0) FROM `yeshi_ec_quality_factory` h
        LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
        WHERE 1=1
        <!-- 关键词搜索  -->
        WHERE
        1=1
        <!-- 关键词搜索 -->
        <if test='key != null and key != ""'> AND tb.`title` LIKE '%${key}%' </if>
        <!-- 在售价范围  -->
         <if test='startprice != null'>
               AND <![CDATA[  tb.`zkPrice` >= #{startprice}]]>
         </if>
          <if test='endprice != null'>
               AND <![CDATA[  tb.`zkPrice` <= #{endprice}]]>
        <!-- 在售价范围 -->
        <if test='startprice != null'>
            AND <![CDATA[  tb.`zkPrice` >= #{startprice}]]>
        </if>
        <!-- 返利比范围  -->
         <if test='startTkRate != null'>
               AND <![CDATA[  tb.`tkRate` >= #{startTkRate}]]>
         </if>
          <if test='endTkRate != null'>
               AND <![CDATA[  tb.`tkRate` <= #{endTkRate}]]>
        <if test='endprice != null'>
            AND <![CDATA[  tb.`zkPrice` <= #{endprice}]]>
        </if>
        <!-- 有券  -->
        <!-- 返利比范围 -->
        <if test='startTkRate != null'>
            AND <![CDATA[  tb.`tkRate` >= #{startTkRate}]]>
        </if>
        <if test='endTkRate != null'>
            AND <![CDATA[  tb.`tkRate` <= #{endTkRate}]]>
        </if>
        <!-- 有券 -->
        <if test='hasQuan != null'>
               AND <![CDATA[  tb.`couponLeftCount` > 1]]>
            AND <![CDATA[  tb.`couponLeftCount` > 1]]>
        </if>
        <!-- 天猫商品  -->
        <!-- 天猫商品 -->
        <if test='userType != null'>
               AND <![CDATA[  tb.`userType` = 1]]>
            AND <![CDATA[  tb.`userType` = 1]]>
        </if>
    </select>
    <select id="listQueryBylabIDs" resultMap="GoodsResultMap">
          SELECT * FROM (
            SELECT DISTINCT( tt.`sg_id`) AS tbid  FROM yeshi_ec_quality_factory tt
            LEFT JOIN yeshi_ec_taobao_goods tb ON tt.`sg_goods_id`= tb.`id`
            LEFT JOIN yeshi_ec_label_goods lg ON tt.`sg_goods_id` = lg.`lg_goods_id`
                WHERE tb.`id` != #{gid}
                    <if test='systemCid != null'>
                           AND  tt.`sg_class_id` = #{systemCid}
                    </if>
                     AND  lg.`lg_label_id` IN
                <foreach collection="list" item="item" open="(" close=")"
                    separator=",">#{item}</foreach>
              LIMIT ${start},${count}
         ) a LEFT JOIN yeshi_ec_quality_factory ts ON ts.`sg_id`=a.tbid
             LEFT JOIN yeshi_ec_taobao_goods tbb ON ts.`sg_goods_id`= tbb.`id`
   </select>
    <select id="listQueryBylabIDs" resultMap="GoodsResultMap">
        SELECT * FROM (
        SELECT DISTINCT( tt.`sg_id`) AS tbid FROM
        yeshi_ec_quality_factory tt
        LEFT JOIN yeshi_ec_taobao_goods tb ON
        tt.`sg_goods_id`= tb.`id`
        LEFT JOIN yeshi_ec_label_goods lg ON
        tt.`sg_goods_id` = lg.`lg_goods_id`
        WHERE tb.`id` != #{gid}
        <if test='systemCid != null'>
            AND tt.`sg_class_id` = #{systemCid}
        </if>
        AND lg.`lg_label_id` IN
        <foreach collection="list" item="item" open="(" close=")"
            separator=",">#{item}</foreach>
        LIMIT ${start},${count}
        ) a LEFT JOIN yeshi_ec_quality_factory ts ON
        ts.`sg_id`=a.tbid
        LEFT JOIN yeshi_ec_taobao_goods tbb ON
        ts.`sg_goods_id`= tbb.`id`
    </select>
    <select id="listByMinSalesCountOrderByCreateTimeDesc" resultMap="BaseResultMap">
        SELECT f.* FROM `yeshi_ec_quality_factory` f LEFT JOIN
        yeshi_ec_taobao_goods t ON f.`sg_goods_id`=t.`id` WHERE
        t.`biz30day`>=#{salesCount} ORDER BY f.`sg_createtime` DESC limit
        #{start},#{count}
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/RecommendUserGoodsServiceImpl.java
@@ -60,4 +60,19 @@
        return recommendUserGoodsMapper.countRecommendGoods(uid);
    }
    @Override
    public List<RecommendUserGoodsMap> listByUidAndCommonGoodsId(Long uid, Long commonGoodsId) {
        return null;
    }
    @Override
    public Long countByUidAndCommonGoodsId(Long uid, Long commonGoodsId) {
        return null;
    }
    @Override
    public RecommendUserGoods getLatestRecommendUserGoods(Long uid) {
        return recommendUserGoodsMapper.getLatestRecommendUserGoods(uid);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java
@@ -508,8 +508,8 @@
            // 加入通知
            if (notificationMap.get(type) == null) {
                HongBaoV2 tempHongBao = new HongBaoV2(hongBao.getId());
                tempHongBao.setUserInfo(hongBao.getUserInfo());
                HongBaoV2 tempHongBao = new HongBaoV2(oldHongBao.getId());
                tempHongBao.setUserInfo(oldHongBao.getUserInfo());
                tempHongBao.setMoney(hongBao.getMoney());
                CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
                tempCommonOrder.setPayment(commonOrder.getPayment());
@@ -741,21 +741,21 @@
                }
                hongBaoV2Mapper.insertSelective(firstHongbao);
                // 用户通知
                if (notificationMap.get(type) == null) {
                if (notificationMap.get(HongBaoV2.TYPE_YIJI) == null) {
                    HongBaoV2 tempHongBao = new HongBaoV2(firstHongbao.getId());
                    tempHongBao.setUserInfo(firstHongbao.getUserInfo());
                    tempHongBao.setMoney(firstHongbao.getMoney());
                    CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
                    tempCommonOrder.setPayment(commonOrder.getPayment());
                    notificationMap.put(type, new HongBaoOrder(tempCommonOrder, tempHongBao));
                    notificationMap.put(HongBaoV2.TYPE_YIJI, new HongBaoOrder(tempCommonOrder, tempHongBao));
                } else {
                    // 增加付款金额与资金
                    HongBaoOrder tempHongBaoOrder = notificationMap.get(type);
                    HongBaoOrder tempHongBaoOrder = notificationMap.get(HongBaoV2.TYPE_YIJI);
                    tempHongBaoOrder.getCommonOrder()
                            .setPayment(tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
                    tempHongBaoOrder.getHongBaoV2()
                            .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(firstHongbao.getMoney()));
                    notificationMap.put(type, tempHongBaoOrder);
                    notificationMap.put(HongBaoV2.TYPE_YIJI, tempHongBaoOrder);
                }
                // 插入二级子红包
@@ -789,21 +789,21 @@
                    hongBaoV2Mapper.insertSelective(secondHongbao);
                    // 用户通知
                    if (notificationMap.get(type) == null) {
                    if (notificationMap.get(HongBaoV2.TYPE_ERJI) == null) {
                        HongBaoV2 tempHongBao = new HongBaoV2(secondHongbao.getId());
                        tempHongBao.setUserInfo(secondHongbao.getUserInfo());
                        tempHongBao.setMoney(secondHongbao.getMoney());
                        CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
                        tempCommonOrder.setPayment(commonOrder.getPayment());
                        notificationMap.put(type, new HongBaoOrder(tempCommonOrder, tempHongBao));
                        notificationMap.put(HongBaoV2.TYPE_ERJI, new HongBaoOrder(tempCommonOrder, tempHongBao));
                    } else {
                        // 增加付款金额与资金
                        HongBaoOrder tempHongBaoOrder = notificationMap.get(type);
                        HongBaoOrder tempHongBaoOrder = notificationMap.get(HongBaoV2.TYPE_ERJI);
                        tempHongBaoOrder.getCommonOrder().setPayment(
                                tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
                        tempHongBaoOrder.getHongBaoV2()
                                .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(secondHongbao.getMoney()));
                        notificationMap.put(type, tempHongBaoOrder);
                        notificationMap.put(HongBaoV2.TYPE_ERJI, tempHongBaoOrder);
                    }
                }
fanli/src/main/java/com/yeshi/fanli/service/impl/lable/QualityFactoryServiceImpl.java
@@ -71,12 +71,10 @@
    @Resource
    private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
    @Override
    public int updateByPrimaryKeySelective(QualityFactory record) throws QualityFactoryException {
        return qualityFactoryMapper.updateByPrimaryKeySelective(record);
    }
    @Override
    public void deleteByTbAuctionId(Long auctionId) {
@@ -148,7 +146,6 @@
        labelGoodsMapper.deleteBatchByGoodsId(listGid);
    }
    @Override
    @Transactional
    public void deleteByGoodsId(List<String> ids) throws QualityFactoryException {
@@ -159,7 +156,6 @@
            }
        }
    }
    @Override
    public QualityFactory selectByPrimaryKey(Long id) throws QualityFactoryException {
@@ -290,10 +286,10 @@
                TaoBaoGoodsBrief currentGoodsBrief = taoBaoGoodsBriefList.get(0);
                goodsBrief.setId(currentGoodsBrief.getId());
                // 更新商品最新信息
                taoBaoGoodsUpdateService.updateTaoBaoGoods(goodsBrief);
            } else {
                // 插入本地数据库
@@ -416,22 +412,24 @@
        return qualityFactoryMapper.queryNeedUpdate(start, count, hour);
    }
    /**
     * 获取缓存
     * @param key 键
     * @param title 标签名称
     *
     * @param key
     *            键
     * @param title
     *            标签名称
     * @return
     */
    public String getLabelIdByRedis (String key, String title) throws Exception {
    public String getLabelIdByRedis(String key, String title) throws Exception {
        String value = redisManager.getCommonString(key);
        if (StringUtil.isNullOrEmpty(value)) {
            // id为空时系统进行查询
            List<Label> list9K9 = labelService.selectByTitle(title);
            if (list9K9 != null && list9K9.size() > 0) {
                Long id = list9K9.get(0).getId();
                if (id != null) {
@@ -441,10 +439,10 @@
                }
            }
        }
        return value;
    }
    @Override
    @Transactional
    public void updateGoodsFactory(List<Long> listId) {
@@ -462,8 +460,7 @@
        List<Long> listDeleteQuality = new ArrayList<Long>();
        // 删除标签
        List<Long> listDeleteLabel = new ArrayList<Long>();
        List<QualityFactory> listUpdateQuality = new ArrayList<QualityFactory>();
        List<TaoBaoGoodsBrief> listUpdateGoodsBrief = new ArrayList<TaoBaoGoodsBrief>();
@@ -473,37 +470,37 @@
        List<LabelGoods> listLabelAdd = new ArrayList<LabelGoods>();
        try {
            List<Long> list9Class = new ArrayList<Long>();
            Map<String, Label> map = new HashMap<String, Label>();
            if (Constant.IS_OUTNET) {
                String value9K9 = getLabelIdByRedis("lab-9K9", "9.9");
                String value19K9 = getLabelIdByRedis("lab-19K9", "19.9");
                String value29K9 = getLabelIdByRedis("lab-29K9", "29.9");
                String value49K9 = getLabelIdByRedis("lab-49K9", "49.9");
                if (!StringUtil.isNullOrEmpty(value9K9)) {
                    map.put("9.9", new Label(Long.parseLong(value9K9)));
                    list9Class.add(Long.parseLong(value9K9));
                    list9Class.add(Long.parseLong(value9K9));
                }
                if (!StringUtil.isNullOrEmpty(value19K9)) {
                    map.put("19.9", new Label(Long.parseLong(value19K9)));
                    list9Class.add(Long.parseLong(value19K9));
                    list9Class.add(Long.parseLong(value19K9));
                }
                if (!StringUtil.isNullOrEmpty(value29K9)) {
                    map.put("29.9", new Label(Long.parseLong(value29K9)));
                    list9Class.add(Long.parseLong(value29K9));
                    list9Class.add(Long.parseLong(value29K9));
                }
                if (!StringUtil.isNullOrEmpty(value49K9)) {
                    map.put("49.9", new Label(Long.parseLong(value49K9)));
                    list9Class.add(Long.parseLong(value49K9));
                    list9Class.add(Long.parseLong(value49K9));
                }
            }
            listQuality.parallelStream().forEach(quality -> {
@@ -555,11 +552,12 @@
                        } else {
                            /* 更新商品信息 */
                            TaoBaoGoodsBrief updateGoods = taoBaoGoodsUpdateService.getUpdateTaoBaoGoodsBrief(newGoodsBrief);
                            TaoBaoGoodsBrief updateGoods = taoBaoGoodsUpdateService
                                    .getUpdateTaoBaoGoodsBrief(newGoodsBrief);
                            updateGoods.setId(id);
                            taoBaoGoodsBriefService.setGoodsBriefDefault(updateGoods);
                            listUpdateGoodsBrief.add(updateGoods);
                            /* 更新精选库 信息时间 */
@@ -616,7 +614,7 @@
            if (listDeleteLabel.size() > 0) {
                labelGoodsMapper.deleteBatchByGoodsId(listDeleteLabel);
            }
            // 添加标签
            if (listLabelAdd.size() > 0) {
                labelGoodsMapper.insertBatch(listLabelAdd);
@@ -635,7 +633,6 @@
            }
        }
    }
    @Override
    public void autoInsertOrUpadateStorage(List<TaoBaoGoodsBrief> goodsList, List<Label> listLabs,
@@ -672,8 +669,6 @@
            }
        }
        // 商品id集合
        List<Long> listSystemTBid = new ArrayList<Long>();
@@ -689,7 +684,6 @@
        List<QualityFactory> listAddInsert = new ArrayList<QualityFactory>();
        // 进入精选商品列表
        List<QualityFactory> listAddUpdate = new ArrayList<QualityFactory>();
        // 插入商品淘宝ID集合
        List<Long> listAuctionId = new ArrayList<Long>();
@@ -750,10 +744,10 @@
            /* 商品已存在数据库 */
            if (isExist && systemId != null) {
                // 用于确定是否存在精选库
                listSystemTBid.add(systemId);
                // 更新商品信息
                TaoBaoGoodsBrief updateGoods = taoBaoGoodsUpdateService.getUpdateTaoBaoGoodsBrief(newGoodsBrief);
                // 设置主键id
@@ -763,41 +757,42 @@
                updateGoods.setCreatetime(date);
                updateGoods.setUpdatetime(date);
                taoBaoGoodsBriefService.setGoodsBriefDefault(updateGoods);
                listGoodsUpdate.add(updateGoods);
                Long has9k9ID = null;
                /* 贴上标签   */
                /* 贴上标签 */
                if (listLabs != null && listLabs.size() > 0) {
                    for (Label label : listLabs) {
                        //  包含 9.9/19.9/29.9/49.9 、同时来源淘宝推荐: 由于获取详情与推荐接口的券信息存在出入  以最后详情为准
                        if (list9Class.contains(label.getId()) && autoRule.isCalss9k9() && QualityFactory.SOURCE_TAOBAO_MATERIAL == autoRule.getGoodsSource()) {
                            /* 获取商品详情后计算是否属于 9k9系列  加入对应的标签*/
                        // 包含 9.9/19.9/29.9/49.9 、同时来源淘宝推荐: 由于获取详情与推荐接口的券信息存在出入
                        // 以最后详情为准
                        if (list9Class.contains(label.getId()) && autoRule.isCalss9k9()
                                && QualityFactory.SOURCE_TAOBAO_MATERIAL == autoRule.getGoodsSource()) {
                            /* 获取商品详情后计算是否属于 9k9系列 加入对应的标签 */
                            LabelGoods labelGds = screen9K9(updateGoods, map);
                            if (labelGds != null) {
                                Label label9k = labelGds.getLabel();
                                Long id = label9k.getId();
                                long existence = labelGoodsMapper.isExistence(systemId, id);
                                if (existence <= 0) {
                                    // 不存在对应标签
                                    listLabelAdd.add(labelGds);
                                } else {
                                    // 已存在
                                    has9k9ID = id;
                                    has9k9ID = id;
                                }
                            }
                        } else {
                            long existence = labelGoodsMapper.isExistence(systemId, label.getId());
                            if (existence <= 0) {
                                // 贴上新标签
@@ -809,54 +804,52 @@
                                listLabelAdd.add(lg);
                            } else {
                                if(list9Class.contains(label.getId())){
                                if (list9Class.contains(label.getId())) {
                                    // 已存在
                                    has9k9ID = label.getId();
                                    has9k9ID = label.getId();
                                }
                            }
                        }
                    }
                }
                /* 判断是否已经贴上标签 9k9标签 */
                if (list9Class.size() > 0) {
                    List<LabelGoods> listGlid = labelGoodsMapper.listQuery9k9Class(systemId, list9Class);
                    if (listGlid != null && listGlid.size() > 0) {
                        if (has9k9ID == null && !autoRule.isCalss9k9()) {
                            // 非9k9入库规则  若商品信息变化 对应的标签根据价格 修改
                            // 非9k9入库规则 若商品信息变化 对应的标签根据价格 修改
                            LabelGoods labelGds = screen9K9(updateGoods, map);
                            if (labelGds != null) {
                                Label label9k = labelGds.getLabel();
                                Long id = label9k.getId();
                                long existence = labelGoodsMapper.isExistence(systemId, id);
                                if (existence <= 0) {
                                    // 不存在对应标签
                                    listLabelAdd.add(labelGds);
                                } else {
                                    // 已存在
                                    has9k9ID = id;
                                    has9k9ID = id;
                                }
                            }
                        }
                        // 清空 9K9系列标签
                        for (LabelGoods labelGoods : listGlid) {
                            Label label = labelGoods.getLabel();
                            if (has9k9ID != null && has9k9ID.equals(label.getId())) {
                                continue;
                            }
                            list9ClassDelete.add(labelGoods.getId());
                        }
                    }
                }
            } else {
                newGoodsBrief.setId(null);
                newGoodsBrief.setState(0); // 状态启用
@@ -872,19 +865,20 @@
                // 贴上标签
                if (listLabs != null && listLabs.size() > 0) {
                    for (Label label : listLabs) {
                        // 包含 9.9/19.9/29.9/49.9 、同时来源淘宝推荐: 由于获取详情与推荐接口的券信息存在出入  以最后详情为准
                        if (list9Class.contains(label.getId()) && autoRule.isCalss9k9() &&
                                QualityFactory.SOURCE_TAOBAO_MATERIAL == autoRule.getGoodsSource()) {
                            /*  加入对应的9.9/19.9/29.9/49.9 标签*/
                        // 包含 9.9/19.9/29.9/49.9 、同时来源淘宝推荐: 由于获取详情与推荐接口的券信息存在出入
                        // 以最后详情为准
                        if (list9Class.contains(label.getId()) && autoRule.isCalss9k9()
                                && QualityFactory.SOURCE_TAOBAO_MATERIAL == autoRule.getGoodsSource()) {
                            /* 加入对应的9.9/19.9/29.9/49.9 标签 */
                            LabelGoods labelGds = screen9K9(newGoodsBrief, map);
                            if (labelGds != null) {
                                listLabelAdd.add(labelGds);
                            }
                        } else {
                            // 贴上新标签
                            LabelGoods lg = new LabelGoods();
@@ -894,9 +888,9 @@
                            lg.setTaoBaoGoodsBrief(newGoodsBrief);
                            listLabelAdd.add(lg);
                        }
                    }
                }
            }
        }
@@ -1027,29 +1021,29 @@
        // 查询已存在显示限时抢购的商品
        List<QualityFlashSale> listQuery = qualityFlashSaleService.listQueryByQualityID(listQFId);
        if (listQuery == null || listQuery.size() == 0) {
            // 全部新增入库
            int i = 0;
            for (Long qfId : listQFId) {
                listFlashSale.add(getNewQualityFlashSale(qfId, i, startWeight, endWeight, goodsSource));
            }
        } else {
            int i = 0;
            boolean exist = false;
            for (Long qfId : listQFId) {
                for (QualityFlashSale flashSale : listQuery) {
                    QualityFactory qualityFactory = flashSale.getQualityFactory();
                    if (qfId.equals(qualityFactory.getId())) {
                        exist = true;
                        //即将准备时间段时间
                        //int nowType = qualityFlashSaleService.getQueryType();
                        //flashSale.setType(nowType);
                        // 即将准备时间段时间
                        // int nowType = qualityFlashSaleService.getQueryType();
                        // flashSale.setType(nowType);
                        double weight = startWeight + (Math.random() * ((endWeight - startWeight) + 1));
                        flashSale.setWeight(weight);
@@ -1064,7 +1058,7 @@
                    listFlashSale.add(getNewQualityFlashSale(qfId, i, startWeight, endWeight, goodsSource));
                }
            }
        }
        // 插入限时抢购
@@ -1102,8 +1096,8 @@
            flashSale.setWeight(weight);
        }
        //int nowType = qualityFlashSaleService.getNowType();
        //flashSale.setType(nowType);
        // int nowType = qualityFlashSaleService.getNowType();
        // flashSale.setType(nowType);
        flashSale.setCreatetime(new Date());
        flashSale.setUpdatetime(new Date());
@@ -1315,4 +1309,10 @@
        return lg;
    }
    @Override
    public List<QualityFactory> listByMinSalesCountOrderByCreateTimeDesc(int salesCount, int page, int pageSize) {
        return qualityFactoryMapper.listByMinSalesCountOrderByCreateTimeDesc(salesCount, (page - 1) * pageSize,
                pageSize);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgAccountDetailServiceImpl.java
@@ -11,6 +11,7 @@
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
import com.yeshi.fanli.exception.msg.MsgAccountDetailException;
import com.yeshi.fanli.service.inter.msg.MsgAccountDetailService;
import com.yeshi.fanli.service.inter.msg.UserMsgReadStateService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
@@ -19,6 +20,9 @@
    @Resource
    private MsgAccountDetailMapper msgAccountDetailMapper;
    @Resource
    private UserMsgReadStateService userMsgReadStateService;
    @Override
    public void addMsgAccountDetail(MsgAccountDetail detail) throws MsgAccountDetailException {
@@ -32,6 +36,7 @@
        detail.setUpdateTime(new Date());
        detail.setRead(false);
        msgAccountDetailMapper.insertSelective(detail);
        userMsgReadStateService.addAccountMsgUnReadCount(detail.getUser().getId(), 1);
    }
    @Override
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgInviteDetailServiceImpl.java
@@ -12,6 +12,7 @@
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.exception.msg.MsgInviteDetailException;
import com.yeshi.fanli.service.inter.msg.MsgInviteDetailService;
import com.yeshi.fanli.service.inter.msg.UserMsgReadStateService;
import com.yeshi.fanli.util.Constant;
@Service
@@ -19,6 +20,9 @@
    @Resource
    private MsgInviteDetailMapper msgInviteDetailMapper;
    @Resource
    private UserMsgReadStateService userMsgReadStateService;
    @Override
    public void addMsgInviteDetail(MsgInviteDetail detail) throws MsgInviteDetailException {
@@ -52,6 +56,8 @@
            update.setRead(false);
            msgInviteDetailMapper.updateByPrimaryKeySelective(update);
        }
        userMsgReadStateService.addInviteMsgUnReadCount(detail.getUser().getId(), 1);
    }
    @Override
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgMoneyDetailServiceImpl.java
@@ -12,6 +12,7 @@
import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
import com.yeshi.fanli.exception.msg.MsgMoneyDetailException;
import com.yeshi.fanli.service.inter.msg.MsgMoneyDetailService;
import com.yeshi.fanli.service.inter.msg.UserMsgReadStateService;
import com.yeshi.fanli.util.Constant;
@Service
@@ -19,6 +20,9 @@
    @Resource
    private MsgMoneyDetailMapper msgMoneyDetailMapper;
    @Resource
    private UserMsgReadStateService userMsgReadStateService;
    @Override
    public void addMsgMoneyDetail(MsgMoneyDetail detail) throws MsgMoneyDetailException {
@@ -80,7 +84,18 @@
            detail.setUpdateTime(new Date());
            detail.setRead(false);
            msgMoneyDetailMapper.insertSelective(detail);
        } else if (detail.getMsgType() == MsgTypeMoneyTypeEnum.fanliWeiQuan
                || detail.getMsgType() == MsgTypeMoneyTypeEnum.inviteWeiQuan
                || detail.getMsgType() == MsgTypeMoneyTypeEnum.shareWeiQuan) {
            if (detail.getMoney() == null || detail.getOrderId() == null || detail.getBalance() == null)
                throw new MsgMoneyDetailException(2, "消息信息不全");
            detail.setCreateTime(new Date());
            detail.setUpdateTime(new Date());
            detail.setRead(false);
            msgMoneyDetailMapper.insertSelective(detail);
        }
        userMsgReadStateService.addMoneyMsgUnReadCount(detail.getUser().getId(), 1);
    }
    @Override
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOrderDetailServiceImpl.java
@@ -12,6 +12,7 @@
import com.yeshi.fanli.entity.order.CommonOrder;
import com.yeshi.fanli.exception.msg.MsgOrderDetailException;
import com.yeshi.fanli.service.inter.msg.MsgOrderDetailService;
import com.yeshi.fanli.service.inter.msg.UserMsgReadStateService;
import com.yeshi.fanli.util.Constant;
@Service
@@ -19,6 +20,9 @@
    @Resource
    private MsgOrderDetailMapper msgOrderDetailMapper;
    @Resource
    private UserMsgReadStateService userMsgReadStateService;
    @Override
    public void addMsgOrderDetail(MsgOrderDetail detail) throws MsgOrderDetailException {
@@ -44,6 +48,7 @@
            update.setBeiZhu(detail.getBeiZhu());
            msgOrderDetailMapper.updateByPrimaryKeySelective(update);
        }
        userMsgReadStateService.addOrderMsgUnReadCount(detail.getUser().getId(), 1);
    }
    @Override
@@ -76,12 +81,13 @@
            return;
        MsgOrderDetail update = new MsgOrderDetail();
        update.setId(detail.getId());
        update.setId(msg.getId());
        update.setHongBaoMoney(detail.getHongBaoMoney());
        update.setPayMoney(detail.getPayMoney());
        if (detail.getState().intValue() != msg.getState()) {
            update.setState(detail.getState());
            update.setUpdateTime(new Date());
            userMsgReadStateService.addOrderMsgUnReadCount(detail.getUser().getId(), 1);
        }
        msgOrderDetailMapper.updateByPrimaryKeySelective(update);
    }
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserInviteMsgNotificationServiceImpl.java
@@ -1,29 +1,50 @@
package com.yeshi.fanli.service.impl.msg;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.exception.msg.MsgInviteDetailException;
import com.yeshi.fanli.service.inter.msg.MsgInviteDetailService;
import com.yeshi.fanli.service.inter.msg.UserInviteMsgNotificationService;
import com.yeshi.fanli.util.factory.msg.MsgInviteDetailFactory;
@Service
public class UserInviteMsgNotificationServiceImpl  implements UserInviteMsgNotificationService{
public class UserInviteMsgNotificationServiceImpl implements UserInviteMsgNotificationService {
    @Resource
    private MsgInviteDetailService msgInviteDetailService;
    @Override
    public void inviteScan(Long uid, ThreeSale sale) {
        // TODO Auto-generated method stub
        MsgInviteDetail detail = MsgInviteDetailFactory.createInviteScanSuccess(sale, uid, null);
        try {
            msgInviteDetailService.addMsgInviteDetail(detail);
        } catch (MsgInviteDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void inviteSuccess(Long uid, ThreeSale sale) {
        // TODO Auto-generated method stub
        MsgInviteDetail detail = MsgInviteDetailFactory.createInviteSuccess(sale, uid, null);
        try {
            msgInviteDetailService.addMsgInviteDetail(detail);
        } catch (MsgInviteDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void inviteFail(Long uid, ThreeSale sale) {
        // TODO Auto-generated method stub
        MsgInviteDetail detail = MsgInviteDetailFactory.createInviteFail(sale, uid, null);
        try {
            msgInviteDetailService.addMsgInviteDetail(detail);
        } catch (MsgInviteDetailException e) {
            e.printStackTrace();
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserSystemMsgServiceImpl.java
@@ -13,6 +13,7 @@
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.system.SystemZnx;
import com.yeshi.fanli.exception.msg.UserSystemMsgException;
import com.yeshi.fanli.service.inter.msg.UserMsgReadStateService;
import com.yeshi.fanli.service.inter.msg.UserSystemMsgService;
import com.yeshi.fanli.util.StringUtil;
@@ -21,6 +22,9 @@
    @Resource
    private UserSystemMsgMapper userSystemMsgMapper;
    @Resource
    private UserMsgReadStateService userMsgReadStateService;
    @Override
    public void addUserSystemMsg(Long uid, UserSystemMsgTypeEnum type, String title, String content, int timeTag,
@@ -50,6 +54,7 @@
            msg.setTimeTag(timeTag);
        }
        userSystemMsgMapper.insertSelective(msg);
        userMsgReadStateService.addSystemMsgUnReadCount(uid, 1);
    }
    @Override
fanli/src/main/java/com/yeshi/fanli/service/impl/user/ExtractServiceImpl.java
@@ -541,6 +541,7 @@
        Extract updateExtract = new Extract();
        updateExtract.setId(extract.getId());
        updateExtract.setState(Constant.EXTRACT_PASS);
        updateExtract.setReceiveTime(new Date());
        updateExtract.setReason("提现成功");
        extractMapper.updateByPrimaryKeySelective(updateExtract);
fanli/src/main/java/com/yeshi/fanli/service/inter/goods/RecommendUserGoodsService.java
@@ -4,6 +4,7 @@
import com.yeshi.fanli.entity.goods.CommonGoods;
import com.yeshi.fanli.entity.goods.RecommendUserGoods;
import com.yeshi.fanli.entity.goods.RecommendUserGoodsMap;
import com.yeshi.fanli.exception.goods.RecommendUserGoodsException;
public interface RecommendUserGoodsService {
@@ -18,6 +19,23 @@
     */
    public void addRecommend(Long uid, String recommendDesc, List<CommonGoods> goodsList)
            throws RecommendUserGoodsException;
    /**
     *
     * @param uid
     * @param commonGoodsId
     * @return
     */
    public List<RecommendUserGoodsMap> listByUidAndCommonGoodsId(Long uid,Long commonGoodsId);
    /**
     *
     * @param uid
     * @param commonGoodsId
     * @return
     */
    public Long countByUidAndCommonGoodsId(Long uid,Long commonGoodsId);
    /**
     * 获取推荐列表
@@ -36,5 +54,7 @@
     * @return
     */
    public long countRecommend(Long uid);
    public RecommendUserGoods getLatestRecommendUserGoods(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/lable/QualityFactoryService.java
@@ -1,6 +1,5 @@
package com.yeshi.fanli.service.inter.lable;
import java.util.List;
import java.util.Map;
@@ -12,40 +11,43 @@
import com.yeshi.fanli.exception.QualityFactoryException;
public interface QualityFactoryService {
    /**
     * 选择性更新内容——不为空则更新该字段
     *
     * @param record
     * @return
     * @throws QualityFactoryException
     */
    public int updateByPrimaryKeySelective(QualityFactory record) throws QualityFactoryException;
    /**
     * 根据id查找当前对象
     *
     * @param id
     * @return
     * @throws QualityFactoryException
     */
    public QualityFactory selectByPrimaryKey(Long id) throws QualityFactoryException;
    /**
     * 统计商品数量
     *
     * @return
     */
    public Map<String, Object> getCountAll();
    /**
     * 根据商品id 移除精品库
     *
     * @param ids
     * @throws QualityFactoryException
     */
    public void deleteByGoodsId(List<String> ids) throws QualityFactoryException;
    /**
     * 根据淘宝id 删除精选库对应信息
     *
     * @param gid
     * @throws QualityFactoryException
     */
@@ -53,6 +55,7 @@
    /**
     * 根据淘宝id集合 批量删除精选库对应信息
     *
     * @param listId
     * @throws QualityFactoryException
     */
@@ -60,30 +63,32 @@
    /**
     * 根据淘宝id 删除
     *
     * @param auctionId
     * @throws QualityFactoryException
     */
    public void deleteByTbAuctionId(Long auctionId);
    /**
     * 统计商品id 是存在精品库
     *
     * @param goodsId
     * @return
     */
    public Long queryCountByGoodsId(Long goodsId);
    /**
     * 批量入库--淘宝
     *
     * @param auctionIdList
     * @param admin
     * @throws Exception
     */
    public void addBatch(List<Long> auctionIdList, String las, AdminUser admin) throws Exception;
    /**
     * 精选库商品筛选
     *
     * @param start
     * @param count
     * @param key
@@ -113,22 +118,20 @@
     */
    public List<QualityFactory> query(long start, int count, String key, Integer totalSales, Integer price,
            Integer tkRate, Integer propor, Integer goodsSource, Integer days, Integer startZkPrice, Integer endZkPrice,
            Integer startBiz30day, Integer endBiz30day, Integer startWeight, Integer endWeight,
            Integer startTkRate, Integer endTkRate, Integer startAmount, Integer endAmount,
            Integer hasCoupon, Integer freeShipment, Integer isPrepay, Integer payRate30,
            Integer goodRate, Integer rfdRate,Integer startPropor, Integer endPropor,
            Long gcid, Integer keyType) throws QualityFactoryException;
            Integer startBiz30day, Integer endBiz30day, Integer startWeight, Integer endWeight, Integer startTkRate,
            Integer endTkRate, Integer startAmount, Integer endAmount, Integer hasCoupon, Integer freeShipment,
            Integer isPrepay, Integer payRate30, Integer goodRate, Integer rfdRate, Integer startPropor,
            Integer endPropor, Long gcid, Integer keyType) throws QualityFactoryException;
    public long queryCount(String key, Integer goodsSource, Integer days, Integer startZkPrice,
            Integer endZkPrice, Integer startBiz30day, Integer endBiz30day, Integer startWeight,
            Integer endWeight, Integer startTkRate, Integer endTkRate, Integer startAmount,
            Integer endAmount, Integer hasCoupon, Integer freeShipment, Integer isPrepay,
            Integer payRate30, Integer goodRate, Integer rfdRate,Integer startPropor, Integer endPropor,
            Long gcid, Integer keyType) throws QualityFactoryException;
    public long queryCount(String key, Integer goodsSource, Integer days, Integer startZkPrice, Integer endZkPrice,
            Integer startBiz30day, Integer endBiz30day, Integer startWeight, Integer endWeight, Integer startTkRate,
            Integer endTkRate, Integer startAmount, Integer endAmount, Integer hasCoupon, Integer freeShipment,
            Integer isPrepay, Integer payRate30, Integer goodRate, Integer rfdRate, Integer startPropor,
            Integer endPropor, Long gcid, Integer keyType) throws QualityFactoryException;
    /**
     *  批量设置权重  +  随机权重
     * 批量设置权重 + 随机权重
     *
     * @param idList
     * @param admin
     * @param weight
@@ -136,25 +139,28 @@
     * @param weightLarge
     * @throws Exception
     */
    public void setWeightBatch(List<Long> idList, AdminUser admin, Integer weight, Integer weightSmall, Integer weightLarge) throws Exception;
    public void setWeightBatch(List<Long> idList, AdminUser admin, Integer weight, Integer weightSmall,
            Integer weightLarge) throws Exception;
    /**
     * 统计总行数
     *
     * @return
     */
    public Long countTotalRows(Integer days);
    /**
     * 查询所有数据-无条件
     *
     * @param start
     * @param count
     * @return
     */
    public List<QualityFactory> queryAll(long start, int count, Integer days);
    /**
     * 查询需要更新的精选库商品id
     *
     * @param count
     * @param hour
     * @return
@@ -163,57 +169,65 @@
    /**
     * 统计更新数据量
     *
     * @return
     */
    public long queryNeedUpdateCount();
    /**
     * 查询精选商品数据应用前端
     *
     * @param start
     * @param count
     * @param key
     * @param classId 分类id
     * @param labId  标签id
     * @param classId
     *            分类id
     * @param labId
     *            标签id
     * @return
     */
    public List<QualityFactory> listQuery(long start, int count, String key, Long classId, Long labId);
    /**
     * 对应查询精选商品数据应用前端统计
     */
     */
    public long countQuery(String key, Integer goodsSource, Long classId, Long labId);
    /**
     * 更新精选库商品
     *
     * @param goodsList
     * @param systemCid
     * @param labels
     */
    public void autoInsertOrUpadateStorage(List<TaoBaoGoodsBrief> goodsList,List<Label> listLabs,
    public void autoInsertOrUpadateStorage(List<TaoBaoGoodsBrief> goodsList, List<Label> listLabs,
            BoutiqueAutoRule autoRule) throws Exception;
    /**
     * AuctionId查收精选库
     *
     * @param list
     * @return
     */
    public List<QualityFactory> listQueryByAuctionId(List<Long> list);
    /**
     * 根据时间 获取当前时间之前创建的商品信息
     * @param systemCid 系统分类id
     * @param dateTime  筛选时间
     * @param goodsSource  商品来源
     *
     * @param systemCid
     *            系统分类id
     * @param dateTime
     *            筛选时间
     * @param goodsSource
     *            商品来源
     * @return
     */
    public List<Long> getAuctionIdbyClassId(Long systemCid, Integer goodsSource, String dateTime) throws QualityFactoryException;
    public List<Long> getAuctionIdbyClassId(Long systemCid, Integer goodsSource, String dateTime)
            throws QualityFactoryException;
    /**
     * 更新权重
     *
     * @param weight
     * @param time
     * @return
@@ -222,8 +236,20 @@
    /**
     * 根据精选库商品id 更新商品信息
     * @param listId  商品主键
     *
     * @param listId
     *            商品主键
     */
    public void updateGoodsFactory(List<Long> listId);
    /**
     * 根据最低销量查询精选库(按创建时间倒叙排列)
     *
     * @param salesCount
     * @param page
     * @param pageSize
     * @return
     */
    public List<QualityFactory> listByMinSalesCountOrderByCreateTimeDesc(int salesCount, int page, int pageSize);
}
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgOrderDetailFactory.java
@@ -24,7 +24,7 @@
     */
    public static MsgOrderDetail createFanLiOrder(Long uid, String orderId, int goodsCount, int orderState,
            BigDecimal payMoney, BigDecimal money, String beiZhu) {
        if (payMoney == null || money == null || uid == null)
        if (uid == null)
            return null;
        MsgOrderDetail detail = new MsgOrderDetail();
        detail.setBeiZhu(beiZhu);
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java
@@ -135,7 +135,7 @@
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(
                    TimeUtil.getGernalTime(msg.getExtract().getExtractTime(), "yyyy-MM-dd HH:mm"), COLOR_CONTENT));
                    TimeUtil.getGernalTime(msg.getExtract().getExtractTime()+1000*60*60*24L, "yyyy-MM-dd HH:mm"), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("预计到账", "#888888"), contentList));
            if (msg.getExtract().getState() == Extract.STATE_PASS) {//
@@ -249,7 +249,7 @@
                        date + msg.getMsgType().getDesc(),
                        msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
            else
                new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_invite_money.png",
                return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_invite.png.png",
                        date + msg.getMsgType().getDesc(),
                        msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
@@ -301,7 +301,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_share.png", msg.getMsgType().getDesc(),
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_share_money.png", msg.getMsgType().getDesc(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.inviteWeiQuan) {
            contentList.add(new ClientTextStyleVO(msg.getOrderId(), COLOR_CONTENT));
fanli/src/main/java/com/yeshi/fanli/vo/msg/UserMsgUnReadNumVO.java
New file
@@ -0,0 +1,92 @@
package com.yeshi.fanli.vo.msg;
import org.yeshi.utils.mybatis.Table;
import com.yeshi.fanli.entity.bus.msg.UserMsgUnReadNum;
/*
 * 用户消息已读状态存储
 */
@Table("yeshi_ec_msg_read_state")
public class UserMsgUnReadNumVO {
    private String typeOrder;// 订单消息未读数
    private String typeMoney;// 资金消息未读数
    private String typeAccount;// 账户消息未读数
    private String typeInvite;// 邀请消息未读数
    private String typeScore;// 积分消息未读数
    private String typeSystem;// 系统消息未读数
    public UserMsgUnReadNumVO(UserMsgUnReadNum num) {
        this.typeAccount = getCountDesc(num.getTypeAccount());
        this.typeInvite = getCountDesc(num.getTypeInvite());
        this.typeMoney = getCountDesc(num.getTypeMoney());
        this.typeOrder = getCountDesc(num.getTypeOrder());
        this.typeScore = getCountDesc(num.getTypeScore());
        this.typeSystem = getCountDesc(num.getTypeSystem());
    }
    static String getCountDesc(int count) {
        if (count >= 100)
            return "99+";
        else
            return count + "";
    }
    public UserMsgUnReadNumVO() {
    }
    public String getTypeOrder() {
        return typeOrder;
    }
    public void setTypeOrder(String typeOrder) {
        this.typeOrder = typeOrder;
    }
    public String getTypeMoney() {
        return typeMoney;
    }
    public void setTypeMoney(String typeMoney) {
        this.typeMoney = typeMoney;
    }
    public String getTypeSystem() {
        return typeSystem;
    }
    public void setTypeSystem(String typeSystem) {
        this.typeSystem = typeSystem;
    }
    public String getTypeAccount() {
        return typeAccount;
    }
    public void setTypeAccount(String typeAccount) {
        this.typeAccount = typeAccount;
    }
    public String getTypeInvite() {
        return typeInvite;
    }
    public void setTypeInvite(String typeInvite) {
        this.typeInvite = typeInvite;
    }
    public String getTypeScore() {
        return typeScore;
    }
    public void setTypeScore(String typeScore) {
        this.typeScore = typeScore;
    }
}