精选库商品入库及更新调整 + 9k9类商品查询取消标签查询
| | |
| | | @RequestMapping(value = "removeGoods")
|
| | | public void removeGoods(String callback, String ids, PrintWriter out) {
|
| | | try {
|
| | |
|
| | | Gson gson = new Gson();
|
| | | List<String> goodsIds = gson.fromJson(ids, new TypeToken<ArrayList<String>>() {}.getType());
|
| | | List<Long> goodsIds = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {}.getType());
|
| | |
|
| | | if (goodsIds == null || goodsIds.size() == 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("未检测到移除商品数据")));
|
| | | } else {
|
| | | // 商品移除精品库
|
| | | qualityFactoryService.deleteByGoodsId(goodsIds);
|
| | | // 清理商品所有标签
|
| | | labelGoodsService.deleteByGoodsId(goodsIds);
|
| | |
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("移除成功")));
|
| | | }
|
| | |
|
| | | return;
|
| | | } |
| | | |
| | | qualityFactoryService.deleteBatchByTaoBaoGoodsId(goodsIds);
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("移除成功")));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("操作失败")));
|
| | | e.printStackTrace();
|
| | |
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.lable.Label;
|
| | | import com.yeshi.fanli.entity.bus.lable.MergeClass;
|
| | | import com.yeshi.fanli.entity.bus.lable.QualityFactory;
|
| | | import com.yeshi.fanli.entity.goods.CollectionGoodsV2;
|
| | |
| | | */
|
| | | @RequestMapping(value = "get9k9")
|
| | | public void get9k9(String callback, Integer page, Long mcid, PrintWriter out) {
|
| | | get9k9ClassGoods("9.9", callback, page, mcid, out);
|
| | | get9k9ClassGoods(callback, out, page, 500, new BigDecimal(209.9), new BigDecimal(0), new BigDecimal(9.9), mcid);
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | @RequestMapping(value = "get19k9")
|
| | | public void get19k9(String callback, Integer page, Long mcid, PrintWriter out) {
|
| | | get9k9ClassGoods("19.9", callback, page, mcid, out);
|
| | | get9k9ClassGoods(callback, out, page, 500, new BigDecimal(319.9), new BigDecimal(9.9), new BigDecimal(19.9), mcid);
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | @RequestMapping(value = "get29k9")
|
| | | public void get29k9(String callback, Integer page, Long mcid, PrintWriter out) {
|
| | | get9k9ClassGoods("29.9", callback, page, mcid, out);
|
| | | get9k9ClassGoods(callback, out, page, 500, new BigDecimal(429.9), new BigDecimal(19.9), new BigDecimal(29.9), mcid);
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | @RequestMapping(value = "get49k9")
|
| | | public void get49k9(String callback, Integer page, Long mcid, PrintWriter out) {
|
| | | get9k9ClassGoods("49.9", callback, page, mcid, out);
|
| | | get9k9ClassGoods(callback, out, page, 500, new BigDecimal(549.9), new BigDecimal(29.9), new BigDecimal(49.9), mcid);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * 对应类目id
|
| | | * @param out
|
| | | */
|
| | | public void get9k9ClassGoods(String labName, String callback, Integer page, Long mcid, PrintWriter out) {
|
| | |
|
| | | public void get9k9ClassGoods(String callback, PrintWriter out, Integer page, Integer biz30day, BigDecimal zkPrice,
|
| | | BigDecimal minQuanPrice, BigDecimal maxQuanPrice, Long mcid) {
|
| | | try {
|
| | |
|
| | | List<Label> labs = labelService.selectByTitleCache("labKey", labName);
|
| | | if (labs == null || labs.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | Long labId = labs.get(0).getId();
|
| | |
|
| | | if (page == null)
|
| | | if (page == null || page <= 0) {
|
| | | page = 1;
|
| | | }
|
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | JSONObject jsonGoods = queryGoodsSmallAmount(page, pageSize, mcid, labId);
|
| | | if (jsonGoods == null) {
|
| | | String mergeCids = null;
|
| | | if (mcid != null && (!mcid.equals(0) || mcid != 0)) {
|
| | | MergeClass mergeClass = mergeClassService.selectByPrimaryKeyCache(mcid);
|
| | | if (mergeClass != null) {
|
| | | // 分类id,隔开
|
| | | mergeCids = mergeClass.getMergeCids();
|
| | | }
|
| | | }
|
| | |
|
| | | // 根据标签id 查询数据
|
| | | List<QualityFactory> listQuery = qualityGoodsService.get9k9ClassGoods((page-1)*pageSize, pageSize, biz30day, zkPrice,
|
| | | minQuanPrice, maxQuanPrice, mergeCids);
|
| | | if (listQuery == null || listQuery.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "没有更多了"));
|
| | | return;
|
| | | }
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(jsonGoods));
|
| | | // 总条数
|
| | | long count = qualityGoodsService.count9k9ClassGoods(biz30day, zkPrice, minQuanPrice, maxQuanPrice, mergeCids);
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | | /* 遍历列表数据 */
|
| | | for (QualityFactory selectionGoods : listQuery) {
|
| | | TaoBaoGoodsBrief goodsBrief = selectionGoods.getTaoBaoGoodsBrief();
|
| | | if (goodsBrief == null) {
|
| | | continue;
|
| | | }
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief, proportion.toString(), null)));
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | data.put("result_list", array);
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败"));
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取商品
|
| | | * |
| | | * @param page
|
| | | * @param pageSize
|
| | | * @param labIds
|
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public JSONObject queryGoodsSmallAmount(int page, int pageSize, Long mcid, Long labId) throws Exception {
|
| | |
|
| | | String mergeCids = null;
|
| | | if (mcid != null && (!mcid.equals(0) || mcid != 0)) {
|
| | |
|
| | | MergeClass mergeClass = mergeClassService.selectByPrimaryKeyCache(mcid);
|
| | | if (mergeClass != null) {
|
| | | // 分类id,隔开
|
| | | mergeCids = mergeClass.getMergeCids();
|
| | | }
|
| | | }
|
| | |
|
| | | // 根据标签id 查询数据
|
| | | List<QualityFactory> listQuery = qualityGoodsService.listQuerySmallAmount((page - 1) * pageSize, pageSize, null,
|
| | | labId, mergeCids);
|
| | |
|
| | | // 总条数
|
| | | long count = qualityGoodsService.countQuerySmallAmount(null, labId, mergeCids);
|
| | | if (listQuery == null || listQuery.size() == 0) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | | /* 遍历列表数据 */
|
| | | for (QualityFactory selectionGoods : listQuery) {
|
| | |
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
|
| | |
|
| | | if (taoBaoGoodsBrief == null) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | int biz30day = taoBaoGoodsBrief.getBiz30day();
|
| | | if (biz30day >= 10000) {
|
| | | double sales = biz30day;
|
| | | String salesCountMidea = String.format("%.1f", sales / 10000);
|
| | | taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
|
| | | } else {
|
| | | taoBaoGoodsBrief.setSalesCount(biz30day + "");
|
| | | }
|
| | |
|
| | | // 改变图片尺寸
|
| | | String pictUrl = taoBaoGoodsBrief.getPictUrl();
|
| | | if (!StringUtil.isNullOrEmpty(pictUrl) && !pictUrl.contains("320x320")) {
|
| | | taoBaoGoodsBrief.setPictUrl(TbImgUtil.getTBSize320Img(pictUrl));
|
| | | }
|
| | |
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | |
|
| | | data.put("count", count);
|
| | | data.put("result_list", array);
|
| | |
|
| | | return data;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 9.9商品-每日必抢
|
| | |
| | | */
|
| | | @RequestMapping(value = "get9k9EverydayRob")
|
| | | public void get9k9EverydayRob(String callback, Integer page, Long mcid, PrintWriter out) {
|
| | | get9k9ClassToDayRob("9.9", callback, page, mcid, out, 1.0, 50.0);
|
| | | queryEverydayRob(callback, out, page, new BigDecimal(209.9), new BigDecimal(0), new BigDecimal(9.9));
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | @RequestMapping(value = "get19k9EverydayRob")
|
| | | public void get19k9EverydayRob(String callback, Integer page, Long mcid, PrintWriter out) {
|
| | | get9k9ClassToDayRob("19.9", callback, page, mcid, out, 1.0, 50.0);
|
| | | queryEverydayRob(callback, out, page, new BigDecimal(319.9), new BigDecimal(9.9), new BigDecimal(19.9));
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | @RequestMapping(value = "get29k9EverydayRob")
|
| | | public void get29k9EverydayRob(String callback, Integer page, Long mcid, PrintWriter out) {
|
| | | get9k9ClassToDayRob("29.9", callback, page, mcid, out, 1.0, 50.0);
|
| | | queryEverydayRob(callback, out, page, new BigDecimal(429.9), new BigDecimal(19.9), new BigDecimal(29.9));
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | @RequestMapping(value = "get49k9EverydayRob")
|
| | | public void get49k9EverydayRob(String callback, Integer page, Long mcid, PrintWriter out) {
|
| | | get9k9ClassToDayRob("49.9", callback, page, mcid, out, 1.0, 50.0);
|
| | | queryEverydayRob(callback, out, page, new BigDecimal(549.9), new BigDecimal(29.9), new BigDecimal(49.9));
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 9k9类型商品对应的每日必抢
|
| | | * |
| | | * @param labName
|
| | | * @param callback
|
| | | * @param page
|
| | | * @param mcid
|
| | | * @param out
|
| | | * @param startCouponAmount
|
| | | * @param endCouponAmount
|
| | | */
|
| | | public void get9k9ClassToDayRob(String labName, String callback, Integer page, Long mcid, PrintWriter out,
|
| | | Double startCouponAmount, Double endCouponAmount) {
|
| | |
|
| | | try {
|
| | |
|
| | | List<Label> labs = labelService.selectByTitleCache("labKey", labName);
|
| | | if (labs == null || labs.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | Long labId = labs.get(0).getId();
|
| | | JSONObject jsonGoods = queryEverydayRob(page, labId, 2, startCouponAmount, endCouponAmount);
|
| | |
|
| | | if (jsonGoods == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "没有更多了"));
|
| | | return;
|
| | | }
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(jsonGoods));
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败"));
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 每日必抢
|
| | |
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public JSONObject queryEverydayRob(Integer page, Long labId, int sortField, Double startCouponAmount,
|
| | | Double endCouponAmount) throws Exception {
|
| | | public void queryEverydayRob(String callback, PrintWriter out, Integer page, BigDecimal zkPrice,
|
| | | BigDecimal minQuanPrice, BigDecimal maxQuanPrice) {
|
| | |
|
| | | if (page == null)
|
| | | page = 1;
|
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | // 20 条一页请求到3页结束今日新品
|
| | | if (page > 3) {
|
| | | return null;// 20 条一页请求到3页结束今日新品
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "没有更多了"));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 根据标签id 查询数据
|
| | | List<QualityFactory> listQuery = qualityGoodsService.listQueryEverydayRob((page - 1) * pageSize, pageSize, null,
|
| | | labId, sortField, startCouponAmount, endCouponAmount);
|
| | |
|
| | | // 只取前50条数
|
| | | long count = 50;
|
| | |
|
| | | // long count = qualityGoodsService.countQueryEverydayRob(null, labId,
|
| | | // startCouponAmount, endCouponAmount);
|
| | |
|
| | | if (listQuery == null || listQuery.size() == 0) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | /* 遍历列表数据 */
|
| | | for (QualityFactory selectionGoods : listQuery) {
|
| | |
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
|
| | |
|
| | | if (taoBaoGoodsBrief == null) {
|
| | | continue;
|
| | | try {
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | List<QualityFactory> listQuery = qualityGoodsService.listQueryEverydayRob((page - 1) * pageSize, pageSize,
|
| | | zkPrice, minQuanPrice, maxQuanPrice);
|
| | | if (listQuery == null || listQuery.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "没有更多了"));
|
| | | return;
|
| | | }
|
| | |
|
| | | int biz30day = taoBaoGoodsBrief.getBiz30day();
|
| | | if (biz30day >= 10000) {
|
| | | double sales = biz30day;
|
| | | String salesCountMidea = String.format("%.1f", sales / 10000);
|
| | | taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | for (QualityFactory selectionGoods : listQuery) {
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
|
| | | if (taoBaoGoodsBrief == null) {
|
| | | continue;
|
| | | }
|
| | | array.add(gson
|
| | | .toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
|
| | | }
|
| | |
|
| | | long count = qualityGoodsService.countQueryEverydayRob(zkPrice, minQuanPrice, maxQuanPrice);
|
| | | if (count < 50) {
|
| | | count = listQuery.size();
|
| | | } else {
|
| | | taoBaoGoodsBrief.setSalesCount(biz30day + "");
|
| | | count = 50;
|
| | | }
|
| | |
|
| | | // 改变图片尺寸
|
| | | String pictUrl = taoBaoGoodsBrief.getPictUrl();
|
| | | if (!StringUtil.isNullOrEmpty(pictUrl) && !pictUrl.contains("320x320")) {
|
| | | taoBaoGoodsBrief.setPictUrl(TbImgUtil.getTBSize320Img(pictUrl));
|
| | | }
|
| | |
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | data.put("result_list", array);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | |
|
| | | data.put("count", count);
|
| | | data.put("result_list", array);
|
| | |
|
| | | return data;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | List<TaoBaoClassRelation> listByTaoBaoCid(Long taobaoCid); |
| | | |
| | | /** |
| | | * 根据淘宝分类id查询系统分类 |
| | | * @param taobaoCid |
| | | * @return |
| | | */ |
| | | Long getClassIdByTaoBaoCid(Long taobaoCid); |
| | | |
| | | /** |
| | | * 根据分类id查询 |
| | | * |
| | | * @param taobaoCid |
| | |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.lable.LabelGoods; |
| | | |
| | | |
| | | |
| | | public interface LabelGoodsMapper { |
| | | public interface LabelGoodsMapper extends BaseMapper<LabelGoods>{ |
| | | |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(LabelGoods record); |
| | | |
| | | int insertSelective(LabelGoods record); |
| | | |
| | | LabelGoods selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(LabelGoods record); |
| | | |
| | | int updateByPrimaryKey(LabelGoods record); |
| | | |
| | | /** |
| | | * 批量插入 |
| | | * @param list |
| | |
| | | |
| | | |
| | | /** |
| | | * 删除商品多个标签 |
| | | */ |
| | | void deleteByAuctionIdAndLabIDs(@Param("auctionId")Long auctionId, @Param("list") List<Long> list); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * @param ids |
| | | * @return |
| | |
| | | |
| | | List<Label> selectByTitle(@Param("title") String title); |
| | | |
| | | |
| | | Label getByTitle(@Param("title") String title); |
| | | |
| | | |
| | | /** |
| | | * 多个标签查询 |
| | | * @param list |
| | | * @return |
| | | */ |
| | | List<Label> listByTitles(List<String> list); |
| | | |
| | | |
| | | /** |
| | | * 统计标签总数 |
| | | * @return |
| | |
| | | package com.yeshi.fanli.dao.mybatis.lable; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.lable.QualityFactory; |
| | | import com.yeshi.fanli.vo.quality.QualityFactoryVO; |
| | | |
| | | public interface QualityFactoryMapper { |
| | | public interface QualityFactoryMapper extends BaseMapper<QualityFactory>{ |
| | | |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(QualityFactory record); |
| | | |
| | | int insertSelective(QualityFactory record); |
| | | |
| | | QualityFactory selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(QualityFactory record); |
| | | |
| | | int updateByPrimaryKey(QualityFactory record); |
| | | |
| | | /** |
| | | * 批量插入 |
| | |
| | | * @return |
| | | */ |
| | | int deleteBatchByPrimaryKey(List<Long> list); |
| | | |
| | | |
| | | /** |
| | | * 根据商品id 批量删除 |
| | | * @param list |
| | | */ |
| | | void deleteBatchByGoodsId(List<Long> list); |
| | | |
| | | /** |
| | | * 统计总行数 |
| | |
| | | Long countTotalRows(@Param("days") Integer days); |
| | | |
| | | List<QualityFactory> queryByGoodsId(@Param("goodsId") Long goodsId); |
| | | |
| | | |
| | | /** |
| | | * 根据商品id查询 |
| | | * @param auctionId |
| | | * @return |
| | | */ |
| | | QualityFactory getByAuctionId(@Param("auctionId") Long auctionId); |
| | | |
| | | |
| | | /** |
| | | * 根据多个商品id 查询对应的商品信息 |
| | |
| | | */ |
| | | int removeStorageGoods(String doTime, Long gcids); |
| | | |
| | | /** |
| | | * 今日必抢 - 9k9 |
| | | * |
| | | * @param start |
| | | * @param count |
| | | * @param systemCid |
| | | * @param labId |
| | | * @param sortField |
| | | * @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("shopId") Long shopId); |
| | | |
| | | long countByShopId(@Param("shopId") Long shopId); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 9k9类 |
| | | * |
| | | */ |
| | | List<QualityFactory> get9k9ClassGoods(@Param("start") long start, @Param("count") int count, |
| | | @Param("biz30day") Integer biz30day, @Param("zkPrice") BigDecimal zkPrice, |
| | | @Param("minQuanPrice") BigDecimal minQuanPrice, @Param("maxQuanPrice") BigDecimal maxQuanPrice, |
| | | @Param("cids") String cids); |
| | | |
| | | long count9k9ClassGoods(@Param("biz30day") Integer biz30day, @Param("zkPrice") BigDecimal zkPrice, |
| | | @Param("minQuanPrice") BigDecimal minQuanPrice, @Param("maxQuanPrice") BigDecimal maxQuanPrice |
| | | ,@Param("cids") String cids); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 今日必抢 - 9k9 |
| | | * |
| | | */ |
| | | List<QualityFactory> listQueryEverydayRob(@Param("start") long start, @Param("count") int count, |
| | | @Param("zkPrice") BigDecimal zkPrice, |
| | | @Param("minQuanPrice") BigDecimal minQuanPrice, @Param("maxQuanPrice") BigDecimal maxQuanPrice); |
| | | |
| | | long countQueryEverydayRob(@Param("zkPrice") BigDecimal zkPrice, |
| | | @Param("minQuanPrice") BigDecimal minQuanPrice, @Param("maxQuanPrice") BigDecimal maxQuanPrice); |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.lable.QualityFlashSale; |
| | | |
| | | public interface QualityFlashSaleMapper { |
| | | public interface QualityFlashSaleMapper extends BaseMapper<QualityFlashSale>{ |
| | | |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * @param list |
| | | * @return |
| | | */ |
| | | int deleteBatchByPrimaryKey(List<Long> list); |
| | | |
| | | int insert(QualityFlashSale record); |
| | | |
| | | int insertSelective(QualityFlashSale record); |
| | | |
| | | QualityFlashSale selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(QualityFlashSale record); |
| | | |
| | | int updateByPrimaryKey(QualityFlashSale record); |
| | | |
| | | |
| | | /** |
| | | * 批量插入 |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | int deleteByQualityID(Long qid); |
| | | int deleteByGoodsId(Long qid); |
| | | |
| | | /** |
| | | * 根据精选id 批量删除 |
| | |
| | | |
| | | int deleteByAuctionId(Long auctionId); |
| | | |
| | | /* |
| | | * 根据商品id 批量删除 |
| | | * @param list |
| | | */ |
| | | void deleteBatchByGoodsId(List<Long> list); |
| | | |
| | | |
| | | /** |
| | | * 根据auctionId 查询商品信息 |
| | |
| | | * @return |
| | | */ |
| | | List<TaoBaoGoodsBrief> queryGoodsByAuctionId(List<Long> list); |
| | | |
| | | |
| | | /** |
| | | * 根据多个auctionId是否已存在 |
| | | * |
| | | * @param list |
| | | * @return |
| | | */ |
| | | List<Long> listExistById(List<Long> list); |
| | | |
| | | /** |
| | | * 批量更新 |
| | |
| | | @Param("shopId") Long shopId); |
| | | |
| | | long countByShopId(@Param("shopId") Long shopId); |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.fanli.entity.bus.lable;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | |
| | | * @date 2018年7月3日
|
| | | */
|
| | | @Table("yeshi_ec_quality_factory")
|
| | | public class QualityFactory implements Serializable {
|
| | | |
| | | /**
|
| | | * |
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | | public class QualityFactory {
|
| | |
|
| | | // 人工筛选入库
|
| | | public final static int MODE_MANUAL = 1;
|
| | |
| | | public final static int MODE_SYSTEM = 2;
|
| | | // 自动入库
|
| | | public final static int MODE_AUTO = 3;
|
| | | |
| | | |
| | |
|
| | | // 来源-淘宝
|
| | | public final static int SOURCE_TAOBAO = 1;
|
| | |
| | | public final static int SOURCE_OTHER = 5;
|
| | |
|
| | |
|
| | | |
| | | |
| | | @Column(name = "sg_id")
|
| | | private Long id;
|
| | |
|
| | | |
| | | @Column(name = "sg_class_id")
|
| | | private Long systemCid; // 商品类目id
|
| | |
|
| | | @Column(name = "sg_goods_id")
|
| | | private TaoBaoGoodsBrief taoBaoGoodsBrief;// 商品id
|
| | |
|
| | |
|
| | | @Column(name = "sg_entry_mode")
|
| | | private Integer entryMode; // 录入方式
|
| | |
| | | package com.yeshi.fanli.entity.bus.lable;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
|
| | | /**
|
| | | * 精选库:限时抢购
|
| | |
| | | * @date 2018年9月18日
|
| | | */
|
| | | @Table("yeshi_ec_quality_flash_sale")
|
| | | public class QualityFlashSale implements Serializable{
|
| | | |
| | |
|
| | | /**
|
| | | * |
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | | public class QualityFlashSale {
|
| | |
|
| | | @Column(name = "fs_id")
|
| | | private Long id;
|
| | |
|
| | | @Column(name = "fs_qfgoods_id")
|
| | | private QualityFactory qualityFactory; // 精选id
|
| | | |
| | | // 取消数据区分时间段:1(00:00) 2(09:00) 3(12:00) 4(14:00) 5(16:00) 6(20:00) 7(22:00) |
| | | private TaoBaoGoodsBrief taoBaoGoodsBrief;// 商品id
|
| | |
|
| | | // 取消数据区分时间段:1(00:00) 2(09:00) 3(12:00) 4(14:00) 5(16:00) 6(20:00) 7(22:00)
|
| | | @Column(name = "fs_type")
|
| | | private Integer type; // 暂停用
|
| | | |
| | | |
| | |
|
| | | @Column(name = "fs_weight")
|
| | | private Double weight; // 商品权重 -- 排序
|
| | | |
| | | |
| | |
|
| | | @Column(name = "fs_createtime")
|
| | | private Date createtime; // 创建时间
|
| | | |
| | |
|
| | | @Column(name = "fs_updatetime")
|
| | | private Date updatetime; // 更新时间
|
| | |
|
| | |
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public QualityFactory getQualityFactory() {
|
| | | return qualityFactory;
|
| | | public TaoBaoGoodsBrief getTaoBaoGoodsBrief() {
|
| | | return taoBaoGoodsBrief;
|
| | | }
|
| | |
|
| | | public void setQualityFactory(QualityFactory qualityFactory) {
|
| | | this.qualityFactory = qualityFactory;
|
| | | public void setTaoBaoGoodsBrief(TaoBaoGoodsBrief taoBaoGoodsBrief) {
|
| | | this.taoBaoGoodsBrief = taoBaoGoodsBrief;
|
| | | }
|
| | |
|
| | | public Integer geTtype() {
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.lable.LabelService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityFactoryService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | |
| | | private QualityFactoryService qualityFactoryService;
|
| | | @Resource
|
| | | private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | | |
| | |
|
| | | public QualityFactoryJob() {
|
| | | System.out.println("--UpdateQualityFactoryJob 构造函数--");
|
| | |
| | | */
|
| | | private void searchTaoBao(JSONObject jsonData, List<Label> listLabs, BoutiqueAutoRule autoRule) {
|
| | | try {
|
| | | Date time = new Date();
|
| | | String formatDate = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(time);
|
| | | String formatDate = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date());
|
| | |
|
| | | // 页大小,默认100条
|
| | | int pageSize = 100;
|
| | |
| | | autoRule.setStartWeight(startWeight);
|
| | | autoRule.setEndWeight(endWeight);
|
| | |
|
| | | /* 筛选商品进入精选库中 */
|
| | | if (!StringUtil.isNullOrEmpty(title) && title.contains(IS_9K9)) {
|
| | | screen9K9(filter, listGoods, jsonData, listLabs, autoRule);
|
| | | } else {
|
| | | screen(listGoods, jsonData, filter, listLabs, autoRule);
|
| | | }
|
| | | // 筛选入库
|
| | | screen(listGoods, jsonData, filter, listLabs, autoRule);
|
| | |
|
| | | |
| | | |
| | | /* 销售量小值 */
|
| | | int minSales = 0;
|
| | | if (jsonData.get("startSales") != null) {
|
| | |
| | | /* 更新完成后清理之前创建的数据 */
|
| | | if (jsonData.get("systemCid") != null && !StringUtil.isNullOrEmpty(jsonData.get("systemCid").toString())) {
|
| | | Long systemCid = Long.parseLong(jsonData.get("systemCid").toString());
|
| | | deleteNotUpdateGoods(systemCid, formatDate, autoRule.getGoodsSource());
|
| | | qualityFactoryService.deleteNotUpdateGoods(systemCid, formatDate, autoRule.getGoodsSource());
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | |
| | | private void searchMaterial(JSONObject jsonData, List<Label> listLabs, BoutiqueAutoRule autoRule) {
|
| | |
|
| | | try {
|
| | | String formatDate = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date());
|
| | |
|
| | | // 默认20条
|
| | | int pageSize = 20;
|
| | |
|
| | | boolean isCrawl = true;
|
| | |
|
| | | // 权重起始
|
| | | int startWeight = 1000;
|
| | | // 权重结束
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | /* 筛选商品进入精选库中 */
|
| | | if (!StringUtil.isNullOrEmpty(title) && title.contains(IS_9K9)) {
|
| | | screen9K9(filter, listGoods, jsonData, listLabs, autoRule);
|
| | | } else {
|
| | | screen(listGoods, jsonData, filter, listLabs, autoRule);
|
| | | }
|
| | | // 筛选入库
|
| | | screen(listGoods, jsonData, filter, listLabs, autoRule);
|
| | | |
| | |
|
| | | // 总页数爬取完成
|
| | | PageEntity pageEntity = result.getPageEntity();
|
| | |
| | | LogHelper.test("----" + title + "--结束-------");
|
| | | break;// 结束爬取数据
|
| | | }
|
| | | }
|
| | | |
| | | // 9k9 限时抢购 不操作删除
|
| | | if (!StringUtil.isNullOrEmpty(title) && (title.contains(IS_9K9) || title.contains(FLASH_SALE))) {
|
| | | return;
|
| | | }
|
| | |
|
| | | /* 更新完成后清理之前创建的数据 */
|
| | | if (jsonData.get("systemCid") != null && !StringUtil.isNullOrEmpty(jsonData.get("systemCid").toString())) {
|
| | | Long systemCid = Long.parseLong(jsonData.get("systemCid").toString());
|
| | | qualityFactoryService.deleteNotUpdateGoods(systemCid, formatDate, autoRule.getGoodsSource());
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | |
| | | return filter;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 9.9 19.9 29.9 39.9 商品筛选
|
| | | * |
| | | * @param taoBaoGoodsBriefs
|
| | | */
|
| | | public void screen9K9(SearchFilter filter, List<TaoBaoGoodsBrief> taoBaoGoodsBriefs, JSONObject jsonData,
|
| | | List<Label> listLabs, BoutiqueAutoRule autoRule) throws Exception {
|
| | |
|
| | | /* 9k9 */
|
| | | BigDecimal price9k9 = new BigDecimal(10);
|
| | | List<TaoBaoGoodsBrief> list9k9 = new ArrayList<TaoBaoGoodsBrief>();
|
| | |
|
| | | /* 19k9 */
|
| | | BigDecimal price19k9 = new BigDecimal(20);
|
| | | List<TaoBaoGoodsBrief> list19k9 = new ArrayList<TaoBaoGoodsBrief>();
|
| | |
|
| | | /* 29.9 */
|
| | | BigDecimal price29K9 = new BigDecimal(30);
|
| | | List<TaoBaoGoodsBrief> list29k9 = new ArrayList<TaoBaoGoodsBrief>();
|
| | |
|
| | | /* 49.9 */
|
| | | BigDecimal price49K9 = new BigDecimal(50);
|
| | | List<TaoBaoGoodsBrief> list49k9 = new ArrayList<TaoBaoGoodsBrief>();
|
| | |
|
| | | /* 销售量小值 */
|
| | | int minSales = 0;
|
| | | if (jsonData.get("startSales") != null) {
|
| | | minSales = (int) jsonData.get("startSales");
|
| | | }
|
| | |
|
| | | /* 销售量大值 */
|
| | | int maxSales = 0;
|
| | | if (jsonData.get("endSales") != null) {
|
| | | maxSales = (int) jsonData.get("endSales");
|
| | | }
|
| | |
|
| | | // 验证是否符合要求入库
|
| | | for (TaoBaoGoodsBrief goodsBrief : taoBaoGoodsBriefs) {
|
| | |
|
| | | /* 验证在是否有券 */
|
| | | if (filter.getQuan() > 0) {
|
| | | String couponInfo = goodsBrief.getCouponInfo();
|
| | | if (StringUtil.isNullOrEmpty(couponInfo)) {
|
| | | continue;
|
| | | }
|
| | | }
|
| | |
|
| | | /* 验证销售量 */
|
| | | int biz30day = goodsBrief.getBiz30day();
|
| | | if (maxSales > 0 && minSales > 0 && (biz30day < minSales || biz30day > maxSales)) {
|
| | | continue;
|
| | | } else if (maxSales > 0 && biz30day > maxSales) {
|
| | | continue;
|
| | | } else if (minSales > 0 && biz30day < minSales) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | /* 验证比例 */
|
| | | if (BoutiqueAutoRule.TB_MATERIAL == autoRule.getSource()) {
|
| | | int startTkRate = filter.getStartTkRate();
|
| | | int endTkRate = filter.getEndTkRate();
|
| | | BigDecimal tkRate = goodsBrief.getTkRate();
|
| | | if (startTkRate > 0 && endTkRate > 0 && (tkRate.compareTo(new BigDecimal(startTkRate / 100)) < 0
|
| | | || tkRate.compareTo(new BigDecimal(endTkRate / 100)) > 0)) {
|
| | | continue;
|
| | | } else if (endTkRate > 0 && tkRate.compareTo(new BigDecimal(endTkRate / 100)) > 0) {
|
| | | continue;
|
| | | } else if (startTkRate > 0 && tkRate.compareTo(new BigDecimal(startTkRate / 100)) < 0) {
|
| | | continue;
|
| | | }
|
| | | }
|
| | |
|
| | | /* 券后价--计算 */
|
| | | BigDecimal couponPrice = TaoBaoUtil.getAfterUseCouplePrice(goodsBrief);
|
| | | if (couponPrice.compareTo(price9k9) < 0) {
|
| | | list9k9.add(goodsBrief);
|
| | | } else if (couponPrice.compareTo(price19k9) < 0) {
|
| | | list19k9.add(goodsBrief);
|
| | | } else if (couponPrice.compareTo(price29K9) < 0) {
|
| | | list29k9.add(goodsBrief);
|
| | | } else if (couponPrice.compareTo(price49K9) < 0) {
|
| | | list49k9.add(goodsBrief);
|
| | | }
|
| | | }
|
| | | autoRule.setCalss9k9(true);
|
| | | AdminUser admin = autoRule.getAdminUser();
|
| | |
|
| | | if (list9k9.size() > 0) {
|
| | | Label label = labelService.getByTitleCache("labKey", "9.9");
|
| | | if (label == null) {
|
| | | label = insertLabel("9.9", admin);
|
| | | }
|
| | | qualityFactoryService.autoInsertOrUpadateStorage(autoRule, list9k9, listLabs, label);
|
| | | }
|
| | |
|
| | | if (list19k9.size() > 0) {
|
| | | Label label = labelService.getByTitleCache("labKey", "19.9");
|
| | | if (label == null) {
|
| | | label = insertLabel("9.9", admin);
|
| | | }
|
| | | qualityFactoryService.autoInsertOrUpadateStorage(autoRule, list19k9, listLabs, label);
|
| | | }
|
| | |
|
| | | if (list29k9.size() > 0) {
|
| | | Label label = labelService.getByTitleCache("labKey", "29.9");
|
| | | if (label == null) {
|
| | | label = insertLabel("9.9", admin);
|
| | | }
|
| | | qualityFactoryService.autoInsertOrUpadateStorage(autoRule, list29k9, listLabs, label);
|
| | | }
|
| | |
|
| | | if (list49k9.size() > 0) {
|
| | | Label label = labelService.getByTitleCache("labKey", "49.9");
|
| | | if (label == null) {
|
| | | label = insertLabel("9.9", admin);
|
| | | }
|
| | | qualityFactoryService.autoInsertOrUpadateStorage(autoRule, list49k9, listLabs, label);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 筛选符合条件的商品
|
| | |
| | | */
|
| | | public void screen(List<TaoBaoGoodsBrief> taoBaoGoodsBriefs, JSONObject jsonData, SearchFilter filter,
|
| | | List<Label> listLabs, BoutiqueAutoRule autoRule) throws Exception {
|
| | |
|
| | | List<TaoBaoGoodsBrief> listGoods = new ArrayList<TaoBaoGoodsBrief>();
|
| | | for (TaoBaoGoodsBrief goodsBrief : taoBaoGoodsBriefs) {
|
| | | // 验证是否符合要求
|
| | |
| | | listGoods.add(goodsBrief);
|
| | | }
|
| | | }
|
| | |
|
| | | if (listGoods.size() > 0) {
|
| | | autoRule.setCalss9k9(false);
|
| | | qualityFactoryService.autoInsertOrUpadateStorage(autoRule, listGoods, listLabs, null);
|
| | | }
|
| | | qualityFactoryService.autoInsertOrUpadateStorage(autoRule, listGoods, listLabs);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | return label;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除未更新的商品
|
| | | * |
| | | * @param systemCid
|
| | | * @param formatDate
|
| | | * @param source
|
| | | */
|
| | | public void deleteNotUpdateGoods(Long systemCid, String formatDate, int source) {
|
| | | List<Long> list = qualityFactoryService.getAuctionIdbyClassId(systemCid, source, formatDate);
|
| | | if (list == null || list.size() == 0) {
|
| | | return;
|
| | | }
|
| | |
|
| | | // 小于100条直接删除
|
| | | if (list.size() <= 100) {
|
| | | qualityFactoryService.deleteBatchByTaoBaoGoodsId(list);
|
| | | return;
|
| | | } |
| | | |
| | | |
| | | // 大于100需要分段删除
|
| | | int start = 0;
|
| | | int end = 100;
|
| | | int countRow = 100;
|
| | |
|
| | | int count = list.size() / countRow;
|
| | | if (list.size() % countRow > 0) {
|
| | | count += 1;
|
| | | }
|
| | |
|
| | | for (int i = 0; i < count; i++) {
|
| | | List<Long> sublist = new ArrayList<Long>();
|
| | | if (i == count - 1) {
|
| | | sublist = list.subList(start, list.size());
|
| | | qualityFactoryService.deleteBatchByTaoBaoGoodsId(sublist);
|
| | | break;
|
| | | }
|
| | | sublist = list.subList(start, end);
|
| | | qualityFactoryService.deleteBatchByTaoBaoGoodsId(sublist);
|
| | | start += countRow;
|
| | | end += countRow;
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
| | | package com.yeshi.fanli.job;
|
| | |
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | | 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.entity.taobao.dataoke.DaTaoKeDetail;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityFactoryService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.taobao.DaTaoKeUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | |
|
| | | /**
|
| | | * 更新大淘客数据
|
| | |
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsDetailService daTaoKeGoodsService;
|
| | | |
| | |
|
| | | // 两小时执行一次 对商品信息进行更新
|
| | | /**
|
| | | * 限时秒杀 数据更新
|
| | | */
|
| | | @Scheduled(cron = "0 0 0/2 * * ?")
|
| | | public void doUpdateJob() {
|
| | |
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | |
|
| | | List<TaoBaoGoodsBrief> listgoods = DaTaoKeUtil.getDingDongQiang();
|
| | | if (listgoods == null || listgoods.size() == 0) {
|
| | | List<DaTaoKeDetail> listTaoKe = DaTaoKeUtil.getDingDongQiang();
|
| | | if (listTaoKe == null || listTaoKe.size() == 0) {
|
| | | return;
|
| | | }
|
| | | |
| | | List<Long> listDaoKeId = new ArrayList<Long>();
|
| | | for (DaTaoKeDetail daTaoKeDetail: listTaoKe) {
|
| | | listDaoKeId.add(daTaoKeDetail.getId());
|
| | | }
|
| | | |
| | | List<DaTaoKeDetail> listDetail = daTaoKeGoodsService.listByIds(listDaoKeId);
|
| | | if (listDetail == null || listDetail.size() == 0) {
|
| | | return;
|
| | | }
|
| | | |
| | | List<TaoBaoGoodsBrief> listgoods = new ArrayList<TaoBaoGoodsBrief>();
|
| | | for (DaTaoKeDetail daTaoKeDetail: listDetail) {
|
| | | listgoods.add( TaoBaoUtil.convert(daTaoKeDetail));
|
| | | }
|
| | |
|
| | | String formatDate = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date());
|
| | | try {
|
| | | /* 操作人: 开发账号 */
|
| | | AdminUser admin = new AdminUser(2L);
|
| | |
| | | autoRule.setStartWeight(1);
|
| | | autoRule.setEndWeight(3000);
|
| | | autoRule.setGoodsSource(QualityFactory.SOURCE_TAOBAO_DATAOKE);
|
| | | qualityFactoryService.autoInsertOrUpadateStorage(autoRule, listgoods, null, null);
|
| | | qualityFactoryService.autoInsertOrUpadateStorage(autoRule, listgoods, null);
|
| | |
|
| | | // 删除之前的
|
| | | qualityFactoryService.deleteNotUpdateGoods(null, formatDate, autoRule.getGoodsSource());
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | // 20分钟更新一次
|
| | |
| | | }
|
| | |
|
| | | try {
|
| | | LogHelper.test("---执行--updateQualityFactoryWeightJob--");
|
| | |
|
| | | qualityFactoryService.updateWeight(10, 3);
|
| | |
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | LogHelper.test("---addNeddUpdateTaoBaoGoods----execute ");
|
| | |
|
| | | List<Long> list = qualityFactoryService.queryNeedUpdate(0, 3000, 4);
|
| | | if (list != null) {
|
| | | for (Long id : list) {
|
| | | try {
|
| | | CMQManager.getInstance().addNeedUpdateTaoBaoGoodsId(id);
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | List<Long> list = qualityFactoryService.queryNeedUpdate(0, 1000, 4);
|
| | | if (list == null || list.size() == 0) {
|
| | | return;
|
| | | }
|
| | | |
| | | for (Long id : list) {
|
| | | try {
|
| | | CMQManager.getInstance().addNeedUpdateTaoBaoGoodsId(id);
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | try {
|
| | | while (true) {
|
| | | List<Long> list = qualityFlashSaleService.queryNeedRemove(0, 100, 6);
|
| | |
|
| | | List<Long> list = qualityFlashSaleService.queryNeedRemove(0, 200, 6);
|
| | | if (list == null || list.size() == 0) {
|
| | | break;
|
| | | }
|
| | |
| | | </delete> |
| | | |
| | | |
| | | <select id="getClassIdByTaoBaoCid" parameterType="java.lang.Long" resultType="java.lang.Long"> |
| | | SELECT tm.tm_system_cid FROM `yeshi_ec_taobao_class_mapper` tm |
| | | LEFT JOIN `yeshi_ec_taobao_class` tc ON tc.`tc_id` = tm.`tm_taobao_cid` |
| | | WHERE tc.`tc_category_id`= #{taobaoCid,jdbcType=BIGINT} |
| | | LIMIT 1 |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | separator=",">#{item}</foreach> |
| | | </delete> |
| | | |
| | | |
| | | <delete id="deleteByAuctionIdAndLabIDs"> |
| | | delete FROM yeshi_ec_label_goods |
| | | WHERE lg_goods_id = #{auctionId} AND lg_label_id in |
| | | <foreach collection="list" item="item" open="(" close=")" |
| | | separator=",">#{item}</foreach> |
| | | </delete> |
| | | |
| | | |
| | | |
| | | |
| | | <select id="isExistence" resultType="java.lang.Long"> |
| | | <!-- 判断是否已贴过标签 --> |
| | |
| | | where lab_title = #{title} |
| | | </select> |
| | | |
| | | |
| | | <select id="listByTitles" parameterType="java.util.List" resultMap="ResultMap"> |
| | | select * from yeshi_ec_label |
| | | where lab_title in <foreach collection="list" item="item" open="(" separator="," close=")">#{item}</foreach> |
| | | </select> |
| | | |
| | | |
| | | <select id="getByTitle" resultMap="ResultMap"> |
| | | select * from yeshi_ec_label |
| | | WHERE lab_title = #{title} |
| | | limit 1 |
| | | </select> |
| | | |
| | | <!-- 查询商品标 签候选项 --> |
| | | <select id="queryGoodsCandidate" resultMap="BaseResultMap"> |
| | | SELECT <include refid="Base_Column_List" /> FROM `yeshi_ec_label` |
| | |
| | | </association> |
| | | </resultMap> |
| | | |
| | | <resultMap id="GoodsResultMap" |
| | | type="com.yeshi.fanli.entity.bus.lable.QualityFactory"> |
| | | <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" /> |
| | |
| | | </set> |
| | | where sg_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | |
| | | <!-- 查询超过4个小时未更新商品,进行更新 --> |
| | | <update 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} ]]> |
| | | </update> |
| | | |
| | | |
| | | |
| | | <delete id="deleteBatchByPrimaryKey" parameterType="java.util.List"> |
| | | delete FROM yeshi_ec_quality_factory WHERE sg_id in |
| | | DELETE FROM yeshi_ec_quality_factory WHERE sg_id in |
| | | <foreach collection="list" item="item" open="(" close=")" |
| | | separator=",">#{item}</foreach> |
| | | </delete> |
| | | |
| | | <delete id="deleteBatchByGoodsId" parameterType="java.util.List"> |
| | | DELETE FROM yeshi_ec_quality_factory WHERE sg_goods_id in |
| | | <foreach collection="list" item="item" open="(" close=")" |
| | | separator=",">#{item}</foreach> |
| | | </delete> |
| | | |
| | | |
| | | <insert id="insertBatch" useGeneratedKeys="true" keyProperty="id" |
| | | parameterType="java.util.List"> |
| | |
| | | <!-- 查询超过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 |
| | | 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 |
| | | 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> |
| | | |
| | |
| | | <include refid="Base_Column_List" /> |
| | | FROM yeshi_ec_quality_factory WHERE sg_goods_id = ${goodsId} |
| | | </select> |
| | | |
| | | |
| | | <!--查询精选商品信息 --> |
| | | <select id="getByAuctionId" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_quality_factory |
| | | WHERE sg_goods_id = ${auctionId} |
| | | limit 1 |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryCountByGoodsId" resultType="java.lang.Long"> |
| | | SELECT COUNT(sg_id) |
| | |
| | | </select> |
| | | |
| | | <delete id="deleteByGoodsId" parameterType="java.lang.Long"> |
| | | delete from |
| | | yeshi_ec_quality_factory where sg_goods_id = |
| | | delete from yeshi_ec_quality_factory where sg_goods_id = |
| | | #{goodsId,jdbcType=BIGINT} |
| | | </delete> |
| | | |
| | |
| | | </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 --> |
| | | <if test="systemCid != null"> |
| | | 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}]]> |
| | | </if> |
| | | |
| | | ORDER BY |
| | | |
| | | <if test="sortField == 1"> |
| | | h.sg_createtime, |
| | | </if> |
| | | <if test="sortField == 2"> |
| | | h.sg_createtime desc, |
| | | </if> |
| | | <if test="sortField == 3"> |
| | | h.sg_updatetime, |
| | | </if> |
| | | <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()) |
| | | <if test="systemCid != null"> |
| | | 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}]]> |
| | | </if> |
| | | |
| | | </select> |
| | | |
| | | |
| | | |
| | | <delete id="removeStorageGoods" parameterType="java.lang.Long"> |
| | |
| | | |
| | | |
| | | <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 h.`sg_goods_id` FROM `yeshi_ec_quality_factory` h |
| | | WHERE h.`sg_goods_source` = #{goodsSource} <if test="systemCid != null">AND h.`sg_class_id` = #{systemCid}</if> |
| | | AND h.`sg_updatetime` <![CDATA[<]]> #{beforeTime} |
| | | AND NOT EXISTS(SELECT lg_goods_id FROM `yeshi_ec_label_goods` lb WHERE lb.`lg_goods_id` = h.`sg_goods_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 |
| | |
| | | WHERE t.`sellerId` = #{shopId} |
| | | </select> |
| | | |
| | | <select id="get9k9ClassGoods" resultMap="GoodsResultMap"> |
| | | SELECT * FROM `yeshi_ec_quality_factory` h |
| | | LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id` |
| | | WHERE tb.`couponAmount` > 0 AND tb.`couponTotalCount` > 0 |
| | | AND IF(tb.`zkPrice` - tb.`couponStartFee`>=0, TRUE, FALSE) |
| | | AND tb.`zkPrice` <![CDATA[<=]]> #{zkPrice} |
| | | AND tb.`biz30day` <![CDATA[>=]]> #{biz30day} |
| | | <!-- 券后价范围 --> |
| | | AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[>]]> #{minQuanPrice} |
| | | AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[<= ]]> #{maxQuanPrice} |
| | | <!-- 多个分类id --> |
| | | <if test='cids != null and cids != ""'> |
| | | AND h.`sg_class_id` in (${cids}) |
| | | </if> |
| | | ORDER BY h.sg_weight desc,tb.`biz30day`desc |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | | <select id="count9k9ClassGoods" 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.`couponAmount` > 0 AND tb.`couponTotalCount` > 0 |
| | | AND IF(tb.`zkPrice` - tb.`couponStartFee`>=0, TRUE, FALSE) |
| | | AND tb.`zkPrice` <![CDATA[<=]]> #{zkPrice} |
| | | AND tb.`biz30day` <![CDATA[>=]]> #{biz30day} |
| | | <!-- 券后价范围 --> |
| | | AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[>]]> #{minQuanPrice} |
| | | AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[<= ]]> #{maxQuanPrice} |
| | | <!-- 多个分类id --> |
| | | <if test='cids != null and cids != ""'> |
| | | AND h.`sg_class_id` in (${cids}) |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <!-- 每日必抢 --> |
| | | <select id="listQueryEverydayRob" resultMap="GoodsResultMap"> |
| | | SELECT * FROM `yeshi_ec_quality_factory` h |
| | | LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id` |
| | | WHERE tb.`couponTotalCount` > 0 AND tb.couponAmount <![CDATA[>]]> 1 AND tb.couponAmount <![CDATA[<=]]> 50 |
| | | AND IF(tb.`zkPrice` - tb.`couponStartFee`>=0, TRUE, FALSE) |
| | | AND tb.`zkPrice` <![CDATA[<=]]> #{zkPrice} |
| | | AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[>]]> #{minQuanPrice} |
| | | AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[<=]]> #{maxQuanPrice} |
| | | ORDER BY h.sg_createtime 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_taobao_goods tb ON h.`sg_goods_id`= tb.`id` |
| | | WHERE tb.`couponTotalCount` > 0 AND tb.couponAmount <![CDATA[>]]> 1 AND tb.couponAmount <![CDATA[<=]]> 50 |
| | | AND IF(tb.`zkPrice` - tb.`couponStartFee`>=0, TRUE, FALSE) |
| | | AND tb.`zkPrice` <![CDATA[<=]]> #{zkPrice} |
| | | AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[>]]> #{minQuanPrice} |
| | | AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[<=]]> #{maxQuanPrice} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <result column="fs_createtime" property="createtime" jdbcType="TIMESTAMP" /> |
| | | <result column="fs_updatetime" property="updatetime" jdbcType="TIMESTAMP" /> |
| | | |
| | | <association property="qualityFactory" column="fs_qfgoods_id" |
| | | javaType="com.yeshi.fanli.entity.bus.lable.QualityFactory"> |
| | | <association property="taoBaoGoodsBrief" column="fs_qfgoods_id" javaType="com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief"> |
| | | <id column="fs_qfgoods_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | </resultMap> |
| | |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_quality_flash_sale |
| | | (fs_id,fs_qfgoods_id,fs_type,fs_weight,fs_createtime,fs_updatetime) values |
| | | (#{id,jdbcType=BIGINT},#{qualityFactory.id,jdbcType=BIGINT},#{type,jdbcType=INTEGER},#{weight,jdbcType=DOUBLE},#{createtime,jdbcType=TIMESTAMP},#{updatetime,jdbcType=TIMESTAMP}) |
| | | (#{id,jdbcType=BIGINT},#{taoBaoGoodsBrief.id,jdbcType=BIGINT},#{type,jdbcType=INTEGER},#{weight,jdbcType=DOUBLE},#{createtime,jdbcType=TIMESTAMP},#{updatetime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFlashSale" |
| | |
| | | insert into yeshi_ec_quality_flash_sale |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">fs_id,</if> |
| | | <if test="qualityFactory != null">fs_qfgoods_id,</if> |
| | | <if test="taoBaoGoodsBrief != null">fs_qfgoods_id,</if> |
| | | <if test="type != null">fs_type,</if> |
| | | <if test="weight != null">fs_weight,</if> |
| | | <if test="createtime != null">fs_createtime,</if> |
| | |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="qualityFactory != null">#{qualityFactory.id,jdbcType=BIGINT},</if> |
| | | <if test="taoBaoGoodsBrief != null">#{taoBaoGoodsBrief.id,jdbcType=BIGINT},</if> |
| | | <if test="type != null">#{type,jdbcType=INTEGER},</if> |
| | | <if test="weight != null">#{weight,jdbcType=DOUBLE},</if> |
| | | <if test="createtime != null">#{createtime,jdbcType=TIMESTAMP},</if> |
| | |
| | | |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFlashSale">update |
| | | yeshi_ec_quality_flash_sale set |
| | | fs_qfgoods_id = #{qualityFactory.id,jdbcType=BIGINT}, |
| | | fs_qfgoods_id = #{taoBaoGoodsBrief.id,jdbcType=BIGINT}, |
| | | fs_type = #{type,jdbcType=INTEGER}, |
| | | fs_weight = #{weight,jdbcType=DOUBLE}, |
| | | fs_createtime = #{createtime,jdbcType=TIMESTAMP}, |
| | |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFlashSale"> |
| | | update yeshi_ec_quality_flash_sale |
| | | <set> |
| | | <if test="qualityFactory != null">fs_qfgoods_id=#{qualityFactory.id,jdbcType=BIGINT},</if> |
| | | <if test="taoBaoGoodsBrief != null">fs_qfgoods_id=#{taoBaoGoodsBrief.id,jdbcType=BIGINT},</if> |
| | | <if test="type != null">fs_type=#{type,jdbcType=INTEGER},</if> |
| | | <if test="weight != null">fs_weight=#{weight,jdbcType=DOUBLE},</if> |
| | | <if test="createtime != null">fs_createtime=#{createtime,jdbcType=TIMESTAMP},</if> |
| | |
| | | <foreach collection="list" item="item" separator=","> |
| | | ( |
| | | #{item.id,jdbcType=BIGINT}, |
| | | #{item.qualityFactory.id,jdbcType=BIGINT}, |
| | | #{item.taoBaoGoodsBrief.id,jdbcType=BIGINT}, |
| | | #{item.type,jdbcType=INTEGER}, |
| | | #{item.weight,jdbcType=DOUBLE}, |
| | | #{item.createtime,jdbcType=TIMESTAMP}, |
| | |
| | | separator=",">#{item}</foreach> |
| | | </select> |
| | | |
| | | <delete id="deleteByQualityID" parameterType="java.lang.Long"> |
| | | <delete id="deleteByGoodsId" parameterType="java.lang.Long"> |
| | | delete from yeshi_ec_quality_flash_sale where fs_qfgoods_id = #{qid,jdbcType=BIGINT} |
| | | </delete> |
| | | |
| | |
| | | yeshi_ec_taobao_goods where auctionId = #{auctionId,jdbcType=BIGINT} |
| | | </delete> |
| | | |
| | | |
| | | <delete id="deleteBatchByGoodsId" parameterType="java.util.List"> |
| | | DELETE FROM yeshi_ec_taobao_goods WHERE id in |
| | | <foreach collection="list" item="item" open="(" close=")" |
| | | separator=",">#{item}</foreach> |
| | | </delete> |
| | | |
| | | |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief" |
| | |
| | | separator=",">#{item}</foreach> |
| | | ORDER BY id DESC |
| | | </select> |
| | | |
| | | |
| | | <select id="listExistById" resultType="Long"> |
| | | SELECT id FROM yeshi_ec_taobao_goods |
| | | WHERE id IN |
| | | <foreach collection="list" item="item" open="(" close=")" |
| | | separator=",">#{item}</foreach> |
| | | </select> |
| | | |
| | | |
| | | <update id="updateBatchSelective" parameterType="java.util.List"> |
| | | |
| | |
| | | </if> |
| | | </foreach> |
| | | </trim> |
| | | |
| | | |
| | | <trim prefix="updatetime =case" suffix="end,"> |
| | | <foreach collection="list" item="item" index="index"> |
| | | <if test="item.updatetime !=null"> |
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper;
|
| | |
| | | BigDecimal rate = hongBaoManageService.getShareRate();
|
| | | return TaoBaoUtil.getShareGoodsHongBaoInfo(goods, rate);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public void deleteByPrimaryKey(Long id) {
|
| | | taoBaoGoodsBriefMapper.deleteByPrimaryKey(id);
|
| | | }
|
| | | |
| | | @Override
|
| | | public void deleteBatchByGoodsId(List<Long> list) {
|
| | | taoBaoGoodsBriefMapper.deleteBatchByGoodsId(list);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> queryByAuctionId(Long auctionId) {
|
| | | return taoBaoGoodsBriefMapper.queryByAuctionId(auctionId);
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> listQueryByAuctionId(List<Long> list) {
|
| | | public List<Long> listExistById(List<Long> list) {
|
| | | if (list != null && list.size() > 0)
|
| | | return taoBaoGoodsBriefMapper.queryGoodsByAuctionId(list);
|
| | | return taoBaoGoodsBriefMapper.listExistById(list);
|
| | | else
|
| | | return null;
|
| | | }
|
| | |
| | | return taoBaoGoodsBriefMapper.listByShopId(start, count, shopId);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public long countByShopId(Long shopId) {
|
| | | return taoBaoGoodsBriefMapper.countByShopId(shopId);
|
| | | }
|
| | |
|
| | | |
| | | }
|
| | |
| | |
|
| | | @Override
|
| | | public List<LabelGoods> queryByGoodsId(int start, int count, Long goodsId) throws LabelClassException {
|
| | | // TODO Auto-generated method stub
|
| | | return labelGoodsMapper.queryByGoodsId(start, count, goodsId);
|
| | | }
|
| | |
|
| | |
| | | import com.yeshi.fanli.entity.bus.lable.LabelGoods;
|
| | | import com.yeshi.fanli.entity.common.AdminUser;
|
| | | import com.yeshi.fanli.exception.LabelException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.lable.LabelService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | |
| | |
|
| | | @Override
|
| | | public List<Label> selectByTitle(String title) throws LabelException{
|
| | | LogHelper.test("查询标签: "+title);
|
| | | return labelMapper.selectByTitle(title);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | @Cacheable(value = "labelCache",key="'selectByTitleCache-'+#labKey +'-'+#title")
|
| | | public List<Label> selectByTitleCache(String labKey, String title) throws LabelException{
|
| | | return selectByTitle(title);
|
| | | @Cacheable(value = "labelCache",key="'getByTitleCache-'+#labKey +'-'+#title")
|
| | | public Label getByTitleCache(String labKey, String title) throws LabelException{
|
| | | return labelMapper.getByTitle(title);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | @Cacheable(value = "labelCache",key="'listByTitlesCache-'+#list")
|
| | | public List<Label> listByTitlesCache(List<String> list){
|
| | | return labelMapper.listByTitles(list);
|
| | | }
|
| | |
|
| | |
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.lable.QualityFactoryMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.lable.QualityFlashSaleMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper;
|
| | | import com.yeshi.fanli.entity.bus.clazz.TaoBaoClassRelation;
|
| | | import com.yeshi.fanli.entity.bus.lable.BoutiqueAutoRule;
|
| | | import com.yeshi.fanli.entity.bus.lable.Label;
|
| | | import com.yeshi.fanli.entity.bus.lable.LabelGoods;
|
| | |
| | | public int updateByPrimaryKeySelective(QualityFactory record) throws QualityFactoryException {
|
| | | return qualityFactoryMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void deleteByTbAuctionId(Long auctionId) {
|
| | |
|
| | | public void deleteByTaoBaoGoodsId(Long auctionId) {
|
| | | if (auctionId == null) {
|
| | | return;
|
| | | }
|
| | |
|
| | | List<TaoBaoGoodsBrief> tbgoods = taoBaoGoodsBriefMapper.queryByAuctionId(auctionId);
|
| | | if (tbgoods != null && tbgoods.size() > 0) {
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = tbgoods.get(0);
|
| | | try {
|
| | | deleteByTaoBaoGoodsId(taoBaoGoodsBrief.getId());
|
| | | } catch (QualityFactoryException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void deleteByTaoBaoGoodsId(Long gid) throws QualityFactoryException {
|
| | |
|
| | | if (gid == null) {
|
| | | return;
|
| | | }
|
| | |
|
| | | List<QualityFactory> list = qualityFactoryMapper.queryByGoodsId(gid);
|
| | | if (list != null && list.size() > 0) {
|
| | |
|
| | | // 删除限时抢购
|
| | | for (QualityFactory qualityFactory : list) {
|
| | | qualityFlashSaleMapper.deleteByQualityID(qualityFactory.getId());
|
| | | }
|
| | |
|
| | | // 移除精选库
|
| | | qualityFactoryMapper.deleteByGoodsId(gid);
|
| | | }
|
| | |
|
| | | // 移除精选库
|
| | | qualityFactoryMapper.deleteByGoodsId(auctionId);
|
| | | // 删除限时抢购
|
| | | qualityFlashSaleMapper.deleteByGoodsId(auctionId);
|
| | | // 删除对应标签
|
| | | labelGoodsMapper.deleteByGoodsId(gid);
|
| | | labelGoodsMapper.deleteByGoodsId(auctionId);
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public void deleteBatchByTaoBaoGoodsId(List<Long> listGid) throws QualityFactoryException {
|
| | | public void deleteBatchByTaoBaoGoodsId(List<Long> listGid) {
|
| | |
|
| | | if (listGid == null || listGid.size() == 0) {
|
| | | return;
|
| | | }
|
| | |
|
| | | List<QualityFactory> list = qualityFactoryMapper.listQueryGoodsByGoodsId(listGid);
|
| | |
|
| | | if (list != null && list.size() > 0) {
|
| | |
|
| | | List<Long> listFid = new ArrayList<Long>();
|
| | | for (QualityFactory qualityFactory : list) {
|
| | | listFid.add(qualityFactory.getId());
|
| | | }
|
| | |
|
| | | if (listFid.size() > 0) {
|
| | | // 批量删除精选库
|
| | | qualityFactoryMapper.deleteBatchByPrimaryKey(listFid);
|
| | | // 批量删除限时抢购
|
| | | qualityFlashSaleMapper.deleteBatchByQualityID(listFid);
|
| | | }
|
| | | }
|
| | |
|
| | | // 批量删除精选库
|
| | | qualityFactoryMapper.deleteBatchByGoodsId(listGid);
|
| | | // 批量删除限时抢购
|
| | | qualityFlashSaleMapper.deleteBatchByQualityID(listGid);
|
| | | // 删除对应标签
|
| | | labelGoodsMapper.deleteBatchByGoodsId(listGid);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | @Transactional
|
| | | public void deleteByGoodsId(List<String> ids) throws QualityFactoryException {
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Long> getAuctionIdbyClassId(Long systemCid, Integer goodsSource, String dateTime)
|
| | | throws QualityFactoryException {
|
| | | public List<Long> getAuctionIdbyClassId(Long systemCid, Integer goodsSource, String dateTime){
|
| | | return qualityFactoryMapper.getAuctionIdbyClassId(systemCid, goodsSource, dateTime);
|
| | | }
|
| | |
|
| | |
| | | goodsBrief.setCreatetime(new Date());
|
| | | goodsBrief.setUpdatetime(new Date());
|
| | | // 非空项 设置默认值
|
| | | setTaoBaoGoodsBriefDefault(goodsBrief);
|
| | | taoBaoGoodsBriefService.setGoodsBriefDefault(goodsBrief);
|
| | | // 保存至本地
|
| | | taoBaoGoodsBriefService.insertSelective(goodsBrief);
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public void updateGoodsFactory(List<Long> listId) {
|
| | |
|
| | | if (listId == null || listId.size() == 0) {
|
| | | public void updateQualityGoods(Long goodsId) {
|
| | | if (goodsId == null) {
|
| | | return;
|
| | | }
|
| | |
|
| | | List<QualityFactory> listQuality = qualityFactoryMapper.listQueryGoodsByGoodsId(listId);
|
| | | if (listQuality == null || listQuality.size() == 0) {
|
| | | return;
|
| | | }
|
| | |
|
| | | // 删除精选库
|
| | | List<Long> listDeleteQuality = new ArrayList<Long>();
|
| | | // 删除标签
|
| | | List<Long> listDeleteLabel = new ArrayList<Long>();
|
| | |
|
| | | List<QualityFactory> listUpdateQuality = new ArrayList<QualityFactory>();
|
| | |
|
| | | List<TaoBaoGoodsBrief> listUpdateGoodsBrief = new ArrayList<TaoBaoGoodsBrief>();
|
| | |
|
| | | List<Long> list9ClassDelete = new ArrayList<Long>();
|
| | | // 添加商品标签列表
|
| | | List<LabelGoods> listLabelAdd = new ArrayList<LabelGoods>();
|
| | |
|
| | | TaoBaoGoodsBrief goods = null;
|
| | | boolean isDelete = false;
|
| | | 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));
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(value19K9)) {
|
| | | map.put("19.9", new Label(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));
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(value49K9)) {
|
| | | map.put("49.9", new Label(Long.parseLong(value49K9)));
|
| | | list9Class.add(Long.parseLong(value49K9));
|
| | | }
|
| | |
|
| | | // 获取详情
|
| | | goods = TaoKeApiUtil.searchGoodsDetail(goodsId);
|
| | | if(goods == null) {
|
| | | isDelete = true;
|
| | | } else if (goods.getCouponAmount().compareTo(BigDecimal.valueOf(0)) > 0) {
|
| | | isDelete = true;
|
| | | }
|
| | |
|
| | | listQuality.parallelStream().forEach(quality -> {
|
| | |
|
| | | TaoBaoGoodsBrief goods = quality.getTaoBaoGoodsBrief();
|
| | |
|
| | | if (goods == null) {
|
| | | // 移除精选库
|
| | | listDeleteQuality.add(quality.getId());
|
| | |
|
| | | } else {
|
| | |
|
| | | Long id = goods.getId();
|
| | |
|
| | | TaoBaoGoodsBrief newGoodsBrief = null;
|
| | |
|
| | | Long auctionId = goods.getAuctionId();
|
| | | try {
|
| | | // 获取详情
|
| | | newGoodsBrief = TaoKeApiUtil.searchGoodsDetail(auctionId);
|
| | | } catch (TaobaoGoodsDownException e1) {
|
| | | // 商品下架 移除数据库
|
| | | taoBaoGoodsUpdateService.deleteTaoBaoGoods(auctionId);
|
| | |
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | if (newGoodsBrief == null) {
|
| | |
|
| | | /* 无券信息 移除精选库 */
|
| | | listDeleteQuality.add(quality.getId());
|
| | | // 移除标签
|
| | | listDeleteLabel.add(goods.getId());
|
| | |
|
| | | } else {
|
| | | /* 无券信息 移除精选库 */
|
| | | if (StringUtil.isNullOrEmpty(newGoodsBrief.getCouponInfo())
|
| | | && StringUtil.isNullOrEmpty(newGoodsBrief.getCouponActivityId())) { // 无券信息
|
| | |
|
| | | // 移除精选库
|
| | | listDeleteQuality.add(quality.getId());
|
| | | // 移除标签
|
| | | listDeleteLabel.add(goods.getId());
|
| | |
|
| | | } else {
|
| | | /* 更新商品信息 */
|
| | | TaoBaoGoodsBrief updateGoods = taoBaoGoodsUpdateService
|
| | | .getUpdateTaoBaoGoodsBrief(newGoodsBrief);
|
| | |
|
| | | 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);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | });
|
| | |
|
| | | // 更新商品信息
|
| | | if (listUpdateGoodsBrief.size() > 0) {
|
| | | taoBaoGoodsUpdateService.updateTaoBaoGoods(listUpdateGoodsBrief);
|
| | | }
|
| | |
|
| | | // 更新精选库
|
| | | if (listUpdateQuality.size() > 0) {
|
| | | qualityFactoryMapper.updateBatchSelective(listUpdateQuality);
|
| | | }
|
| | |
|
| | | // 批量删除精选库
|
| | | if (listDeleteQuality.size() > 0) {
|
| | | qualityFactoryMapper.deleteBatchByPrimaryKey(listDeleteQuality);
|
| | | // 批量删除限时抢购
|
| | | qualityFlashSaleMapper.deleteBatchByQualityID(listDeleteQuality);
|
| | | }
|
| | |
|
| | | // 删除对应标签
|
| | | if (listDeleteLabel.size() > 0) {
|
| | | labelGoodsMapper.deleteBatchByGoodsId(listDeleteLabel);
|
| | | }
|
| | |
|
| | | // 添加标签
|
| | | if (listLabelAdd.size() > 0) {
|
| | | labelGoodsMapper.insertBatch(listLabelAdd);
|
| | | }
|
| | |
|
| | | // 删除标签
|
| | | if (list9ClassDelete.size() > 0) {
|
| | | labelGoodsMapper.deleteBatchByPK(list9ClassDelete);
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | isDelete = true;
|
| | | }
|
| | | |
| | | // 移除精选库
|
| | | if (isDelete) {
|
| | | deleteByTaoBaoGoodsId(goodsId);
|
| | | taoBaoGoodsBriefService.deleteByPrimaryKey(goodsId);
|
| | | return;
|
| | | }
|
| | | |
| | | goods.setId(goodsId);
|
| | | goods.setCreatetime(new Date());
|
| | | goods.setUpdatetime(new Date());
|
| | | try {
|
| | | taoBaoGoodsUpdateService.updateTaoBaoGoods(goods);
|
| | | } catch (TaobaoGoodsUpdateException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void autoInsertOrUpadateStorage(List<TaoBaoGoodsBrief> goodsList, List<Label> listLabs,
|
| | | BoutiqueAutoRule autoRule) throws Exception {
|
| | | public void autoInsertOrUpadateStorage(BoutiqueAutoRule autoRule, List<TaoBaoGoodsBrief> goodsList, List<Label> listLabs) {
|
| | |
|
| | | if (goodsList == null || goodsList.size() == 0) {
|
| | | return;
|
| | | }
|
| | |
|
| | | /* 来源推荐商品需要获取详情 */
|
| | | |
| | | /* 来源推荐商品 需要获取详情 */
|
| | | if (QualityFactory.SOURCE_TAOBAO_MATERIAL == autoRule.getGoodsSource()) {
|
| | | // 插入商品集合
|
| | | List<TaoBaoGoodsBrief> listGoodsBrief = new ArrayList<TaoBaoGoodsBrief>();
|
| | |
|
| | | |
| | | goodsList.parallelStream().forEach(goods -> {
|
| | | // 获取详情
|
| | | try {
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = TaoKeApiUtil.searchGoodsDetail(goods.getAuctionId());
|
| | | if (taoBaoGoodsBrief != null) {
|
| | |
|
| | | listGoodsBrief.add(taoBaoGoodsBrief);
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | });
|
| | |
|
| | | |
| | | goodsList.clear();
|
| | |
|
| | | goodsList = listGoodsBrief;
|
| | |
|
| | | if (goodsList == null || goodsList.size() == 0) {
|
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | | for (int i = 0; i < goodsList.size(); i++) {
|
| | | if (goodsList.get(i).getMaterialLibType() != null && goodsList.get(i).getMaterialLibType() == 0) {
|
| | | goodsList.remove(i);
|
| | | i--;
|
| | | }
|
| | | }
|
| | |
|
| | | // 商品id集合
|
| | | List<Long> listSystemTBid = new ArrayList<Long>();
|
| | | |
| | | |
| | | // for (int i = 0; i < goodsList.size(); i++) {
|
| | | // if (goodsList.get(i).getMaterialLibType() != null && goodsList.get(i).getMaterialLibType() == 0) {
|
| | | // goodsList.remove(i);
|
| | | // i--;
|
| | | // }
|
| | | // }
|
| | | |
| | |
|
| | | // 添加商品标签列表
|
| | | List<LabelGoods> listLabelAdd = new ArrayList<LabelGoods>();
|
| | |
|
| | | |
| | | // 插入商品集合
|
| | | List<TaoBaoGoodsBrief> listGoodsInsert = new ArrayList<TaoBaoGoodsBrief>();
|
| | | // 更新商品集合
|
| | | List<TaoBaoGoodsBrief> listGoodsUpdate = new ArrayList<TaoBaoGoodsBrief>();
|
| | |
|
| | | // 进入精选商品列表
|
| | | List<QualityFactory> listAddInsert = new ArrayList<QualityFactory>();
|
| | | List<QualityFactory> listInsertQuality = new ArrayList<QualityFactory>();
|
| | | // 进入精选商品列表
|
| | | List<QualityFactory> listAddUpdate = new ArrayList<QualityFactory>();
|
| | |
|
| | | List<QualityFactory> listUpdateQuality = new ArrayList<QualityFactory>();
|
| | | |
| | | // 插入商品淘宝ID集合
|
| | | List<Long> listAuctionId = new ArrayList<Long>();
|
| | | for (TaoBaoGoodsBrief goodsBrief : goodsList) {
|
| | | listAuctionId.add(goodsBrief.getAuctionId());
|
| | | }
|
| | | List<Long> listHas = taoBaoGoodsBriefService.listExistById(listAuctionId);
|
| | |
|
| | | List<TaoBaoGoodsBrief> listHas = taoBaoGoodsBriefService.listQueryByAuctionId(listAuctionId);
|
| | |
|
| | | List<Long> list9Class = null;
|
| | | List<Long> list9ClassDelete = new ArrayList<Long>();
|
| | | Map<String, Label> map = new HashMap<String, Label>();
|
| | |
|
| | | list9Class = new ArrayList<Long>();
|
| | |
|
| | | List<Label> list9K9 = labelService.selectByTitleCache("labKey", "9.9");
|
| | | if (list9K9 != null && list9K9.size() > 0) {
|
| | | map.put("9.9", list9K9.get(0));
|
| | | list9Class.add(list9K9.get(0).getId());
|
| | | }
|
| | |
|
| | | List<Label> list19k9 = labelService.selectByTitleCache("labKey", "19.9");
|
| | | if (list19k9 != null && list19k9.size() > 0) {
|
| | | map.put("19.9", list19k9.get(0));
|
| | | list9Class.add(list19k9.get(0).getId());
|
| | | }
|
| | |
|
| | | List<Label> list29k9 = labelService.selectByTitleCache("labKey", "29.9");
|
| | | if (list29k9 != null && list29k9.size() > 0) {
|
| | | map.put("29.9", list29k9.get(0));
|
| | | list9Class.add(list29k9.get(0).getId());
|
| | | }
|
| | |
|
| | | List<Label> list49k9 = labelService.selectByTitleCache("labKey", "49.9");
|
| | | if (list49k9 != null && list49k9.size() > 0) {
|
| | | map.put("49.9", list49k9.get(0));
|
| | | list9Class.add(list49k9.get(0).getId());
|
| | | }
|
| | |
|
| | | |
| | | |
| | | // 遍历商品
|
| | | for (TaoBaoGoodsBrief newGoodsBrief : goodsList) {
|
| | |
|
| | | Long systemId = null;
|
| | | boolean isExist = false;
|
| | | Long auctionId = newGoodsBrief.getAuctionId();
|
| | |
|
| | | // 设置成主键
|
| | | newGoodsBrief.setId(auctionId);
|
| | | newGoodsBrief.setState(0); // 状态启用
|
| | | newGoodsBrief.setCreatetime(new Date());
|
| | | newGoodsBrief.setUpdatetime(new Date());
|
| | | |
| | | /* 判断商品 是否已经存在数据库 */
|
| | | if (listHas != null && listHas.size() > 0) {
|
| | | for (TaoBaoGoodsBrief hasgoodsBrief : listHas) {
|
| | | Long hasId = hasgoodsBrief.getAuctionId();
|
| | | if (auctionId.equals(hasId)) {
|
| | | systemId = hasgoodsBrief.getId();
|
| | | // 存在数据库
|
| | | isExist = true;
|
| | | break;// 结束内部循环
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /* 商品已存在数据库 */
|
| | | if (isExist && systemId != null) {
|
| | |
|
| | | // 用于确定是否存在精选库
|
| | | listSystemTBid.add(systemId);
|
| | |
|
| | | // 更新商品信息
|
| | | TaoBaoGoodsBrief updateGoods = taoBaoGoodsUpdateService.getUpdateTaoBaoGoodsBrief(newGoodsBrief);
|
| | | // 设置主键id
|
| | | updateGoods.setId(systemId);
|
| | | // 修改创建时间 - 换义新创建
|
| | | Date date = new Date();
|
| | | updateGoods.setCreatetime(date);
|
| | | updateGoods.setUpdatetime(date);
|
| | | taoBaoGoodsBriefService.setGoodsBriefDefault(updateGoods);
|
| | |
|
| | | listGoodsUpdate.add(updateGoods);
|
| | |
|
| | | Long has9k9ID = null;
|
| | |
|
| | | /* 贴上标签 */
|
| | | if (listHas != null && listHas.size() > 0 && listHas.contains(auctionId)) {
|
| | | // 更新商品
|
| | | |
| | | listGoodsUpdate.add(newGoodsBrief); |
| | | |
| | | // 商品标签
|
| | | 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系列 加入对应的标签 */
|
| | | 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;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | } else {
|
| | |
|
| | | long existence = labelGoodsMapper.isExistence(systemId, label.getId());
|
| | | if (existence <= 0) {
|
| | | // 贴上新标签
|
| | | LabelGoods lg = new LabelGoods();
|
| | | lg.setLabel(label);
|
| | | lg.setCreateUser(autoRule.getAdminUser());
|
| | | lg.setCreatetime(new Date());
|
| | | lg.setTaoBaoGoodsBrief(updateGoods);
|
| | |
|
| | | listLabelAdd.add(lg);
|
| | | } else {
|
| | | if (list9Class.contains(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入库规则 若商品信息变化 对应的标签根据价格 修改
|
| | | 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;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | // 清空 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); // 状态启用
|
| | | newGoodsBrief.setCreatetime(new Date());
|
| | | newGoodsBrief.setUpdatetime(new Date());
|
| | | // 设置默认值
|
| | | taoBaoGoodsBriefService.setGoodsBriefDefault(newGoodsBrief);
|
| | | // 插入数据库
|
| | | listGoodsInsert.add(newGoodsBrief);
|
| | |
|
| | | // 加入精选库
|
| | | listAddInsert.add(getNewQualityFactory(newGoodsBrief, autoRule));
|
| | |
|
| | | // 贴上标签
|
| | | 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 标签 */
|
| | | LabelGoods labelGds = screen9K9(newGoodsBrief, map);
|
| | |
|
| | | if (labelGds != null) {
|
| | | listLabelAdd.add(labelGds);
|
| | | }
|
| | |
|
| | | } else {
|
| | | for (Label lab: listLabs) {
|
| | | long existence = labelGoodsMapper.isExistence(auctionId, lab.getId());
|
| | | if (existence <= 0) {
|
| | | // 贴上新标签
|
| | | LabelGoods lg = new LabelGoods();
|
| | | lg.setLabel(label);
|
| | | lg.setLabel(lab);
|
| | | lg.setCreateUser(autoRule.getAdminUser());
|
| | | lg.setCreatetime(new Date());
|
| | | lg.setTaoBaoGoodsBrief(newGoodsBrief);
|
| | | listLabelAdd.add(lg);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | // 更新的商品信息 是否存在精选库中
|
| | | List<QualityFactory> listExist = null;
|
| | | if (listSystemTBid.size() > 0) {
|
| | | listExist = qualityFactoryMapper.listQueryGoodsByGoodsId(listSystemTBid);
|
| | | }
|
| | |
|
| | | /* 更新淘宝商品信息 */
|
| | | if (listGoodsUpdate.size() > 0) {
|
| | |
|
| | | for (TaoBaoGoodsBrief goodsBrief : listGoodsUpdate) {
|
| | | boolean isExist = false;
|
| | |
|
| | | if (listExist == null || listExist.size() == 0) {
|
| | | // 加入到精选库
|
| | | listAddInsert.add(getNewQualityFactory(goodsBrief, autoRule));
|
| | | continue;
|
| | | }
|
| | |
|
| | | QualityFactory selection = null;
|
| | | Long id = goodsBrief.getId();
|
| | | for (QualityFactory selectionGoods : listExist) {
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
|
| | | if (taoBaoGoodsBrief != null) {
|
| | | Long sid = taoBaoGoodsBrief.getId();
|
| | | if (id.equals(sid)) {
|
| | | isExist = true;
|
| | | selection = selectionGoods;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | if (isExist) {
|
| | | /* 更新精选库信息 */
|
| | |
|
| | | |
| | | // 更新的商品信息 是否存在精选库中
|
| | | QualityFactory quality = qualityFactoryMapper.getByAuctionId(auctionId);
|
| | | if (quality == null) {
|
| | | listInsertQuality.add(getNewQualityFactory(newGoodsBrief, autoRule));
|
| | | } else {
|
| | | // 随机权重
|
| | | int weight = autoRule.getStartWeight()
|
| | | + (int) (Math.random() * ((autoRule.getEndWeight() - autoRule.getStartWeight()) + 1));
|
| | | selection.setWeight(weight);
|
| | | quality.setWeight(weight);
|
| | | // 更新时间
|
| | | selection.setUpdatetime(new Date());
|
| | | quality.setUpdatetime(new Date());
|
| | | // 更新来源规则
|
| | | selection.setBoutiqueAutoRule(autoRule);
|
| | | quality.setBoutiqueAutoRule(autoRule);
|
| | | // 更新来源类别
|
| | | selection.setSourceCalss(autoRule.getSourceCalss());
|
| | | quality.setSourceCalss(autoRule.getSourceCalss());
|
| | | // 来源
|
| | | selection.setGoodsSource(autoRule.getGoodsSource());
|
| | |
|
| | | listAddUpdate.add(selection);
|
| | |
|
| | | } else {
|
| | | // 新增至精选库
|
| | | listAddInsert.add(getNewQualityFactory(goodsBrief, autoRule));
|
| | | quality.setGoodsSource(autoRule.getGoodsSource());
|
| | | listUpdateQuality.add(quality);
|
| | | }
|
| | | |
| | | } else {
|
| | | // 设置商品默认值
|
| | | taoBaoGoodsBriefService.setGoodsBriefDefault(newGoodsBrief);
|
| | | listGoodsInsert.add(newGoodsBrief);
|
| | | |
| | | // 精选库信息
|
| | | listInsertQuality.add(getNewQualityFactory(newGoodsBrief, autoRule));
|
| | |
|
| | | }
|
| | | try {
|
| | | taoBaoGoodsUpdateService.updateTaoBaoGoods(listGoodsUpdate);
|
| | | } catch (TaobaoGoodsUpdateException e) {
|
| | | System.out.println(e.getMsg());
|
| | | // 商品标签
|
| | | if (listLabs != null && listLabs.size() > 0) {
|
| | | for (Label lab: listLabs) {
|
| | | LabelGoods lg = new LabelGoods();
|
| | | lg.setLabel(lab);
|
| | | lg.setCreateUser(autoRule.getAdminUser());
|
| | | lg.setCreatetime(new Date());
|
| | | lg.setTaoBaoGoodsBrief(newGoodsBrief);
|
| | | listLabelAdd.add(lg);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | // 淘宝商品插入数据库
|
| | | // 插入淘宝商品
|
| | | if (listGoodsInsert.size() > 0) {
|
| | | taoBaoGoodsBriefService.insertBatch(listGoodsInsert);
|
| | | }
|
| | |
|
| | | // 更新精选库
|
| | | if (listAddUpdate.size() > 0) {
|
| | | qualityFactoryMapper.updateBatchSelective(listAddUpdate);
|
| | | |
| | | // 更新淘宝商品
|
| | | if (listGoodsUpdate.size() > 0) {
|
| | | try {
|
| | | taoBaoGoodsUpdateService.updateTaoBaoGoods(listGoodsUpdate);
|
| | | } catch (TaobaoGoodsUpdateException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | // 加入精选库
|
| | | if (listAddInsert.size() > 0) {
|
| | | qualityFactoryMapper.insertBatch(listAddInsert);
|
| | | if (listInsertQuality.size() > 0) {
|
| | | qualityFactoryMapper.insertBatch(listInsertQuality);
|
| | | }
|
| | |
|
| | | // 更新精选库
|
| | | if (listUpdateQuality.size() > 0) {
|
| | | qualityFactoryMapper.updateBatchSelective(listUpdateQuality);
|
| | | }
|
| | |
|
| | | // 添加标签
|
| | |
| | | labelGoodsMapper.insertBatch(listLabelAdd);
|
| | | }
|
| | |
|
| | | // 删除标签
|
| | | if (list9ClassDelete.size() > 0) {
|
| | | labelGoodsMapper.deleteBatchByPK(list9ClassDelete);
|
| | | }
|
| | |
|
| | | // 加入限时抢购
|
| | | if (autoRule.isFlashSale()) {
|
| | | updateQualityFlashSale(listAddInsert, listAddUpdate, autoRule);
|
| | | updateQualityFlashSale(goodsList, autoRule);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public void updateQualityFlashSale(List<QualityFactory> listinsert, List<QualityFactory> listUpdate,
|
| | | BoutiqueAutoRule autoRule) {
|
| | | // 精选id集合
|
| | | |
| | | |
| | | /**
|
| | | * 限时秒杀
|
| | | * @param listinsert
|
| | | * @param listUpdate
|
| | | * @param autoRule
|
| | | */
|
| | | public void updateQualityFlashSale(List<TaoBaoGoodsBrief> listGoods, BoutiqueAutoRule autoRule) {
|
| | | |
| | | List<Long> listQFId = new ArrayList<Long>();
|
| | |
|
| | | if (listinsert.size() > 0) {
|
| | | for (QualityFactory qualityFactory : listinsert) {
|
| | | listQFId.add(qualityFactory.getId());
|
| | | }
|
| | | }
|
| | |
|
| | | if (listUpdate.size() > 0) {
|
| | | for (QualityFactory qualityFactory : listUpdate) {
|
| | | listQFId.add(qualityFactory.getId());
|
| | | }
|
| | | }
|
| | |
|
| | | if (listQFId.size() == 0) {
|
| | | return;
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoods) {
|
| | | listQFId.add(taoBaoGoodsBrief.getId());
|
| | | }
|
| | |
|
| | | int startWeight = autoRule.getStartWeight();
|
| | |
| | |
|
| | | // 加入入限时抢购
|
| | | List<QualityFlashSale> listFlashSale = new ArrayList<QualityFlashSale>();
|
| | | // 限时抢购更新: 时间、权重
|
| | | // 限时抢购更新:
|
| | | List<QualityFlashSale> listFlashSaleUpdate = new ArrayList<QualityFlashSale>();
|
| | | |
| | |
|
| | | // 查询已存在显示限时抢购的商品
|
| | | 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));
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief: listGoods) {
|
| | | listFlashSale.add(getNewQualityFlashSale(taoBaoGoodsBrief, startWeight, endWeight, goodsSource));
|
| | | }
|
| | |
|
| | | } else {
|
| | | int i = 0;
|
| | | boolean exist = false;
|
| | |
|
| | | for (Long qfId : listQFId) {
|
| | |
|
| | | |
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief: listGoods) {
|
| | | boolean exist = false;
|
| | | Long id = taoBaoGoodsBrief.getId();
|
| | | |
| | | for (QualityFlashSale flashSale : listQuery) {
|
| | | QualityFactory qualityFactory = flashSale.getQualityFactory();
|
| | |
|
| | | if (qfId.equals(qualityFactory.getId())) {
|
| | | TaoBaoGoodsBrief goodsBrief = flashSale.getTaoBaoGoodsBrief();
|
| | | if (id.equals(goodsBrief.getId())) {
|
| | | exist = true;
|
| | |
|
| | | // 即将准备时间段时间
|
| | | // int nowType = qualityFlashSaleService.getQueryType();
|
| | | // flashSale.setType(nowType);
|
| | |
|
| | | double weight = startWeight + (Math.random() * ((endWeight - startWeight) + 1));
|
| | | flashSale.setWeight(weight);
|
| | | flashSale.setUpdatetime(new Date());
|
| | | listFlashSaleUpdate.add(flashSale);
|
| | |
|
| | | listQuery.remove(flashSale);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | if (!exist) {
|
| | | listFlashSale.add(getNewQualityFlashSale(qfId, i, startWeight, endWeight, goodsSource));
|
| | | listFlashSale.add(getNewQualityFlashSale(taoBaoGoodsBrief, startWeight, endWeight, goodsSource));
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | // 插入限时抢购
|
| | |
| | | if (listFlashSaleUpdate.size() > 0) {
|
| | | qualityFlashSaleService.updateBatchSelective(listFlashSaleUpdate);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @param i
|
| | | * @return
|
| | | */
|
| | | public QualityFlashSale getNewQualityFlashSale(Long qfId, int i, int startWeight, int endWeight, int goodsSource) {
|
| | | public QualityFlashSale getNewQualityFlashSale(TaoBaoGoodsBrief taoBaoGoodsBrief, int startWeight, |
| | | int endWeight, int goodsSource) {
|
| | |
|
| | | QualityFlashSale flashSale = new QualityFlashSale();
|
| | | QualityFactory qualityFactory = new QualityFactory();
|
| | | qualityFactory.setId(qfId);
|
| | | flashSale.setQualityFactory(qualityFactory);
|
| | |
|
| | | if (QualityFactory.SOURCE_TAOBAO_DATAOKE == goodsSource) {
|
| | | // 大淘客优先展示
|
| | | double weight = 20000 + (Math.random() * 2001);
|
| | | flashSale.setWeight(weight);
|
| | | } else {
|
| | | double weight = startWeight + (Math.random() * ((endWeight - startWeight) + 1));
|
| | | flashSale.setWeight(weight);
|
| | | }
|
| | |
|
| | | // int nowType = qualityFlashSaleService.getNowType();
|
| | | // flashSale.setType(nowType);
|
| | |
|
| | | flashSale.setTaoBaoGoodsBrief(taoBaoGoodsBrief);
|
| | | flashSale.setCreatetime(new Date());
|
| | | flashSale.setUpdatetime(new Date());
|
| | |
|
| | | |
| | | // 权重设置:大淘客优先展示
|
| | | double weight = 0;
|
| | | if (QualityFactory.SOURCE_TAOBAO_DATAOKE == goodsSource) {
|
| | | weight = 10000 + (Math.random() * 2001);
|
| | | } else {
|
| | | weight = startWeight + (Math.random() * ((endWeight - startWeight) + 1));
|
| | | }
|
| | | flashSale.setWeight(weight);
|
| | | |
| | | return flashSale;
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 商品加入精选库-new QualityFactory()
|
| | | *
|
| | |
| | |
|
| | | Integer rootCatId = goodsBrief.getRootCatId();
|
| | | if (rootCatId != null) {
|
| | | List<TaoBaoClassRelation> listRelation = taoBaoClassRelationMapper.listByTaoBaoCid(rootCatId.longValue());
|
| | | if (listRelation != null && listRelation.size() > 0) {
|
| | | TaoBaoClassRelation taoBaoClassRelation = listRelation.get(0);
|
| | | classID = taoBaoClassRelation.getCid();
|
| | | }
|
| | | classID = taoBaoClassRelationMapper.getClassIdByTaoBaoCid(rootCatId.longValue());
|
| | | }
|
| | |
|
| | | // 添加至精选商品库
|
| | |
| | | return selectionGoods;
|
| | |
|
| | | }
|
| | | |
| | | |
| | | |
| | | /**
|
| | | * 删除未更新的商品
|
| | | * |
| | | * @param systemCid
|
| | | * @param formatDate
|
| | | * @param source
|
| | | */
|
| | | @Override
|
| | | public void deleteNotUpdateGoods(Long systemCid, String formatDate, int source) {
|
| | | List<Long> list = qualityFactoryMapper.getAuctionIdbyClassId(systemCid, source, formatDate);
|
| | | if (list == null || list.size() == 0) {
|
| | | return;
|
| | | }
|
| | |
|
| | | public void setTaoBaoGoodsBriefDefault(TaoBaoGoodsBrief goodsBrief) {
|
| | | BigDecimal defaultZero = new BigDecimal("0");
|
| | | // 小于100条直接删除
|
| | | if (list.size() <= 100) {
|
| | | // 删除精选库
|
| | | deleteBatchByTaoBaoGoodsId(list);
|
| | | // 删除商品
|
| | | taoBaoGoodsBriefService.deleteBatchByGoodsId(list);
|
| | | return;
|
| | | } |
| | | |
| | | |
| | | // 大于100需要分段删除
|
| | | int start = 0;
|
| | | int end = 100;
|
| | | int countRow = 100;
|
| | |
|
| | | if (goodsBrief.getBiz30day() == null)
|
| | | goodsBrief.setBiz30day(0);
|
| | | int count = list.size() / countRow;
|
| | | if (list.size() % countRow > 0) {
|
| | | count += 1;
|
| | | }
|
| | |
|
| | | if (goodsBrief.getCouponAmount() == null)
|
| | | goodsBrief.setCouponAmount(defaultZero);
|
| | |
|
| | | if (goodsBrief.getCouponLeftCount() == null)
|
| | | goodsBrief.setCouponLeftCount(0);
|
| | |
|
| | | if (goodsBrief.getCouponStartFee() == null)
|
| | | goodsBrief.setCouponStartFee(defaultZero);
|
| | |
|
| | | if (goodsBrief.getCouponTotalCount() == null)
|
| | | goodsBrief.setCouponTotalCount(0);
|
| | |
|
| | | if (goodsBrief.getDayLeft() == null)
|
| | | goodsBrief.setDayLeft(0);
|
| | |
|
| | | if (goodsBrief.getEventCreatorId() == null)
|
| | | goodsBrief.setEventCreatorId(0);
|
| | |
|
| | | if (goodsBrief.getHasRecommended() == null)
|
| | | goodsBrief.setHasRecommended(0);
|
| | |
|
| | | if (goodsBrief.getHasSame() == null)
|
| | | goodsBrief.setHasSame(0);
|
| | |
|
| | | if (goodsBrief.getIncludeDxjh() == null)
|
| | | goodsBrief.setIncludeDxjh(0);
|
| | |
|
| | | if (goodsBrief.getLeafCatId() == null)
|
| | | goodsBrief.setIncludeDxjh(0);
|
| | |
|
| | | if (goodsBrief.getReservePrice() == null)
|
| | | goodsBrief.setReservePrice(defaultZero);
|
| | |
|
| | | if (goodsBrief.getRfdRate() == null)
|
| | | goodsBrief.setRfdRate(0);
|
| | |
|
| | | if (goodsBrief.getRootCatId() == null)
|
| | | goodsBrief.setRootCatId(0);
|
| | |
|
| | | if (goodsBrief.getRootCatScore() == null)
|
| | | goodsBrief.setRootCatScore(0);
|
| | |
|
| | | if (goodsBrief.getSameItemPid() == null)
|
| | | goodsBrief.setSameItemPid(0L);
|
| | |
|
| | | if (goodsBrief.getSellerId() == null)
|
| | | goodsBrief.setSellerId(0L);
|
| | |
|
| | | if (goodsBrief.getTkCommFee() == null)
|
| | | goodsBrief.setTkCommFee(defaultZero);
|
| | |
|
| | | if (goodsBrief.getTkRate() == null)
|
| | | goodsBrief.setTkRate(defaultZero);
|
| | |
|
| | | if (goodsBrief.getTotalFee() == null)
|
| | | goodsBrief.setTotalFee(defaultZero);
|
| | |
|
| | | if (goodsBrief.getTotalNum() == null)
|
| | | goodsBrief.setTotalNum(0);
|
| | |
|
| | | if (goodsBrief.getUserType() == null)
|
| | | goodsBrief.setUserType(0);
|
| | |
|
| | | if (goodsBrief.getZkPrice() == null)
|
| | | goodsBrief.setZkPrice(defaultZero);
|
| | |
|
| | | for (int i = 0; i < count; i++) {
|
| | | List<Long> sublist = new ArrayList<Long>();
|
| | | if (i == count - 1) {
|
| | | sublist = list.subList(start, list.size());
|
| | | deleteBatchByTaoBaoGoodsId(sublist);
|
| | | taoBaoGoodsBriefService.deleteBatchByGoodsId(sublist);
|
| | | break;
|
| | | }
|
| | | sublist = list.subList(start, end);
|
| | | deleteBatchByTaoBaoGoodsId(sublist);
|
| | | taoBaoGoodsBriefService.deleteBatchByGoodsId(sublist);
|
| | | start += countRow;
|
| | | end += countRow;
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 查询精选商品数据应用前端
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.lable.QualityFlashSaleMapper;
|
| | |
| | | package com.yeshi.fanli.service.impl.lable;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | |
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 今日必抢 - 9k9
|
| | | * @param start
|
| | | * @param count
|
| | | * @param systemCid
|
| | | * @param labId
|
| | | * @param sortField
|
| | | * @return
|
| | | */
|
| | | @Override
|
| | | public List<QualityFactory> listQueryEverydayRob(long start, int count, Long cid, Long labId, Integer sortField,Double startCouponAmount,Double endCouponAmount) {
|
| | | return qualityFactoryMapper.listQueryEverydayRob(start, count, cid, labId, sortField,startCouponAmount,endCouponAmount);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countQueryEverydayRob(Long cid, Long labId, Double startCouponAmount,Double endCouponAmount) {
|
| | | return qualityFactoryMapper.countQueryEverydayRob(cid, labId,startCouponAmount,endCouponAmount);
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 小金额查询:9.9/19.9/29.9/49.9
|
| | |
| | | * @return
|
| | | */
|
| | | @Override
|
| | | @Cacheable(value = "quality9K9Cache",key="'listQuerySmallAmount-'+#start+'-'+#key+'-'+#labId+'-'+#cids")
|
| | | public List<QualityFactory> listQuerySmallAmount(long start, int count, String key, Long labId, String cids) {
|
| | | return qualityFactoryMapper.listQuery(start, count, key, null, labId, cids,1);
|
| | | @Cacheable(value = "quality9K9Cache",key="'get9k9ClassGoods-'+#start+'-'+#biz30day+'-'+#zkPrice+'-'+#minQuanPrice+'-'+#maxQuanPrice+'-'+#cids")
|
| | | public List<QualityFactory> get9k9ClassGoods(long start, int count, Integer biz30day, BigDecimal zkPrice,
|
| | | BigDecimal minQuanPrice, BigDecimal maxQuanPrice, String cids) {
|
| | | return qualityFactoryMapper.get9k9ClassGoods(start, count, biz30day, zkPrice, minQuanPrice, maxQuanPrice, cids);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 对应小金额查询:9.9/19.9/29.9/49.9
|
| | | */
|
| | | @Override
|
| | | @Cacheable(value = "quality9K9Cache",key="'countQuerySmallAmount-'+#key+'-'+#labId+'-'+#cids")
|
| | | public long countQuerySmallAmount(String key, Long labId, String cids) {
|
| | | return qualityFactoryMapper.countQuery(key, null, labId, cids,1);
|
| | | @Cacheable(value = "quality9K9Cache",key="'count9k9ClassGoods-'+#biz30day+'-'+#zkPrice+'-'+#minQuanPrice+'-'+#maxQuanPrice+'-'+#cids")
|
| | | public long count9k9ClassGoods(Integer biz30day, BigDecimal zkPrice, BigDecimal minQuanPrice, |
| | | BigDecimal maxQuanPrice, String cids) {
|
| | | return qualityFactoryMapper.count9k9ClassGoods(biz30day, zkPrice, minQuanPrice, maxQuanPrice, cids);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | public long countByShopId(Long shopId) {
|
| | | return qualityFactoryMapper.countByShopId(shopId);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public List<QualityFactory> listQueryEverydayRob(long start, int count, BigDecimal zkPrice, |
| | | BigDecimal minQuanPrice, BigDecimal maxQuanPrice) {
|
| | | return qualityFactoryMapper.listQueryEverydayRob(start, count, zkPrice, minQuanPrice, maxQuanPrice);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countQueryEverydayRob(BigDecimal zkPrice, BigDecimal minQuanPrice, BigDecimal maxQuanPrice) {
|
| | | return qualityFactoryMapper.countQueryEverydayRob(zkPrice, minQuanPrice, maxQuanPrice);
|
| | | }
|
| | | }
|
| | |
| | | @Override
|
| | | public void deleteTaoBaoGoods(Long auctionId) {
|
| | | // 删除精选库相关的数据
|
| | | qualityFactoryService.deleteByTbAuctionId(auctionId);
|
| | | qualityFactoryService.deleteByTaoBaoGoodsId(auctionId);
|
| | |
|
| | | // 删除商品本身数据
|
| | | taoBaoGoodsBriefMapper.deleteByAuctionId(auctionId);
|
| | |
| | | activityService.downTaoBaoGoods(auctionId);
|
| | |
|
| | | // 删除精选库相关的数据
|
| | | qualityFactoryService.deleteByTbAuctionId(auctionId);
|
| | | qualityFactoryService.deleteByTaoBaoGoodsId(auctionId);
|
| | |
|
| | | // 删除商品本身数据
|
| | | taoBaoGoodsBriefMapper.deleteByAuctionId(auctionId);
|
| | |
| | | List<TaoBaoGoodsBrief> updateList = new ArrayList<>();
|
| | |
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | |
|
| | | if (goods.getId() == null || goods.getId() == 0L) {
|
| | | throw new TaobaoGoodsUpdateException(1, "商品主键ID为空");
|
| | | }
|
| | |
|
| | | |
| | | // 需要更新的信息
|
| | | TaoBaoGoodsBrief updateGoods = getUpdateTaoBaoGoodsBrief(goods);
|
| | | updateGoods.setCreatetime(goods.getCreatetime());
|
| | |
|
| | | updateList.add(updateGoods);
|
| | | }
|
| | |
|
| | |
| | | * @param list
|
| | | * @return
|
| | | */
|
| | | public List<TaoBaoGoodsBrief> listQueryByAuctionId(List<Long> list);
|
| | | public List<Long> listExistById(List<Long> list);
|
| | |
|
| | | /**
|
| | | * 根据店铺id查询
|
| | |
| | |
|
| | | public long countByShopId(Long shopId);
|
| | |
|
| | | /**
|
| | | * 批量删除
|
| | | * @param list
|
| | | */
|
| | | public void deleteBatchByGoodsId(List<Long> list);
|
| | |
|
| | | /**
|
| | | * 主键删除
|
| | | * @param id
|
| | | */
|
| | | public void deleteByPrimaryKey(Long id);
|
| | |
|
| | | }
|
| | |
| | | public List<LabelGoods> getByGoodsId(Long goodsId);
|
| | |
|
| | |
|
| | | public List<Label> selectByTitleCache(String labKey, String title) throws LabelException;
|
| | | public Label getByTitleCache(String labKey, String title) throws LabelException;
|
| | |
|
| | | /**
|
| | | * 新建标签
|
| | |
| | | * @return
|
| | | */
|
| | | public List<Label> addBatchByNames(String lableNames, AdminUser admin) throws LabelException;
|
| | |
|
| | | /**
|
| | | * 多个标签查询
|
| | | * @param list
|
| | | * @return
|
| | | */
|
| | | public List<Label> listByTitlesCache(List<String> list);
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | 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;
|
| | | public void deleteBatchByTaoBaoGoodsId(List<Long> listId);
|
| | |
|
| | | /**
|
| | | * 根据淘宝id 删除
|
| | |
| | | * @param auctionId
|
| | | * @throws QualityFactoryException
|
| | | */
|
| | | public void deleteByTbAuctionId(Long auctionId);
|
| | | public void deleteByTaoBaoGoodsId(Long auctionId);
|
| | |
|
| | | /**
|
| | | * 统计商品id 是存在精品库
|
| | |
| | | * @param systemCid
|
| | | * @param labels
|
| | | */
|
| | | public void autoInsertOrUpadateStorage(List<TaoBaoGoodsBrief> goodsList, List<Label> listLabs,
|
| | | BoutiqueAutoRule autoRule) throws Exception;
|
| | | public void autoInsertOrUpadateStorage(BoutiqueAutoRule autoRule, List<TaoBaoGoodsBrief> goodsList, List<Label> listLabs) throws Exception;
|
| | |
|
| | | /**
|
| | | * AuctionId查收精选库
|
| | |
| | | * 商品来源
|
| | | * @return
|
| | | */
|
| | | public List<Long> getAuctionIdbyClassId(Long systemCid, Integer goodsSource, String dateTime)
|
| | | throws QualityFactoryException;
|
| | | public List<Long> getAuctionIdbyClassId(Long systemCid, Integer goodsSource, String dateTime);
|
| | |
|
| | | /**
|
| | | * 更新权重
|
| | |
| | | /**
|
| | | * 根据精选库商品id 更新商品信息
|
| | | *
|
| | | * @param listId
|
| | | * @param gid
|
| | | * 商品主键
|
| | | */
|
| | | public void updateGoodsFactory(List<Long> listId);
|
| | | public void updateQualityGoods(Long goodsId);
|
| | |
|
| | | /**
|
| | | * 根据最低销量查询精选库(按创建时间倒叙排列)
|
| | |
| | | public void addBatchTaoBaoGoods(List<TaoBaoGoodsBrief> listTaoBaoGoods, String lableNames, AdminUser admin)
|
| | | throws Exception;
|
| | |
|
| | | /**
|
| | | * 删除数据
|
| | | * @param systemCid
|
| | | * @param formatDate
|
| | | * @param source
|
| | | */
|
| | | public void deleteNotUpdateGoods(Long systemCid, String formatDate, int source);
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.lable;
|
| | |
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | |
| | | public List<QualityFactory> listQueryByFlashSale(long start, int count);
|
| | | public long countQueryByFlashSale();
|
| | |
|
| | | |
| | | /**
|
| | | * 今日必抢 - 9k9
|
| | | * @param start
|
| | | * @param count
|
| | | * @param systemCid
|
| | | * @param labId
|
| | | * @param sortField
|
| | | * @return
|
| | | */
|
| | | public List<QualityFactory> listQueryEverydayRob(long start, int count, Long cid, Long labId, Integer sortField, Double startCouponAmount, Double endCouponAmount);
|
| | | public long countQueryEverydayRob(Long cid, Long labId,Double startCouponAmount,Double endCouponAmount);
|
| | |
|
| | | |
| | |
|
| | | /**
|
| | | * 小金额查询:9.9/19.9/29.9/49.9(移动端)
|
| | | * @param start
|
| | | * @param count
|
| | | * @param key
|
| | | * @param classId 分类id
|
| | | * @param labId 标签id
|
| | | * @return
|
| | | */
|
| | | public List<QualityFactory> listQuerySmallAmount(long start, int count, String key, Long labId, String cids);
|
| | |
|
| | | /**
|
| | | * 对应小金额查询:9.9/19.9/29.9/49.9
|
| | | */
|
| | | public long countQuerySmallAmount(String key, Long labId, String cids);
|
| | |
|
| | |
|
| | | /**
|
| | | * 根据关键词搜索
|
| | |
| | | public List<QualityFactory> listByShopId(long start, int count, Long shopId);
|
| | |
|
| | | public long countByShopId(Long shopId);
|
| | | |
| | | |
| | | /**
|
| | | * 9k9类商品筛选
|
| | | * @param start
|
| | | * @param count
|
| | | * @param biz30day
|
| | | * @param zkPrice
|
| | | * @param minQuanPrice
|
| | | * @param maxQuanPrice
|
| | | * @param cids
|
| | | * @return
|
| | | */
|
| | | public List<QualityFactory> get9k9ClassGoods(long start, int count, Integer biz30day, BigDecimal zkPrice,
|
| | | BigDecimal minQuanPrice, BigDecimal maxQuanPrice, String cids);
|
| | | |
| | | public long count9k9ClassGoods(Integer biz30day, BigDecimal zkPrice, BigDecimal minQuanPrice, BigDecimal maxQuanPrice,
|
| | | String cids);
|
| | | |
| | | |
| | | /**
|
| | | * 9k9中的每日必抢
|
| | | * @param start
|
| | | * @param count
|
| | | * @param zkPrice
|
| | | * @param minQuanPrice
|
| | | * @param maxQuanPrice
|
| | | * @return
|
| | | */
|
| | | public List<QualityFactory> listQueryEverydayRob(long start, int count, BigDecimal zkPrice, BigDecimal minQuanPrice,
|
| | | BigDecimal maxQuanPrice);
|
| | | |
| | | public long countQueryEverydayRob(BigDecimal zkPrice, BigDecimal minQuanPrice, BigDecimal maxQuanPrice);
|
| | | }
|
| | |
| | | package com.yeshi.fanli.util;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
| | | doUserMoneyDebtJob();// 债务偿还
|
| | | } else if (!Constant.IS_TEST) {
|
| | | initScheduler();// 启动定时任务
|
| | | //
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | boutiqueAutoRuleService.startScheduler();
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 更新精选库商品
|
| | | */
|
| | | public void doUpdateGoodsJob() {
|
| | |
|
| | | // 采用4个线程做更新
|
| | | for (int i = 0; i < 4; i++)
|
| | | for (int i = 0; i < 1; i++)
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | |
|
| | | while (true) {
|
| | | try {
|
| | |
|
| | | Map<String, Long> map = CMQManager.getInstance().consumeNeedUpdateTaoBaoGoodsIdMsg(16);
|
| | |
|
| | | if (map != null) {
|
| | |
|
| | | Iterator<String> its = map.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | |
|
| | | String key = its.next();
|
| | | try {
|
| | | Long goodsId = map.get(key);
|
| | | List<Long> list = new ArrayList<>();
|
| | | list.add(goodsId);
|
| | | qualityFactoryService.updateGoodsFactory(list);
|
| | | CMQManager.getInstance().deleteNeedUpdateTaoBaoGoodsIdMsg(key);
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | qualityFactoryService.updateQualityGoods(map.get(its.next()));
|
| | | CMQManager.getInstance().deleteNeedUpdateTaoBaoGoodsIdMsg(its.next());
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.error("更新商品出错:" + e.getMessage());
|
| | |
|
| | | }
|
| | | }
|
| | | }
|