| @@ -110,4 +110,37 @@ public class TtPoiPlanController extends BaseController { | |||||
| return ttCouponGoodsService.poiPlanUpdateStatus(getTenantInfo(),planId,status); | return ttCouponGoodsService.poiPlanUpdateStatus(getTenantInfo(),planId,status); | ||||
| } | } | ||||
| @ApiOperation("商品达人分佣配置") | |||||
| @PostMapping("takeRate") | |||||
| @SystemControllerLog(description = "更新") | |||||
| public ResultData takeRate(@RequestBody Map<String, Object> param) { | |||||
| logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::takeRate"); | |||||
| Integer status = (Integer) param.get("status"); | |||||
| if(status == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"状态为空"); | |||||
| } | |||||
| if(status.intValue() != 1 || status.intValue() != 2){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"状态不规范"); | |||||
| } | |||||
| Integer takeRate = (Integer) param.get("takeRate"); | |||||
| if(takeRate == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"抽佣率为空"); | |||||
| } | |||||
| if(takeRate.intValue() < 100 || takeRate.intValue() > 2900){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"抽佣率需在1%-29%之间"); | |||||
| } | |||||
| String douyinId = (String) param.get("douyinId"); | |||||
| if(StringUtils.isBlank(douyinId)){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"抖音号为空"); | |||||
| } | |||||
| String couponIdStr = (String) param.get("couponId"); | |||||
| if(StringUtils.isBlank(couponIdStr)){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"商品Id为空"); | |||||
| } | |||||
| Long couponId = Long.parseLong(couponIdStr); | |||||
| return ttCouponGoodsService.poiTakeRate(getTenantInfo(),couponId,douyinId,takeRate,status); | |||||
| } | |||||
| } | } | ||||
| @@ -34,4 +34,6 @@ public interface TtCouponGoodsService { | |||||
| ResultData poiPlanSave(TenantEntity tenantInfo, Long couponId, Long planId, Integer contentType, Integer commissionRate); | ResultData poiPlanSave(TenantEntity tenantInfo, Long couponId, Long planId, Integer contentType, Integer commissionRate); | ||||
| ResultData poiPlanUpdateStatus(TenantEntity tenantInfo, Long planId, Integer status); | ResultData poiPlanUpdateStatus(TenantEntity tenantInfo, Long planId, Integer status); | ||||
| ResultData poiTakeRate(TenantEntity tenantInfo, Long couponId, String douyinId, Integer takeRate, Integer status); | |||||
| } | } | ||||
| @@ -14,6 +14,7 @@ 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.PoiPlan; | ||||
| import com.iformall.douyin.web.bean.PoiPlanPage; | import com.iformall.douyin.web.bean.PoiPlanPage; | ||||
| import com.iformall.douyin.web.bean.PoiTakeRate; | |||||
| 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.*; | ||||
| @@ -518,5 +519,27 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| } | } | ||||
| } | } | ||||
| @Override | |||||
| public ResultData poiTakeRate(TenantEntity tenantInfo, Long couponId, String douyinId, Integer takeRate, Integer status) { | |||||
| 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 { | |||||
| PoiTakeRate poiTakeRate = new PoiTakeRate(); | |||||
| poiTakeRate.setSpuExtId(couponId.toString()); | |||||
| String spu_id = ttMerchantPoiService.getTtWebService(tenantInfo).getPoiPlanService().poiTakeRate(poiTakeRate); | |||||
| if(StringUtils.isNotBlank(spu_id) && spu_id.equals(ttCouponChannelPoi.getSpuId())){ | |||||
| return new ResultData(); | |||||
| }else{ | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"设置达人分佣错误"); | |||||
| } | |||||
| } catch (WxErrorException e) { | |||||
| e.printStackTrace(); | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -646,12 +646,12 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| // 卡券下架,未使用的卡密要下架 | // 卡券下架,未使用的卡密要下架 | ||||
| couponPasswordMapper.disableByCouponId(record.getId()); | couponPasswordMapper.disableByCouponId(record.getId()); | ||||
| try{ | |||||
| //同步抖音状态 | |||||
| wxCouponChannelService.spuStatusSyncByCoupon(record,record.getId()); | |||||
| }catch(Exception e){ | |||||
| logger.error("send spuStatusSync error: " + e.getMessage()); | |||||
| } | |||||
| // try{ | |||||
| // //同步抖音状态 | |||||
| // wxCouponChannelService.spuStatusSyncByCoupon(record,record.getId()); | |||||
| // }catch(Exception e){ | |||||
| // logger.error("send spuStatusSync error: " + e.getMessage()); | |||||
| // } | |||||
| } | } | ||||
| record.setUpdateDate(new Date()); | record.setUpdateDate(new Date()); | ||||
| wxCouponMapper.updateById(record); | wxCouponMapper.updateById(record); | ||||