袁野 2 months ago
parent c1398ca568
commit 8e3c3f451c
  1. 141
      cweb/src/main/java/com/hfkj/controller/goodsController.java
  2. 5
      service/src/main/java/com/hfkj/model/CouponModel.java
  3. 39
      service/src/main/java/com/hfkj/model/GoodsInfoModel.java
  4. 56
      service/src/main/java/com/hfkj/model/GoodsModel.java
  5. 22
      service/src/main/java/com/hfkj/model/IncomeInfoModel.java
  6. 36
      service/src/main/java/com/hfkj/model/MorePromotionListModel.java
  7. 29
      service/src/main/java/com/hfkj/model/PricePromotionInfoModel.java
  8. 26
      service/src/main/java/com/hfkj/model/PublishInfoModel.java

@ -1,4 +1,145 @@
package com.hfkj.controller; package com.hfkj.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.model.*;
import com.hfkj.service.taobao.TaoBaoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.License;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@Controller
@RequestMapping(value="/goods")
@Api(value="商品")
public class goodsController { public class goodsController {
private static Logger log = LoggerFactory.getLogger(goodsController.class);
@RequestMapping(value="/goodsList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询商品列表")
public ResponseData goodsList(@RequestParam(value = "title" , required = false) String title,
@RequestParam(value = "type" , required = true) Integer type,
@RequestParam(value = "pageNo" , required = false) Long pageNo,
@RequestParam(value = "pageSize" , required = false) Long pageSize
) {
try {
// 定义数据列表
List<GoodsModel> goodsModelList = new ArrayList<>();
GoodsModel goodsModel;
// 淘客推广信息
PublishInfoModel publishInfoModel;
// 价格促销信息
PricePromotionInfoModel pricePromotionInfoModel;
// 基础信息
GoodsInfoModel goodsInfoModel;
// 商品佣金信息
IncomeInfoModel incomeInfoModel;
// 更多活动优惠
MorePromotionListModel morePromotionListModel;
// 1:淘宝 2:拼多多
// if (type == 1) {
// JSONObject jsonObject = TaoBaoService.material(title , pageNo , pageSize);
//
// if (jsonObject.getBoolean("success")) {
// return ResponseMsgUtil.success(jsonObject.getJSONArray("result_list"));
// } else {
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!");
// }
//
// JSONArray data = jsonObject.getJSONArray("result_list");
//
// for (Object o : data) {
// goodsModel = new GoodsModel();
// JSONObject object = (JSONObject) o;
// JSONObject publish_info = object.getJSONObject("publish_info");
// JSONObject price_promotion_info = object.getJSONObject("price_promotion_info");
// JSONObject item_basic_info = object.getJSONObject("item_basic_info");
// JSONObject income_info = publish_info.getJSONObject("income_info");
// JSONObject more_promotion_list = price_promotion_info.getJSONObject("more_promotion_list");
// JSONObject final_promotion_path_list = price_promotion_info.getJSONObject("final_promotion_path_list");
//
// // 淘客推广信息
// // 商品佣金信息
// incomeInfoModel = new IncomeInfoModel();
// publishInfoModel = new PublishInfoModel();
// publishInfoModel.setClickUrl(publish_info.getString("click_url"));
// publishInfoModel.setCouponShareUrl(publish_info.getString("coupon_share_url"));
// incomeInfoModel.setCommissionAmount(income_info.getBigDecimal("commission_amount"));
// incomeInfoModel.setCommissionRate(income_info.getString("commission_rate"));
// // 插入商品佣金信息
// publishInfoModel.setIncomeInfo(incomeInfoModel);
// // 插入淘客推广信息
// goodsModel.setPublishInfo(publishInfoModel);
// // 商品基础信息
// goodsInfoModel = new GoodsInfoModel();
// goodsInfoModel.setIngot(incomeInfoModel.getCommissionAmount().multiply(new BigDecimal(100)));
// goodsInfoModel.setProvCity(item_basic_info.getString("prov_city"));
// goodsInfoModel.setTitle(item_basic_info.getString("title"));
// goodsInfoModel.setPictUrl(item_basic_info.getString("pict_url"));
// goodsInfoModel.setShortTitle(item_basic_info.getString("short_title"));
// String small_images = item_basic_info.getJSONArray("small_images").toString();
// goodsInfoModel.setSmallImages(JSONObject.parseArray(small_images,String.class));
// goodsInfoModel.setShopTitle(item_basic_info.getString("shop_title"));
// // 插入商品基础信息
// goodsModel.setGoodsInfo(goodsInfoModel);
// // 价格促销信息
// pricePromotionInfoModel = new PricePromotionInfoModel();
// pricePromotionInfoModel.setReservePrice(price_promotion_info.getBigDecimal("reserve_price"));
// pricePromotionInfoModel.setZkFinalPrice(price_promotion_info.getBigDecimal("zk_final_price"));
// pricePromotionInfoModel.setFinalPromotionPrice(price_promotion_info.getBigDecimal("final_promotion_price"));
// // 更多活动优惠
// morePromotionListModel = new MorePromotionListModel();
// morePromotionListModel.setPromotionDesc(more_promotion_list.getString("promotion_desc"));
// morePromotionListModel.setPromotionFee(final_promotion_path_list.getBigDecimal("promotion_fee"));
// }
//
//
// }
return ResponseMsgUtil.success("121");
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/createCommand",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "淘口令生成 ")
public ResponseData createCommand(@RequestParam(value = "url" , required = false) String url
) {
try {
JSONObject jsonObject = TaoBaoService.createCommand("https:" + url);
if (jsonObject.getBoolean("success")) {
return ResponseMsgUtil.success(jsonObject.getJSONObject("data"));
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!");
}
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
} }

@ -1,4 +1,9 @@
package com.hfkj.model; package com.hfkj.model;
public class CouponModel { public class CouponModel {
/**
* 标题
*/
String title;
} }

@ -0,0 +1,39 @@
package com.hfkj.model;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data
public class GoodsInfoModel {
/**
* 商品标题
*/
String title;
/**
* 商品短标题
*/
String shortTitle;
/**
* 商品主图
*/
String pictUrl;
/**
* 店铺信息
*/
String shopTitle;
/**
* 商品小图列表
*/
List<String> smallImages;
/**
* 地区
*/
String provCity;
/**
* 元宝数量
*/
BigDecimal ingot;
}

@ -2,64 +2,20 @@ package com.hfkj.model;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data @Data
public class GoodsModel { public class GoodsModel {
/**
* 标题
*/
String title;
/**
* 售卖价格
*/
BigDecimal salePrice;
/**
* 原价
*/
BigDecimal originalPrice;
/**
* 优惠券价格
*/
BigDecimal couponPrice;
/**
* 元宝数量
*/
BigDecimal ingot;
/**
* 售卖数量
*/
String saleNum;
/**
* 分类名称
*/
String categoryName;
/**
* 列表图片
*/
String listImg;
/** /**
* 轮播图列表 * 淘客推广信息
*/ */
List<String> bannerImg; PublishInfoModel publishInfo;
/**
* 门店名称
*/
String merName;
/** /**
* 卡券 * 价格促销信息
*/ */
List<CouponModel> coupons; PricePromotionInfoModel pricePromotionInfo;
/** /**
* 价格集合 * 基础信息
*/ */
GoodsPriceModel goodsPrice; GoodsInfoModel goodsInfo;
} }

@ -0,0 +1,22 @@
package com.hfkj.model;
import lombok.Data;
import java.math.BigDecimal;
/**
* 商品佣金信息
*/
@Data
public class IncomeInfoModel {
/**
* 商品佣金比率
*/
String commissionRate;
/**
* 商品佣金金额
*/
BigDecimal commissionAmount;
}

@ -0,0 +1,36 @@
package com.hfkj.model;
import lombok.Data;
import java.math.BigDecimal;
/**
* 更多活动优惠
*/
@Data
public class MorePromotionListModel {
/**
* 优惠名称
*/
String promotionTitle;
/**
* 优惠利益点文案
*/
String promotionDesc;
/**
* 优惠开始时间
*/
String promotionStartTime;
/**
* 优惠结束时间
*/
String promotionEndTime;
/**
* 实际优惠金额
*/
BigDecimal promotionFee;
/**
* 优惠ID
*/
String promotionId;
}

@ -0,0 +1,29 @@
package com.hfkj.model;
import lombok.Data;
import java.math.BigDecimal;
/**
* 价格促销信息
*/
@Data
public class PricePromotionInfoModel {
/**
* 一口价通常显示为划线价
*/
BigDecimal reservePrice;
/**
* 预估到手价()若属于预售商品付定金时间内预估到手价价=定金+尾款的预估到手价
*/
BigDecimal finalPromotionPrice;
/**
* 销售价格无促销时等于一口价有促销时为促销价若属于预售商品付定金时间内在线售卖价=预售价
*/
BigDecimal zkFinalPrice;
/**
* 更多活动优惠
*/
MorePromotionListModel morePromotionList;
}

@ -0,0 +1,26 @@
package com.hfkj.model;
import lombok.Data;
/**
* 淘客推广信息
*/
@Data
public class PublishInfoModel {
/**
* 宝贝推广链接
*/
String clickUrl;
/**
* 宝贝+券二合一页面链接
*/
String couponShareUrl;
/**
* 商品佣金信息
*/
IncomeInfoModel incomeInfo;
}
Loading…
Cancel
Save