admin
2018-12-18 ecda3630b637155ce1ae4a4cabf6ef869a561fbd
fanli/src/main/java/com/yeshi/fanli/controller/admin/TaoBaoGoodsBriefAdminController.java
@@ -10,11 +10,10 @@
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;
@@ -46,7 +45,7 @@
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")
@@ -71,7 +70,6 @@
   
   @Resource
   private TaoBaoClassService taoBaoClassService;
   
   @RequestMapping(value = "getTBGoodsList", method = RequestMethod.POST)
   public void getTaoBaoGoodsBriefList(int pageIndex, String key, PrintWriter out) {
@@ -195,40 +193,6 @@
      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(",");
@@ -280,15 +244,15 @@
    * @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)
@@ -532,7 +496,6 @@
                  }
               }
            }
            map.put("isExistence", existence);
@@ -843,7 +806,6 @@
      }
   }
   /**
    * 
    * @param callback
@@ -863,8 +825,8 @@
    * @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 {
@@ -890,11 +852,9 @@
            return;
         }
         
         // 页大小,默认20,1~100
         if (pageSize == null || pageSize < 1)
            pageSize = Constant.PAGE_SIZE;
         // 第几页,默认:1
         if (pageIndex == null || pageIndex < 1)
@@ -913,7 +873,6 @@
            return;
         } 
         
         // 插入商品集合
         List<Long> listAuctionId = new ArrayList<Long>();
         for (TaoBaoGoodsBrief goodsBrief : taoBaoGoodsBriefs) {
@@ -923,14 +882,12 @@
         // 验证是否存在数据库
         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());
@@ -976,7 +933,6 @@
                  }
               }
            }
            
            map.put("isExistence", existence);
@@ -1003,16 +959,12 @@
         e.printStackTrace();
      }
      
   }
   
   @RequestMapping(value = "getQiangGou")
   public void getQiangGou(String callback, Integer pageIndex, PrintWriter out) {
      try {
         
         int pageSize = 40;
@@ -1026,8 +978,6 @@
         
         TaoBaoSearchResult result = TaoKeApiUtil.taoQiangGou(pageIndex, pageSize,startTime, endTime);
         
         if (result == null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂未获取到相关数据"));
            return;
@@ -1039,7 +989,6 @@
            return;
         } 
         
         // 插入商品集合
         List<Long> listAuctionId = new ArrayList<Long>();
         for (TaoBaoGoodsBrief goodsBrief : taoBaoGoodsBriefs) {
@@ -1049,14 +998,12 @@
         // 验证是否存在数据库
         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());
@@ -1103,7 +1050,6 @@
               }
            }
            
            map.put("isExistence", existence);
            listmap.add(map);
@@ -1128,7 +1074,6 @@
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询异常"));
         e.printStackTrace();
      }
      
   }