yujian
2019-07-11 698e358a3183e062943fa9dc1b144b6dffb4f66b
fanli/src/main/java/com/yeshi/fanli/controller/admin/QualityFactoryAdminController.java
@@ -14,6 +14,7 @@
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.yeshi.utils.JsonUtil;
import org.yeshi.utils.taobao.TbImgUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -58,7 +59,6 @@
   @Resource
   private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
   
   public static final int SALES_ASC = 1;
   public static final int SALES_DESC = 2;
@@ -68,10 +68,8 @@
   public static final int TKRATE_ASC = 5;
   public static final int TKRATE_DESC = 6;
   
   public static final int PROPOR_ASC = 7;
   public static final int PROPOR_DESC = 8;
   /**
    * 保存修改精品库商品关联信息
@@ -82,7 +80,8 @@
    * @param out
    */
   @RequestMapping(value = "saveModify")
   public void saveModify(String callback, QualityFactory selectionGoods, HttpServletRequest request, PrintWriter out) {
   public void saveModify(String callback, QualityFactory selectionGoods, HttpServletRequest request,
         PrintWriter out) {
      try {
         AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
@@ -153,7 +152,8 @@
   public void removeGoods(String callback, String ids, PrintWriter out) {
      try {
         Gson gson = new Gson();
         List<Long> goodsIds = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {}.getType());
         List<Long> goodsIds = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {
         }.getType());
         if (goodsIds == null || goodsIds.size() == 0) {
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("未检测到移除商品数据")));
@@ -171,6 +171,7 @@
   /**
    * 查询
    *
    * @param out
    */
   @RequestMapping(value = "query")
@@ -259,7 +260,6 @@
            if (taoBaoGoodsBrief == null)
               continue; // 为空结束本次循环
            
            Long id = taoBaoGoodsBrief.getId();
            idBuf.append(id + ",");
            
@@ -328,13 +328,15 @@
            
         }
         
         for (QualityFactory selectionGoods : selectionList) {
            TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
            if (taoBaoGoodsBrief == null)
               continue; // 为空结束本次循环
            // 设置图片大小
            taoBaoGoodsBrief.setPictUrl(TbImgUtil.getTBSize220Img(taoBaoGoodsBrief.getPictUrl()));
            
            String auctionUrl = taoBaoGoodsBrief.getAuctionUrl();
            if (auctionUrl != null && auctionUrl.trim().length() > 0 && auctionUrl.contains("id=null")) {
@@ -370,7 +372,6 @@
            
            map.put("goodsSource", reslutSource);
            
            map.put("selectionGoods", selectionGoods);
            /* 商品销售状态: 0 在售 1停售 */
@@ -388,7 +389,6 @@
            }
            
            map.put("saleStae", saleStae);
            /* 1 定向计划 2 营销返利 、高佣 3 普佣 */
            Integer includeDxjh = taoBaoGoodsBrief.getIncludeDxjh();
@@ -414,8 +414,6 @@
               }
            }
            
             /* 券后价--计算 */
            BigDecimal couponPrice = TaoBaoUtil.getAfterUseCouplePrice(taoBaoGoodsBrief);
            map.put("couponPrice", couponPrice);
@@ -429,7 +427,6 @@
            // 预计收益
            map.put("estimateProfit", estimateProfit);
            
            BigDecimal couponAmount = taoBaoGoodsBrief.getCouponAmount();
            if (couponAmount != null && zkPrice != null) {
               BigDecimal propors = couponAmount.divide(zkPrice ,10 ,BigDecimal.ROUND_HALF_DOWN);
@@ -438,7 +435,6 @@
            } else {
               map.put("propor", 0);
            }
            /* 商品标签列表 */
            Long id = taoBaoGoodsBrief.getId();
@@ -470,7 +466,8 @@
    * 获取商品信息 以及对应标签列表;此商品标签候选项
    * 
    * @param callback
    * @param id 精选id
    * @param id
    *            精选id
    * @param request
    * @param out
    */
@@ -512,7 +509,6 @@
   }
   /**
    * 单个商品贴上标签
    * 
@@ -529,7 +525,8 @@
         // 获取当前操作用户
         AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
//         if (admin == null) {
//            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆。")));
         // out.print(JsonUtil.loadJSONP(callback,
         // JsonUtil.loadFalseResult("当前账户失效,请重新登陆。")));
//            return;
//         }
@@ -623,7 +620,8 @@
         AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
//
//         if (admin == null) {
//            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("当前账户已失效,请重新登陆")));
         // out.print(JsonUtil.loadJSONP(callback,
         // JsonUtil.loadFalseResult("当前账户已失效,请重新登陆")));
//            return;
//         } 
@@ -646,7 +644,6 @@
            }
         }
         
      } catch (QualityFactoryException e) {
         e.printStackTrace();
         out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("操作异常")));
@@ -655,8 +652,8 @@
   }
   @RequestMapping(value = "queryMyLabels")
   public void queryMyLabels(String callback, Integer pageIndex, Integer pageSize,
         String ids, HttpServletRequest request, PrintWriter out) {
   public void queryMyLabels(String callback, Integer pageIndex, Integer pageSize, String ids,
         HttpServletRequest request, PrintWriter out) {
      try {
         
@@ -666,7 +663,8 @@
         }
         
         Gson gson = new Gson();
         List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {}.getType());
         List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {
         }.getType());
         if (idList == null || idList.size() == 0) {
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请传递正确参数:102")));
            return;
@@ -677,7 +675,6 @@
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请传递正确参数:103")));
            return;
         }
         
         Long id = idList.get(0);
         
@@ -693,8 +690,7 @@
            pageSize = Constant.PAGE_SIZE;
         // 商品标签列表
         List<LabelGoods> labelList = labelGoodsService.queryByGoodsId((pageIndex - 1) * pageSize,
               pageSize, id);
         List<LabelGoods> labelList = labelGoodsService.queryByGoodsId((pageIndex - 1) * pageSize, pageSize, id);
         if (labelList == null || labelList.size() == 0) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无标签"));
@@ -734,8 +730,8 @@
    * @param out
    */
   @RequestMapping(value = "queryLabel")
   public void queryLabel(String callback, Integer pageIndex, Integer pageSize, String key,
         String ids, HttpServletRequest request, PrintWriter out) {
   public void queryLabel(String callback, Integer pageIndex, Integer pageSize, String key, String ids,
         HttpServletRequest request, PrintWriter out) {
      try {
@@ -745,7 +741,8 @@
         }
         
         Gson gson = new Gson();
         List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {}.getType());
         List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {
         }.getType());
         if (idList == null || idList.size() == 0) {
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请传递正确参数:102")));
            return;
@@ -813,7 +810,8 @@
    * @param out
    */
   @RequestMapping(value = "addBatchcGoodsLabel")
   public void addBatchcGoodsLabel(String callback, String labIds, Long id, HttpServletRequest request, PrintWriter out) {
   public void addBatchcGoodsLabel(String callback, String labIds, Long id, HttpServletRequest request,
         PrintWriter out) {
      try {
         if (StringUtil.isNullOrEmpty(labIds)) {
@@ -892,17 +890,20 @@
      
   }
   
   /**
    * 批量添加标签 --- 精品库(随机权重)
    *
    * @param callback
    * @param request
    * @param out @param         权重范围 大值
    * @param         佣金范围 小值
    * @param out
    * @param 权重范围
    *            大值
    * @param 佣金范围
    *            小值
    */
   @RequestMapping(value = "setWeightBatch")
   public void setWeightBatch(String callback,String ids, Integer weight,Integer weightSmall,
         Integer weightLarge, HttpServletRequest request, PrintWriter out) {
   public void setWeightBatch(String callback, String ids, Integer weight, Integer weightSmall, Integer weightLarge,
         HttpServletRequest request, PrintWriter out) {
      try {  
      
@@ -912,7 +913,8 @@
          } 
          
          Gson gson = new Gson();
          List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {}.getType());
         List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {
         }.getType());
          
          if (idList == null || idList.size() == 0) {
             out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请选择需操作的商品")));
@@ -930,6 +932,5 @@
      }
   }
   
}