| | |
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | import org.springframework.core.task.TaskExecutor;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.clazz.ClassRecommendGoods;
|
| | | 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.lable.QualityFactory;
|
| | | import com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass;
|
| | | import com.yeshi.fanli.entity.system.System;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.taobao.SearchFilter;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoCoupon;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchNav;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.SystemService;
|
| | | import com.yeshi.fanli.service.inter.goods.ClassRecommendGoodsService;
|
| | | import com.yeshi.fanli.service.inter.config.BusinessSystemService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsSecondClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsSubClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.SuperGoodsClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoClassService;
|
| | | 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.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.Utils;
|
| | | import com.yeshi.fanli.util.factory.MonitorFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("api/v1/class")
|
| | |
| | |
|
| | | @Resource
|
| | | private GoodsSecondClassService goodsSecondClassService;
|
| | |
|
| | | @Resource
|
| | | private ClassRecommendGoodsService classRecommendGoodsService;
|
| | |
|
| | | @Resource
|
| | | private GoodsClassService goodsClassService;
|
| | |
| | | private HongBaoManageService manageService;
|
| | |
|
| | | @Resource
|
| | | private SystemService systemService;
|
| | | private BusinessSystemService businessSystemService;
|
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | |
| | | @Resource
|
| | | private QualityGoodsService qualityGoodsService;
|
| | |
|
| | | @Resource
|
| | | private MonitorService monitorService;
|
| | | |
| | | @Resource
|
| | | private HomeNavbarService homeNavbarService;
|
| | | @Resource
|
| | | private SwiperPictureService swiperPictureService;
|
| | |
|
| | |
|
| | | @Resource(name = "taskExecutor")
|
| | | private TaskExecutor executor;
|
| | |
|
| | | /**
|
| | | * 获取主类目
|
| | | *
|
| | |
| | | */
|
| | | @RequestMapping(value = "getgoodsclass", method = RequestMethod.POST)
|
| | | public void getGoodsClass(AcceptData acceptData, PrintWriter out) {
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | |
|
| | | try {
|
| | | List<GoodsClass> goodsClassList = goodsClassService.getEffectiveClassCache();
|
| | | if (goodsClassList == null || goodsClassList.size() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", goodsClassList.size());
|
| | | data.put("goodsClassList", JsonUtil.getApiCommonGson().toJson(goodsClassList));
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("获取失败"));
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | List<SuperGoodsClass> superGoodsClassList = superGoodsClassService.getSuperGoodsClassBySystemId(system.getId());
|
| | | if (superGoodsClassList == null || superGoodsClassList.size() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | | List<GoodsClass> goodsClassList = new ArrayList<GoodsClass>();
|
| | | for (SuperGoodsClass superGoodsClass : superGoodsClassList) {
|
| | | GoodsClass goodsClass = superGoodsClass.getGoodsClass();
|
| | | goodsClassList.add(goodsClass);
|
| | | }
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", goodsClassList.size());
|
| | | data.put("goodsClassList", goodsClassList);
|
| | | String result = JsonUtil.loadTrueResult(data);
|
| | | out.print(result);
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getgoodssecondclass", method = RequestMethod.POST)
|
| | | public void getGoodsSecondClass(AcceptData acceptData, long gcid, PrintWriter out) {
|
| | |
|
| | | public void getGoodsSecondClass(AcceptData acceptData, long gcid, Long swpid, PrintWriter out) {
|
| | | try {
|
| | |
|
| | | GoodsClass goodsClass = goodsClassService.getGoodsClassCache(gcid);
|
| | | if (goodsClass == null) {
|
| | | out.print(JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if ("android".equalsIgnoreCase(acceptData.getPlatform())) {
|
| | | Long androidClick = goodsClass.getAndroidClick();
|
| | | if (androidClick != null) {
|
| | | goodsClass.setAndroidClick(androidClick + 1);
|
| | | } else {
|
| | | goodsClass.setAndroidClick(1L);
|
| | | }
|
| | | } else if ("ios".equalsIgnoreCase(acceptData.getPlatform())) {
|
| | | Long iosClick = goodsClass.getIosClick();
|
| | | if (iosClick != null) {
|
| | | goodsClass.setIosClick(iosClick + 1);
|
| | | } else {
|
| | | goodsClass.setIosClick(1L);
|
| | | }
|
| | | // 轮播图
|
| | | List<SwiperPicture> picList = null;
|
| | | if (swpid != null) {
|
| | | picList = swiperPictureService.getByBannerId(swpid);
|
| | | }
|
| | | goodsClassService.updateByPrimaryKeySelective(goodsClass);
|
| | |
|
| | | if (picList == null) {
|
| | | picList = new ArrayList<SwiperPicture>();
|
| | | }
|
| | | |
| | | List<GoodsSubClass> goodsSubClassList = goodsSubClassService.getSubClassCache(gcid, 1);
|
| | |
|
| | | if (goodsSubClassList == null || goodsSubClassList.size() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | 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){
|
| | | changePicture = true;
|
| | | }
|
| | | |
| | | // 1.5.3新版图片替换
|
| | | if (changePicture) {
|
| | | 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());
|
| | | data.put("goodsSecondClassList", JsonUtil.getApiCommonGson().toJson(goodsSubClassList));
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
|
| | | // 更新分类点击次数
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | if ("android".equalsIgnoreCase(acceptData.getPlatform())) {
|
| | | Long androidClick = goodsClass.getAndroidClick();
|
| | | if (androidClick != null) {
|
| | | goodsClass.setAndroidClick(androidClick + 1);
|
| | | } else {
|
| | | goodsClass.setAndroidClick(1L);
|
| | | }
|
| | | } else if ("ios".equalsIgnoreCase(acceptData.getPlatform())) {
|
| | | Long iosClick = goodsClass.getIosClick();
|
| | | if (iosClick != null) {
|
| | | goodsClass.setIosClick(iosClick + 1);
|
| | | } else {
|
| | | goodsClass.setIosClick(1L);
|
| | | }
|
| | | }
|
| | | |
| | | GoodsClass gc = new GoodsClass();
|
| | | gc.setId(goodsClass.getId());
|
| | | gc.setIosClick(goodsClass.getIosClick());
|
| | | gc.setAndroidClick(goodsClass.getAndroidClick());
|
| | | goodsClassService.updateByPrimaryKeySelective(gc);
|
| | | }
|
| | | });
|
| | |
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("暂无数据"));
|
| | |
| | |
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getclassrecommendgoods", method = RequestMethod.POST)
|
| | | public void getClassRecommendGoods(AcceptData acceptData, long goodsClassId, PrintWriter out) {
|
| | | List<ClassRecommendGoods> classRecommendGoodsList = classRecommendGoodsService
|
| | | .getClassRecommendGoodsByGoodsClassId(goodsClassId);
|
| | | if (classRecommendGoodsList == null) {
|
| | | out.print(JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", classRecommendGoodsList.size());
|
| | | data.put("classRecommendGoodsList", JsonUtil.getApiCommonGson().toJson(classRecommendGoodsList));
|
| | | String result = JsonUtil.loadTrueResult(data);
|
| | | out.print(result);
|
| | | }
|
| | |
|
| | | @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) {
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | |
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | JSONArray array = new JSONArray();
|
| | | List<TaoBaoGoodsBrief> taobaoList = taoKeGoodsService.searchWuLiaoList(sf);
|
| | | Map<String, String> map = manageService.convertMap();
|
| | | String proportion = map.get("hongbao_goods_proportion");
|
| | | String fcRate = map.get("hongbao_fc_ratio");
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : taobaoList) {
|
| | | int biz30day = taoBaoGoodsBrief.getBiz30day();
|
| | | if (biz30day >= 10000) {
|
| | |
| | | } else {
|
| | | taoBaoGoodsBrief.setSalesCount(biz30day + "");
|
| | | }
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion, fcRate, null)));
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
|
| | | }
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("nav", new JSONArray());
|
| | |
| | | * @param page
|
| | | * @param scid
|
| | | * @param filter
|
| | | * @param order 来源:【推荐:0 | 综合:4 、综合只看有券 1 、综合只看天猫 1 | 价格:低到高3 高到低2 | 销量:1】
|
| | | * 排序值:【销量由高到低: 1 ; 销量由低到高 5; 价格从高到低: 2 ; 价格从低到高:3 ; 推广量高到低:4 ; 其他默认: 销量由高到低】
|
| | | * |
| | | * @param order
|
| | | * 来源:【推荐:0 | 综合:4 、综合只看有券 1 、综合只看天猫 1 | 价格:低到高3 高到低2 | 销量:1】
|
| | | * 排序值:【销量由高到低: 1 ; 销量由低到高 5; 价格从高到低: 2 ; 价格从低到高:3 ; 推广量高到低:4 ;
|
| | | * 其他默认: 销量由高到低】
|
| | | * |
| | | * @param startprice
|
| | | * 起始价格
|
| | | * @param endprice
|
| | |
| | | @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) {
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | |
| | |
|
| | | GoodsSubClass goodsSubClass = goodsSubClassService.getSubClassByPrimaryKeyCache(scid);
|
| | | if (goodsSubClass == null) {
|
| | | out.print(JsonUtil.loadFalseResult("不存在该分类"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (page == 0) {
|
| | | // 统计点击量
|
| | | goodsSubClassService.countClick(acceptData, goodsSubClass);
|
| | | }
|
| | | |
| | |
|
| | | /* 搜索关键词 */
|
| | | String searchKey = goodsSubClass.getName();
|
| | | String key = goodsSubClass.getKey();
|
| | | if (key != null && !"".equals(key.trim())) {
|
| | | searchKey = key;
|
| | | }
|
| | | |
| | |
|
| | | /* 商品系统分类id */
|
| | | Long systemCid = null;
|
| | | GoodsClass rootClass = goodsSubClass.getRootClass();
|
| | | if (rootClass != null) {
|
| | | systemCid = rootClass.getId();
|
| | | }
|
| | | |
| | | |
| | |
|
| | | // page从1开始
|
| | | page += 1;
|
| | | // 请求淘宝接口页码
|
| | | int pageNo = page; |
| | | |
| | | int pageNo = page;
|
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | |
| | | /* 查询推荐模块 清空其他非必要筛选项和排序项 */
|
| | |
|
| | | /* 查询推荐模块 清空其他非必要筛选项和排序项 */
|
| | | if (!StringUtil.isNullOrEmpty(order) && Integer.parseInt(order) == 0) {
|
| | | |
| | |
|
| | | // 分类关联标签id集合
|
| | | List<Long> listLabId = |
| | | labelClassService.getRelationLabIds((page - 1) * pageSize, pageSize, goodsSubClass.getId());
|
| | | |
| | | List<Long> listLabId = labelClassService.getRelationLabIds((page - 1) * pageSize, pageSize,
|
| | | goodsSubClass.getId());
|
| | |
|
| | | /* 计算精选库数据 总页数 */
|
| | | long incount = taoKeGoodsService.countByQuality(searchKey, systemCid, listLabId);
|
| | |
|
| | | int totalPage = (int) (incount % pageSize == 0 ? incount / pageSize : incount / pageSize + 1);
|
| | | |
| | |
|
| | | pageNo = page - totalPage;
|
| | | |
| | | |
| | |
|
| | | /* 查询精选库数据 */
|
| | | if (pageNo <= 0 ) {
|
| | | |
| | | List<QualityFactory> listQuality = taoKeGoodsService.queryByQuality((page - 1) * pageSize,
|
| | | pageSize,searchKey, systemCid, listLabId);
|
| | | |
| | | if (pageNo <= 0) {
|
| | |
|
| | | List<QualityFactory> listQuality = taoKeGoodsService.queryByQuality((page - 1) * pageSize, pageSize,
|
| | | searchKey, systemCid, listLabId);
|
| | |
|
| | | List<TaoBaoGoodsBrief> searchWuLiaoList = null;
|
| | | |
| | | /* 精选库数据不足10条 */
|
| | |
|
| | | /* 精选库数据不足10条 */
|
| | | if (listQuality != null && listQuality.size() != 0 && listQuality.size() < 10) {
|
| | | |
| | |
|
| | | String searchParam = goodsSubClass.getSearchJson();
|
| | | |
| | |
|
| | | Gson gs = new Gson();
|
| | | SearchFilter searchfilter = gs.fromJson(searchParam, SearchFilter.class);
|
| | | |
| | |
|
| | | int quanfilter = searchfilter.getQuan();
|
| | | if (quanfilter != 1) {
|
| | | searchfilter.setQuan(1);
|
| | |
| | | if (endPricefilter == null) {
|
| | | searchfilter.setEndPrice(new BigDecimal(220));
|
| | | }
|
| | | |
| | |
|
| | | boolean includeGoodRate = searchfilter.isIncludeGoodRate();
|
| | | if (!includeGoodRate) {
|
| | | searchfilter.setIncludeGoodRate(true);
|
| | | }
|
| | | |
| | | //请求第一页数据
|
| | |
|
| | | // 请求第一页数据
|
| | | searchfilter.setPage(1);
|
| | | searchfilter.setPageSize(pageSize);
|
| | | searchfilter.setKey(searchKey);
|
| | | searchfilter.setMaterialId("6707");
|
| | | |
| | |
|
| | | searchWuLiaoList = taoKeGoodsService.searchWuLiaoList(searchfilter);
|
| | | }
|
| | |
|
| | | Map<String, String> map = manageService.convertMap();
|
| | | |
| | |
|
| | | JSONObject data = taoKeGoodsService.listQualityGoods(listQuality, searchWuLiaoList, map);
|
| | | |
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | |
| | |
|
| | | return;
|
| | | }
|
| | | |
| | | |
| | | if (pageNo > 0 && totalPage > 0) {
|
| | | List<QualityFactory> list = taoKeGoodsService.queryByQuality((totalPage - 1) * pageSize,
|
| | | pageSize, searchKey, systemCid, listLabId);
|
| | | |
| | |
|
| | | if (pageNo > 0 && totalPage > 0) {
|
| | | List<QualityFactory> list = taoKeGoodsService.queryByQuality((totalPage - 1) * pageSize, pageSize,
|
| | | searchKey, systemCid, listLabId);
|
| | |
|
| | | if (list != null && list.size() != 0 && list.size() < 10) {
|
| | | // 页码+ 1 已请求一次淘宝接口
|
| | | pageNo += 1 ;
|
| | | pageNo += 1;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | /* 网络请求 */
|
| | |
|
| | | /* 网络请求 */
|
| | | SearchFilter searchfilter = null;
|
| | | String searchParam = goodsSubClass.getSearchJson();
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(searchParam) && !StringUtil.isNullOrEmpty(order) |
| | |
|
| | | if (!StringUtil.isNullOrEmpty(searchParam) && !StringUtil.isNullOrEmpty(order)
|
| | | && Integer.parseInt(order) == 0) {
|
| | | // 推荐 使用子分类默认查询条件
|
| | | Gson gs = new Gson();
|
| | | searchfilter = gs.fromJson(searchParam, SearchFilter.class);
|
| | | |
| | |
|
| | | int quanfilter = searchfilter.getQuan();
|
| | | if (quanfilter != 1) {
|
| | | searchfilter.setQuan(1);
|
| | |
| | | if (endPricefilter == null) {
|
| | | searchfilter.setEndPrice(new BigDecimal(220));
|
| | | }
|
| | | |
| | |
|
| | | boolean includeGoodRate = searchfilter.isIncludeGoodRate();
|
| | | if (!includeGoodRate) {
|
| | | searchfilter.setIncludeGoodRate(true);
|
| | | }
|
| | | |
| | |
|
| | | } else {
|
| | | searchfilter = new SearchFilter();
|
| | | // 设置SearchFilter
|
| | | taoKeGoodsService.setSearchFilter(searchfilter, filter, order, startprice, endprice, fastFilter, totalSales);
|
| | | taoKeGoodsService.setSearchFilter(searchfilter, filter, order, startprice, endprice, fastFilter,
|
| | | totalSales);
|
| | |
|
| | | // 用户未输入最高价格时 最高价格限制99999
|
| | | if (searchfilter.getEndPrice() == null) {
|
| | | searchfilter.setEndPrice(new BigDecimal(99999));
|
| | | }
|
| | | }
|
| | |
|
| | | searchfilter.setPage(pageNo);
|
| | | searchfilter.setPageSize(pageSize);
|
| | | searchfilter.setKey(searchKey);
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(order) && Integer.parseInt(order) != 4 ) {
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(order) && Integer.parseInt(order) != 4) {
|
| | | searchfilter.setMaterialId("6707");
|
| | | }
|
| | | |
| | |
|
| | | // 查询物料接口
|
| | | JSONObject result = taoKeGoodsService.searchWuLiao(searchfilter);
|
| | | out.print(JsonUtil.loadTrueResult(result));
|
| | |
| | | @RequestMapping("choiceGoods")
|
| | | public void choiceGoods(AcceptData acceptData, long gcid, int page, PrintWriter out) {
|
| | |
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | |
| | | filter = new SearchFilter();
|
| | | }
|
| | |
|
| | | // String searchKey = goodsClass.getName();
|
| | | // String key = goodsClass.getKey();
|
| | | // if (key != null && !"".equals(key.trim())) {
|
| | | // searchKey = key;
|
| | | // }
|
| | | // filter.setKey(searchKey);
|
| | |
|
| | | filter.setMaterialId("6707");
|
| | | filter.setPage(page);
|
| | | filter.setPageSize(pageSize);
|
| | |
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | Map<String, String> map = manageService.convertMap();
|
| | | String proportion = map.get("hongbao_goods_proportion");
|
| | | String fcRate = map.get("hongbao_fc_ratio");
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | |
|
| | | // 遍历列表数据
|
| | | for (QualityFactory selectionGoods : listQuery) {
|
| | |
| | | taoBaoGoodsBrief.setSalesCount(biz30day + "");
|
| | | }
|
| | |
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion, fcRate, null)));
|
| | | // 白底图测试
|
| | | // if
|
| | | // (!StringUtil.isNullOrEmpty(taoBaoGoodsBrief.getPictUrlWhite()))
|
| | | // taoBaoGoodsBrief.setPictUrl(taoBaoGoodsBrief.getPictUrlWhite());
|
| | |
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | |
| | | data.put("result", array);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
|
| | | /*
|
| | | * // 测试取消缓存 GoodsClass goodsClass =
|
| | | * goodsClassService.getGoodsClassCache(gcid); if (goodsClass == null) {
|
| | | * out.append(JsonUtil.loadFalseResult("不存在该分类")); return; }
|
| | | * |
| | | * SearchFilter sf = new SearchFilter(); sf.setKey(goodsClass.getKey());
|
| | | * sf.setPage(page); sf.setPageSize(Constant.PAGE_SIZE); sf.setQuan(1);
|
| | | * |
| | | * TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf);
|
| | | * |
| | | * List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav(); if
|
| | | * (result.getNavList() != null) navList.addAll(result.getNavList());
|
| | | * Gson gson = new GsonBuilder().create(); JSONObject data = new
|
| | | * JSONObject(); data.put("nav", gson.toJson(navList));
|
| | | * List<TaoBaoGoodsBriefExtra> re = new
|
| | | * ArrayList<TaoBaoGoodsBriefExtra>(); List<TaoBaoGoodsBrief>
|
| | | * taoBaoGoodsBriefs = result.getTaoBaoGoodsBriefs(); Map<String,
|
| | | * String> map = manageService.convertMap(); String proportion =
|
| | | * map.get("hongbao_goods_proportion"); String fcRate =
|
| | | * map.get("hongbao_fc_ratio");
|
| | | * |
| | | * TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra; if (taoBaoGoodsBriefs !=
|
| | | * null) for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) {
|
| | | * int count = taoBaoGoodsBrief.getBiz30day(); if (count >= 10000) {
|
| | | * double sales = count; String salesCountMidea = String.format("%.1f",
|
| | | * sales / 10000); taoBaoGoodsBrief.setSalesCount(salesCountMidea +
|
| | | * "万"); taoBaoGoodsBriefExtra =
|
| | | * TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion,
|
| | | * fcRate, ""); re.add(taoBaoGoodsBriefExtra); } else {
|
| | | * taoBaoGoodsBrief.setSalesCount(count + ""); taoBaoGoodsBriefExtra =
|
| | | * TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion,
|
| | | * fcRate, ""); re.add(taoBaoGoodsBriefExtra); } }
|
| | | * |
| | | * Gson gson2 = JsonUtil.getApiCommonGson(); data.put("result",
|
| | | * gson2.toJson(re)); data.put("count",
|
| | | * result.getTaoBaoHead().getDocsfound());
|
| | | * out.print(JsonUtil.loadTrueResult(data));
|
| | | */
|
| | |
|
| | | }
|
| | |
|
| | | @RequestMapping("getCouponList")
|
| | | public void getCouponList(AcceptData acceptData, int page, PrintWriter out) {
|
| | | public void getCouponList(AcceptData acceptData, int page, HttpServletRequest request, PrintWriter out) {
|
| | | page = page > 0 ? page : 1;
|
| | | List<TaoBaoGoodsBrief> taoBaoGoodsBriefs = taoBaoCouponService.getTaoBaoCouponList(page);
|
| | | Map<String, String> map = manageService.convertMap();
|
| | | String proportion = map.get("hongbao_goods_proportion");
|
| | | String fcRate = map.get("hongbao_fc_ratio");
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | JSONArray array = new JSONArray();
|
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra;
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create();
|
| | |
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) {
|
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion, fcRate, "");
|
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), "");
|
| | | array.add(gson.toJson(taoBaoGoodsBriefExtra));
|
| | | }
|
| | | int count = 10000;
|
| | |
| | | data.put("taoBaoCoupons", array);
|
| | | data.put("count", count);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
|
| | | try {
|
| | | monitorService.addClientAPIMonitor(MonitorFactory.createClientAPI(request, 0, 0, null));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | if (meterialId > 0)
|
| | | result = TaoKeApiUtil.getMaterialByMaterialId(meterialId, page, 20);
|
| | | else
|
| | | result = TaoKeApiUtil.searchCouple(goodsClassService.getKwById(id), null, page, 20);
|
| | | result = TaoKeApiUtil.searchCouple(goodsClassService.getKeysById(id), null, page, 20);
|
| | |
|
| | | List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav();
|
| | | if (result.getNavList() != null)
|
| | |
| | | data.put("nav", gson.toJson(navList));
|
| | | List<TaoBaoGoodsBriefExtra> re = new ArrayList<TaoBaoGoodsBriefExtra>();
|
| | | List<TaoBaoGoodsBrief> taoBaoGoodsBriefs = result.getTaoBaoGoodsBriefs();
|
| | | Map<String, String> map = manageService.convertMap();
|
| | | String proportion = map.get("hongbao_goods_proportion");
|
| | | String fcRate = map.get("hongbao_fc_ratio");
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra;
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) {
|
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion, fcRate, "");
|
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), "");
|
| | | re.add(taoBaoGoodsBriefExtra);
|
| | | }
|
| | |
|
| | |
| | | */
|
| | | private void setTaoBaoCouponHongBao(List<TaoBaoCoupon> taoBaoCoupons) {
|
| | | if (taoBaoCoupons.size() > 0) {
|
| | | String proportion = hongBaoManageService.get(Constant.HONGBAO_GOODS_PROPORTION);
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | |
|
| | | for (TaoBaoCoupon taoBaoCoupon : taoBaoCoupons) {
|
| | | BigDecimal hb = TaoBaoUtil.getCouponHongBaoInfo(taoBaoCoupon, new BigDecimal(proportion));
|
| | | BigDecimal hb = TaoBaoUtil.getCouponHongBaoInfo(taoBaoCoupon, proportion);
|
| | | taoBaoCoupon.setHongbao(hb);
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | @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){
|
| | | changePicture = true;
|
| | | }
|
| | | |
| | | |
| | | List<Map<String, Object>> listCache = goodsClassService.getClassListAllCache(changePicture);
|
| | | if (listCache == null) {
|
| | | listCache = new ArrayList<Map<String, Object>>();
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("categoryList", listCache);
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("获取失败"));
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|