| | |
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import com.yeshi.fanli.vo.quality.QualityFactoryVO;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | |
| | | @Resource
|
| | | private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
|
| | |
|
| | |
|
| | | public static final int SALES_ASC = 1;
|
| | | public static final int SALES_DESC = 2;
|
| | |
|
| | |
| | | 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;
|
| | |
|
| | | @RequestMapping(value = "addBatch")
|
| | | public void addBatch(String callback, String auctionIds, String lableNames, HttpServletRequest request,
|
| | | PrintWriter out) {
|
| | |
|
| | | try {
|
| | | // 获取当前操作用户
|
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
|
| | | if (admin == null) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆")));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(auctionIds)) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请选者正确的商品入库")));
|
| | | return;
|
| | | }
|
| | |
|
| | | Gson gson = new Gson();
|
| | | List<Long> auctionIdList = gson.fromJson(auctionIds, new TypeToken<ArrayList<Long>>() {
|
| | | }.getType());
|
| | | if (auctionIdList == null || auctionIdList.size() == 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请选择正确的商品入库")));
|
| | | return;
|
| | | }
|
| | |
|
| | | List<TaoBaoGoodsBrief> listTaoBaoGoods = new ArrayList<>();
|
| | |
|
| | | JSONArray array = JSONArray.fromObject(auctionIds);
|
| | |
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | listTaoBaoGoods.add(TaoKeApiUtil.searchGoodsDetail(array.optLong(i)));
|
| | | }
|
| | | qualityFactoryService.addBatchTaoBaoGoods(listTaoBaoGoods, lableNames, admin);
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("添加成功")));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("操作异常")));
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 保存修改精品库商品关联信息
|
| | |
| | | * @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);
|
| | |
| | | try {
|
| | |
|
| | | Gson gson = new Gson();
|
| | | List<String> goodsIds = gson.fromJson(ids, new TypeToken<ArrayList<String>>() {
|
| | | }.getType());
|
| | | List<String> goodsIds = gson.fromJson(ids, new TypeToken<ArrayList<String>>() {}.getType());
|
| | |
|
| | | if (goodsIds == null || goodsIds.size() == 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("未检测到移除商品数据")));
|
| | |
| | |
|
| | | /**
|
| | | * 查询
|
| | | * |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "query")
|
| | |
| | | if (taoBaoGoodsBrief == null)
|
| | | continue; // 为空结束本次循环
|
| | |
|
| | | |
| | | Long id = taoBaoGoodsBrief.getId();
|
| | | idBuf.append(id + ",");
|
| | |
|
| | |
| | |
|
| | | }
|
| | |
|
| | | |
| | | for (QualityFactory selectionGoods : selectionList) {
|
| | |
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
|
| | | if (taoBaoGoodsBrief == null)
|
| | | continue; // 为空结束本次循环
|
| | |
|
| | |
|
| | | String auctionUrl = taoBaoGoodsBrief.getAuctionUrl();
|
| | | if (auctionUrl != null && auctionUrl.trim().length() > 0 && auctionUrl.contains("id=null")) {
|
| | |
| | |
|
| | | map.put("goodsSource", reslutSource);
|
| | |
|
| | | |
| | | map.put("selectionGoods", selectionGoods);
|
| | |
|
| | | /* 商品销售状态: 0 在售 1停售 */
|
| | |
| | | }
|
| | |
|
| | | map.put("saleStae", saleStae);
|
| | | |
| | |
|
| | | /* 1 定向计划 2 营销返利 、高佣 3 普佣 */
|
| | | Integer includeDxjh = taoBaoGoodsBrief.getIncludeDxjh();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /* 券后价--计算 */
|
| | | BigDecimal couponPrice = TaoBaoUtil.getAfterUseCouplePrice(taoBaoGoodsBrief);
|
| | | map.put("couponPrice", couponPrice);
|
| | |
| | | // 预计收益
|
| | | map.put("estimateProfit", estimateProfit);
|
| | |
|
| | | |
| | | BigDecimal couponAmount = taoBaoGoodsBrief.getCouponAmount();
|
| | | if (couponAmount != null && zkPrice != null) {
|
| | | BigDecimal propors = couponAmount.divide(zkPrice, 10, BigDecimal.ROUND_HALF_DOWN);
|
| | |
| | | } else {
|
| | | map.put("propor", 0);
|
| | | }
|
| | | |
| | |
|
| | | /* 商品标签列表 */
|
| | | Long id = taoBaoGoodsBrief.getId();
|
| | |
| | | * 获取商品信息 以及对应标签列表;此商品标签候选项
|
| | | *
|
| | | * @param callback
|
| | | * @param id
|
| | | * 精选id
|
| | | * @param id 精选id
|
| | | * @param request
|
| | | * @param out
|
| | | */
|
| | |
| | |
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 单个商品贴上标签
|
| | | *
|
| | |
| | | // 获取当前操作用户
|
| | | 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;
|
| | | // }
|
| | |
|
| | |
| | | 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;
|
| | | // }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | } catch (QualityFactoryException e) {
|
| | | e.printStackTrace();
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("操作异常")));
|
| | |
| | | }
|
| | |
|
| | | @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 {
|
| | |
|
| | |
| | | }
|
| | |
|
| | | 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;
|
| | |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请传递正确参数:103")));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | Long id = idList.get(0);
|
| | |
|
| | |
| | | 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("暂无标签"));
|
| | |
| | | * @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 {
|
| | |
|
| | |
| | | }
|
| | |
|
| | | 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;
|
| | |
| | | * @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)) {
|
| | |
| | |
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 批量添加标签 --- 精品库(随机权重)
|
| | | * |
| | | * @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 {
|
| | |
|
| | |
| | | }
|
| | |
|
| | | 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("请选择需操作的商品")));
|
| | |
| | |
|
| | | }
|
| | |
|
| | | |
| | | }
|