| | |
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClass;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.bus.clazz.TaoBaoClass;
|
| | | import com.yeshi.fanli.entity.bus.lable.QualityFactory;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.taobao.SearchFilter;
|
| | |
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoCouponService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.HomeNavbarService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.lable.LabelClassService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityFactoryService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
|
| | | import com.yeshi.fanli.service.inter.lable.TaoKeGoodsService;
|
| | | import com.yeshi.fanli.service.inter.monitor.MonitorService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
| | | import com.yeshi.fanli.util.factory.MonitorFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import com.yeshi.fanli.vo.homemodule.BannerVO;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | |
|
| | | @Resource
|
| | | private MonitorService monitorService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private HomeNavbarService homeNavbarService;
|
| | | @Resource
|
| | | private SwiperPictureService swiperPictureService;
|
| | |
|
| | |
|
| | | @Resource(name = "taskExecutor")
|
| | | private TaskExecutor executor;
|
| | |
| | | }
|
| | |
|
| | | // 轮播图
|
| | | List<SwiperPicture> picList = null;
|
| | | List<BannerVO> picList = null;
|
| | | if (swpid != null) {
|
| | | picList = swiperPictureService.getByBannerId(swpid);
|
| | | picList = swiperPictureService.getByBannerId(swpid, acceptData.getPlatform(),
|
| | | Integer.parseInt(acceptData.getVersion()));
|
| | | }
|
| | | if (picList == null) {
|
| | | picList = new ArrayList<SwiperPicture>();
|
| | | picList = new ArrayList<BannerVO>();
|
| | | }
|
| | | |
| | | List<GoodsSubClass> goodsSubClassList = goodsSubClassService.getSubClassCache(gcid, 1);
|
| | |
|
| | | List<GoodsSubClass> goodsSubClassList = goodsSubClassService.getSubClassCache(gcid, 1,
|
| | | Calendar.getInstance().get(Calendar.MONTH) + 1);
|
| | | if (goodsSubClassList == null) {
|
| | | goodsSubClassList = new ArrayList<GoodsSubClass>();
|
| | | }
|
| | | |
| | |
|
| | | boolean changePicture = false;
|
| | | String version = acceptData.getVersion();
|
| | | int tversion = Integer.parseInt(version);
|
| | | String platform = acceptData.getPlatform();
|
| | | if ("android".equalsIgnoreCase(platform) && tversion > 38) {
|
| | | changePicture = true;
|
| | | } else if (tversion > 47){
|
| | | } else if (tversion > 47) {
|
| | | changePicture = true;
|
| | | }
|
| | | |
| | |
|
| | | // 1.5.3新版图片替换
|
| | | if (changePicture) {
|
| | | for (GoodsSubClass goodsSubClass: goodsSubClassList) {
|
| | | for (GoodsSubClass goodsSubClass : goodsSubClassList) {
|
| | | String pictureSecond = goodsSubClass.getPictureSecond();
|
| | | if (pictureSecond != null && pictureSecond.trim().length() > 0) {
|
| | | goodsSubClass.setPicture(pictureSecond);
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("picList", JsonUtil.getApiCommonGson().toJson(picList));
|
| | | data.put("count", goodsSubClassList.size());
|
| | |
| | | goodsClass.setIosClick(1L);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | GoodsClass gc = new GoodsClass();
|
| | | gc.setId(goodsClass.getId());
|
| | | gc.setIosClick(goodsClass.getIosClick());
|
| | |
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | @RequestMapping(value = "getCouponGoods", method = RequestMethod.POST)
|
| | | public void getCouponGoods(AcceptData acceptData, int page, long gcid, PrintWriter out) {
|
| | |
| | | @RequestMapping(value = "getgoods", method = RequestMethod.POST)
|
| | | public void getGoods(AcceptData acceptData, int page, long scid, String filter, String order, String startprice,
|
| | | String endprice, String fastFilter, PrintWriter out) {
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | |
| | | @RequestMapping(value = "getsecondclassgoods", method = RequestMethod.POST)
|
| | | public void getSecondClassGoods(AcceptData acceptData, int page, long scid, String filter, String order,
|
| | | String startprice, String endprice, String fastFilter, Integer totalSales, PrintWriter out) {
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | |
| | | goodsSubClassService.countClick(acceptData, goodsSubClass);
|
| | | }
|
| | |
|
| | | SearchFilter sf = new SearchFilter();
|
| | | String catesId = "";
|
| | | // 查询是否有淘宝分类ID
|
| | | List<TaoBaoClass> tbClassList = taoBaoClassService.listBySystemSubCid(0, 10, goodsSubClass.getId());
|
| | | if (tbClassList != null && tbClassList.size() > 0)
|
| | | for (TaoBaoClass tbc : tbClassList) {
|
| | | catesId += tbc.getCategoryId() + ",";
|
| | | }
|
| | | if (catesId.endsWith(","))
|
| | | catesId = catesId.substring(0, catesId.length() - 1);
|
| | | sf.setCateIds(catesId);
|
| | | if (!StringUtil.isNullOrEmpty(catesId))// 按分类名称搜索
|
| | | {
|
| | | String searchParam = goodsSubClass.getSearchJson();
|
| | | Gson gs = new Gson();
|
| | | SearchFilter searchfilter = gs.fromJson(searchParam, SearchFilter.class);
|
| | | searchfilter.setCateIds(catesId);
|
| | | searchfilter.setPage(page);
|
| | | searchfilter.setPageSize(20);
|
| | | if (Integer.parseInt(order) == 0)
|
| | | searchfilter.setMaterialId("6707");
|
| | | taoKeGoodsService.setSearchFilter(searchfilter, filter, order, startprice, endprice, fastFilter,
|
| | | totalSales);
|
| | | TaoBaoSearchResult searchResult = TaoKeApiUtil.searchWuLiao(searchfilter);
|
| | | long count = searchResult.getPageEntity().getTotalCount();
|
| | |
|
| | | JSONObject result = new JSONObject();
|
| | |
|
| | | BigDecimal rate = hongBaoManageService.getFanLiRate();
|
| | |
|
| | | List<TaoBaoGoodsBrief> resultGoodsList = searchResult.getTaoBaoGoodsBriefs();
|
| | | // 查询是否超过了最大的商品数
|
| | | if ((resultGoodsList == null || resultGoodsList.size() < 20)
|
| | | && !StringUtil.isNullOrEmpty(goodsSubClass.getKey())) {
|
| | | if (resultGoodsList == null)
|
| | | resultGoodsList = new ArrayList<>();
|
| | |
|
| | | // 需要根据关键字查询
|
| | | searchfilter.setCateIds(null);
|
| | | searchfilter.setPage((int) (count % 20 == 0 ? count / 20 - 1 : count / 20));
|
| | | searchfilter.setPageSize(20);
|
| | | searchfilter.setKey(goodsSubClass.getKey());
|
| | | TaoBaoSearchResult searchResult2 = TaoKeApiUtil.searchWuLiao(searchfilter);
|
| | | if (searchResult2 != null) {
|
| | | List<TaoBaoGoodsBrief> resultListTemp = searchResult2.getTaoBaoGoodsBriefs();
|
| | | if (resultListTemp != null)
|
| | | resultGoodsList.addAll(resultListTemp);
|
| | | }
|
| | | }
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson2 = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().create();
|
| | | if (resultGoodsList != null)
|
| | | for (TaoBaoGoodsBrief goods : resultGoodsList) {
|
| | | array.add(gson2.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods, rate + "", null)));
|
| | | }
|
| | | result.put("result", array);
|
| | | result.put("count", result.optLong("count") + count);
|
| | | out.print(JsonUtil.loadTrueResult(result));
|
| | | return;
|
| | | } else {
|
| | | String searchParam = goodsSubClass.getSearchJson();
|
| | | Gson gs = new Gson();
|
| | | SearchFilter searchfilter = gs.fromJson(searchParam, SearchFilter.class);
|
| | | searchfilter.setCateIds(catesId);
|
| | | searchfilter.setPage(page);
|
| | | searchfilter.setPageSize(20);
|
| | | if (Integer.parseInt(order) == 0)
|
| | | searchfilter.setMaterialId("6707");
|
| | | searchfilter.setKey(goodsSubClass.getKey());
|
| | | taoKeGoodsService.setSearchFilter(searchfilter, filter, order, startprice, endprice, fastFilter,
|
| | | totalSales);
|
| | | JSONObject result = taoKeGoodsService.searchWuLiao(searchfilter);
|
| | | if (1 > 0) {
|
| | | out.print(JsonUtil.loadTrueResult(result));
|
| | | return;
|
| | | }
|
| | | }
|
| | | /* 搜索关键词 */
|
| | | String searchKey = goodsSubClass.getName();
|
| | | String key = goodsSubClass.getKey();
|
| | |
| | | @RequestMapping("choiceGoods")
|
| | | public void choiceGoods(AcceptData acceptData, long gcid, int page, PrintWriter out) {
|
| | |
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | |
| | | GoodsClass goodsClass = goodsClassService.getGoodsClassCache(gcid);
|
| | | if (goodsClass == null) {
|
| | | out.print(JsonUtil.loadFalseResult("不存在该分类"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (page < 1)
|
| | |
| | | long counttotal = 5000;
|
| | |
|
| | | // 精选库数据为空时,网络进行查询
|
| | | if (listQuery == null || listQuery.size() == 0) {
|
| | | if (listQuery == null || listQuery.size() == 0 || listQuery.size() < 10) {
|
| | | long count = qualityGoodsService.countQueryClassId(gcid);
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | page = page - totalPage;
|
| | |
| | | data.put("result", array);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | | @RequestMapping("getCouponList")
|
| | |
| | | if (id == null)
|
| | | return;
|
| | | page = page < 1 ? 1 : page;
|
| | | String key = String.format("getCouponListByClass-%s-%s", id + "", page + "");
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.couponByClass, id + "-" + page);
|
| | | String resultStr = "";
|
| | |
|
| | | if (Constant.IS_OUTNET)
|
| | |
| | | meterialId = 0;
|
| | | if (meterialId > 0)
|
| | | result = TaoKeApiUtil.getMaterialByMaterialId(meterialId, page, 20);
|
| | | else
|
| | | result = TaoKeApiUtil.searchCouple(goodsClassService.getKeysById(id), null, page, 20);
|
| | | else {
|
| | | SearchFilter sf = new SearchFilter();
|
| | | sf.setPage(page);
|
| | | sf.setPageSize(20);
|
| | | sf.setQuan(1);
|
| | | sf.setKey(goodsClassService.getKeysById(id));
|
| | |
|
| | | result = TaoKeApiUtil.searchWuLiao(sf);
|
| | |
|
| | | }
|
| | | List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav();
|
| | | if (result.getNavList() != null)
|
| | | if (result != null && result.getNavList() != null)
|
| | | navList.addAll(result.getNavList());
|
| | |
|
| | | if (navList == null)
|
| | |
| | | @RequestMapping(value = { "getcategory" }, method = { org.springframework.web.bind.annotation.RequestMethod.POST })
|
| | | public void getcategory(AcceptData acceptData, PrintWriter out) {
|
| | | try {
|
| | | |
| | |
|
| | | boolean changePicture = false;
|
| | | String version = acceptData.getVersion();
|
| | | int tversion = Integer.parseInt(version);
|
| | | String platform = acceptData.getPlatform();
|
| | | if ("android".equalsIgnoreCase(platform) && tversion > 38) {
|
| | | changePicture = true;
|
| | | } else if (tversion > 47){
|
| | | } else if (tversion > 47) {
|
| | | changePicture = true;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | List<Map<String, Object>> listCache = goodsClassService.getClassListAllCache(changePicture);
|
| | | if (listCache == null) {
|
| | | listCache = new ArrayList<Map<String, Object>>();
|