| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | 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.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("admin/new/api/v1/taobao")
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoClassService taoBaoClassService;
|
| | | |
| | |
|
| | | @RequestMapping(value = "getTBGoodsList", method = RequestMethod.POST)
|
| | | public void getTaoBaoGoodsBriefList(int pageIndex, String key, PrintWriter out) {
|
| | |
| | | out.print(JsonUtil.loadTrueResult(dataAll));
|
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * 方法说明: 添加商品到每日任务
|
| | | * |
| | | * @author mawurui createTime 2018年3月29日 上午11:36:25
|
| | | * @param tbids
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "addEveryDayTask", method = RequestMethod.POST)
|
| | | public void addEveryDayTask(String tbids, PrintWriter out) {
|
| | | String[] tbidStrArr = tbids.split(",");
|
| | | long[] tbidArr = StringUtil.parseLong(tbidStrArr);
|
| | | List<JSONObject> list = new ArrayList<JSONObject>();
|
| | | JSONObject data = null;
|
| | | for (long tbid : tbidArr) {
|
| | | data = new JSONObject();
|
| | | try {
|
| | | taoBaoGoodsBriefService.addEveryDayTask(tbid);
|
| | | data.put("id", tbid);
|
| | | data.put("msg", "添加成功");
|
| | | } catch (NotExistObjectException e) {
|
| | | data.put("id", tbid);
|
| | | data.put("msg", e.getMessage());
|
| | | } catch (ExistObjectException e) {
|
| | | data.put("id", tbid);
|
| | | data.put("msg", e.getMessage());
|
| | | }
|
| | | list.add(data);
|
| | | }
|
| | | JSONObject dataAll = new JSONObject();
|
| | | dataAll.put("list", list);
|
| | | out.print(JsonUtil.loadTrueResult(dataAll));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "addClassRecommendGoods", method = RequestMethod.POST)
|
| | | public void addClassRecommendGoods(long gcid, String tbids, PrintWriter out) {
|
| | | String[] tbidStrArr = tbids.split(",");
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "queryOnSale")
|
| | | public void queryOnSale(String callback, Integer pageIndex, Integer pageSize, String key, Long tbClassId, Integer startPrice,
|
| | | Integer endPrice, String startTkRate, String endTkRate, Integer sort, Integer istmall, Integer hasCoupon,
|
| | | Integer baoYou, Integer startDsr, Integer overseas, Integer needPrepay, Integer includePayRate30,
|
| | | Integer includeGoodRate, Integer includeRfdRate, Integer npxLevel, PrintWriter out) {
|
| | | public void queryOnSale(String callback, Integer pageIndex, Integer pageSize, String key, Long tbClassId,
|
| | | Integer startPrice, Integer endPrice, String startTkRate, String endTkRate, Integer sort, Integer istmall,
|
| | | Integer hasCoupon, Integer baoYou, Integer startDsr, Integer overseas, Integer needPrepay,
|
| | | Integer includePayRate30, Integer includeGoodRate, Integer includeRfdRate, Integer npxLevel,
|
| | | PrintWriter out) {
|
| | |
|
| | | try {
|
| | |
|
| | | SearchFilter filter = new SearchFilter();
|
| | | |
| | |
|
| | | // 页大小,默认20,1~100
|
| | | if (pageSize == null || pageSize < 1)
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | map.put("isExistence", existence);
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | *
|
| | | * @param callback
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "searchMaterial")
|
| | | public void searchMaterial(String callback, Integer pageIndex, Integer pageSize, |
| | | String subName, String superName, PrintWriter out) {
|
| | | public void searchMaterial(String callback, Integer pageIndex, Integer pageSize, String subName, String superName,
|
| | | PrintWriter out) {
|
| | |
|
| | | try {
|
| | |
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | |
| | | // 页大小,默认20,1~100
|
| | | if (pageSize == null || pageSize < 1)
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | |
|
| | | // 第几页,默认:1
|
| | | if (pageIndex == null || pageIndex < 1)
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | |
| | | // 插入商品集合
|
| | | List<Long> listAuctionId = new ArrayList<Long>();
|
| | | for (TaoBaoGoodsBrief goodsBrief : taoBaoGoodsBriefs) {
|
| | |
| | | // 验证是否存在数据库
|
| | | List<QualityFactory> listHas = selectionGoodsService.listQueryByAuctionId(listAuctionId);
|
| | |
|
| | | |
| | | List<Map<String, Object>> listmap = new ArrayList<Map<String, Object>>();
|
| | |
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) {
|
| | | taoBaoGoodsBrief.setId(null);
|
| | |
|
| | | Map<String, Object> map = new HashMap<String, Object>();
|
| | |
|
| | |
|
| | | map.put("pictUrl", taoBaoGoodsBrief.getPictUrl());
|
| | | map.put("title", taoBaoGoodsBrief.getTitle());
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | map.put("isExistence", existence);
|
| | |
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | |
| | | }
|
| | | |
| | | |
| | |
|
| | | @RequestMapping(value = "getQiangGou")
|
| | | public void getQiangGou(String callback, Integer pageIndex, PrintWriter out) {
|
| | |
|
| | | try {
|
| | |
|
| | |
|
| | | int pageSize = 40;
|
| | |
|
| | |
| | |
|
| | | TaoBaoSearchResult result = TaoKeApiUtil.taoQiangGou(pageIndex, pageSize,startTime, endTime);
|
| | |
|
| | | |
| | | |
| | | if (result == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂未获取到相关数据"));
|
| | | return;
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | |
| | | // 插入商品集合
|
| | | List<Long> listAuctionId = new ArrayList<Long>();
|
| | | for (TaoBaoGoodsBrief goodsBrief : taoBaoGoodsBriefs) {
|
| | |
| | | // 验证是否存在数据库
|
| | | List<QualityFactory> listHas = selectionGoodsService.listQueryByAuctionId(listAuctionId);
|
| | |
|
| | | |
| | | List<Map<String, Object>> listmap = new ArrayList<Map<String, Object>>();
|
| | |
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) {
|
| | | taoBaoGoodsBrief.setId(null);
|
| | |
|
| | | Map<String, Object> map = new HashMap<String, Object>();
|
| | |
|
| | |
|
| | | map.put("pictUrl", taoBaoGoodsBrief.getPictUrl());
|
| | | map.put("title", taoBaoGoodsBrief.getTitle());
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | map.put("isExistence", existence);
|
| | |
|
| | | listmap.add(map);
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
|