| @@ -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<String, Object> 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<String, Object> 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); | |||||
| } | |||||
| } | |||||
| @@ -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<Long> plan_id_list) throws WxErrorException ; | |||||
| /** | |||||
| * 通用佣金计划查询带货达人列表 | |||||
| */ | |||||
| PoiPlanTalentPage poiPlanTalentList(Long plan_id,Integer pageNo,Integer pageSize) throws WxErrorException ; | |||||
| /** | |||||
| * 通用佣金计划查询达人带货数据 | |||||
| */ | |||||
| PoiPlanTalentDetail poiPlanTalentDetail(Long plan_id,List<String> douyin_id_list) throws WxErrorException ; | |||||
| /** | |||||
| * 通用佣金计划查询达人带货详情 | |||||
| * | |||||
| */ | |||||
| PoiPlanTalentMediaPage poiPlanTalentMediaList(Long plan_id,Integer pageNo,Integer pageSize,String douyin_id,Integer content_type) throws WxErrorException ; | |||||
| } | |||||
| @@ -112,4 +112,6 @@ public interface TtWebService { | |||||
| TtWebGoodsService getGoodsService(); | TtWebGoodsService getGoodsService(); | ||||
| TtWebPoiPlanService getPoiPlanService(); | |||||
| } | } | ||||
| @@ -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<String,Object> 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<String,Object> map = new HashMap<>(); | |||||
| List<Map<String,Object>> updateList = new ArrayList<>(); | |||||
| Map<String,Object> 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<Long> plan_id_list) throws WxErrorException { | |||||
| final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); | |||||
| Map<String,Object> 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<String,Object> 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<String> douyin_id_list) throws WxErrorException { | |||||
| final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); | |||||
| Map<String,Object> 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<String,Object> 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); | |||||
| } | |||||
| } | |||||
| @@ -4,10 +4,7 @@ import com.alibaba.fastjson.JSON; | |||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.google.gson.Gson; | import com.google.gson.Gson; | ||||
| import com.google.gson.JsonParser; | 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 com.iformall.douyin.web.config.TtWebConfig; | ||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
| import me.chanjar.weixin.common.WxType; | import me.chanjar.weixin.common.WxType; | ||||
| @@ -52,7 +49,8 @@ public class TtWebServiceImpl implements TtWebService, RequestHttp<CloseableHttp | |||||
| private TtWebShopMatchService shopMatchService = new TtWebShopMatchServiceImpl(this); | private TtWebShopMatchService shopMatchService = new TtWebShopMatchServiceImpl(this); | ||||
| private TtWebProductService productService = new TtWebProductServiceImpl(this); | private TtWebProductService productService = new TtWebProductServiceImpl(this); | ||||
| private TtWebGoodsServiceImpl goodService = new TtWebGoodsServiceImpl(this); | |||||
| private TtWebGoodsService goodService = new TtWebGoodsServiceImpl(this); | |||||
| private TtWebPoiPlanService poiPlanService = new TtWebPoiPlanServiceImpl(this); | |||||
| private int retrySleepMillis = 1000; | private int retrySleepMillis = 1000; | ||||
| private int maxRetryTimes = 5; | private int maxRetryTimes = 5; | ||||
| @@ -301,4 +299,9 @@ public class TtWebServiceImpl implements TtWebService, RequestHttp<CloseableHttp | |||||
| return this.goodService; | return this.goodService; | ||||
| } | } | ||||
| @Override | |||||
| public TtWebPoiPlanService getPoiPlanService() { | |||||
| return this.poiPlanService; | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,61 @@ | |||||
| 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 PoiPlan implements Serializable { | |||||
| private static final long serialVersionUID = -1L; | |||||
| /** | |||||
| * 分佣率,万分位 | |||||
| */ | |||||
| @SerializedName(value = "commission_rate") | |||||
| private Integer commissionRate; | |||||
| /** | |||||
| * 计划支持的带货场景,可选以下的值: | |||||
| * | |||||
| * 1:仅短视频 | |||||
| * 2:仅直播间 | |||||
| * 3:短视频和直播间 | |||||
| */ | |||||
| @SerializedName(value = "content_type") | |||||
| private Integer contentType; | |||||
| /** | |||||
| * 计划创建时间 | |||||
| */ | |||||
| @SerializedName(value = "create_time") | |||||
| private String createTime; | |||||
| /** | |||||
| * 计划ID | |||||
| */ | |||||
| @SerializedName(value = "plan_id") | |||||
| private Long planId; | |||||
| /** | |||||
| * 可选值: | |||||
| * | |||||
| * 1:进行中 | |||||
| * 2:暂停中 | |||||
| * 3:已终止 | |||||
| */ | |||||
| @SerializedName(value = "status") | |||||
| private Integer status; | |||||
| @SerializedName(value = "spu_id") | |||||
| private Long spuId; | |||||
| } | |||||
| @@ -0,0 +1,61 @@ | |||||
| 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; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * 商品. | |||||
| * | |||||
| * @author thinsstar | |||||
| */ | |||||
| @Data | |||||
| @NoArgsConstructor | |||||
| public class PoiPlanDetail implements Serializable { | |||||
| private static final long serialVersionUID = -1L; | |||||
| /** | |||||
| * 数据产出日期 | |||||
| */ | |||||
| @SerializedName(value = "date") | |||||
| private String date; | |||||
| /** | |||||
| * 计划带货信息详情,以计划ID为key,带货数据为value | |||||
| */ | |||||
| @SerializedName(value = "data") | |||||
| private Map<String,PlanGMV> 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; | |||||
| } | |||||
| } | |||||
| @@ -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<PoiPlan> data; | |||||
| } | |||||
| @@ -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<String,PlanGMVDatail> 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; | |||||
| } | |||||
| } | |||||
| @@ -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<PoiPlanTalentMedia> 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; | |||||
| } | |||||
| } | |||||
| @@ -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<DaRenPlanGvm> 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; | |||||
| } | |||||
| } | |||||
| @@ -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; | |||||
| } | |||||
| @@ -26,4 +26,12 @@ public interface TtCouponGoodsService { | |||||
| ResultData productStockSync(TenantEntity tenantInfo, Long id); | ResultData productStockSync(TenantEntity tenantInfo, Long id); | ||||
| ResultData productFreeAudit(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); | |||||
| } | } | ||||
| @@ -12,6 +12,8 @@ import com.iformall.domain.po.base.BaseEntity; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.*; | import com.iformall.domain.vo.*; | ||||
| import com.iformall.douyin.web.api.TtWebService; | 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.douyin.web.bean.Product; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| @@ -458,4 +460,63 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| return JSON.toJSONString(map); | 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()); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -486,7 +486,7 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { | |||||
| @Override | @Override | ||||
| public TtWebService getTtWebService(TenantEntity tenantInfo){ | public TtWebService getTtWebService(TenantEntity tenantInfo){ | ||||
| WxAppinfo appinfoQ = new WxAppinfo(); | WxAppinfo appinfoQ = new WxAppinfo(); | ||||
| appinfoQ.updateTenantInfo(tenantInfo); | |||||
| // appinfoQ.updateTenantInfo(tenantInfo); | |||||
| appinfoQ.setPlat(EnumAppPlat.TOUTIAO.getCode()); | appinfoQ.setPlat(EnumAppPlat.TOUTIAO.getCode()); | ||||
| appinfoQ.setType(EnumAppType.A.getCode()); | appinfoQ.setType(EnumAppType.A.getCode()); | ||||
| WxAppinfo appinfo = wxAppinfoMapper.selectOne(new QueryWrapper<>(appinfoQ)); | WxAppinfo appinfo = wxAppinfoMapper.selectOne(new QueryWrapper<>(appinfoQ)); | ||||