Browse Source

更新cps

release_toaliyun_real
lrh 2 years ago
parent
commit
3fecf2349b
7 changed files with 482 additions and 70 deletions
  1. +18
    -17
      mallinkAdmin/src/main/java/com/iformall/controller/basic/TtPoiPlanController.java
  2. +169
    -0
      mallinkService/src/main/java/com/iformall/douyin/web/api/goodlifesaas/TtGoodLifeSaasPoiPlanService.java
  3. +2
    -0
      mallinkService/src/main/java/com/iformall/douyin/web/api/goodlifesaas/TtGoodLifeSaasService.java
  4. +194
    -0
      mallinkService/src/main/java/com/iformall/douyin/web/api/goodlifesaas/impl/TtGoodLifeSaasPoiPlanServiceImpl.java
  5. +6
    -1
      mallinkService/src/main/java/com/iformall/douyin/web/api/goodlifesaas/impl/TtGoodLifeSaasServiceImpl.java
  6. +8
    -12
      mallinkService/src/main/java/com/iformall/service/TtCouponGoodsService.java
  7. +85
    -40
      mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java

+ 18
- 17
mallinkAdmin/src/main/java/com/iformall/controller/basic/TtPoiPlanController.java View File

@@ -6,6 +6,7 @@ import com.iformall.annotation.SystemControllerLog;
import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.controller.base.BaseController;
import com.iformall.controller.base.DouyinBaseController;
import com.iformall.domain.po.TtPoiTakeRate;
import com.iformall.domain.po.WxCoupon;
import com.iformall.domain.po.base.BaseEntity;
@@ -34,7 +35,7 @@ import java.util.stream.Collectors;
*/
@RestController
@RequestMapping("poiPlan")
public class TtPoiPlanController extends BaseController {
public class TtPoiPlanController extends DouyinBaseController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
@@ -83,7 +84,7 @@ public class TtPoiPlanController extends BaseController {
@GetMapping("list")
@ApiImplicitParams({})
@SystemControllerLog(description = "列表")
public ResultData list(Long couponId,Integer pageNum, Integer pageSize) {
public ResultData list(Long couponId,Integer pageNum, Integer pageSize) throws Exception {
logger.debug("[" + getIpAddr() + "] TtPoiPlanController::list");
if(couponId == null){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
@@ -94,14 +95,14 @@ public class TtPoiPlanController extends BaseController {
if(pageSize == null){
pageSize = 100;
}
return ttCouponGoodsService.poiPlanList(getTenantInfo(),couponId,pageNum,pageSize);
return ttCouponGoodsService.poiPlanList(getTenantInfo(),couponId,pageNum,pageSize,isGoodLifeSaas());
}

@ApiOperation("定向计划分页列表接口")
@GetMapping("orientedList")
@ApiImplicitParams({})
@SystemControllerLog(description = "列表")
public ResultData orientedList(Long couponId,Integer pageNum, Integer pageSize) {
public ResultData orientedList(Long couponId,Integer pageNum, Integer pageSize) throws Exception {
logger.debug("[" + getIpAddr() + "] TtPoiPlanController::orientedList");
if(couponId == null){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
@@ -112,13 +113,13 @@ public class TtPoiPlanController extends BaseController {
if(pageSize == null){
pageSize = 100;
}
return ttCouponGoodsService.poiOrientedPlanList(getTenantInfo(),couponId,pageNum,pageSize);
return ttCouponGoodsService.poiOrientedPlanList(getTenantInfo(),couponId,pageNum,pageSize,isGoodLifeSaas());
}

@ApiOperation("发布修改通用佣金计划")
@PostMapping("save")
@SystemControllerLog(description = "更新")
public ResultData save(@RequestBody TtPoiTakeRate record) {
public ResultData save(@RequestBody TtPoiTakeRate record) throws Exception {
logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::save");
if(record.getTakeRate() == null){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"商品的抽佣率为空");
@@ -134,13 +135,13 @@ public class TtPoiPlanController extends BaseController {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"商品Id为空");
}
record.updateTenantInfo(getTenantInfo());
return ttCouponGoodsService.poiPlanSave(record);
return ttCouponGoodsService.poiPlanSave(record,isGoodLifeSaas());
}

@ApiOperation("发布修改定向佣金计划")
@PostMapping("saveOrientedPlan")
@SystemControllerLog(description = "更新")
public ResultData saveOrientedPlan(@RequestBody TtPoiTakeRate record) {
public ResultData saveOrientedPlan(@RequestBody TtPoiTakeRate record) throws Exception {
logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::saveOrientedPlan");
if(StringUtils.isBlank(record.getName())){//不可修改
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"计划名称为空");
@@ -184,13 +185,13 @@ public class TtPoiPlanController extends BaseController {
}

record.updateTenantInfo(getTenantInfo());
return ttCouponGoodsService.saveOrientedPlan(record);
return ttCouponGoodsService.saveOrientedPlan(record,isGoodLifeSaas());
}

@ApiOperation("新增定向佣金达人合作")
@PostMapping("addOrientedPlanDouyin")
@SystemControllerLog(description = "更新")
public ResultData addOrientedPlanDouyin(@RequestBody TtPoiTakeRate record) {
public ResultData addOrientedPlanDouyin(@RequestBody TtPoiTakeRate record) throws Exception {
logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::addOrientedPlanDouyin");
if(record.getId() == null){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"Id为空");
@@ -200,13 +201,13 @@ public class TtPoiPlanController extends BaseController {
}

record.updateTenantInfo(getTenantInfo());
return ttCouponGoodsService.addOrientedPlanDouyin(record);
return ttCouponGoodsService.addOrientedPlanDouyin(record,isGoodLifeSaas());
}

@ApiOperation("取消定向佣金达人合作")
@PostMapping("cancelOrientedPlanDouyin")
@SystemControllerLog(description = "更新")
public ResultData cancelOrientedPlanDouyin(@RequestBody TtPoiTakeRate record) {
public ResultData cancelOrientedPlanDouyin(@RequestBody TtPoiTakeRate record) throws Exception {
logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::cancelOrientedPlanDouyin");
if(record.getId() == null){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"Id为空");
@@ -215,13 +216,13 @@ public class TtPoiPlanController extends BaseController {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"取消定向达人抖音号为空");
}
record.updateTenantInfo(getTenantInfo());
return ttCouponGoodsService.cancelOrientedPlanDouyin(record);
return ttCouponGoodsService.cancelOrientedPlanDouyin(record,isGoodLifeSaas());
}

@ApiOperation("修改通用佣金计划状态")
@PostMapping("updateStatus")
@SystemControllerLog(description = "更新")
public ResultData updateStatus(@RequestBody TtPoiTakeRate record) {
public ResultData updateStatus(@RequestBody TtPoiTakeRate record) throws Exception {
logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::updateStatus");
if(record.getId() == null){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"计划ID为空");
@@ -235,13 +236,13 @@ public class TtPoiPlanController extends BaseController {
}
record.updateTenantInfo(getTenantInfo());

return ttCouponGoodsService.poiPlanUpdateStatus(record);
return ttCouponGoodsService.poiPlanUpdateStatus(record,isGoodLifeSaas());
}

@ApiOperation("修改定向佣金计划状态")
@PostMapping("updateOrientedStatus")
@SystemControllerLog(description = "更新")
public ResultData updateOrientedStatus(@RequestBody TtPoiTakeRate record) {
public ResultData updateOrientedStatus(@RequestBody TtPoiTakeRate record) throws Exception {
logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::updateOrientedStatus");
if(record.getId() == null){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"计划ID为空");
@@ -255,7 +256,7 @@ public class TtPoiPlanController extends BaseController {
}
record.updateTenantInfo(getTenantInfo());

return ttCouponGoodsService.poiOrientedPlanUpdateStatus(record);
return ttCouponGoodsService.poiOrientedPlanUpdateStatus(record,isGoodLifeSaas());
}




+ 169
- 0
mallinkService/src/main/java/com/iformall/douyin/web/api/goodlifesaas/TtGoodLifeSaasPoiPlanService.java View File

@@ -0,0 +1,169 @@
package com.iformall.douyin.web.api.goodlifesaas;


import com.iformall.douyin.web.bean.*;
import me.chanjar.weixin.common.error.WxErrorException;

import java.util.List;

/**
* 商铺 商品poi接入操作接口.
*
* @author
*/
public interface TtGoodLifeSaasPoiPlanService {

/**
*查询通用佣金计划
*/
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_ORIENTED_PLAN_LIVE_SAVE = "https://open.douyin.com/poi/oriented/plan/live/save/";
/**
* 发布/修改短视频定向佣金计划
*/
String POI_ORIENTED_PLAN_VIDEO_SAVE = "https://open.douyin.com/poi/oriented/plan/video/save/";
/**
* 修改定向计划状态
*/
String POI_ORIENTED_PLAN_UPDATE_STATUS = "https://open.douyin.com/poi/oriented/plan/update/status/";
/**
* 取消定向佣金计划指定的达人
*/
String POI_ORIENTED_PLAN_DELETE_TALENT = "https://open.douyin.com/poi/oriented/plan/delete/talent/";
/**
* 查询达人的定向佣金计划带货数据
*/
String POI_ORIENTED_PLAN_TALENT_DETAIL = "https://open.douyin.com/poi/oriented/plan/talent/detail/";
/**
* 通过商品 ID 查询定向佣金计划
*/
String POI_ORIENTED_PLAN_LIST = "https://open.douyin.com/poi/oriented/plan/list/";
/**
* 查询定向佣金计划带货汇总数据
*/
String POI_ORIENTED_PLAN_DETAIL = "https://open.douyin.com/poi/oriented/plan/detail/";


/**
* 商品达人分佣配置
* 淘汰
*/
String POI_TAKE_RATE = "https://open.douyin.com/poi/v2/spu/take_rate/sync/";

/**
* 查询通用佣金计划
*/
PoiPlanPage poiPlanList(Long spuId,Integer pageNo,Integer pageSize) throws WxErrorException;

/**
* 通过商品 ID 查询定向佣金计划
*/
PoiOrientedPlanPage poiOrientedPlanList(Long spuId, Integer pageNo, Integer pageSize) throws WxErrorException;

/**
* 发布/修改通用佣金计划
*/
Long poiPlanSave(PoiPlan poiPlan) throws WxErrorException ;

/**
* 发布/修改直播间定向佣金计划
*/
Long poiOrientedPlanLiveSave(PoiOrientedPlan poiPlan) throws WxErrorException ;

/**
* 发布/修改短视频定向佣金计划
*/
Long poiOrientedPlanVideoSave(PoiOrientedPlan poiPlan) throws WxErrorException ;

/**
* 修改通用佣金计划状态
* status
* 1:设置为进行中
* 2:设置为暂停中
* 3:设置为已关闭
*/
boolean poiPlanUpdateStatus(Long planId,Integer status) throws WxErrorException ;

/**
* 修改定向佣金计划状态
* status
* 1:设置为进行中
* 2:设置为暂停中
* 3:设置为已关闭
*/
boolean poiOrientedPlanUpdateStatus(Long planId,Integer status) throws WxErrorException ;

/**
* 取消定向佣金计划指定的达人ORIENTED_PLAN_DELETE_TALENT
*/
boolean poiOrientedPlanDeleteTalent(Long planId,String douyinId) throws WxErrorException ;



/**
* 商品达人分佣配置(定向分佣)
* 淘汰
*/
String poiTakeRate(PoiTakeRate poiTakeRate) throws WxErrorException ;

/**
* 通用佣金计划查询带货数据
*/
PoiPlanDetail poiPlanDetail(List<Long> plan_id_list) throws WxErrorException ;

/**
* 查询定向佣金计划带货汇总数据
*/
PoiOrientedPlanDetail poiOrientedPlanDetail(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 ;

/**
* 查询达人的定向佣金计划带货数据
*/
PoiOrientedPlanTalentDetail poiOrientedPlanTalentDetail(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 ;

}

+ 2
- 0
mallinkService/src/main/java/com/iformall/douyin/web/api/goodlifesaas/TtGoodLifeSaasService.java View File

@@ -11,4 +11,6 @@ import com.iformall.douyin.web.api.web.TtWebShopMatchService;
public interface TtGoodLifeSaasService extends TtBasicService{

TtGoodLifeSaasGoodsService getGoodsService();

TtGoodLifeSaasPoiPlanService getPoiPlanService();
}

+ 194
- 0
mallinkService/src/main/java/com/iformall/douyin/web/api/goodlifesaas/impl/TtGoodLifeSaasPoiPlanServiceImpl.java View File

@@ -0,0 +1,194 @@
package com.iformall.douyin.web.api.goodlifesaas.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.basic.TtWebPostRequestExecutor;
import com.iformall.douyin.web.api.goodlifesaas.TtGoodLifeSaasPoiPlanService;
import com.iformall.douyin.web.api.goodlifesaas.TtGoodLifeSaasService;
import com.iformall.douyin.web.api.web.TtWebService;
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 TtGoodLifeSaasPoiPlanServiceImpl implements TtGoodLifeSaasPoiPlanService {

private static final Gson GSON = new GsonBuilder().create();

private TtGoodLifeSaasService 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 PoiOrientedPlanPage poiOrientedPlanList(Long spuId, Integer pageNo, Integer pageSize) throws WxErrorException {
final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp());
Map<String,Object> map = new HashMap<>();
List<Long> spu_id_list = new ArrayList<>();
spu_id_list.add(spuId);
map.put("spu_id_list",spu_id_list);
String result = this.service.execute(executor, this.POI_ORIENTED_PLAN_LIST, GSON.toJson(map));
return GSON.fromJson(result, PoiOrientedPlanPage.class);
}

@Override
public Long 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.getLong("plan_id");
}

@Override
public Long poiOrientedPlanLiveSave(PoiOrientedPlan poiPlan) throws WxErrorException {
final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp());
String result = this.service.execute(executor, this.POI_ORIENTED_PLAN_LIVE_SAVE, GSON.toJson(poiPlan));
JSONObject jsonObject = JSONObject.parseObject(result);
return jsonObject.getLong("plan_id");
}

@Override
public Long poiOrientedPlanVideoSave(PoiOrientedPlan poiPlan) throws WxErrorException {
final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp());
String result = this.service.execute(executor, this.POI_ORIENTED_PLAN_VIDEO_SAVE, GSON.toJson(poiPlan));
JSONObject jsonObject = JSONObject.parseObject(result);
return jsonObject.getLong("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 boolean poiOrientedPlanUpdateStatus(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_ORIENTED_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 boolean poiOrientedPlanDeleteTalent(Long planId, String douyinId) throws WxErrorException {
final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp());
Map<String,Object> map = new HashMap<>();
map.put("plan_id",planId);
map.put("douyin_id",douyinId);
String result = this.service.execute(executor, this.POI_ORIENTED_PLAN_DELETE_TALENT, GSON.toJson(map));
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 PoiOrientedPlanDetail poiOrientedPlanDetail(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_ORIENTED_PLAN_DETAIL, GSON.toJson(map));
return GSON.fromJson(result, PoiOrientedPlanDetail.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 PoiOrientedPlanTalentDetail poiOrientedPlanTalentDetail(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_ORIENTED_PLAN_TALENT_DETAIL, GSON.toJson(map));
return GSON.fromJson(result, PoiOrientedPlanTalentDetail.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);
}

}

+ 6
- 1
mallinkService/src/main/java/com/iformall/douyin/web/api/goodlifesaas/impl/TtGoodLifeSaasServiceImpl.java View File

@@ -2,6 +2,7 @@ package com.iformall.douyin.web.api.goodlifesaas.impl;

import com.iformall.douyin.web.api.basic.TtBasicServiceImpl;
import com.iformall.douyin.web.api.goodlifesaas.TtGoodLifeSaasGoodsService;
import com.iformall.douyin.web.api.goodlifesaas.TtGoodLifeSaasPoiPlanService;
import com.iformall.douyin.web.api.goodlifesaas.TtGoodLifeSaasService;
import lombok.extern.slf4j.Slf4j;

@@ -11,12 +12,16 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public class TtGoodLifeSaasServiceImpl extends TtBasicServiceImpl implements TtGoodLifeSaasService {
private TtGoodLifeSaasGoodsService shopMatchService = new TtGoodLifeSaasGoodsServiceImpl(this);
private TtGoodLifeSaasPoiPlanService ttGoodLifeSaasPoiPlanService = new TtGoodLifeSaasPoiPlanServiceImpl(this);

@Override
public TtGoodLifeSaasGoodsService getGoodsService() {
return this.shopMatchService;
}

@Override
public TtGoodLifeSaasPoiPlanService getPoiPlanService() {
return this.ttGoodLifeSaasPoiPlanService;
}

}

+ 8
- 12
mallinkService/src/main/java/com/iformall/service/TtCouponGoodsService.java View File

@@ -6,12 +6,8 @@ import com.iformall.domain.po.TtCouponChannelPoi;
import com.iformall.domain.po.TtPoiTakeRate;
import com.iformall.domain.po.WxCoupon;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.TtCouponChannelVo;
import com.iformall.domain.vo.TtCouponVo;
import com.iformall.enums.EnumCpsPlanType;

import java.util.List;

public interface TtCouponGoodsService {

// ResultData couponList(TtCouponVo ttCouponVo, Integer pageNum, Integer pageSize);
@@ -39,21 +35,21 @@ public interface TtCouponGoodsService {
TtPoiTakeRate getTakeRateById(TenantEntity tenantInfo, Long id);

//根据商品id查询线上通用佣金情况
ResultData poiPlanList(TenantEntity tenantInfo,Long couponId, Integer pageNum, Integer pageSize);
ResultData poiPlanList(TenantEntity tenantInfo, Long couponId, Integer pageNum, Integer pageSize, boolean isGoodSaas);
//根据商品id查询线上定向佣金情况
ResultData poiOrientedPlanList(TenantEntity tenantInfo,Long couponId, Integer pageNum, Integer pageSize);
ResultData poiOrientedPlanList(TenantEntity tenantInfo, Long couponId, Integer pageNum, Integer pageSize, boolean isGoodSaas);

ResultData poiPlanSave(TtPoiTakeRate record);
ResultData poiPlanSave(TtPoiTakeRate record,boolean isGoodSaas);

ResultData saveOrientedPlan(TtPoiTakeRate record);
ResultData saveOrientedPlan(TtPoiTakeRate record, boolean isGoodSaas);

ResultData addOrientedPlanDouyin(TtPoiTakeRate record);
ResultData addOrientedPlanDouyin(TtPoiTakeRate record, boolean isGoodSaas);

ResultData cancelOrientedPlanDouyin(TtPoiTakeRate record);
ResultData cancelOrientedPlanDouyin(TtPoiTakeRate record, boolean isGoodSaas);

ResultData poiPlanUpdateStatus(TtPoiTakeRate record);
ResultData poiPlanUpdateStatus(TtPoiTakeRate record, boolean isGoodSaas);

ResultData poiOrientedPlanUpdateStatus(TtPoiTakeRate record);
ResultData poiOrientedPlanUpdateStatus(TtPoiTakeRate record, boolean isGoodSaas);

ResultData setUpAll(TenantEntity tenantInfo, Long couponId, Integer mallRate);



+ 85
- 40
mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java View File

@@ -2,7 +2,6 @@ package com.iformall.service.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.common.ErrorCode;
@@ -11,8 +10,7 @@ import com.iformall.common.ResultData;
import com.iformall.domain.po.*;
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.web.TtWebPoiPlanService;
import com.iformall.douyin.web.api.goodlifesaas.TtGoodLifeSaasService;
import com.iformall.douyin.web.api.web.TtWebService;
import com.iformall.douyin.web.bean.*;
import com.iformall.enums.*;
@@ -35,10 +33,6 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static java.util.stream.Collectors.toList;


@Service
@@ -84,11 +78,11 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {

@Autowired
TtGoodsCategoryService ttGoodsCategoryService;
@Lazy
@Autowired
WxCouponMallService wxCouponMallService;
@Lazy
@Autowired
WxMerchantService wxMerchantService;
@@ -217,14 +211,14 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
merchantIds.add(adminMerchant.getId());
}
}
}else {
merchantIds = wxCouponMerchantMapper.findMerchantIdListByProduct(coupon.getId(), coupon.getTenantId());
}
if (null == merchantIds || merchantIds.size() <= 0) {
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),"未设置商户");
}
List<TtMerchantPoi> pois = null;
if (EnumCouponType.isParentCoupon(coupon.getType())) {
if (null == couponMallList || couponMallList.size() <= 0 ) {
@@ -243,14 +237,14 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
pois.addAll(pois1);
}
}
}else {
TtMerchantPoi poiQ = new TtMerchantPoi();
poiQ.updateTenantInfo(coupon);
poiQ.setIds(merchantIds);
pois = ttMerchantPoiMapper.findList(poiQ);
}
if(pois == null || pois.isEmpty()){
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),"未找到poi门店");
}
@@ -277,7 +271,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
}else {
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),"当前券类型未找到收款商户");
}
}else {
WxMerchant merchantQ = new WxMerchant();
merchantQ.updateTenantInfo(coupon);
@@ -285,7 +279,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
merchantQ.setSortColumns(BaseEntity.SortField.MerchantAdmin);
payAccountMerchant = wxMerchantMapper.findIdNameList(merchantQ).get(0);
}
//投放到抖音渠道,获取详情地址,以做审核
WxCouponChannel wxCouponChannelQuery = new WxCouponChannel();
wxCouponChannelQuery.updateTenantInfo(coupon);
@@ -392,7 +386,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
skuStruct.setStatus(1);
skuStruct.setAttrKeyValueMap(ttattrs.getSkuAttrKeyValueMap());
product.setSku(skuStruct);
if (isSaas) {
product.setAccountId(getDouyinLaikeId(coupon));
}
@@ -430,8 +424,8 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
}
return appinfo.getLaikeId();
}
@Override
public int handlerTtGoodsAudit(TtCouponChannelPoi couponChannelPoi) {
return ttCouponChannelPoiMapper.updateBySpuId(couponChannelPoi);
@@ -450,7 +444,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
}else {
products = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi).getGoodsService().productDraftGet(null, ttCouponChannelPoi.getId().toString());
}
if(null != products && products.size() > 0){
Product product = products.get(0);
if(product.getDraftStatus().intValue() == 12 && !EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getLastStatus())){
@@ -493,7 +487,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
}else {
products = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi).getGoodsService().productOnlineGet(null, ttCouponChannelPoi.getId().toString());
}
if(products.size() > 0){
Product product = products.get(0);
if(product.getOnlineStatus().intValue() == 1 && !EnumSpuSyncStatus.sync_put_on.getCode().equals(ttCouponChannelPoi.getStatus())){
@@ -562,7 +556,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
}else {
b = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi).getGoodsService().productOperate(null,wxCoupon.getId().toString(),op_type);
}
if(b){
TtCouponChannelPoi ccPoi = new TtCouponChannelPoi();
ccPoi.setId(ttCouponChannelPoi.getId());
@@ -635,7 +629,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
b = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi).getGoodsService().productFreeAudit(null,wxCoupon.getId().toString(),
null,wxCoupon.getInventory());
}
if(b){
return new ResultData();
}else{
@@ -735,7 +729,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {


@Override
public ResultData poiPlanList(TenantEntity tenantInfo,Long couponId, Integer pageNum, Integer pageSize) {
public ResultData poiPlanList(TenantEntity tenantInfo,Long couponId, Integer pageNum, Integer pageSize,boolean isGoodSaas) {
TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),couponId);
if(ttCouponChannelPoi == null || EnumSpuSyncStatus.sync_auditing.getCode().equals(ttCouponChannelPoi.getLastStatus())
|| EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getLastStatus())){
@@ -743,7 +737,12 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
}
try {
Long spu_id = Long.parseLong(ttCouponChannelPoi.getSpuId());
PoiPlanPage poiPlanPage = ttMerchantPoiService.getTtWebService(tenantInfo).getPoiPlanService().poiPlanList(spu_id, pageNum, pageSize);
PoiPlanPage poiPlanPage;
if (isGoodSaas) {
poiPlanPage = ttMerchantPoiService.getTtGoodLifeSassService(tenantInfo).getPoiPlanService().poiPlanList(spu_id, pageNum, pageSize);
} else {
poiPlanPage = ttMerchantPoiService.getTtWebService(tenantInfo).getPoiPlanService().poiPlanList(spu_id, pageNum, pageSize);
}
return new ResultData(poiPlanPage);
} catch (WxErrorException e) {
e.printStackTrace();
@@ -752,7 +751,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
}

@Override
public ResultData poiOrientedPlanList(TenantEntity tenantInfo,Long couponId, Integer pageNum, Integer pageSize) {
public ResultData poiOrientedPlanList(TenantEntity tenantInfo, Long couponId, Integer pageNum, Integer pageSize, boolean isGoodSaas) {
TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),couponId);
if(ttCouponChannelPoi == null || EnumSpuSyncStatus.sync_auditing.getCode().equals(ttCouponChannelPoi.getLastStatus())
|| EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getLastStatus())){
@@ -760,7 +759,12 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
}
try {
Long spu_id = Long.parseLong(ttCouponChannelPoi.getSpuId());
PoiOrientedPlanPage poiOrientedPlanPage = ttMerchantPoiService.getTtWebService(tenantInfo).getPoiPlanService().poiOrientedPlanList(spu_id, pageNum, pageSize);
PoiOrientedPlanPage poiOrientedPlanPage;
if (isGoodSaas) {
poiOrientedPlanPage = ttMerchantPoiService.getTtGoodLifeSassService(tenantInfo).getPoiPlanService().poiOrientedPlanList(spu_id, pageNum, pageSize);
} else {
poiOrientedPlanPage = ttMerchantPoiService.getTtWebService(tenantInfo).getPoiPlanService().poiOrientedPlanList(spu_id, pageNum, pageSize);
}
return new ResultData(poiOrientedPlanPage);
} catch (WxErrorException e) {
e.printStackTrace();
@@ -769,7 +773,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
}

@Override
public ResultData poiPlanSave(TtPoiTakeRate record) {
public ResultData poiPlanSave(TtPoiTakeRate record,boolean isGoodSaas) {
WxCoupon wxCoupon = wxCouponMapper.selectById(record.getCouponId(), record.getTenantId());
if(wxCoupon == null){
return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"未找到该券");
@@ -801,7 +805,13 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
poiPlan.setContentType(record.getContentType());
poiPlan.setCommissionRate(record.getTakeRate());

Long returnPlanId = ttMerchantPoiService.getTtWebService(record).getPoiPlanService().poiPlanSave(poiPlan);
Long returnPlanId;
if (isGoodSaas){
returnPlanId = ttMerchantPoiService.getTtGoodLifeSassService(record).getPoiPlanService().poiPlanSave(poiPlan);
}else {
returnPlanId = ttMerchantPoiService.getTtWebService(record).getPoiPlanService().poiPlanSave(poiPlan);
}

if(returnPlanId != null){
if(record.getId() == null){
record.setId(returnPlanId);
@@ -821,7 +831,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
}

@Override
public ResultData saveOrientedPlan(TtPoiTakeRate record) {
public ResultData saveOrientedPlan(TtPoiTakeRate record, boolean isGoodSaas) {
WxCoupon wxCoupon = wxCouponMapper.selectById(record.getCouponId(), record.getTenantId());
if(wxCoupon == null){
return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"未找到该券");
@@ -845,6 +855,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
}
Long spu_id = Long.parseLong(ttCouponChannelPoi.getSpuId());
TtWebService ttWebService = ttMerchantPoiService.getTtWebService(record);
TtGoodLifeSaasService ttGoodLifeSassService = ttMerchantPoiService.getTtGoodLifeSassService(record);
Long returnPlanId = null;
PoiOrientedPlan poiPlan = new PoiOrientedPlan();
if(record.getId() != null){
@@ -916,7 +927,11 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
poiPlan.setProductList(productList);

if(EnumCpsPlanContentType.LIVE.getCode().equals(record.getContentType())){
returnPlanId = ttWebService.getPoiPlanService().poiOrientedPlanLiveSave(poiPlan);
if (isGoodSaas){
returnPlanId = ttGoodLifeSassService.getPoiPlanService().poiOrientedPlanLiveSave(poiPlan);
}else {
returnPlanId = ttWebService.getPoiPlanService().poiOrientedPlanLiveSave(poiPlan);
}
}else if(EnumCpsPlanContentType.VIDEO.getCode().equals(record.getContentType())){
if(record.getStartTime() != null){
poiPlan.setStartTime(record.getStartTime().getTime()/1000);
@@ -927,7 +942,11 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
if(record.getCommissionDuration() != null){
poiPlan.setCommissionDuration(record.getCommissionDuration());
}
returnPlanId = ttWebService.getPoiPlanService().poiOrientedPlanVideoSave(poiPlan);
if (isGoodSaas){
returnPlanId = ttGoodLifeSassService.getPoiPlanService().poiOrientedPlanVideoSave(poiPlan);
}else {
returnPlanId = ttWebService.getPoiPlanService().poiOrientedPlanVideoSave(poiPlan);
}
}else{
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"带货场景错误");
}
@@ -949,7 +968,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
}

@Override
public ResultData addOrientedPlanDouyin(TtPoiTakeRate record) {
public ResultData addOrientedPlanDouyin(TtPoiTakeRate record, boolean isGoodSaas) {
TtPoiTakeRate takeRate = ttPoiTakeRateMapper.selectById(record.getId(), record.getTenantId());
if(takeRate == null){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未获取到计划");
@@ -968,14 +987,23 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {

try {
TtWebService ttWebService = ttMerchantPoiService.getTtWebService(record);
TtGoodLifeSaasService ttGoodLifeSassService = ttMerchantPoiService.getTtGoodLifeSassService(record);
PoiOrientedPlan poiPlan = new PoiOrientedPlan();
poiPlan.setPlanId(record.getId());
poiPlan.setDouyinIdList(record.getDouyinIdList());
Long returnPlanId = null;
if(EnumCpsPlanContentType.LIVE.getCode().equals(record.getContentType())){
returnPlanId = ttWebService.getPoiPlanService().poiOrientedPlanLiveSave(poiPlan);
if (isGoodSaas){
returnPlanId = ttGoodLifeSassService.getPoiPlanService().poiOrientedPlanLiveSave(poiPlan);
}else {
returnPlanId = ttWebService.getPoiPlanService().poiOrientedPlanLiveSave(poiPlan);
}
}else if(EnumCpsPlanContentType.VIDEO.getCode().equals(record.getContentType())){
returnPlanId = ttWebService.getPoiPlanService().poiOrientedPlanVideoSave(poiPlan);
if (isGoodSaas){
returnPlanId = ttGoodLifeSassService.getPoiPlanService().poiOrientedPlanVideoSave(poiPlan);
}else {
returnPlanId = ttWebService.getPoiPlanService().poiOrientedPlanVideoSave(poiPlan);
}
}

TtPoiTakeRate updTakeRate = new TtPoiTakeRate();
@@ -993,7 +1021,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
}

@Override
public ResultData cancelOrientedPlanDouyin(TtPoiTakeRate record) {
public ResultData cancelOrientedPlanDouyin(TtPoiTakeRate record, boolean isGoodSaas) {
TtPoiTakeRate takeRate = ttPoiTakeRateMapper.selectById(record.getId(), record.getTenantId());
if(takeRate == null){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未获取到计划");
@@ -1006,7 +1034,13 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
douyinMap.put(record.getDouyinId(),EnumCpsPlanStatus.OFF.getCode());
try {
TtWebService ttWebService = ttMerchantPoiService.getTtWebService(record);
boolean b = ttWebService.getPoiPlanService().poiOrientedPlanDeleteTalent(record.getId(), record.getDouyinId());
TtGoodLifeSaasService ttGoodLifeSassService = ttMerchantPoiService.getTtGoodLifeSassService(record);
boolean b;
if (isGoodSaas){
b = ttGoodLifeSassService.getPoiPlanService().poiOrientedPlanDeleteTalent(record.getId(), record.getDouyinId());
}else {
b = ttWebService.getPoiPlanService().poiOrientedPlanDeleteTalent(record.getId(), record.getDouyinId());
}


TtPoiTakeRate updTakeRate = new TtPoiTakeRate();
@@ -1085,9 +1119,14 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
// }

@Override
public ResultData poiPlanUpdateStatus(TtPoiTakeRate record) {
public ResultData poiPlanUpdateStatus(TtPoiTakeRate record, boolean isGoodSaas) {
try {
boolean b = ttMerchantPoiService.getTtWebService(record).getPoiPlanService().poiPlanUpdateStatus(record.getId(), record.getStatus());
boolean b;
if (isGoodSaas){
b = ttMerchantPoiService.getTtGoodLifeSassService(record).getPoiPlanService().poiPlanUpdateStatus(record.getId(), record.getStatus());
}else {
b = ttMerchantPoiService.getTtWebService(record).getPoiPlanService().poiPlanUpdateStatus(record.getId(), record.getStatus());
}
if(b){
TtPoiTakeRate updTakeRate = new TtPoiTakeRate();
updTakeRate.setId(record.getId());
@@ -1107,11 +1146,17 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
}

@Override
public ResultData poiOrientedPlanUpdateStatus(TtPoiTakeRate record) {
public ResultData poiOrientedPlanUpdateStatus(TtPoiTakeRate record, boolean isGoodSaas) {
try {
//仅支持传3,将计划修改为已取消
//仅支持修改直播间定向佣金计划,不支持修改短视频定向佣金计划
boolean b = ttMerchantPoiService.getTtWebService(record).getPoiPlanService().poiOrientedPlanUpdateStatus(record.getId(), record.getStatus());
boolean b;
if (isGoodSaas){
b = ttMerchantPoiService.getTtGoodLifeSassService(record).getPoiPlanService().poiOrientedPlanUpdateStatus(record.getId(), record.getStatus());

}else {
b = ttMerchantPoiService.getTtWebService(record).getPoiPlanService().poiOrientedPlanUpdateStatus(record.getId(), record.getStatus());
}
if(b){
TtPoiTakeRate updTakeRate = new TtPoiTakeRate();
updTakeRate.setId(record.getId());


Loading…
Cancel
Save