Merge remote-tracking branch 'origin/master'
Conflicts:
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoBaoUtil.java
| | |
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | LogHelper.test("美洽:body----" + sb.toString());
|
| | |
|
| | | String sign = "";
|
| | | try {
|
| | |
| | | "android".equalsIgnoreCase(deviceOS) ? 1 : 2, 1, msg, new Date());
|
| | | }
|
| | |
|
| | | LogHelper.test("美洽:body----" + sb.toString());
|
| | | |
| | | }
|
| | |
|
| | | public String sign(String raw_body) throws java.security.SignatureException {
|
| | |
| | | ehCacheCacheManager.getCacheManager().clearAll();
|
| | | }
|
| | |
|
| | | |
| | | @RequestMapping(value = "removeRedisCache")
|
| | | public void removeRedisCache(String key, PrintWriter out) {
|
| | | redisManager.removeCommonString(key);
|
| | | }
|
| | | |
| | | |
| | | @RequestMapping(value = "testConfig")
|
| | | public void getTestConfig(PrintWriter pw) {
|
| | | pw.print(configService.get("test"));
|
| | |
| | | @Controller
|
| | | @RequestMapping("admin/new/api/v1/brand")
|
| | | public class BrandShopAdminController {
|
| | | |
| | |
|
| | | @Resource
|
| | | private BrandClassService brandClassService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private BrandClassShopService brandClassShopService;
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 保存信息
|
| | | *
|
| | |
| | | @RequestMapping(value = "save")
|
| | | public void save(String callback, BrandClass brandClass, PrintWriter out) {
|
| | | try {
|
| | | brandClassService.saveObject(brandClass);
|
| | | brandClassService.saveObject(brandClass);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
|
| | | } catch (BrandClassException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | |
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | |
| | | /**
|
| | | * 修改排序
|
| | | *
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | |
| | | /**
|
| | | * 查询
|
| | | * |
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | | * @param key 模糊查询:说明、标识
|
| | | * @param key
|
| | | * 模糊查询:说明、标识
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "query")
|
| | | public void query(String callback, Integer pageIndex, Integer pageSize, String key,
|
| | | Integer state, PrintWriter out) {
|
| | | public void query(String callback, Integer pageIndex, Integer pageSize, String key, Integer state,
|
| | | PrintWriter out) {
|
| | |
|
| | | if (pageIndex == null || pageIndex < 1) {
|
| | | pageIndex = 1;
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | long count = brandClassService.countQuery(key, state);
|
| | | |
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls(); |
| | | gsonBuilder.serializeNulls();
|
| | | Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 删除
|
| | | * |
| | | * @param callback
|
| | | * @param idArray
|
| | | * @param out
|
| | |
| | | return;
|
| | | }
|
| | | Gson gson = new Gson();
|
| | | List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {}.getType());
|
| | | List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {
|
| | | }.getType());
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未检测到删除的数据"));
|
| | | return;
|
| | | }
|
| | | int count = brandClassService.deleteBatchByPrimaryKey(list);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("成功删除["+ count +"]条数据"));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("成功删除[" + count + "]条数据"));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("删除失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 筛选列表
|
| | | * |
| | | * @param callback
|
| | | * @param out
|
| | | */
|
| | |
| | |
|
| | | List<Object> result_list = new ArrayList<Object>();
|
| | | if (list != null && list.size() > 0) {
|
| | | for (BrandClass record: list) {
|
| | | Map<String,Object> map =new HashMap<String,Object>();
|
| | | for (BrandClass record : list) {
|
| | | Map<String, Object> map = new HashMap<String, Object>();
|
| | | map.put("key", record.getId());
|
| | | map.put("value", record.getName());
|
| | | result_list.add(map);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("result_list", result_list);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 查询
|
| | | * |
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | | * @param key 模糊查询:说明、标识
|
| | | * @param key
|
| | | * 模糊查询:说明、标识
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "queryTaoBaoShop")
|
| | |
| | | if (pageIndex == null || pageIndex < 1) {
|
| | | pageIndex = 1;
|
| | | }
|
| | | |
| | |
|
| | | if (pageSize == null || pageSize < 1) {
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | | TaoBaoShopInfoDTO taoBaoShopInfoDTO = TaoKeApiUtil.searchShop(key, pageIndex, pageSize);
|
| | | |
| | | TaoBaoShopInfoDTO taoBaoShopInfoDTO = TaoKeApiUtil.searchShop(key, pageIndex, pageSize);
|
| | |
|
| | | List<TaoBaoShopInfo> listInfo = taoBaoShopInfoDTO.getListInfo();
|
| | | if (listInfo == null || listInfo.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | List<Long> listShopId = new ArrayList<Long>();
|
| | | for (TaoBaoShopInfo taoBaoShopInfo: listInfo) {
|
| | | for (TaoBaoShopInfo taoBaoShopInfo : listInfo) {
|
| | | listShopId.add(taoBaoShopInfo.getUserId());
|
| | | }
|
| | | |
| | |
|
| | | // 已存在数据库中
|
| | | List<BrandClassShop> listExist = brandClassShopService.getExistByShopIds(listShopId);
|
| | | |
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | for (TaoBaoShopInfo taoBaoShopInfo: listInfo) {
|
| | | for (TaoBaoShopInfo taoBaoShopInfo : listInfo) {
|
| | | String name = "";
|
| | | if (listExist != null && listExist.size() > 0) {
|
| | | Long userId = taoBaoShopInfo.getUserId();
|
| | | for (BrandClassShop brandClassShop: listExist) {
|
| | | for (BrandClassShop brandClassShop : listExist) {
|
| | | TaoBaoShop shop = brandClassShop.getShop();
|
| | | if (shop !=null && userId == shop.getId() || userId.equals(shop.getId()) ) {
|
| | | if (shop != null && userId == shop.getId() || userId.equals(shop.getId())) {
|
| | | BrandClass brandClass = brandClassShop.getBrandClass();
|
| | | name = brandClass.getName();
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | JSONObject innerData = new JSONObject();
|
| | | innerData.put("cname", name);
|
| | | innerData.put("shopInfo", taoBaoShopInfo);
|
| | | array.add(innerData);
|
| | | }
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", taoBaoShopInfoDTO.getPage());
|
| | | data.put("result_list",array);
|
| | | data.put("result_list", array);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 添加店铺入库
|
| | | *
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveShopInfo")
|
| | | public void saveShopInfo(String callback,Long cid, String idArray, PrintWriter out) {
|
| | | public void saveShopInfo(String callback, Long cid, String idArray, PrintWriter out) {
|
| | | try {
|
| | | if (StringUtil.isNullOrEmpty(idArray)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择操作的数据"));
|
| | | return;
|
| | | }
|
| | | Gson gson = new Gson();
|
| | | List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {}.getType());
|
| | | List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {
|
| | | }.getType());
|
| | |
|
| | | String shopIds = brandClassShopService.saveShopInfo(cid,list);
|
| | | String shopIds = brandClassShopService.saveShopInfo(cid, list);
|
| | | if (StringUtil.isNullOrEmpty(shopIds)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
|
| | | } else {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("以下店铺ID:"+ shopIds + ",未添加成功"));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("以下店铺ID:" + shopIds + ",未添加成功"));
|
| | | }
|
| | | } catch (BrandClassShopException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 查询
|
| | | * |
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | | * @param key 模糊查询:说明、标识
|
| | | * @param key
|
| | | * 模糊查询:说明、标识
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "queryClassShop")
|
| | | public void queryClassShop(String callback, Integer pageIndex, Integer pageSize, String key,
|
| | | Long cid , Integer state, PrintWriter out) {
|
| | | public void queryClassShop(String callback, Integer pageIndex, Integer pageSize, String key, Long cid,
|
| | | Integer state, PrintWriter out) {
|
| | |
|
| | | if (pageIndex == null || pageIndex < 1) {
|
| | | pageIndex = 1;
|
| | |
| | | }
|
| | |
|
| | | try {
|
| | | List<BrandClassShop> list = brandClassShopService.listQuery((pageIndex - 1) * pageSize, pageSize, key, cid, state);
|
| | | List<BrandClassShop> list = brandClassShopService.listQuery((pageIndex - 1) * pageSize, pageSize, key, cid,
|
| | | state);
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | long count = brandClassShopService.countQuery(key, cid, state);
|
| | | |
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls(); |
| | | gsonBuilder.serializeNulls();
|
| | | Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 保存信息
|
| | | *
|
| | |
| | | */
|
| | | @RequestMapping(value = "saveClassShop")
|
| | | public void saveClassShop(String callback, Long id, Long cid, String shopName, Integer state, Integer top,
|
| | | HttpServletRequest request, PrintWriter out) {
|
| | | String key, HttpServletRequest request, PrintWriter out) {
|
| | | try {
|
| | | if (request instanceof MultipartHttpServletRequest) {
|
| | | MultipartHttpServletRequest fileRequest = (MultipartHttpServletRequest) request;
|
| | | brandClassShopService.changeShopInfo(fileRequest.getFile("file"), id, cid, shopName, state, top);
|
| | | }else{
|
| | | brandClassShopService.changeShopInfo(null, id, cid, shopName, state, top);
|
| | | }
|
| | | MultipartHttpServletRequest fileRequest = (MultipartHttpServletRequest) request;
|
| | | brandClassShopService.changeShopInfo(fileRequest.getFile("file"), id, cid, shopName, state, top, key);
|
| | | } else {
|
| | | brandClassShopService.changeShopInfo(null, id, cid, shopName, state, top, key);
|
| | | }
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
|
| | | } catch (BrandClassShopException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 修改排序
|
| | | *
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 删除
|
| | | * |
| | | * @param callback
|
| | | * @param idArray
|
| | | * @param out
|
| | |
| | | return;
|
| | | }
|
| | | Gson gson = new Gson();
|
| | | List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {}.getType());
|
| | | List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {
|
| | | }.getType());
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未检测到删除的数据"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | brandClassShopService.deleteBatchByPrimaryKey(list);
|
| | | |
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("删除成功"));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("删除失败"));
|
| | |
| | | import com.yeshi.fanli.service.inter.lable.QualityFlashSaleService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
|
| | | import com.yeshi.fanli.service.inter.lable.TaoKeGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsActivityService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaobaoMeterialService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private QualityFactoryService selectionGoodsService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsActivityService taoBaoGoodsActivityService;
|
| | |
|
| | | /**
|
| | | * 9.9商品
|
| | |
| | | */
|
| | | @RequestMapping(value = "get19k9")
|
| | | public void get19k9(String callback, Integer page, Long mcid, PrintWriter out) {
|
| | | get9k9ClassGoods(callback, out, page, 500, new BigDecimal(319.9), new BigDecimal(9.9), new BigDecimal(19.9), mcid);
|
| | | 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(callback, out, page, 500, new BigDecimal(429.9), new BigDecimal(19.9), new BigDecimal(29.9), mcid);
|
| | | 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(callback, out, page, 500, new BigDecimal(549.9), new BigDecimal(29.9), new BigDecimal(49.9), mcid);
|
| | | get9k9ClassGoods(callback, out, page, 500, new BigDecimal(549.9), new BigDecimal(29.9), new BigDecimal(49.9),
|
| | | mcid);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @param out
|
| | | */
|
| | | public void get9k9ClassGoods(String callback, PrintWriter out, Integer page, Integer biz30day, BigDecimal zkPrice,
|
| | | BigDecimal minQuanPrice, BigDecimal maxQuanPrice, Long mcid) {
|
| | | BigDecimal minQuanPrice, BigDecimal maxQuanPrice, Long mcid) {
|
| | | try {
|
| | | if (page == null || page <= 0) {
|
| | | page = 1;
|
| | |
| | | }
|
| | |
|
| | | // 根据标签id 查询数据
|
| | | List<QualityFactory> listQuery = qualityGoodsService.get9k9ClassGoods((page-1)*pageSize, pageSize, biz30day, zkPrice,
|
| | | minQuanPrice, maxQuanPrice, mergeCids);
|
| | | 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;
|
| | | }
|
| | |
|
| | | // 总条数
|
| | | long count = qualityGoodsService.count9k9ClassGoods(biz30day, zkPrice, minQuanPrice, maxQuanPrice, mergeCids);
|
| | | long count = qualityGoodsService.count9k9ClassGoods(biz30day, zkPrice, minQuanPrice, maxQuanPrice,
|
| | | mergeCids);
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | |
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief, proportion.toString(), null)));
|
| | | }
|
| | |
|
| | | // 618活动
|
| | | if (System.currentTimeMillis() < TimeUtil.convertToTimeTemp("2019-06-19", "yyyy-MM-dd")) {
|
| | | if (mcid == null || mcid == 0) {
|
| | | count = taoBaoGoodsActivityService.countByPrice(minQuanPrice,
|
| | | maxQuanPrice.add(new BigDecimal("0.1")));
|
| | | List<TaoBaoGoodsBrief> goodsList = taoBaoGoodsActivityService.listByPrice(minQuanPrice,
|
| | | maxQuanPrice.add(new BigDecimal("0.1")), page, pageSize);
|
| | | if (goodsList != null) {
|
| | | array.clear();
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | | array.add(gson
|
| | | .toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods, proportion.toString(), null)));
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | data.put("result_list", array);
|
| | |
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 9.9商品-每日必抢
|
| | |
| | | queryEverydayRob(callback, out, page, new BigDecimal(549.9), new BigDecimal(29.9), new BigDecimal(49.9));
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 每日必抢
|
| | |
| | | } else {
|
| | | count = 50;
|
| | | }
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | data.put("result_list", array);
|
| | |
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | BigDecimal proportion =manageService.getFanLiRate();
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | |
|
| | | /* 遍历列表数据 */
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : listMaterial) {
|
| | |
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | int type = qualityFlashSaleService.getNowType();
|
| | | |
| | |
|
| | | TaoBaoGoodsBrief goodsBrief = null;
|
| | | if (page == 1 && auctionId != null) {
|
| | | List<TaoBaoGoodsBrief> list = taoBaoGoodsBriefService.queryByAuctionId(auctionId);
|
| | |
| | | }
|
| | |
|
| | | if (goodsBrief != null) {
|
| | | pageSize = pageSize -1;
|
| | | pageSize = pageSize - 1;
|
| | | }
|
| | | |
| | |
|
| | | List<QualityFactory> listQuery = qualityGoodsService.listQueryByFlashSale((page - 1) * pageSize, pageSize);
|
| | |
|
| | | // 精选库数据为空
|
| | |
| | | if (goodsBrief != null) {
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief, proportion.toString(), null)));
|
| | | }
|
| | | |
| | |
|
| | | // 遍历列表数据
|
| | | for (QualityFactory quality : listQuery) {
|
| | |
|
| | |
| | | if (taoBaoGoodsBrief == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | if (goodsBrief != null && auctionId.equals(taoBaoGoodsBrief.getAuctionId())) {
|
| | | continue;
|
| | | }
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | long count = qualityGoodsService.countQueryByRebateAmount(proportion.toString(), startAmount, endAmount, tkRate);
|
| | | long count = qualityGoodsService.countQueryByRebateAmount(proportion.toString(), startAmount, endAmount,
|
| | | tkRate);
|
| | |
|
| | | // 精选库数据处理返回 前端
|
| | | JSONArray array = new JSONArray();
|
| | |
| | | int pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | JSONArray array = qualityGoodsService.getRecommendToIndex((page - 1) * pageSize, pageSize, proportion.toString());
|
| | | JSONArray array = qualityGoodsService.getRecommendToIndex((page - 1) * pageSize, pageSize,
|
| | | proportion.toString());
|
| | |
|
| | | if (array == null) {
|
| | | out.print(JsonUtil.loadFalseResult("没有更多了"));
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 超高奖金
|
| | | *
|
| | |
| | | try {
|
| | | if (page == null || page < 1)
|
| | | page = 1;
|
| | | |
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | |
| | |
|
| | | List<QualityFactory> listQuery = qualityGoodsService.listFreeGoods((page - 1) * pageSize, pageSize);
|
| | | if (listQuery == null || listQuery.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "没有更多了"));
|
| | |
| | | continue; // 券后价大于10
|
| | | }
|
| | |
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, |
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
|
| | | proportion.toString(), null);
|
| | | // 将返利改为券后价
|
| | | TaoBaoHongBaoInfo taoBaoHongBaoInfo = extra.getTaoBaoHongBaoInfo();
|
| | |
| | | taoBaoHongBaoInfo.setHongbao(extra.getQuanPrice());
|
| | | taoBaoHongBaoInfo.setRate("¥" + extra.getQuanPrice());
|
| | | }
|
| | | |
| | |
|
| | | array.add(gson.toJson(extra));
|
| | | }
|
| | |
|
| | | long count = qualityGoodsService.countFreeGoods();
|
| | |
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | if (page == 1) {
|
| | | // 抽奖规则
|
| | | String rules = configService.get("free_goods_rule");
|
| | | data.put("ruleLink", rules);
|
| | | }
|
| | | |
| | |
|
| | | data.put("count", count);
|
| | | data.put("result_list", array);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
| | |
|
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null) {
|
| | | // 筛选
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | List<TaoBaoGoodsBriefExtra> goodsList = new ArrayList<>();
|
| | |
|
| | | // 设备推荐
|
| | | for (TaoBaoGoodsBrief goods : result.getTaoBaoGoodsBriefs()) {
|
| | | if (!StringUtil.isNullOrEmpty(goods.getCouponInfo()) && goods.getCouponAmount() != null
|
| | | && goods.getCouponAmount().compareTo(new BigDecimal("5")) >= 0
|
| | | && goods.getBiz30day() > 1000 && !StringUtil.isNullOrEmpty(goods.getPictUrlWhite()))
|
| | | goodsList.add(goods);
|
| | | && goods.getBiz30day() > 1000 && !StringUtil.isNullOrEmpty(goods.getPictUrlWhite())) {
|
| | |
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods,
|
| | | proportion.toString(), "");
|
| | | extra.setRecommend(true);
|
| | | goodsList.add(extra);
|
| | | }
|
| | | }
|
| | | try {
|
| | | monitorService.addClientAPIMonitor(MonitorFactory.createClientAPI(request, 0,
|
| | |
| | |
|
| | | Collections.shuffle(goodsList);
|
| | | goodsList = goodsList.size() > 20 ? goodsList.subList(0, 20) : goodsList;
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods, proportion.toString(), "")));
|
| | | for (TaoBaoGoodsBriefExtra goods : goodsList) {
|
| | | array.add(gson.toJson(goods));
|
| | | }
|
| | | } else {
|
| | | try {
|
| | |
| | | } catch (UserCustomSettingsException e) {
|
| | | }
|
| | |
|
| | | if (VersionUtil.greaterThan_1_5_50(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | int totalCount = msgDeviceReadStateService.getUnReadCount(acceptData.getDevice(),
|
| | | "android".equalsIgnoreCase(acceptData.getPlatform()) ? 1 : 2, MsgDeviceReadState.TYPE_KEFU);
|
| | | data.put("totalCount", totalCount);
|
| | | }
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | |
| | |
|
| | | } else
|
| | | vo.setRead(true);
|
| | | |
| | | if(StringUtil.isNullOrEmpty(vo.getLatestMsg()))
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(vo.getLatestMsg()))
|
| | | vo.setLatestMsg("[点击打开人工客服]");
|
| | |
|
| | | return vo;
|
| | |
| | | package com.yeshi.fanli.dao.mybatis.goods.recommend; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.goods.recommend.RecommendGoodsDeleteHistory; |
| | | |
| | | public interface RecommendGoodsDeleteHistoryMapper extends BaseMapper<RecommendGoodsDeleteHistory> { |
| | | |
| | | /** |
| | | * 批量查询商品是否在删除队列中 |
| | | * |
| | | * @param goodsList |
| | | * @return |
| | | */ |
| | | List<RecommendGoodsDeleteHistory> listByGoodsInfo(@Param("device") String device, |
| | | @Param("goodsList") List<RecommendGoodsDeleteHistory> goodsList); |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.taobao;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import org.springframework.data.mongodb.core.query.Criteria;
|
| | | import org.springframework.data.mongodb.core.query.Query;
|
| | | import org.springframework.stereotype.Repository;
|
| | |
|
| | | import com.yeshi.fanli.dao.MongodbBaseDao;
|
| | | import com.yeshi.fanli.entity.taobao.s618.SuperTaoBaoGoods;
|
| | |
|
| | | @Repository
|
| | | public class SuperTaoBaoGoodsDao extends MongodbBaseDao<SuperTaoBaoGoods> {
|
| | |
|
| | | public List<SuperTaoBaoGoods> listByMaxAndMinFinalPrice(BigDecimal minPrice, BigDecimal maxPrice, int start,
|
| | | int count) {
|
| | | Query query = new Query();
|
| | | Criteria ca = new Criteria();
|
| | | ca.andOperator(Criteria.where("finalPrice").lt(maxPrice.multiply(new BigDecimal(100)).intValue()),
|
| | | Criteria.where("finalPrice").gte(minPrice.multiply(new BigDecimal(100)).intValue()));
|
| | | query.addCriteria(ca);
|
| | | query.limit(count);
|
| | | query.skip(start);
|
| | | return mongoTemplate.find(query, SuperTaoBaoGoods.class);
|
| | | }
|
| | |
|
| | | public long countByMaxAndMinFinalPrice(BigDecimal minPrice, BigDecimal maxPrice) {
|
| | | Query query = new Query();
|
| | | Criteria ca = new Criteria();
|
| | | ca.andOperator(Criteria.where("finalPrice").lt(maxPrice.multiply(new BigDecimal(100)).intValue()),
|
| | | Criteria.where("finalPrice").gte(minPrice.multiply(new BigDecimal(100)).intValue()));
|
| | | query.addCriteria(ca);
|
| | | return mongoTemplate.count(query, SuperTaoBaoGoods.class);
|
| | | }
|
| | |
|
| | | public void deleteByMaxTime(long timeStamp) {
|
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("updateTime").lt(timeStamp));
|
| | | mongoTemplate.remove(query, SuperTaoBaoGoods.class);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.dto.common;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
|
| | | public class CommonContentResult {
|
| | | public class CommonContentResult implements Serializable {
|
| | | private static final long serialVersionUID = 1L;
|
| | | private List<TaoBaoGoodsBrief> goodsList;
|
| | | private long count;
|
| | |
|
| | |
| | | @Column(name = "ud_beizhu")
|
| | | private String beiZhu;
|
| | |
|
| | | public RecommendGoodsDeleteHistory(Long goodsId, Integer goodsSource) {
|
| | | this.goodsId = goodsId;
|
| | | this.goodsSource = goodsSource;
|
| | | }
|
| | | public RecommendGoodsDeleteHistory() {
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
| | | private boolean coupon; // 是否有券
|
| | |
|
| | | @Expose
|
| | | private boolean recommend = true; // 是否推荐
|
| | | private boolean recommend; // 是否推荐
|
| | |
|
| | | @Expose
|
| | | private String spreadMoney;// 推广红包
|
New file |
| | |
| | | package com.yeshi.fanli.entity.taobao.s618;
|
| | |
|
| | | import org.springframework.data.annotation.Id;
|
| | | import org.springframework.data.mongodb.core.index.Indexed;
|
| | | import org.springframework.data.mongodb.core.mapping.Document;
|
| | | import org.springframework.data.mongodb.core.mapping.Field;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
|
| | | @Document(collection = "super_taobao_goods")
|
| | | public class SuperTaoBaoGoods {
|
| | | @Id
|
| | | @Field
|
| | | private Long auctionId;
|
| | | @Indexed
|
| | | @Field
|
| | | private int finalPrice;// 分为单位
|
| | | @Field
|
| | | private TaoBaoGoodsBrief goods;
|
| | | @Field
|
| | | @Indexed
|
| | | private long updateTime;
|
| | |
|
| | | public long getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(long updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | public SuperTaoBaoGoods(Long auctionId, int finalPrice, TaoBaoGoodsBrief goods) {
|
| | | this.auctionId = auctionId;
|
| | | this.finalPrice = finalPrice;
|
| | | this.goods = goods;
|
| | | }
|
| | |
|
| | | public SuperTaoBaoGoods() {
|
| | |
|
| | | }
|
| | |
|
| | | public int getFinalPrice() {
|
| | | return finalPrice;
|
| | | }
|
| | |
|
| | | public void setFinalPrice(int finalPrice) {
|
| | | this.finalPrice = finalPrice;
|
| | | }
|
| | |
|
| | | public Long getAuctionId() {
|
| | | return auctionId;
|
| | | }
|
| | |
|
| | | public void setAuctionId(Long auctionId) {
|
| | | this.auctionId = auctionId;
|
| | | }
|
| | |
|
| | | public TaoBaoGoodsBrief getGoods() {
|
| | | return goods;
|
| | | }
|
| | |
|
| | | public void setGoods(TaoBaoGoodsBrief goods) {
|
| | | this.goods = goods;
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.service.inter.lable.LabelService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityFactoryService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityFlashSaleService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsActivityService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.util.BeanUtil;
|
| | | import com.yeshi.fanli.util.CMQManager;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private BrandClassShopService brandClassShopService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsActivityService taoBaoGoodsActivityService;
|
| | |
|
| | | // 动态商品更新 ,1个小时更新
|
| | | @Scheduled(cron = "0 0 */1 * * ?")
|
| | |
| | | brandClassShopService.updateShopGoods();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 每小时更新一次
|
| | | */
|
| | | @Scheduled(cron = "0 0 0/1 * * ?")
|
| | | public void update618() {
|
| | | LogHelper.test("更新618商品");
|
| | | taoBaoGoodsActivityService.sysncS618Goods();
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | from yeshi_ec_recommend_goods_user_delete where ud_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | |
| | | <select id="listByGoodsInfo" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_recommend_goods_user_delete where ud_device = |
| | | #{device} |
| | | <foreach collection="goodsList" item="item" open=" and (" |
| | | close=")" separator=" or "> |
| | | ( |
| | | ud_goods_id= #{item.goodsId} and ud_goods_source=#{item.goodsSource} |
| | | ) |
| | | </foreach> |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_recommend_goods_user_delete where ud_id = |
| | | #{id,jdbcType=BIGINT} |
| | |
| | | <if test="unReadCount != null">#{unReadCount,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="latestContent != null">#{latestContent,jdbcType=VARCHAR}</if> |
| | | <if test="latestContent != null">#{latestContent,jdbcType=VARCHAR},</if> |
| | | <if test="latestContentTime != null">#{latestContentTime,jdbcType=TIMESTAMP}</if> |
| | | </trim> |
| | | </insert> |
| | |
| | | <select id="getShopByKey" resultMap="BaseResultVOMap" > |
| | | SELECT * FROM (SELECT COUNT(t.`id`) AS totalGoods,po.* FROM yeshi_ec_taobao_shop_info po |
| | | LEFT JOIN `yeshi_ec_taobao_goods` t ON t.`sellerId` = po.`tsi_id` |
| | | WHERE <![CDATA[t.`couponAmount` > 0 AND po.`tsi_key` LIKE '%${key}%' |
| | | WHERE <![CDATA[t.`couponAmount` > 0 AND FIND_IN_SET(#{key},po.`tsi_key`) |
| | | GROUP BY t.`sellerId` HAVING totalGoods> 2]]>)A |
| | | LEFT JOIN (SELECT t.*,po.`tsi_id` FROM yeshi_ec_taobao_shop_info po |
| | | LEFT JOIN `yeshi_ec_taobao_goods` t ON t.`sellerId` = po.`tsi_id` |
| | | WHERE<![CDATA[ t.`couponAmount` > 0 ]]>AND po.`tsi_key` LIKE '%${key}%' |
| | | WHERE<![CDATA[ t.`couponAmount` > 0 ]]>AND FIND_IN_SET(#{key},po.`tsi_key`) |
| | | ORDER BY t.`biz30day` DESC |
| | | LIMIT 3)B ON B.`tsi_id` = A.`tsi_id` |
| | | </select> |
| | |
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public void changeShopInfo(MultipartFile file, Long id, Long cid, String shopName, Integer state, Integer top)
|
| | | public void changeShopInfo(MultipartFile file, Long id, Long cid, String shopName, Integer state, Integer top,String key)
|
| | | throws BrandClassShopException {
|
| | |
|
| | | if (id == null) {
|
| | |
| | | }
|
| | |
|
| | | // 自定义图片
|
| | | taoBaoShopService.changeInfo(file, shop.getId(), shopName);
|
| | | taoBaoShopService.changeInfo(file, shop.getId(), shopName,key);
|
| | |
|
| | | BrandClassShop updateshop = new BrandClassShop();
|
| | | updateshop.setState(state);
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dto.common.CommonContentNav;
|
| | |
| | | return navList;
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @Cacheable(value = "commonContentCache", key = "#type+'-'+#cid+'-'+#page+'-'+#pageSize")
|
| | | @Override
|
| | | public CommonContentResult getContentList(CommonContentTypeEnum type, String cid, int page, int pageSize) {
|
| | | if (type == CommonContentTypeEnum._9k9)
|
| | |
| | | package com.yeshi.fanli.service.impl.goods.recommend;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.concurrent.ConcurrentHashMap;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.qcloud.cos.model.ListMultipartUploadsRequest;
|
| | | import com.yeshi.fanli.dao.mybatis.goods.recommend.RecommendGoodsDeleteHistoryMapper;
|
| | | import com.yeshi.fanli.entity.goods.recommend.RecommendGoodsDeleteHistory;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.service.inter.goods.recommend.RecommendGoodsDeleteHistoryService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | |
| | | recommendGoodsDeleteHistoryMapper.insertSelective(history);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> filterGoods(String device, List<TaoBaoGoodsBrief> goodsList) {
|
| | | List<TaoBaoGoodsBrief> resultList = new ArrayList<>();
|
| | | if (goodsList == null || goodsList.size() == 0)
|
| | | return goodsList;
|
| | |
|
| | | Map<Long, TaoBaoGoodsBrief> resultMap = new ConcurrentHashMap<>();
|
| | | List<RecommendGoodsDeleteHistory> hlist = new ArrayList<>();
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | | hlist.add(new RecommendGoodsDeleteHistory(goods.getAuctionId(), Constant.SOURCE_TYPE_TAOBAO));
|
| | | resultMap.put(goods.getAuctionId(), goods);
|
| | | }
|
| | | List<RecommendGoodsDeleteHistory> existList = recommendGoodsDeleteHistoryMapper.listByGoodsInfo(device, hlist);
|
| | | if (existList != null)
|
| | | for (RecommendGoodsDeleteHistory dh : existList)
|
| | | resultMap.remove(dh.getGoodsId());
|
| | |
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | | if (resultMap.get(goods.getAuctionId()) != null)
|
| | | resultList.add(resultMap.get(goods.getAuctionId()));
|
| | | }
|
| | | return resultList;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialCardService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialPlaceService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | |
|
| | |
| | | }
|
| | |
|
| | | // 处理9.9包邮
|
| | | if (listArc != null && VersionUtil.greaterThan_1_5_50(acceptData.getPlatform(), acceptData.getVersion()))
|
| | | if (listArc != null && VersionUtil.greaterThan_1_5_50(acceptData.getPlatform(), acceptData.getVersion())&&!Constant.IS_TEST)
|
| | | for (Special s : listArc) {
|
| | | if (s.getName().contains("9.9")) {// 9块9
|
| | | s.setJumpDetail(jumpDetailV2Service.getByTypeCache("common_template"));
|
| | |
| | | }
|
| | |
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getFanliOrderStatisticedTitle(),
|
| | | Constant.znxConfig.getFanliOrderStatisticedMsg().replace("[订单号]", orderId), null, null);
|
| | | if (payMoney != null && payMoney.compareTo(new BigDecimal(0)) > 0)
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getFanliOrderStatisticedTitle(),
|
| | | Constant.znxConfig.getFanliOrderStatisticedMsg().replace("[订单号]", orderId), null, null);
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.taobao;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.taobao.SuperTaoBaoGoodsDao;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
|
| | | import com.yeshi.fanli.entity.taobao.s618.SuperTaoBaoGoods;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsActivityService;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | @Service
|
| | | public class TaoBaoGoodsActivityServiceImpl implements TaoBaoGoodsActivityService {
|
| | |
|
| | | @Resource
|
| | | private SuperTaoBaoGoodsDao superTaoBaoGoodsDao;
|
| | |
|
| | | @Override
|
| | | public void sysncS618Goods() {
|
| | | long startTime = System.currentTimeMillis();
|
| | | for (int i = 0; i < 20; i++) {
|
| | | TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(18528, i + 1, 100);
|
| | | for (TaoBaoGoodsBrief goods : result.getTaoBaoGoodsBriefs()) {
|
| | | SuperTaoBaoGoods sg = new SuperTaoBaoGoods();
|
| | | sg.setAuctionId(goods.getAuctionId());
|
| | | sg.setGoods(goods);
|
| | | sg.setFinalPrice(TaoBaoUtil.getAfterUseCouplePrice(goods).multiply(new BigDecimal(100)).intValue());
|
| | | sg.setUpdateTime(System.currentTimeMillis());
|
| | | superTaoBaoGoodsDao.save(sg);
|
| | | }
|
| | | }
|
| | | // 删除更新时间比开始时间小的
|
| | | superTaoBaoGoodsDao.deleteByMaxTime(startTime);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> listByPrice(BigDecimal minPrice, BigDecimal maxPrice, int page, int pageSize) {
|
| | | List<SuperTaoBaoGoods> list = superTaoBaoGoodsDao.listByMaxAndMinFinalPrice(minPrice, maxPrice,
|
| | | (page - 1) * pageSize, pageSize);
|
| | | List<TaoBaoGoodsBrief> newList = new ArrayList<>();
|
| | | if (list != null)
|
| | | for (SuperTaoBaoGoods goods : list)
|
| | | newList.add(goods.getGoods());
|
| | | return newList;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countByPrice(BigDecimal minPrice, BigDecimal maxPrice) {
|
| | | return superTaoBaoGoodsDao.countByMaxAndMinFinalPrice(minPrice, maxPrice);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoShopMapper taoBaoShopMapper;
|
| | | |
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void changeInfo(MultipartFile file, Long id, String shopName) {
|
| | | public void changeInfo(MultipartFile file, Long id, String shopName, String key) {
|
| | | TaoBaoShop taoBaoShop = taoBaoShopMapper.selectByPrimaryKey(id);
|
| | | if (taoBaoShop == null) {
|
| | | return;
|
| | |
| | |
|
| | | updateShop.setId(id);
|
| | | updateShop.setShopNameCustom(shopName);
|
| | | updateShop.setKey(key);
|
| | | taoBaoShopMapper.updateByPrimaryKeySelective(updateShop);
|
| | | }
|
| | |
|
| | |
| | | return shop;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | @Cacheable(value = "brandCache", key = "'getShopByKey-'+#key")
|
| | | public List<TaoBaoShopVO> getShopByKey(String key) {
|
| | |
| | | addGoodsList(result.getDetailList());
|
| | | totalCount += result.getDetailList().size();
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | LogHelper.test("大淘客总共更新数据数量:" + totalCount);
|
| | |
| | | * @param state
|
| | | * @throws BrandClassShopException
|
| | | */
|
| | | public void changeShopInfo(MultipartFile file, Long id, Long cid, String shopName, Integer state, Integer top)
|
| | | public void changeShopInfo(MultipartFile file, Long id, Long cid, String shopName, Integer state, Integer top,String key)
|
| | | throws BrandClassShopException;
|
| | |
|
| | |
|
| | |
| | | package com.yeshi.fanli.service.inter.goods.recommend;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.goods.recommend.RecommendGoodsDeleteHistory;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
|
| | | public interface RecommendGoodsDeleteHistoryService {
|
| | |
|
| | |
| | | */
|
| | | public void addRecommendGoodsDeleteHistory(RecommendGoodsDeleteHistory history);
|
| | |
|
| | | /**
|
| | | * 过滤已经删除的商品
|
| | | * |
| | | * @param device
|
| | | * @param goodsList
|
| | | * @return
|
| | | */
|
| | | public List<TaoBaoGoodsBrief> filterGoods(String device, List<TaoBaoGoodsBrief> goodsList);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.taobao;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
|
| | | /**
|
| | | * 淘宝活动服务
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface TaoBaoGoodsActivityService {
|
| | |
|
| | | /**
|
| | | * 同步618商品到数据库
|
| | | */
|
| | | public void sysncS618Goods();
|
| | |
|
| | | public List<TaoBaoGoodsBrief> listByPrice(BigDecimal minPrice,BigDecimal maxPrice, int page, int pageSize);
|
| | | |
| | | public long countByPrice(BigDecimal minPrice,BigDecimal maxPrice);
|
| | |
|
| | | }
|
| | |
| | | * @param id
|
| | | * @param shopName
|
| | | */
|
| | | public void changeInfo(MultipartFile file, Long id, String shopName);
|
| | | public void changeInfo(MultipartFile file, Long id, String shopName,String key);
|
| | |
|
| | | /**
|
| | | * 查询店铺信息、并返回钱3个商品数量
|
| | |
| | |
|
| | | public static boolean greaterThan_1_5_50(String platform, String versionCode) {
|
| | | if ((("android".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 42))
|
| | | || (("ios".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 51)))
|
| | | || (("ios".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 52)))
|
| | | return true;
|
| | | else
|
| | | return false;
|
| | |
| | |
|
| | | static Gson gson = new Gson();
|
| | |
|
| | | private static String request(String url) {
|
| | | String result = null;
|
| | |
|
| | | while (result == null) {
|
| | | try {
|
| | | result = HttpUtil.get(url);
|
| | | if (result != null && result.startsWith("<html>"))
|
| | | result = null;
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | Thread.sleep(400);
|
| | | } catch (InterruptedException e1) {
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | return result;
|
| | | }
|
| | |
|
| | | public static DaTaoKeApiResult goodsList(int page) {
|
| | | List<DaTaoKeDetail> list = new ArrayList<>();
|
| | | String url = String.format("http://api.dataoke.com/index.php?r=Port/index&type=total&appkey=%s&v=2&page=%s",
|
| | | Math.random() > 0.5 ? API_KEY : API_KEY_2, page + "");
|
| | | String result = HttpUtil.get(url);
|
| | | String result = request(url);
|
| | |
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | System.out.println(resultJson);
|
| | | JSONArray array = resultJson.optJSONArray("result");
|
| | |
| | | taoBaoGoods.setCouponTotalCount(detail.getCouponTotalNum());
|
| | | taoBaoGoods.setPictUrl(detail.getMainPic());
|
| | | taoBaoGoods.setPictUrlWhite(detail.getMainPic());
|
| | | if (taoBaoGoods.getPictUrl() != null && !taoBaoGoods.getPictUrl().startsWith("http"))
|
| | | taoBaoGoods.setPictUrl("https:" + taoBaoGoods.getPictUrl());
|
| | |
|
| | | if (taoBaoGoods.getPictUrlWhite() != null && !taoBaoGoods.getPictUrlWhite().startsWith("http"))
|
| | | taoBaoGoods.setPictUrlWhite("https:" + taoBaoGoods.getPictUrlWhite());
|
| | |
|
| | | taoBaoGoods.setSellerId(detail.getSellerId());
|
| | | taoBaoGoods.setShopTitle(detail.getShopName());
|
| | | taoBaoGoods.setTitle(detail.getDtitle());
|
| | |
| | | import org.yeshi.utils.StringUtil;
|
| | |
|
| | | public class TbImgUtil {
|
| | | |
| | |
|
| | | public static String getTBSize320Img(String url) {
|
| | | return getTBSizeImg(url, 320);
|
| | |
| | | public static String getTBSize320ImgWebp(String url) {
|
| | | return getTBSizeImgWebp(url, 320);
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | public static String getTBSize220ImgWebp(String url) {
|
| | | return getTBSizeImgWebp(url, 220);
|
| | |
| | | public static String getTBSizeImg(String url, int size) {
|
| | | if (StringUtil.isNullOrEmpty(url))
|
| | | return url;
|
| | | if (url.contains("img.alicdn.com")||url.contains("gw.alicdn.com")) {
|
| | | if (url.contains("img.alicdn.com") || url.contains("gw.alicdn.com") || url.contains("gd1.alicdn.com")
|
| | | || url.contains("gd2.alicdn.com") || url.contains("gd3.alicdn.com") || url.contains("gd4.alicdn.com")) {
|
| | | boolean isMatch = Pattern.matches(".*[0-9]x[0-9].*", url);
|
| | | if (isMatch)
|
| | | return url;
|
| | |
| | | public static String getTBSizeImgWebp(String url, int size) {
|
| | | if (StringUtil.isNullOrEmpty(url))
|
| | | return url;
|
| | | if (url.contains("img.alicdn.com")||url.contains("gw.alicdn.com")) {
|
| | | if (url.contains("img.alicdn.com") || url.contains("gw.alicdn.com") || url.contains("gd1.alicdn.com")
|
| | | || url.contains("gd2.alicdn.com") || url.contains("gd3.alicdn.com") || url.contains("gd4.alicdn.com")) {
|
| | | boolean isMatch = Pattern.matches(".*[0-9]x[0-9].*", url);
|
| | | if (isMatch)
|
| | | return url;
|