喻健
2018-12-15 2aeddf5d098b99d28783c6a73bfa67414aa1f2fe
精选库代码优化:更新数据加入更新时间,删除无用代码
8个文件已修改
708 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/admin/LabelGoodsAdminController.java 159 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/QualityFactoryAdminController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/TaoBaoGoodsBriefServiceImpl.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/lable/LabelGoodsServiceImpl.java 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/lable/QualityFactoryServiceImpl.java 172 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/goods/TaoBaoGoodsBriefService.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/lable/LabelGoodsService.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/lable/QualityFactoryService.java 96 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/LabelGoodsAdminController.java
@@ -7,24 +7,16 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.yeshi.utils.JsonUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.yeshi.fanli.entity.bus.lable.LabelGoods;
import com.yeshi.fanli.entity.common.AdminUser;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
import com.yeshi.fanli.service.inter.lable.LabelGoodsService;
import com.yeshi.fanli.service.inter.lable.LabelService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import org.yeshi.utils.JsonUtil;
@Controller
@RequestMapping("admin/new/api/v1/labelGoods")
@@ -32,125 +24,7 @@
    @Resource
    private LabelGoodsService labelGoodsService;
    @Resource
    private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
    @Resource
    private LabelService labelService;
    /**
     * 批量贴标签---精品库
     *
     * @param callback
     * @param param
     * @param auctionIds
     * @param request
     * @param out
     */
    @RequestMapping(value = "addBatch")
    public void addBatch(String callback, String lables, String ids, HttpServletRequest request, PrintWriter out) {
        // 鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛
        AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
        if (admin == null) {
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆。")));
        } else {
            try {
                if (StringUtil.isNullOrEmpty(lables)) {
                    out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("未填写标签名称")));
                } else {
                    Gson gson = new Gson();
                    List<String> idList = gson.fromJson(ids, new TypeToken<ArrayList<String>>() {
                    }.getType());
                    if (idList == null || idList.size() == 0) {
                        out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请选择商品")));
                    } else {
                        String[] arrtitle = lables.split("\\s+");
                        labelGoodsService.setGoodsLabel(arrtitle, idList, admin);
                        out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("保存成功")));
                    }
                }
            } catch (Exception e) {
                // TODO Auto-generated catch block
                out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("操作失败")));
                e.printStackTrace();
            }
        }
    }
    /**
     * 批量添加标签 --- 精品库(随机权重)
     *
     * @param callback
     * @param label
     * @param request
     * @param out
     *            @param 权重范围 大值
     * @param 佣金范围
     *            小值
     */
    @RequestMapping(value = "addBatchRandom")
    public void addBatchRandom(String callback, String lables, String ids, Integer weight, Integer weightSmall, Integer weightLarge, HttpServletRequest request, PrintWriter out) {
        // 获取当前操作用户
        AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
        if (admin == null) {
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆。")));
        } else {
            try {
                if (StringUtil.isNullOrEmpty(lables)) {
                    out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("未填写标签名称")));
                } else {
                    if (StringUtil.isNullOrEmpty(ids)) {
                        out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("未选择需操作的商品")));
                    } else {
                        Gson gson = new Gson();
                        List<String> idList = gson.fromJson(ids, new TypeToken<ArrayList<String>>() {
                        }.getType());
                        if (idList == null || idList.size() == 0) {
                            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请选择需操作的商品")));
                        } else {
                            String[] arrtitle = lables.split("\\s+");
                            labelGoodsService.addBatchRandom(arrtitle, idList, admin, weight, weightSmall, weightLarge);
                            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("添加成功")));
                        }
                    }
                }
            } catch (Exception e) {
                // TODO Auto-generated catch block
                out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("添加异常")));
                e.printStackTrace();
            }
        }
    }
    /**
     * 批量商品添加标签-关联lableId
@@ -165,28 +39,21 @@
    public void batchGoodsAddLables(String callback, String labIds, String ids, 
            HttpServletRequest request, PrintWriter out) {
        if (StringUtil.isNullOrEmpty(ids)) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择需操作的商品"));
            return;
        }
        Gson gson = new Gson();
        List<Long> goodsIdList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {}.getType());
        if (goodsIdList == null || goodsIdList.size() == 0) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择需操作的商品"));
            return;
        }
        try {
            // 获取当前操作用户
            AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
//            if (admin == null) {
//                out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆。")));
//                return;
//            }
            if (StringUtil.isNullOrEmpty(ids)) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择需操作的商品"));
                return;
            }
            Gson gson = new Gson();
            List<Long> goodsIdList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {}.getType());
            if (goodsIdList == null || goodsIdList.size() == 0) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择需操作的商品"));
                return;
            }
            if (goodsIdList.size() == 1) {
                List<Long> labIdList = null;
fanli/src/main/java/com/yeshi/fanli/controller/admin/QualityFactoryAdminController.java
@@ -15,6 +15,7 @@
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.yeshi.utils.JsonUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -31,6 +32,7 @@
import com.yeshi.fanli.service.inter.lable.LabelGoodsService;
import com.yeshi.fanli.service.inter.lable.LabelService;
import com.yeshi.fanli.service.inter.lable.QualityFactoryService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
import com.yeshi.fanli.tag.PageEntity;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
@@ -38,7 +40,6 @@
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
import org.yeshi.utils.JsonUtil;
@Controller
@RequestMapping("admin/new/api/v1/qualityFactory")
@@ -54,6 +55,9 @@
    private QualityFactoryService qualityFactoryService;
    @Resource
    private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
    @Resource
    private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
    @Resource
    private AdminUserService adminUserService;
    
@@ -619,7 +623,7 @@
                lg.setCreatetime(nowTime);
                lg.setTaoBaoGoodsBrief(taoBaoGoodsBrief);
                int insert = labelGoodsService.insert(lg);
                int insert = labelGoodsService.insertSelective(lg);
                if (insert > 0) {
                    out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("添加成功")));
                } else {
@@ -909,7 +913,6 @@
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
        } catch (Exception e) {
            // TODO Auto-generated catch block
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
            e.printStackTrace();
        }
@@ -944,7 +947,8 @@
            if (!StringUtil.isNullOrEmpty(pictUrl)) 
                taobao.setPictUrl(pictUrl);
            
            taoBaoGoodsBriefService.updateByPrimaryKeySelective(taobao);
            // 更新商品
            taoBaoGoodsUpdateService.getUpdateTaoBaoGoodsBrief(taobao);
            
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("修改成功")));
            
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/TaoBaoGoodsBriefServiceImpl.java
@@ -4,7 +4,6 @@
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.transaction.Transactional;
@@ -14,6 +13,7 @@
import org.hibernate.Session;
import org.springframework.orm.hibernate4.HibernateCallback;
import org.springframework.stereotype.Service;
import org.yeshi.utils.NumberUtil;
import com.yeshi.fanli.dao.config.AddEveryDayTaskDao;
import com.yeshi.fanli.dao.goods.RecommendSectionGoodsDao;
@@ -46,7 +46,6 @@
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
import org.yeshi.utils.NumberUtil;
@Service
public class TaoBaoGoodsBriefServiceImpl implements TaoBaoGoodsBriefService {
@@ -336,10 +335,6 @@
        return taoBaoGoodsBriefMapper.selectByPrimaryKey(id);
    }
    @Override
    public int updateByPrimaryKey(TaoBaoGoodsBrief taoBaoGoodsBrief) {
        return taoBaoGoodsBriefMapper.updateByPrimaryKey(taoBaoGoodsBrief);
    }
    @Override
    public void updateTBGoodsWithNewInfo(TaoBaoGoodsBrief tb) throws NotExistObjectException {
@@ -356,48 +351,6 @@
            }
        }
    }
    @Override
    public void updateTaoBaoGoodsByMybatis(TaoBaoGoodsBrief taoBaoGoodsBrief) throws TaobaoGoodsDownException {
        SearchFilter filter = new SearchFilter();
        filter.setKey("https://item.taobao.com/item.htm?id=" + taoBaoGoodsBrief.getAuctionId());
        TaoBaoGoodsBrief tb = TaoKeApiUtil.searchGoodsDetail(taoBaoGoodsBrief.getAuctionId());
        if (tb == null) {
            return;
        }
        taoBaoGoodsBrief.setCouponLink(tb.getCouponLink());
        taoBaoGoodsBrief.setCouponActivityId(tb.getCouponActivityId());
        taoBaoGoodsBrief.setCouponAmount(tb.getCouponAmount());
        taoBaoGoodsBrief.setCouponEffectiveStartTime(tb.getCouponEffectiveStartTime());
        taoBaoGoodsBrief.setCouponEffectiveEndTime(tb.getCouponEffectiveEndTime());
        taoBaoGoodsBrief.setCouponInfo(tb.getCouponInfo());
        taoBaoGoodsBrief.setCouponLeftCount(tb.getCouponLeftCount());
        taoBaoGoodsBrief.setCouponLinkTaoToken(tb.getCouponLinkTaoToken());
        taoBaoGoodsBrief.setCouponOriLink(tb.getCouponOriLink());
        taoBaoGoodsBrief.setCouponShortLink(tb.getCouponShortLink());
        taoBaoGoodsBrief.setCouponStartFee(tb.getCouponStartFee());
        taoBaoGoodsBrief.setCouponTotalCount(tb.getCouponTotalCount());
        taoBaoGoodsBrief.setBiz30day(tb.getBiz30day());
        taoBaoGoodsBrief.setTkRate(tb.getTkRate());
        taoBaoGoodsBrief.setZkPrice(tb.getZkPrice());
        taoBaoGoodsBrief.setEventRate(tb.getEventRate());
        taoBaoGoodsBrief.setTkMktStatus(tb.getTkMktStatus());
        taoBaoGoodsBrief.setReservePrice(tb.getReservePrice());
        taoBaoGoodsBrief.setCreatetime(new Date());
        setGoodsBriefDefault(taoBaoGoodsBrief);
        taoBaoGoodsBriefMapper.updateByPrimaryKeySelective(taoBaoGoodsBrief);
    }
    @Override
    public void updateByPrimaryKeySelective(TaoBaoGoodsBrief taoBaoGoodsBrief) throws TaobaoGoodsDownException {
        setGoodsBriefDefault(taoBaoGoodsBrief);
        taoBaoGoodsBriefMapper.updateByPrimaryKeySelective(taoBaoGoodsBrief);
    }
    @Override
fanli/src/main/java/com/yeshi/fanli/service/impl/lable/LabelGoodsServiceImpl.java
@@ -14,7 +14,6 @@
import com.yeshi.fanli.dao.mybatis.lable.QualityFactoryMapper;
import com.yeshi.fanli.entity.bus.lable.Label;
import com.yeshi.fanli.entity.bus.lable.LabelGoods;
import com.yeshi.fanli.entity.bus.lable.QualityFactory;
import com.yeshi.fanli.entity.common.AdminUser;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.exception.LabelClassException;
@@ -44,26 +43,12 @@
    private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
    @Override
    public int insert(LabelGoods record) throws LabelGoodsException{
        return labelGoodsMapper.insert(record);
    }
    @Override
    public int updateByPrimaryKey(LabelGoods record) throws LabelGoodsException{
        // TODO Auto-generated method stub
        return labelGoodsMapper.updateByPrimaryKey(record);
    }
    @Override
    public int updateByPrimaryKeySelective(LabelGoods record) throws LabelGoodsException{
        // TODO Auto-generated method stub
        return labelGoodsMapper.updateByPrimaryKeySelective(record);
    public int insertSelective(LabelGoods record) throws LabelGoodsException{
        return labelGoodsMapper.insertSelective(record);
    }
    @Override
    public int deleteByPrimaryKey(Long id) throws LabelGoodsException{
        // TODO Auto-generated method stub
        return labelGoodsMapper.deleteByPrimaryKey(id);
    }
    
@@ -101,151 +86,12 @@
    @Override
    public LabelGoods selectByPrimaryKey(Long id) throws LabelGoodsException{
        // TODO Auto-generated method stub
        return labelGoodsMapper.selectByPrimaryKey(id);
    }
    
    @Override
    public Long getRelationNum(Long labelId) throws LabelGoodsException{
        return labelGoodsMapper.getRelationNum(labelId);
    }
    @Override
    @Transactional
    public void setGoodsLabel(String [] arrtitle, List<String> auctionIdList, AdminUser admin) throws Exception{
        // TODO Auto-generated method stub
        Date nowTime = new Date();
        for (String title: arrtitle) {
            /*   遍历标签名称:查询数据库中是否已存在    */
            Label label = null;
            List<Label> labels = labelService.selectByTitle(title.trim());
            if (labels == null || labels.size() == 0) {
                label = labels.get(0);
            } else {
                // 新增
                label =  new Label();
                label.setTitle(title);// 名称
                label.setEntrymode(Label.MODE_EXCEL); // 批量录入
                label.setCreatetime(nowTime);
                label.setUpdatetime(nowTime);
                label.setCreateUser(admin);
                label.setIosClick(0l);
                label.setAndroidClick(0l);
                labelService.insertSelective(label);
            }
            /*  各个商品贴上标签       */
            for (String id: auctionIdList) {
                long gid = Long.parseLong(id);
                TaoBaoGoodsBrief goodsBrief =  taoBaoGoodsBriefService.selectByPrimaryKey(Long.parseLong(id));
                if (goodsBrief != null) {
                    /*  贴上标签 : 已贴不处理则   */
                    Long existence = labelGoodsMapper.isExistence(gid, label.getId());
                    // 该商品不存在此标签则添加, 反之不做处理
                    if (existence == null || existence == 0l) {
                        // 贴上新标签
                        LabelGoods  lg = new LabelGoods();
                        lg.setLabel(label);
                        lg.setCreateUser(admin);
                        lg.setCreatetime(nowTime);
                        lg.setTaoBaoGoodsBrief(goodsBrief);
                        labelGoodsMapper.insertSelective(lg);
                    }
                }
            }
        }
    }
    @Override
    @Transactional
    public void addBatchRandom(String[] arrtitle, List<String> idList, AdminUser admin,
            Integer weight,    Integer weightSmall, Integer weightLarge) throws Exception{
        // 默认 50
        int resultWeight = 50;
        if (weight != null) {
            resultWeight = weight;
        } else {
            if (weightSmall != null && weightLarge != null) {
                resultWeight = weightSmall + (int)(Math.random() * ((weightLarge - weightSmall) + 1));
            }
        }
        Date nowTime = new Date();
        for (String title: arrtitle) {
            /*   遍历标签名称:查询数据库中是否已存在    */
            Label label = null;
            List<Label> labels = labelService.selectByTitle(title.trim());
            if (labels == null || labels.size() == 0) {
                label = labels.get(0);
            } else {
                // 新增
                label =  new Label();
                label.setTitle(title);// 名称
                label.setEntrymode(Label.MODE_EXCEL); // 批量录入
                label.setCreatetime(nowTime);
                label.setUpdatetime(nowTime);
                label.setCreateUser(admin);
                label.setIosClick(0l);
                label.setAndroidClick(0l);
                labelService.insertSelective(label);
            }
            for (String sid: idList) {
                Long selectId = Long.parseLong(sid);
                QualityFactory selectionGoods = selectionGoodsMapper.selectByPrimaryKey(selectId);
                if (selectionGoods == null ) {
                    continue;
                }
                TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
                if (taoBaoGoodsBrief == null ) {
                    continue;
                }
                /*  贴上标签 : 已贴不处理则   */
                Long existence = labelGoodsMapper.isExistence(taoBaoGoodsBrief.getId(), label.getId());
                // 该商品不存在此标签则添加, 反之不做处理
                if (existence == null || existence == 0l) {
                    // 贴上新标签
                    LabelGoods  lg = new LabelGoods();
                    lg.setLabel(label);
                    lg.setCreateUser(admin);
                    lg.setCreatetime(nowTime);
                    lg.setTaoBaoGoodsBrief(taoBaoGoodsBrief);
                    labelGoodsMapper.insertSelective(lg);
                }
                // 修改权重
                selectionGoods.setUpdateUser(admin);
                selectionGoods.setUpdatetime(nowTime);
                selectionGoods.setWeight(resultWeight);
                selectionGoodsMapper.insertSelective(selectionGoods);
            }
        }
    }
    
    
fanli/src/main/java/com/yeshi/fanli/service/impl/lable/QualityFactoryServiceImpl.java
@@ -70,25 +70,12 @@
    @Resource
    private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
    @Override
    public int insert(QualityFactory record) throws QualityFactoryException {
        return qualityFactoryMapper.insert(record);
    }
    @Override
    public int updateByPrimaryKey(QualityFactory record) throws QualityFactoryException {
        return qualityFactoryMapper.updateByPrimaryKey(record);
    }
    @Override
    public int updateByPrimaryKeySelective(QualityFactory record) throws QualityFactoryException {
        return qualityFactoryMapper.updateByPrimaryKeySelective(record);
    }
    @Override
    public int deleteByPrimaryKey(Long id) throws QualityFactoryException {
        return qualityFactoryMapper.deleteByPrimaryKey(id);
    }
    @Override
    public void deleteByTbAuctionId(Long auctionId) {
@@ -160,16 +147,6 @@
        labelGoodsMapper.deleteBatchByGoodsId(listGid);
    }
    @Override
    @Transactional
    public void deleteBatchByPrimaryKey(List<String> ids) throws QualityFactoryException {
        if (ids != null) {
            for (String id : ids) {
                qualityFactoryMapper.deleteByPrimaryKey(Long.parseLong(id));
            }
        }
    }
    @Override
    @Transactional
@@ -182,10 +159,6 @@
        }
    }
    @Override
    public int removeStorageGoods(String doTime, Long gcids) throws QualityFactoryException {
        return qualityFactoryMapper.removeStorageGoods(doTime, gcids);
    }
    @Override
    public QualityFactory selectByPrimaryKey(Long id) throws QualityFactoryException {
@@ -320,10 +293,10 @@
                TaoBaoGoodsBrief currentGoodsBrief = taoBaoGoodsBriefList.get(0);
                goodsBrief.setId(currentGoodsBrief.getId());
                // 非空项 处理
                setTaoBaoGoodsBriefDefault(goodsBrief);
                // 更新商品最新信息
                taoBaoGoodsBriefService.updateByPrimaryKey(goodsBrief);
                taoBaoGoodsUpdateService.updateTaoBaoGoods(goodsBrief);
            } else {
                // 插入本地数据库
@@ -361,7 +334,7 @@
                // 更新商品
                QualityFactory selectionGoods = selectionList.get(0);
                selectionGoods.setUpdatetime(new Date());
                qualityFactoryMapper.updateByPrimaryKey(selectionGoods);
                qualityFactoryMapper.updateByPrimaryKeySelective(selectionGoods);
            }
            if (listLabs.size() > 0) {
@@ -419,7 +392,7 @@
            }
            // 修改权重
            // selectionGoods.setUpdateUser(admin);
            selectionGoods.setUpdateUser(admin);
            selectionGoods.setWeight(resultWeight);
            qualityFactoryMapper.updateByPrimaryKeySelective(selectionGoods);
        }
@@ -443,7 +416,7 @@
    @Override
    public List<Long> queryNeedUpdate(long start, int count, int hour) {
        return qualityFactoryMapper.queryNeedUpdate(0, count, hour);
        return qualityFactoryMapper.queryNeedUpdate(start, count, hour);
    }
    
@@ -651,139 +624,6 @@
        }
    }
    @Override
    @Transactional
    public void updateBatchQualityFactory(List<QualityFactory> listQuality, List<Long> list9Class,
            Map<String, Label> map) throws Exception {
        if (listQuality == null || listQuality.size() == 0) {
            return;
        }
        List<Long> listDeleteQuality = new ArrayList<Long>();
        List<QualityFactory> listUpdateQuality = new ArrayList<QualityFactory>();
        List<Long> listGid = new ArrayList<Long>();
        List<TaoBaoGoodsBrief> listUpdateGoodsBrief = new ArrayList<TaoBaoGoodsBrief>();
        List<Long> list9ClassDelete = new ArrayList<Long>();
        // 添加商品标签列表
        List<LabelGoods> listLabelAdd = new ArrayList<LabelGoods>();
        listQuality.parallelStream().forEach(quality -> {
            TaoBaoGoodsBrief goods = quality.getTaoBaoGoodsBrief();
            if (goods == null) {
                // 移除精选库
                listDeleteQuality.add(quality.getId());
            } else {
                Long id = goods.getId();
                Long auctionId = goods.getAuctionId();
                try {
                    // 获取详情
                    TaoBaoGoodsBrief taoBaoGoodsBrief = TaoKeApiUtil.searchGoodsDetail(auctionId);
                    if (taoBaoGoodsBrief == null) {
                        /* 无券信息 移除精选库 */
                        listGid.add(id);
                    } else {
                        /* 无券信息 移除精选库 */
                        if (StringUtil.isNullOrEmpty(taoBaoGoodsBrief.getCouponInfo())
                                && StringUtil.isNullOrEmpty(taoBaoGoodsBrief.getCouponActivityId())) { // 无券信息
                            // 移除精选库
                            listGid.add(id);
                            /* 更新商品信息 */
                            TaoBaoGoodsBrief updateGoods = taoBaoGoodsUpdateService
                                    .getUpdateTaoBaoGoodsBrief(taoBaoGoodsBrief);
                            updateGoods.setId(id);
                            taoBaoGoodsBriefService.setGoodsBriefDefault(updateGoods);
                            listUpdateGoodsBrief.add(updateGoods);
                        } else {
                            /* 更新商品信息 */
                            TaoBaoGoodsBrief updateGoods = taoBaoGoodsUpdateService
                                    .getUpdateTaoBaoGoodsBrief(taoBaoGoodsBrief);
                            updateGoods.setId(id);
                            taoBaoGoodsBriefService.setGoodsBriefDefault(updateGoods);
                            listUpdateGoodsBrief.add(updateGoods);
                            /* 更新精选库 信息时间 */
                            Integer biz30day = updateGoods.getBiz30day();
                            if (biz30day < 1000) {
                                // 销量小于1000 重新设置权重
                                int weight = 10 + (int) (Math.random() * 2000);
                                quality.setWeight(weight);
                            }
                            quality.setUpdatetime(new Date());
                            listUpdateQuality.add(quality);
                            /* 判断是否已经贴上标签 9k9标签 对应价格变化 */
                            if (list9Class.size() > 0) {
                                List<LabelGoods> listGlid = labelGoodsMapper.listQuery9k9Class(id, list9Class);
                                if (listGlid != null && listGlid.size() > 0) {
                                    /* 删除原标签 9k9 */
                                    for (LabelGoods labelGoods : listGlid) {
                                        list9ClassDelete.add(labelGoods.getId());
                                    }
                                    /* 贴上新标签 9k9 */
                                    LabelGoods labelGds = screen9K9(updateGoods, map);
                                    if (labelGds != null) {
                                        listLabelAdd.add(labelGds);
                                    }
                                }
                            }
                        }
                    }
                } catch (TaobaoGoodsDownException e1) {
                    // 商品下架 移除数据库
                    taoBaoGoodsUpdateService.deleteTaoBaoGoods(auctionId);
                } catch (Exception e) {
                    try {
                        LogHelper.errorDetailInfo(e);
                    } catch (Exception e1) {
                        e1.printStackTrace();
                    }
                }
            }
        });
        // 更新商品信息
        if (listUpdateGoodsBrief.size() > 0) {
            taoBaoGoodsBriefService.updateBatchSelective(listUpdateGoodsBrief);
        }
        // 更新精选库
        if (listUpdateQuality.size() > 0) {
            qualityFactoryMapper.updateBatchSelective(listUpdateQuality);
        }
        // 批量移除精选库
        if (listGid.size() > 0) {
            deleteBatchByTaoBaoGoodsId(listGid);
        }
        // 批量删除精选库
        if (listDeleteQuality.size() > 0) {
            qualityFactoryMapper.deleteBatchByPrimaryKey(listDeleteQuality);
        }
        // 添加标签
        if (listLabelAdd.size() > 0) {
            labelGoodsMapper.insertBatch(listLabelAdd);
        }
        // 删除标签
        if (list9ClassDelete.size() > 0) {
            labelGoodsMapper.deleteBatchByPK(list9ClassDelete);
        }
    }
    @Override
    public void autoInsertOrUpadateStorage(List<TaoBaoGoodsBrief> goodsList, List<Label> listLabs,
fanli/src/main/java/com/yeshi/fanli/service/inter/goods/TaoBaoGoodsBriefService.java
@@ -89,22 +89,6 @@
    public TaoBaoGoodsBrief selectByPrimaryKey(Long id);
    /**
     * 更新商品信息与淘宝信息一致
     *
     * @param taoBaoGoodsBrief
     * @throws TaobaoGoodsDownException
     */
    public void updateTaoBaoGoodsByMybatis(TaoBaoGoodsBrief taoBaoGoodsBrief) throws TaobaoGoodsDownException;
    /**
     * 选择性更新数据--mybatis
     *
     * @param taoBaoGoodsBrief
     * @throws TaobaoGoodsDownException
     */
    public void updateByPrimaryKeySelective(TaoBaoGoodsBrief taoBaoGoodsBrief) throws TaobaoGoodsDownException;
    /**
     * 设置默认值
     * 
     * @param goodsBrief
@@ -121,10 +105,6 @@
     */
    public TaoBaoGoodsBrief getTaoBaoGoodsDetailForShare(Long auctionId, Long uid) throws ShareGoodsException;
    public int updateByPrimaryKey(TaoBaoGoodsBrief taoBaoGoodsBrief);
    /**
     * 批量插入商品
     * @param list
fanli/src/main/java/com/yeshi/fanli/service/inter/lable/LabelGoodsService.java
@@ -17,25 +17,7 @@
     * @return
     * @throws LabelGoodsException
     */
    public int insert(LabelGoods record) throws LabelGoodsException;
    /**
     * 更新当前对象所有数据
     *
     * @param record
     * @return
     * @throws LabelGoodsException
     */
    public int updateByPrimaryKey(LabelGoods record) throws LabelGoodsException;
    /**
     * 选择性更新内容——不为空则更新该字段
     *
     * @param record
     * @return
     * @throws LabelGoodsException
     */
    public int updateByPrimaryKeySelective(LabelGoods record) throws LabelGoodsException;
    public int insertSelective(LabelGoods record) throws LabelGoodsException;
    /**
     * 根据id删除当前对象
@@ -63,16 +45,6 @@
     */
    public int deleteBatchById(long[] ids) throws LabelGoodsException;
    /**
     * 商品贴标签
     *
     * @param arrtitle
     * @param ids
     * @param admin
     * @return
     * @throws LabelGoodsException
     */
    public void setGoodsLabel(String[] arrtitle, List<String> goodsIds, AdminUser admin) throws Exception;
    /**
     * 根据商品id 删除商品对应的所有标签信息
@@ -82,18 +54,6 @@
     */
    public void deleteByGoodsId(List<String> ids) throws LabelGoodsException;
    /**
     * 批量添加商品标签
     *
     * @param label
     * @param goodsIdList
     * @param admin
     * @param weight
     * @param weightSmall
     * @param weightLarge
     */
    public void addBatchRandom(String[] lables, List<String> idList, AdminUser admin, Integer weight,
            Integer weightSmall, Integer weightLarge) throws Exception;
    /**
     * 获取标签商品关联数量
fanli/src/main/java/com/yeshi/fanli/service/inter/lable/QualityFactoryService.java
@@ -14,22 +14,6 @@
public interface QualityFactoryService {
    
    /**
     * 插入对象
     * @param record
     * @return
     * @throws QualityFactoryException
     */
    public int insert(QualityFactory record) throws QualityFactoryException;
    /**
     * 更新当前对象所有数据
     * @param record
     * @return
     * @throws QualityFactoryException
     */
    public int updateByPrimaryKey(QualityFactory record) throws QualityFactoryException;
    /**
     * 选择性更新内容——不为空则更新该字段
     * @param record
     * @return
@@ -37,14 +21,6 @@
     */
    public int updateByPrimaryKeySelective(QualityFactory record) throws QualityFactoryException;
    
    /**
     * 根据id删除当前对象
     * @param id
     * @return
     * @throws QualityFactoryException
     */
    public int deleteByPrimaryKey(Long id) throws QualityFactoryException;
    
    /**
     * 根据id查找当前对象
@@ -53,14 +29,6 @@
     * @throws QualityFactoryException
     */
    public QualityFactory selectByPrimaryKey(Long id) throws QualityFactoryException;
    /**
     * 根据id批量删除
     * @param ids
     */
    public void deleteBatchByPrimaryKey(List<String> ids) throws QualityFactoryException;
    
    
    /**
@@ -75,6 +43,28 @@
     * @throws QualityFactoryException
     */
    public void deleteByGoodsId(List<String> ids) throws QualityFactoryException;
    /**
     * 根据淘宝id 删除精选库对应信息
     * @param gid
     * @throws QualityFactoryException
     */
    public void deleteByTaoBaoGoodsId(Long gid) throws QualityFactoryException;
    /**
     * 根据淘宝id集合 批量删除精选库对应信息
     * @param listId
     * @throws QualityFactoryException
     */
    public void deleteBatchByTaoBaoGoodsId(List<Long> listId) throws QualityFactoryException;
    /**
     * 根据淘宝id 删除
     * @param auctionId
     * @throws QualityFactoryException
     */
    public void deleteByTbAuctionId(Long auctionId);
    
    /**
     * 统计商品id 是存在精品库
@@ -164,16 +154,6 @@
    /**
     *  批量更新精选库商品信息 : 无优惠券、已下架商品 移除精选库 不能超过20个
     * @param list
     * @throws Exception
     */
    public void updateBatchQualityFactory(List<QualityFactory> list, List<Long> list9Class,
            Map<String,Label> map) throws Exception;
    /**
     * 查询需要更新的精选库商品id
     * @param count
     * @param hour
@@ -216,17 +196,6 @@
    
    /**
     * 根据商品id删除
     * @param doTime
     * @param gcids
     * @return
     * @throws QualityFactoryException
     */
    public int removeStorageGoods(String doTime, Long gcids) throws QualityFactoryException;
    /**
     * AuctionId查收精选库
     * @param list
     * @return
@@ -234,27 +203,6 @@
    public List<QualityFactory> listQueryByAuctionId(List<Long> list);
    
    /**
     * 根据淘宝id 删除精选库对应信息
     * @param gid
     * @throws QualityFactoryException
     */
    public void deleteByTaoBaoGoodsId(Long gid) throws QualityFactoryException;
    /**
     * 根据淘宝id集合 批量删除精选库对应信息
     * @param listId
     * @throws QualityFactoryException
     */
    public void deleteBatchByTaoBaoGoodsId(List<Long> listId) throws QualityFactoryException;
    /**
     * 根据淘宝id 删除
     * @param auctionId
     * @throws QualityFactoryException
     */
    public void deleteByTbAuctionId(Long auctionId);
    /**
     * 根据时间 获取当前时间之前创建的商品信息
     * @param systemCid 系统分类id