From 220a7add79cb2fb26a291756dd20b29be6eea1a7 Mon Sep 17 00:00:00 2001 From: xhxu Date: Tue, 28 Jun 2022 16:50:19 +0800 Subject: [PATCH] =?UTF-8?q?//tt=20=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/basic/TtPoiPlanController.java | 106 ++++++++++++++++ .../douyin/web/api/TtWebPoiPlanService.java | 96 +++++++++++++++ .../iformall/douyin/web/api/TtWebService.java | 2 + .../web/api/impl/TtWebPoiPlanServiceImpl.java | 116 ++++++++++++++++++ .../douyin/web/api/impl/TtWebServiceImpl.java | 13 +- .../com/iformall/douyin/web/bean/PoiPlan.java | 61 +++++++++ .../douyin/web/bean/PoiPlanDetail.java | 61 +++++++++ .../iformall/douyin/web/bean/PoiPlanPage.java | 39 ++++++ .../douyin/web/bean/PoiPlanTalentDetail.java | 66 ++++++++++ .../web/bean/PoiPlanTalentMediaPage.java | 86 +++++++++++++ .../douyin/web/bean/PoiPlanTalentPage.java | 78 ++++++++++++ .../iformall/douyin/web/bean/PoiTakeRate.java | 45 +++++++ .../service/TtCouponGoodsService.java | 8 ++ .../impl/TtCouponGoodsServiceImpl.java | 61 +++++++++ .../impl/TtMerchantPoiServiceImpl.java | 2 +- 15 files changed, 834 insertions(+), 6 deletions(-) create mode 100644 mallinkAdmin/src/main/java/com/iformall/controller/basic/TtPoiPlanController.java create mode 100644 mallinkService/src/main/java/com/iformall/douyin/web/api/TtWebPoiPlanService.java create mode 100644 mallinkService/src/main/java/com/iformall/douyin/web/api/impl/TtWebPoiPlanServiceImpl.java create mode 100644 mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiPlan.java create mode 100644 mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiPlanDetail.java create mode 100644 mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiPlanPage.java create mode 100644 mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiPlanTalentDetail.java create mode 100644 mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiPlanTalentMediaPage.java create mode 100644 mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiPlanTalentPage.java create mode 100644 mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiTakeRate.java diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtPoiPlanController.java b/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtPoiPlanController.java new file mode 100644 index 000000000..4a08f2184 --- /dev/null +++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtPoiPlanController.java @@ -0,0 +1,106 @@ +package com.iformall.controller.basic; + + +import com.iformall.annotation.SystemControllerLog; +import com.iformall.annotation.TenantIgnore; +import com.iformall.common.ErrorCode; +import com.iformall.common.ResultData; +import com.iformall.controller.base.BaseController; +import com.iformall.domain.po.TtCouponChannelPoi; +import com.iformall.domain.po.TtMerchantPoi; +import com.iformall.douyin.web.api.TtWebService; +import com.iformall.douyin.web.bean.PoiPlan; +import com.iformall.enums.EnumSupplierMathStatus; +import com.iformall.service.TtCouponGoodsService; +import com.iformall.service.TtGoodsCategoryService; +import com.iformall.service.TtMerchantPoiService; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * @author + */ +@RestController +@RequestMapping("poiPlan") +public class TtPoiPlanController extends BaseController { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + private TtCouponGoodsService ttCouponGoodsService; + +// @TenantIgnore + @ApiOperation("分页列表接口") + @GetMapping("list") + @ApiImplicitParams({}) + @SystemControllerLog(description = "列表") + public ResultData list(Long couponId,Integer pageNum, Integer pageSize) { + logger.debug("[" + getIpAddr() + "] TtPoiPlanController::list"); + if(couponId == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); + } + if(pageNum == null){ + pageNum = 1; + } + if(pageSize == null){ + pageSize = 100; + } + return ttCouponGoodsService.poiPlanList(getTenantInfo(),couponId,pageNum,pageSize); + } + + @ApiOperation("发布修改通用佣金计划") + @PostMapping("save") + @SystemControllerLog(description = "更新") + public ResultData save(@RequestBody Map param) { + logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::save"); + Integer commissionRate = (Integer) param.get("commissionRate"); + if(commissionRate == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"商品的抽佣率为空"); + } + if(commissionRate.intValue() < 100 || commissionRate.intValue() > 2900){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"商品的抽佣率需在1%-29%之间"); + } + Integer contentType = (Integer) param.get("contentType"); + if(contentType == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"带货场景为空"); + } + if(contentType.intValue() < 1 || contentType.intValue() > 3){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"带货场景不合法"); + } + Long planId = (Long) param.get("planId"); + + Long couponId = (Long) param.get("couponId"); + if(couponId == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"商品Id为空"); + } + + return ttCouponGoodsService.poiPlanSave(getTenantInfo(),couponId,planId,contentType,commissionRate); + } + + @ApiOperation("修改通用佣金计划状态") + @PostMapping("updateStatus") + @SystemControllerLog(description = "更新") + public ResultData updateStatus(@RequestBody Map param) { + logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::updateStatus"); + Long planId = (Long) param.get("planId"); + if(planId == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"计划ID为空"); + } + Integer status = (Integer) param.get("status"); + if(status == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"状态值为空"); + } + if(status.intValue() < 1 || status.intValue() > 3){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"状态不合法"); + } + + return ttCouponGoodsService.poiPlanUpdateStatus(getTenantInfo(),planId,status); + } + +} diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/api/TtWebPoiPlanService.java b/mallinkService/src/main/java/com/iformall/douyin/web/api/TtWebPoiPlanService.java new file mode 100644 index 000000000..205735f3d --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/douyin/web/api/TtWebPoiPlanService.java @@ -0,0 +1,96 @@ +package com.iformall.douyin.web.api; + + +import com.iformall.douyin.web.bean.*; +import me.chanjar.weixin.common.error.WxErrorException; + +import java.util.List; + +/** + * 商铺 商品poi接入操作接口. + * + * @author + */ +public interface TtWebPoiPlanService { + + /** + *查询通用佣金计划 + */ + String POI_PLAN_LIST = "https://open.douyin.com/poi/plan/list/"; + /** + *发布/修改通用佣金计划 + */ + String POI_COMMON_PLAN_SAVE = "https://open.douyin.com/poi/common/plan/save/"; + /** + * 修改通用佣金计划状态 + */ + String POI_COMMON_PLAN_UPDATE_STATUS = "https://open.douyin.com/poi/common/plan/update/status/"; + /** + * 通用佣金计划查询带货数据 + */ + String POI_COMMON_PLAN_DETAIL = "https://open.douyin.com/poi/common/plan/detail/"; + /** + * 通用佣金计划查询带货达人列表 + */ + String POI_COMMON_PLAN_TALENT_LIST = "https://open.douyin.com/poi/common/plan/talent/list/"; + /** + * 通用佣金计划查询达人带货数据 + */ + String POI_COMMON_PLAN_TALENT_DETAIL = "https://open.douyin.com/poi/common/plan/talent/detail/"; + /** + * 通用佣金计划查询达人带货详情 + */ + String POI_COMMON_PLAN_TALENT_MEDIA_LIST = "https://open.douyin.com/poi/common/plan/talent/media/list/"; + + + /** + * 商品达人分佣配置 + */ + String POI_TAKE_RATE = "https://open.douyin.com/poi/v2/spu/take_rate/sync/"; + + /** + * 查询通用佣金计划 + */ + PoiPlanPage poiPlanList(Long spuId,Integer pageNo,Integer pageSize) throws WxErrorException; + + /** + * 发布/修改通用佣金计划 + */ + Integer poiPlanSave(PoiPlan poiPlan) throws WxErrorException ; + + /** + * 修改通用佣金计划状态 + * status + * 1:设置为进行中 + * 2:设置为暂停中 + * 3:设置为已关闭 + */ + boolean poiPlanUpdateStatus(Long planId,Integer status) throws WxErrorException ; + + /** + * 商品达人分佣配置(定向分佣) + */ + String poiTakeRate(PoiTakeRate poiTakeRate) throws WxErrorException ; + + /** + * 通用佣金计划查询带货数据 + */ + PoiPlanDetail poiPlanDetail(List plan_id_list) throws WxErrorException ; + + /** + * 通用佣金计划查询带货达人列表 + */ + PoiPlanTalentPage poiPlanTalentList(Long plan_id,Integer pageNo,Integer pageSize) throws WxErrorException ; + + /** + * 通用佣金计划查询达人带货数据 + */ + PoiPlanTalentDetail poiPlanTalentDetail(Long plan_id,List douyin_id_list) throws WxErrorException ; + + /** + * 通用佣金计划查询达人带货详情 + * + */ + PoiPlanTalentMediaPage poiPlanTalentMediaList(Long plan_id,Integer pageNo,Integer pageSize,String douyin_id,Integer content_type) throws WxErrorException ; + +} diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/api/TtWebService.java b/mallinkService/src/main/java/com/iformall/douyin/web/api/TtWebService.java index e7f6538db..7791d9504 100644 --- a/mallinkService/src/main/java/com/iformall/douyin/web/api/TtWebService.java +++ b/mallinkService/src/main/java/com/iformall/douyin/web/api/TtWebService.java @@ -112,4 +112,6 @@ public interface TtWebService { TtWebGoodsService getGoodsService(); + TtWebPoiPlanService getPoiPlanService(); + } diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/api/impl/TtWebPoiPlanServiceImpl.java b/mallinkService/src/main/java/com/iformall/douyin/web/api/impl/TtWebPoiPlanServiceImpl.java new file mode 100644 index 000000000..afb48e43f --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/douyin/web/api/impl/TtWebPoiPlanServiceImpl.java @@ -0,0 +1,116 @@ +package com.iformall.douyin.web.api.impl; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.iformall.douyin.web.api.*; +import com.iformall.douyin.web.bean.*; +import lombok.AllArgsConstructor; +import me.chanjar.weixin.common.error.WxErrorException; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * + */ +@AllArgsConstructor +public class TtWebPoiPlanServiceImpl implements TtWebPoiPlanService { + + private static final Gson GSON = new GsonBuilder().create(); + + private TtWebService service; + + @Override + public PoiPlanPage poiPlanList(Long spuId, Integer pageNo, Integer pageSize) throws WxErrorException { + final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); + Map map = new HashMap<>(); + map.put("spu_id",spuId); + map.put("page_no",pageNo); + map.put("page_size",pageSize); + String result = this.service.execute(executor, this.POI_PLAN_LIST, GSON.toJson(map)); + return GSON.fromJson(result, PoiPlanPage.class); + } + + @Override + public Integer poiPlanSave(PoiPlan poiPlan) throws WxErrorException { + final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); + String result = this.service.execute(executor, this.POI_COMMON_PLAN_SAVE, GSON.toJson(poiPlan)); + JSONObject jsonObject = JSONObject.parseObject(result); + return jsonObject.getInteger("plan_id"); + } + + @Override + public boolean poiPlanUpdateStatus(Long planId, Integer status) throws WxErrorException { + final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); + Map map = new HashMap<>(); + List> updateList = new ArrayList<>(); + Map updateMap = new HashMap<>(); + updateMap.put("plan_id",planId); + updateMap.put("status",status); + updateList.add(updateMap); + map.put("plan_update_list",updateList); + String result = this.service.execute(executor, this.POI_COMMON_PLAN_UPDATE_STATUS, GSON.toJson(map)); + JSONObject jsonObject = JSONObject.parseObject(result); + JSONArray fail_plan_id_list = jsonObject.getJSONArray("fail_plan_id_list"); + if(fail_plan_id_list != null && fail_plan_id_list.size() > 0){ + return false; + } + return true; + } + + @Override + public String poiTakeRate(PoiTakeRate poiTakeRate) throws WxErrorException { + final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); + String result = this.service.execute(executor, this.POI_TAKE_RATE, GSON.toJson(poiTakeRate)); + JSONObject jsonObject = JSONObject.parseObject(result); + return jsonObject.getString("spu_id"); + } + + @Override + public PoiPlanDetail poiPlanDetail(List plan_id_list) throws WxErrorException { + final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); + Map map = new HashMap<>(); + map.put("plan_id_list",plan_id_list); + String result = this.service.execute(executor, this.POI_COMMON_PLAN_DETAIL, GSON.toJson(map)); + return GSON.fromJson(result, PoiPlanDetail.class); + } + + @Override + public PoiPlanTalentPage poiPlanTalentList(Long plan_id, Integer pageNo, Integer pageSize) throws WxErrorException { + final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); + Map map = new HashMap<>(); + map.put("plan_id",plan_id); + map.put("page_no",pageNo); + map.put("page_size",pageSize); + String result = this.service.execute(executor, this.POI_COMMON_PLAN_TALENT_LIST, GSON.toJson(map)); + return GSON.fromJson(result, PoiPlanTalentPage.class); + } + + @Override + public PoiPlanTalentDetail poiPlanTalentDetail(Long plan_id, List douyin_id_list) throws WxErrorException { + final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); + Map map = new HashMap<>(); + map.put("plan_id",plan_id); + map.put("douyin_id_list",douyin_id_list); + String result = this.service.execute(executor, this.POI_COMMON_PLAN_TALENT_DETAIL, GSON.toJson(map)); + return GSON.fromJson(result, PoiPlanTalentDetail.class); + } + + @Override + public PoiPlanTalentMediaPage poiPlanTalentMediaList(Long plan_id, Integer pageNo, Integer pageSize, String douyin_id, Integer content_type) throws WxErrorException { + final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); + Map map = new HashMap<>(); + map.put("plan_id",plan_id); + map.put("page_no",pageNo); + map.put("page_size",pageSize); + map.put("douyin_id",douyin_id); + map.put("content_type",content_type); + String result = this.service.execute(executor, this.POI_COMMON_PLAN_TALENT_MEDIA_LIST, GSON.toJson(map)); + return GSON.fromJson(result, PoiPlanTalentMediaPage.class); + } + +} diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/api/impl/TtWebServiceImpl.java b/mallinkService/src/main/java/com/iformall/douyin/web/api/impl/TtWebServiceImpl.java index 1d9e81ad2..961869ae1 100644 --- a/mallinkService/src/main/java/com/iformall/douyin/web/api/impl/TtWebServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/douyin/web/api/impl/TtWebServiceImpl.java @@ -4,10 +4,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.google.gson.Gson; import com.google.gson.JsonParser; -import com.iformall.douyin.web.api.TtWebGoodsService; -import com.iformall.douyin.web.api.TtWebProductService; -import com.iformall.douyin.web.api.TtWebService; -import com.iformall.douyin.web.api.TtWebShopMatchService; +import com.iformall.douyin.web.api.*; import com.iformall.douyin.web.config.TtWebConfig; import lombok.extern.slf4j.Slf4j; import me.chanjar.weixin.common.WxType; @@ -52,7 +49,8 @@ public class TtWebServiceImpl implements TtWebService, RequestHttp data; + + @Data + @NoArgsConstructor + public static class PlanGMV implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 带货GMV + */ + @SerializedName(value = "gmv") + private Integer gmv; + /** + * 计划ID + */ + @SerializedName(value = "plan_id") + private Long planId; + /** + * 达人佣金 + */ + @SerializedName(value = "talent_commission") + private Integer talentCommission; + /** + * 已核销GMV + */ + @SerializedName(value = "used_gmv") + private Integer usedGmv; + + } + +} diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiPlanPage.java b/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiPlanPage.java new file mode 100644 index 000000000..9d24ab7ed --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiPlanPage.java @@ -0,0 +1,39 @@ +package com.iformall.douyin.web.bean; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * + * + * @author thinsstar + */ +@Data +@NoArgsConstructor +public class PoiPlanPage implements Serializable { + + private static final long serialVersionUID = -1L; + + /** + * 总页数 + */ + @SerializedName(value = "page_count") + private Integer pageCount; + + /** + * 总计划数 + */ + @SerializedName(value = "total") + private Integer total; + + /** + * 计划 + */ + @SerializedName(value = "data") + private List data; + +} diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiPlanTalentDetail.java b/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiPlanTalentDetail.java new file mode 100644 index 000000000..d3971d84e --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiPlanTalentDetail.java @@ -0,0 +1,66 @@ +package com.iformall.douyin.web.bean; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Map; + +/** + * + * + * @author thinsstar + */ +@Data +@NoArgsConstructor +public class PoiPlanTalentDetail implements Serializable { + + private static final long serialVersionUID = -1L; + + /** + * 数据产出日期 + */ + @SerializedName(value = "date") + private String date; + + /** + * 达人带货数据,以达人抖音号为key,带货数据为value + */ + @SerializedName(value = "data") + private Map data; + + @Data + @NoArgsConstructor + public static class PlanGMVDatail implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 带货GMV + */ + @SerializedName(value = "gmv") + private Integer gmv; + /** + * 直播间数量 + */ + @SerializedName(value = "live_cnt") + private Integer liveCnt; + /** + * 达人佣金 + */ + @SerializedName(value = "talent_commission") + private Integer talentCommission; + /** + * 已核销GMV + */ + @SerializedName(value = "used_gmv") + private Integer usedGmv; + + /** + * 短视频数量 + */ + @SerializedName(value = "short_video_cnt") + private Integer shortVideoCnt; + + } + +} diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiPlanTalentMediaPage.java b/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiPlanTalentMediaPage.java new file mode 100644 index 000000000..838cd1980 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiPlanTalentMediaPage.java @@ -0,0 +1,86 @@ +package com.iformall.douyin.web.bean; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * + * + * @author thinsstar + */ +@Data +@NoArgsConstructor +public class PoiPlanTalentMediaPage implements Serializable { + + private static final long serialVersionUID = -1L; + + /** + * 总页数 + */ + @SerializedName(value = "page_count") + private Integer pageCount; + + /** + * 总计划数 + */ + @SerializedName(value = "total") + private Integer total; + + /** + * 数据产出日期 + */ + @SerializedName(value = "date") + private String date; + + /** + * 达人短视频/直播间带货信息列表 + */ + @SerializedName(value = "data") + private List data; + + @Data + @NoArgsConstructor + public static class PoiPlanTalentMedia implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 短视频/直播间的带货GMV + */ + @SerializedName(value = "gmv") + private Integer gmv; + + /** + * 带货场景,可选值: + * + * 1.短视频 + * 2.直播间 + */ + @SerializedName(value = "content_type") + private Integer contentType; + /** + * 加密过的短视频/直播间ID + */ + @SerializedName(value = "content_open_id") + private String contentOpenId; + /** + * 短视频/直播间的观看人数 + */ + @SerializedName(value = "play_cnt") + private Integer playCnt; + /** + * 达人在该段视频/直播间的佣金 + */ + @SerializedName(value = "talent_commission") + private Integer talentCommission; + /** + * 短视频/直播间已核销的GMV + */ + @SerializedName(value = "used_gmv") + private Integer usedGmv; + + } + +} diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiPlanTalentPage.java b/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiPlanTalentPage.java new file mode 100644 index 000000000..b635c2e53 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiPlanTalentPage.java @@ -0,0 +1,78 @@ +package com.iformall.douyin.web.bean; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * + * + * @author thinsstar + */ +@Data +@NoArgsConstructor +public class PoiPlanTalentPage implements Serializable { + + private static final long serialVersionUID = -1L; + + /** + * 总页数 + */ + @SerializedName(value = "page_count") + private Integer pageCount; + + /** + * 总计划数 + */ + @SerializedName(value = "total") + private Integer total; + + /** + * 数据产出日期 + */ + @SerializedName(value = "date") + private String date; + + /** + * 达人在这个计划下的带货信息 + */ + @SerializedName(value = "data") + private List data; + + @Data + @NoArgsConstructor + public static class DaRenPlanGvm implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 达人带货GMV + */ + @SerializedName(value = "gmv") + private Integer gmv; + + /** + * 达人带货场景 + * 可选值: + * + * 1仅短视频 + * 2仅直播间 + * 3短视频和直播间均有 + */ + @SerializedName(value = "content_type") + private Integer contentType; + /** + * 达人抖音号 + */ + @SerializedName(value = "douyin_id") + private String douyinId; + /** + * 达人抖音昵称 + */ + @SerializedName(value = "nickname") + private String nickname; + + } + +} diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiTakeRate.java b/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiTakeRate.java new file mode 100644 index 000000000..9d56d3705 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiTakeRate.java @@ -0,0 +1,45 @@ +package com.iformall.douyin.web.bean; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * + * + * @author thinsstar + */ +@Data +@NoArgsConstructor +public class PoiTakeRate implements Serializable { + + private static final long serialVersionUID = -1L; + + /** + *1-在线; 2-下线 + */ + @SerializedName(value = "status") + private Integer status; + + /** + * 分佣率,万分位 + */ + @SerializedName(value = "take_rate") + private Integer takeRate; + + /** + * 抖音号,抖音个人页可查询 + */ + @SerializedName(value = "douyin_id") + private Integer douyinId; + + /** + * 接入方商品ID + */ + @SerializedName(value = "spu_ext_id") + private String spuExtId; + + +} diff --git a/mallinkService/src/main/java/com/iformall/service/TtCouponGoodsService.java b/mallinkService/src/main/java/com/iformall/service/TtCouponGoodsService.java index 553ae9407..cb9d3fb83 100644 --- a/mallinkService/src/main/java/com/iformall/service/TtCouponGoodsService.java +++ b/mallinkService/src/main/java/com/iformall/service/TtCouponGoodsService.java @@ -26,4 +26,12 @@ public interface TtCouponGoodsService { ResultData productStockSync(TenantEntity tenantInfo, Long id); ResultData productFreeAudit(TenantEntity tenantInfo, Long id); + + //cps 佣金 + + ResultData poiPlanList(TenantEntity tenantInfo,Long couponId, Integer pageNum, Integer pageSize); + + ResultData poiPlanSave(TenantEntity tenantInfo, Long couponId, Long planId, Integer contentType, Integer commissionRate); + + ResultData poiPlanUpdateStatus(TenantEntity tenantInfo, Long planId, Integer status); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java index d6021c617..546ce29f7 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java @@ -12,6 +12,8 @@ import com.iformall.domain.po.base.BaseEntity; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.*; import com.iformall.douyin.web.api.TtWebService; +import com.iformall.douyin.web.bean.PoiPlan; +import com.iformall.douyin.web.bean.PoiPlanPage; import com.iformall.douyin.web.bean.Product; import com.iformall.enums.*; import com.iformall.mapper.*; @@ -458,4 +460,63 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { return JSON.toJSONString(map); } + + @Override + public ResultData poiPlanList(TenantEntity tenantInfo,Long couponId, Integer pageNum, Integer pageSize) { + TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),couponId); + if(ttCouponChannelPoi == null || !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getLastStatus())){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); + } + try { + Long spu_id = Long.parseLong(ttCouponChannelPoi.getSpuId()); + PoiPlanPage poiPlanPage = ttMerchantPoiService.getTtWebService(tenantInfo).getPoiPlanService().poiPlanList(spu_id, pageNum, pageSize); + return new ResultData(poiPlanPage); + } catch (WxErrorException e) { + e.printStackTrace(); + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); + } + } + + @Override + public ResultData poiPlanSave(TenantEntity tenantInfo, Long couponId, Long planId, Integer contentType, Integer commissionRate) { + TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),couponId); + if(ttCouponChannelPoi == null || !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getLastStatus())){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); + } + try { + Long spu_id = Long.parseLong(ttCouponChannelPoi.getSpuId()); + PoiPlan poiPlan = new PoiPlan(); + poiPlan.setPlanId(planId); + poiPlan.setSpuId(spu_id); + poiPlan.setContentType(contentType); + poiPlan.setCommissionRate(commissionRate); + + Integer returnPlanId = ttMerchantPoiService.getTtWebService(tenantInfo).getPoiPlanService().poiPlanSave(poiPlan); + if(returnPlanId != null){ + return new ResultData(returnPlanId); + }else{ + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"未获取到计划ID"); + } + } catch (WxErrorException e) { + e.printStackTrace(); + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); + } + } + + @Override + public ResultData poiPlanUpdateStatus(TenantEntity tenantInfo, Long planId, Integer status) { + try { + boolean b = ttMerchantPoiService.getTtWebService(tenantInfo).getPoiPlanService().poiPlanUpdateStatus(planId, status); + if(b){ + return new ResultData(); + }else{ + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"false"); + } + } catch (WxErrorException e) { + e.printStackTrace(); + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); + } + } + + } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java index 852d2cf2e..3203d6466 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java @@ -486,7 +486,7 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { @Override public TtWebService getTtWebService(TenantEntity tenantInfo){ WxAppinfo appinfoQ = new WxAppinfo(); - appinfoQ.updateTenantInfo(tenantInfo); +// appinfoQ.updateTenantInfo(tenantInfo); appinfoQ.setPlat(EnumAppPlat.TOUTIAO.getCode()); appinfoQ.setType(EnumAppType.A.getCode()); WxAppinfo appinfo = wxAppinfoMapper.selectOne(new QueryWrapper<>(appinfoQ));