Commit b0fc4f9e by yxdubhe_bot

merge:feature-sharer-20250306:operator:wb.xiaoke@mesg.corp.netease.com:auto_bran…

merge:feature-sharer-20250306:operator:wb.xiaoke@mesg.corp.netease.com:auto_branch_merge_by_branchService_end
parents b1b0453a 82f148e5
Pipeline #71962 passed with stages
in 1 minute 15 seconds
...@@ -3,6 +3,7 @@ CREATE TABLE `SHARER_INFO` ...@@ -3,6 +3,7 @@ CREATE TABLE `SHARER_INFO`
( (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID', `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`open_id` varchar(64) NOT NULL DEFAULT '' COMMENT '用户开放ID', `open_id` varchar(64) NOT NULL DEFAULT '' COMMENT '用户开放ID',
`union_id` varchar(64) NOT NULL DEFAULT '' COMMENT '唯一标识符',
`sharer_appid` varchar(64) NOT NULL DEFAULT '' COMMENT '推客应用ID', `sharer_appid` varchar(64) NOT NULL DEFAULT '' COMMENT '推客应用ID',
`bind_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '绑定时间', `bind_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '绑定时间',
`commission_ratio` varchar(32) NOT NULL DEFAULT '' COMMENT '佣金比例', `commission_ratio` varchar(32) NOT NULL DEFAULT '' COMMENT '佣金比例',
......
...@@ -42,8 +42,8 @@ public class LoginUserHelper { ...@@ -42,8 +42,8 @@ public class LoginUserHelper {
/** /**
* 保存用户认证信息 * 保存用户认证信息
*/ */
public void setLoginUserInfo(String token, String openId, String sharerAppId) { public void setLoginUserInfo(String token, String openId, String unionId, String sharerAppId) {
LoginUserInfo loginUserInfo = new LoginUserInfo(token, openId, sharerAppId); LoginUserInfo loginUserInfo = new LoginUserInfo(token, openId, unionId, sharerAppId);
setLoginUserInfo(token, loginUserInfo); setLoginUserInfo(token, loginUserInfo);
} }
......
...@@ -24,6 +24,10 @@ public class LoginUserInfo implements Serializable { ...@@ -24,6 +24,10 @@ public class LoginUserInfo implements Serializable {
*/ */
private String openId; private String openId;
/** /**
* 唯一标识
*/
private String unionId;
/**
* 推客在微信电商平台注册的身份标识 * 推客在微信电商平台注册的身份标识
*/ */
private String sharerAppId; private String sharerAppId;
......
...@@ -12,6 +12,7 @@ import com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.UserCommissionRatio ...@@ -12,6 +12,7 @@ import com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.UserCommissionRatio
import com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.UserTokenVO; import com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.UserTokenVO;
import com.netease.yanxuan.wx.store.sharer.biz.service.IUserService; import com.netease.yanxuan.wx.store.sharer.biz.service.IUserService;
import com.netease.yanxuan.wx.store.sharer.common.exception.NoBindSharerException; import com.netease.yanxuan.wx.store.sharer.common.exception.NoBindSharerException;
import com.netease.yanxuan.wx.store.sharer.common.exception.WeChatException;
import com.netease.yanxuan.wx.store.sharer.dal.mapper.SharerInfoMapper; import com.netease.yanxuan.wx.store.sharer.dal.mapper.SharerInfoMapper;
import com.netease.yanxuan.wx.store.sharer.dal.meta.model.po.SharerInfo; import com.netease.yanxuan.wx.store.sharer.dal.meta.model.po.SharerInfo;
import com.netease.yanxuan.wx.store.sharer.integration.constant.WeChatApi; import com.netease.yanxuan.wx.store.sharer.integration.constant.WeChatApi;
...@@ -34,6 +35,7 @@ import java.math.BigDecimal; ...@@ -34,6 +35,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.Date; import java.util.Date;
/** /**
* @Description 用户-业务实现类 * @Description 用户-业务实现类
* @Author fanjiaxin * @Author fanjiaxin
...@@ -58,6 +60,9 @@ public class UserServiceImpl implements IUserService { ...@@ -58,6 +60,9 @@ public class UserServiceImpl implements IUserService {
Date now = new Date(); Date now = new Date();
// 获取用户信息 // 获取用户信息
WeChatUserInfoVO userInfoVO = weChatUserRequest.handle(bo.getCode()); WeChatUserInfoVO userInfoVO = weChatUserRequest.handle(bo.getCode());
if (null == userInfoVO) {
throw new WeChatException("获取用户信息失败");
}
// 获取本地用户信息 // 获取本地用户信息
LambdaQueryWrapper<SharerInfo> sharerInfoLqw = Wrappers.lambdaQuery(); LambdaQueryWrapper<SharerInfo> sharerInfoLqw = Wrappers.lambdaQuery();
sharerInfoLqw.eq(SharerInfo::getOpenId, userInfoVO.getOpenid()); sharerInfoLqw.eq(SharerInfo::getOpenId, userInfoVO.getOpenid());
...@@ -70,18 +75,29 @@ public class UserServiceImpl implements IUserService { ...@@ -70,18 +75,29 @@ public class UserServiceImpl implements IUserService {
sharerInfo.setCommissionRatio(drmSharerConfig.getDefaultCommissionRatio().toPlainString()); sharerInfo.setCommissionRatio(drmSharerConfig.getDefaultCommissionRatio().toPlainString());
sharerInfo.setCommissionType(CommissionTypeEnum.PLATFORM.getCode()); sharerInfo.setCommissionType(CommissionTypeEnum.PLATFORM.getCode());
sharerInfo.setCreateTime(now); sharerInfo.setCreateTime(now);
sharerInfo.setUpdateTime(now); }
sharerInfo.setUnionId(userInfoVO.getUnionid());
sharerInfo.setUpdateTime(now);
if (null == sharerInfo.getId()) {
sharerInfoMapper.insert(sharerInfo); sharerInfoMapper.insert(sharerInfo);
} else {
sharerInfoMapper.updateById(sharerInfo);
} }
// 生成token // 生成token
String token = LoginUserContextHolder.generateToken(bo.getCode(), sharerInfo.getOpenId()); String token = LoginUserContextHolder.generateToken(bo.getCode(), sharerInfo.getOpenId());
loginUserHelper.setLoginUserInfo(token, sharerInfo.getOpenId(), null); loginUserHelper.setLoginUserInfo(token, sharerInfo.getOpenId(), sharerInfo.getUnionId(), sharerInfo.getSharerAppid());
return UserTokenVO.builder().token(token).build(); return UserTokenVO.builder().token(token).build();
} }
@Override @Override
public SharerInfoVO refreshUserInfo() { public SharerInfoVO refreshUserInfo() {
LoginUserInfo loginUserInfo = LoginUserContextHolder.get(); LoginUserInfo loginUserInfo = LoginUserContextHolder.get();
if (loginUserInfo == null) {
log.error("[op:refreshUserInfo] refreshUserInfo loginUserInfo = null");
return null;
}
log.info("[op:refreshUserInfo] refresh user commission userOpenId={}, userUnionId={}, shareId={}",
loginUserInfo.getOpenId(), loginUserInfo.getUnionId(), loginUserInfo.getSharerAppId());
// 获取本地用户信息 // 获取本地用户信息
LambdaQueryWrapper<SharerInfo> sharerInfoLqw = Wrappers.lambdaQuery(); LambdaQueryWrapper<SharerInfo> sharerInfoLqw = Wrappers.lambdaQuery();
sharerInfoLqw.eq(SharerInfo::getOpenId, loginUserInfo.getOpenId()); sharerInfoLqw.eq(SharerInfo::getOpenId, loginUserInfo.getOpenId());
...@@ -92,6 +108,7 @@ public class UserServiceImpl implements IUserService { ...@@ -92,6 +108,7 @@ public class UserServiceImpl implements IUserService {
if (null == sharerInfo) { if (null == sharerInfo) {
sharerInfo = new SharerInfo(); sharerInfo = new SharerInfo();
sharerInfo.setOpenId(loginUserInfo.getOpenId()); sharerInfo.setOpenId(loginUserInfo.getOpenId());
sharerInfo.setUnionId(loginUserInfo.getUnionId());
} }
WeChatSharerInfoVO sharerInfoVO; WeChatSharerInfoVO sharerInfoVO;
Date now = new Date(); Date now = new Date();
...@@ -110,6 +127,7 @@ public class UserServiceImpl implements IUserService { ...@@ -110,6 +127,7 @@ public class UserServiceImpl implements IUserService {
BigDecimal commissionRatio = sharerCommissionRatio BigDecimal commissionRatio = sharerCommissionRatio
.multiply(new BigDecimal(WeChatApi.WECHAT_COMMISSION_RATIO_MULTIPLIER)) .multiply(new BigDecimal(WeChatApi.WECHAT_COMMISSION_RATIO_MULTIPLIER))
.setScale(0, RoundingMode.DOWN); .setScale(0, RoundingMode.DOWN);
log.info("op:refreshUserInfo:setSharerCommission,openId:{}", loginUserInfo.getOpenId());
// 设置推客分佣比例 // 设置推客分佣比例
weChatShopSetSharerCommissionRequest.handle(sharerInfoVO.getSharer_appid(), weChatShopSetSharerCommissionRequest.handle(sharerInfoVO.getSharer_appid(),
commissionRatio.longValue()); commissionRatio.longValue());
...@@ -131,16 +149,15 @@ public class UserServiceImpl implements IUserService { ...@@ -131,16 +149,15 @@ public class UserServiceImpl implements IUserService {
} }
} }
} }
sharerInfo.setUpdateTime(now);
// 初始化保存 // 初始化保存
if (null == sharerInfo.getId()) { if (null == sharerInfo.getId()) {
// 默认佣金比例 // 默认佣金比例
sharerInfo.setCommissionRatio(sharerCommissionRatio.toPlainString()); sharerInfo.setCommissionRatio(sharerCommissionRatio.toPlainString());
sharerInfo.setCommissionType(CommissionTypeEnum.PLATFORM.getCode()); sharerInfo.setCommissionType(CommissionTypeEnum.PLATFORM.getCode());
sharerInfo.setCreateTime(now); sharerInfo.setCreateTime(now);
sharerInfo.setUpdateTime(now);
sharerInfoMapper.insert(sharerInfo); sharerInfoMapper.insert(sharerInfo);
} else { } else {
sharerInfo.setUpdateTime(now);
sharerInfoMapper.updateById(sharerInfo); sharerInfoMapper.updateById(sharerInfo);
} }
return result; return result;
...@@ -175,7 +192,8 @@ public class UserServiceImpl implements IUserService { ...@@ -175,7 +192,8 @@ public class UserServiceImpl implements IUserService {
if (StringUtils.isBlank(loginUserInfo.getSharerAppId())) { if (StringUtils.isBlank(loginUserInfo.getSharerAppId())) {
throw new NoBindSharerException("未绑定推客"); throw new NoBindSharerException("未绑定推客");
} }
BigDecimal sharerCommissionRatio = drmSharerConfig.getSharerCommissionRatio(loginUserInfo.getOpenId()); log.info("op:bindCommissionRatioDefault:setSharerCommission,openId:{}", loginUserInfo.getOpenId());
BigDecimal sharerCommissionRatio = drmSharerConfig.getSharerCommissionRatioOrDefault(loginUserInfo.getOpenId());
BigDecimal commissionRatio = sharerCommissionRatio BigDecimal commissionRatio = sharerCommissionRatio
.multiply(new BigDecimal(WeChatApi.WECHAT_COMMISSION_RATIO_MULTIPLIER)) .multiply(new BigDecimal(WeChatApi.WECHAT_COMMISSION_RATIO_MULTIPLIER))
.setScale(0, RoundingMode.DOWN); .setScale(0, RoundingMode.DOWN);
......
...@@ -16,12 +16,15 @@ ...@@ -16,12 +16,15 @@
source="log.maxHistory"/> source="log.maxHistory"/>
<springProperty scope="context" name="log.maxSize" <springProperty scope="context" name="log.maxSize"
source="log.maxSize"/> source="log.maxSize"/>
<property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%p] [%X{XTraceId}] [%X{traceId}] [%t] [%c{0}] %m%n" />
<statusListener class="ch.qos.logback.core.status.NopStatusListener" />
<!--日志平台应用日志标准格式--> <!--日志平台应用日志标准格式-->
<property name="patternValue" <property name="patternValue"
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%p] [%X{XTraceId}] %m%n"/> value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%p] [%X{XTraceId}] %m%n"/>
<!-- 控制台输出 --> <!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>
<pattern>${patternValue}</pattern> <pattern>${patternValue}</pattern>
...@@ -30,37 +33,118 @@ ...@@ -30,37 +33,118 @@
</appender> </appender>
<!--默认日志输出 --> <!--默认日志输出 -->
<appender name="default" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/default.log</file>
<appender name="stdinfo" class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoder>
<pattern>${log.pattern}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/default.%d{yyyy-MM-dd}.%i.log</fileNamePattern> <fileNamePattern>${log.path}/info.log.%d{yyyy-MM-dd}.gz</fileNamePattern>
<maxHistory>${log.maxHistory}</maxHistory> <maxHistory>60</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>${log.maxSize}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy> </rollingPolicy>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="asyn-stdinfo" class="ch.qos.logback.classic.AsyncAppender">
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
<queueSize>256</queueSize>
<discardingThreshold>0</discardingThreshold>
<appender-ref ref="stdinfo" />
</appender>
<appender name="stdwarn" class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoder> <encoder>
<pattern>${patternValue}</pattern> <pattern>${log.pattern}</pattern>
<charset>UTF-8</charset> <charset>UTF-8</charset>
</encoder> </encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/warn.log.%d{yyyy-MM-dd}.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>WARN</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender> </appender>
<!--默认异步日志输出 --> <appender name="asyn-stdwarn" class="ch.qos.logback.classic.AsyncAppender">
<appender name="default_ASYNC" class="ch.qos.logback.classic.AsyncAppender"> <!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 --> <queueSize>256</queueSize>
<discardingThreshold>0</discardingThreshold> <discardingThreshold>0</discardingThreshold>
<appender-ref ref="stdwarn" />
</appender>
<appender name="stderr" class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoder>
<pattern>${log.pattern}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/error.log.%d{yyyy-MM-dd}.gz</fileNamePattern>
<maxHistory>60</maxHistory>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="asyn-stderr" class="ch.qos.logback.classic.AsyncAppender">
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 --> <!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
<queueSize>512</queueSize> <queueSize>256</queueSize>
<!-- 提取调用者数据 --> <discardingThreshold>0</discardingThreshold>
<includeCallerData>true</includeCallerData> <appender-ref ref="stderr" />
<!-- 添加附加的appender,最多只能添加一个 --> </appender>
<appender-ref ref="default"/>
<appender name="drm" class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoder>
<pattern>${log.pattern}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/drm.log.%d{yyyy-MM-dd}.gz</fileNamePattern>
<maxHistory>7</maxHistory>
</rollingPolicy>
</appender>
<logger name="com.ctrip.framework.apollo" additivity="false" level="info">
<appender-ref ref="drm" />
</logger>
<appender name="dschedule" class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoder>
<pattern>${log.pattern}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/dschedule.log.%d{yyyy-MM-dd}.gz</fileNamePattern>
<maxHistory>7</maxHistory>
</rollingPolicy>
</appender> </appender>
<root level="${log.level}"> <root level="${log.level}">
<appender-ref ref="console"/> <appender-ref ref="asyn-stdinfo" />
<appender-ref ref="default_ASYNC"/> <appender-ref ref="asyn-stdwarn" />
<appender-ref ref="asyn-stderr" />
</root> </root>
<springProfile name="dev">
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<logger name="com.netease.yanxuan.prom.admin" level="debug" additivity="true" >
<appender-ref ref="console"/>
</logger>
</springProfile>
</configuration> </configuration>
...@@ -17,7 +17,7 @@ public interface HttpStatusConstant { ...@@ -17,7 +17,7 @@ public interface HttpStatusConstant {
/** /**
* 未绑定推客 * 未绑定推客
*/ */
int UNAUTHSHARER = 40101; int NO_BIND_SHARER = 40101;
/** /**
* 失败标记 * 失败标记
......
...@@ -25,8 +25,6 @@ public class GlobalExceptionHandler { ...@@ -25,8 +25,6 @@ public class GlobalExceptionHandler {
*/ */
@ExceptionHandler(NoAuthException.class) @ExceptionHandler(NoAuthException.class)
public Result<Void> handleNoAuthException(NoAuthException e, HttpServletRequest request) { public Result<Void> handleNoAuthException(NoAuthException e, HttpServletRequest request) {
String requestURI = request.getRequestURI();
log.error("请求地址'{}',认证失败'{}',无法访问系统资源", requestURI, e.getMessage());
return Result.fail(HttpStatusConstant.UNAUTHORIZED, "认证失败,无法访问系统资源"); return Result.fail(HttpStatusConstant.UNAUTHORIZED, "认证失败,无法访问系统资源");
} }
...@@ -35,9 +33,7 @@ public class GlobalExceptionHandler { ...@@ -35,9 +33,7 @@ public class GlobalExceptionHandler {
*/ */
@ExceptionHandler(NoBindSharerException.class) @ExceptionHandler(NoBindSharerException.class)
public Result<Void> handleNoBindSharerException(NoBindSharerException e, HttpServletRequest request) { public Result<Void> handleNoBindSharerException(NoBindSharerException e, HttpServletRequest request) {
String requestURI = request.getRequestURI(); return Result.fail(HttpStatusConstant.NO_BIND_SHARER, "未授权推客");
log.error("请求地址'{}',认证失败'{}',无法访问系统资源", requestURI, e.getMessage());
return Result.fail(HttpStatusConstant.UNAUTHSHARER, "未授权推客");
} }
/** /**
......
...@@ -29,6 +29,10 @@ public class SharerInfo implements Serializable { ...@@ -29,6 +29,10 @@ public class SharerInfo implements Serializable {
*/ */
private String openId; private String openId;
/** /**
* 唯一标识
*/
private String unionId;
/**
* 推客应用ID * 推客应用ID
*/ */
private String sharerAppid; private String sharerAppid;
......
package com.netease.yanxuan.wx.store.sharer.integration.handler.impl; package com.netease.yanxuan.wx.store.sharer.integration.handler.impl;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONObject;
import com.netease.yanxuan.wx.store.sharer.integration.config.WeChatConfig; import com.netease.yanxuan.wx.store.sharer.integration.config.WeChatConfig;
import com.netease.yanxuan.wx.store.sharer.integration.constant.WeChatApi; import com.netease.yanxuan.wx.store.sharer.integration.constant.WeChatApi;
import com.netease.yanxuan.wx.store.sharer.integration.core.WeChatContextHolder; import com.netease.yanxuan.wx.store.sharer.integration.core.WeChatContextHolder;
...@@ -8,10 +12,9 @@ import com.netease.yanxuan.wx.store.sharer.integration.handler.WeChatRestTemplat ...@@ -8,10 +12,9 @@ import com.netease.yanxuan.wx.store.sharer.integration.handler.WeChatRestTemplat
import com.netease.yanxuan.wx.store.sharer.integration.meta.enums.CommissionTypeEnum; import com.netease.yanxuan.wx.store.sharer.integration.meta.enums.CommissionTypeEnum;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.WeChatSetSharerCommissionBO; import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.WeChatSetSharerCommissionBO;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatCoreVO; import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatCoreVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
/** /**
* @Description 设置推客的分佣比例信息 * @Description 设置推客的分佣比例信息
...@@ -48,6 +51,9 @@ public class WeChatShopSetSharerCommissionRequest implements IWeChatRequest { ...@@ -48,6 +51,9 @@ public class WeChatShopSetSharerCommissionRequest implements IWeChatRequest {
.commission_type(CommissionTypeEnum.PLATFORM.getCode()) .commission_type(CommissionTypeEnum.PLATFORM.getCode())
.commission_ratio(commissionRatio) .commission_ratio(commissionRatio)
.build(); .build();
return weChatRestTemplateHandler.execute(getRequestUrl(), getRequestMethod(), params, WeChatCoreVO.class); log.info("[op:WeChatShopSetSharerCommissionRequest.handle] requestParam={}", JSONObject.toJSONString(params));
WeChatCoreVO res = weChatRestTemplateHandler.execute(getRequestUrl(), getRequestMethod(), params, WeChatCoreVO.class);
log.info("[op:WeChatShopSetSharerCommissionRequest.handle] res={}", JSONObject.toJSONString(res));
return res;
} }
} }
package com.netease.yanxuan.wx.store.sharer.integration.handler.impl; package com.netease.yanxuan.wx.store.sharer.integration.handler.impl;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONObject;
import com.netease.yanxuan.wx.store.sharer.integration.config.WeChatConfig; import com.netease.yanxuan.wx.store.sharer.integration.config.WeChatConfig;
import com.netease.yanxuan.wx.store.sharer.integration.constant.WeChatApi; import com.netease.yanxuan.wx.store.sharer.integration.constant.WeChatApi;
import com.netease.yanxuan.wx.store.sharer.integration.core.WeChatContextHolder; import com.netease.yanxuan.wx.store.sharer.integration.core.WeChatContextHolder;
...@@ -7,10 +11,9 @@ import com.netease.yanxuan.wx.store.sharer.integration.handler.IWeChatRequest; ...@@ -7,10 +11,9 @@ import com.netease.yanxuan.wx.store.sharer.integration.handler.IWeChatRequest;
import com.netease.yanxuan.wx.store.sharer.integration.handler.WeChatRestTemplateHandler; import com.netease.yanxuan.wx.store.sharer.integration.handler.WeChatRestTemplateHandler;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.WeChatSetSharerProductCommissionBO; import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.WeChatSetSharerProductCommissionBO;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatCoreVO; import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatCoreVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
/** /**
* @Description 设置推客的单个商品的分佣比例信息 * @Description 设置推客的单个商品的分佣比例信息
...@@ -47,6 +50,9 @@ public class WeChatShopSetSharerProductCommissionRequest implements IWeChatReque ...@@ -47,6 +50,9 @@ public class WeChatShopSetSharerProductCommissionRequest implements IWeChatReque
.product_id(productId) .product_id(productId)
.commission_ratio(commissionRatio) .commission_ratio(commissionRatio)
.build(); .build();
return weChatRestTemplateHandler.execute(getRequestUrl(), getRequestMethod(), params, WeChatCoreVO.class); log.info("[op:WeChatShopSetSharerProductCommissionRequest.handle] requestParam={}", JSONObject.toJSONString(params));
WeChatCoreVO res = weChatRestTemplateHandler.execute(getRequestUrl(), getRequestMethod(), params, WeChatCoreVO.class);
log.info("[op:WeChatShopSetSharerProductCommissionRequest.handle] res={}", JSONObject.toJSONString(res));
return res;
} }
} }
package com.netease.yanxuan.wx.store.sharer.integration.handler.impl; package com.netease.yanxuan.wx.store.sharer.integration.handler.impl;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONObject;
import com.netease.yanxuan.wx.store.sharer.integration.config.WeChatConfig; import com.netease.yanxuan.wx.store.sharer.integration.config.WeChatConfig;
import com.netease.yanxuan.wx.store.sharer.integration.constant.WeChatApi; import com.netease.yanxuan.wx.store.sharer.integration.constant.WeChatApi;
import com.netease.yanxuan.wx.store.sharer.integration.core.WeChatContextHolder; import com.netease.yanxuan.wx.store.sharer.integration.core.WeChatContextHolder;
...@@ -7,10 +11,9 @@ import com.netease.yanxuan.wx.store.sharer.integration.handler.IWeChatRequest; ...@@ -7,10 +11,9 @@ import com.netease.yanxuan.wx.store.sharer.integration.handler.IWeChatRequest;
import com.netease.yanxuan.wx.store.sharer.integration.handler.WeChatRestTemplateHandler; import com.netease.yanxuan.wx.store.sharer.integration.handler.WeChatRestTemplateHandler;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.WeChatSharerListBO; import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.WeChatSharerListBO;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatSharerListVO; import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatSharerListVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
/** /**
* @Description 获取机构绑定的推客信息 * @Description 获取机构绑定的推客信息
...@@ -47,6 +50,9 @@ public class WeChatShopSharerListRequest implements IWeChatRequest { ...@@ -47,6 +50,9 @@ public class WeChatShopSharerListRequest implements IWeChatRequest {
.next_key(nextKey) .next_key(nextKey)
.page_size(pageSize) .page_size(pageSize)
.build(); .build();
return weChatRestTemplateHandler.execute(getRequestUrl(), getRequestMethod(), params, WeChatSharerListVO.class); log.info("[op:WeChatShopSharerListRequest.handle] requestParam={}", JSONObject.toJSONString(params));
WeChatSharerListVO res = weChatRestTemplateHandler.execute(getRequestUrl(), getRequestMethod(), params, WeChatSharerListVO.class);
log.info("[op:WeChatShopSharerListRequest.res] res={}", JSONObject.toJSONString(res));
return res;
} }
} }
package com.netease.yanxuan.wx.store.sharer.integration.handler.impl; package com.netease.yanxuan.wx.store.sharer.integration.handler.impl;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONObject;
import com.netease.yanxuan.wx.store.sharer.integration.config.WeChatConfig; import com.netease.yanxuan.wx.store.sharer.integration.config.WeChatConfig;
import com.netease.yanxuan.wx.store.sharer.integration.constant.WeChatApi; import com.netease.yanxuan.wx.store.sharer.integration.constant.WeChatApi;
import com.netease.yanxuan.wx.store.sharer.integration.core.WeChatContextHolder; import com.netease.yanxuan.wx.store.sharer.integration.core.WeChatContextHolder;
...@@ -7,10 +11,9 @@ import com.netease.yanxuan.wx.store.sharer.integration.handler.IWeChatRequest; ...@@ -7,10 +11,9 @@ import com.netease.yanxuan.wx.store.sharer.integration.handler.IWeChatRequest;
import com.netease.yanxuan.wx.store.sharer.integration.handler.WeChatRestTemplateHandler; import com.netease.yanxuan.wx.store.sharer.integration.handler.WeChatRestTemplateHandler;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.WeChatSharerRegisterBindBO; import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.WeChatSharerRegisterBindBO;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatSharerRegisterBindVO; import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatSharerRegisterBindVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
/** /**
* @Description 微信凭证请求 * @Description 微信凭证请求
...@@ -46,6 +49,9 @@ public class WeChatShopSharerRegisterBindRequest implements IWeChatRequest { ...@@ -46,6 +49,9 @@ public class WeChatShopSharerRegisterBindRequest implements IWeChatRequest {
.is_simple_register(true) .is_simple_register(true)
.sharer_openid(sharerOpenid) .sharer_openid(sharerOpenid)
.build(); .build();
return weChatRestTemplateHandler.execute(getRequestUrl(), getRequestMethod(), params, WeChatSharerRegisterBindVO.class); log.info("[op:WeChatShopSharerRegisterBindRequest.handle] requestParam={}", JSONObject.toJSONString(params));
WeChatSharerRegisterBindVO res = weChatRestTemplateHandler.execute(getRequestUrl(), getRequestMethod(), params, WeChatSharerRegisterBindVO.class);
log.info("[op:WeChatShopSharerRegisterBindRequest.handle] res={}", JSONObject.toJSONString(res));
return res;
} }
} }
...@@ -6,8 +6,7 @@ ...@@ -6,8 +6,7 @@
*/ */
package com.netease.yanxuan.wx.store.sharer.web.controller; package com.netease.yanxuan.wx.store.sharer.web.controller;
import com.netease.yanxuan.wx.store.sharer.common.core.Result; import com.netease.yanxuan.wx.store.sharer.biz.core.LoginUserHelper;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatUserInfoVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -19,10 +18,6 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -19,10 +18,6 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/sharer/test") @RequestMapping("/sharer/test")
@RequiredArgsConstructor @RequiredArgsConstructor
public class TestController { public class TestController {
private final LoginUserHelper loginUserHelper;
@RequestMapping("/token")
public Result<WeChatUserInfoVO> token() {
return Result.ok();
}
} }
\ No newline at end of file
package com.netease.yanxuan.wx.store.sharer.web.controller; package com.netease.yanxuan.wx.store.sharer.web.controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.netease.yanxuan.wx.store.sharer.biz.meta.model.bo.LoginBO; import com.netease.yanxuan.wx.store.sharer.biz.meta.model.bo.LoginBO;
import com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.SharerInfoVO; import com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.SharerInfoVO;
import com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.UserCommissionRatioVO; import com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.UserCommissionRatioVO;
import com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.UserTokenVO; import com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.UserTokenVO;
import com.netease.yanxuan.wx.store.sharer.biz.service.IUserService; import com.netease.yanxuan.wx.store.sharer.biz.service.IUserService;
import com.netease.yanxuan.wx.store.sharer.common.core.Result; import com.netease.yanxuan.wx.store.sharer.common.core.Result;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/** /**
* @Description 用户-控制器 * @Description 用户-控制器
...@@ -21,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -21,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
@RequiredArgsConstructor @RequiredArgsConstructor
@RestController @RestController
@RequestMapping("/sharer/user") @RequestMapping("/sharer/user")
@Slf4j
public class UserController extends BaseController { public class UserController extends BaseController {
private final IUserService iUserService; private final IUserService iUserService;
...@@ -65,6 +69,7 @@ public class UserController extends BaseController { ...@@ -65,6 +69,7 @@ public class UserController extends BaseController {
*/ */
@PostMapping("/bindCommissionRatioDefault") @PostMapping("/bindCommissionRatioDefault")
public Result<UserCommissionRatioVO> bindCommissionRatioDefault() { public Result<UserCommissionRatioVO> bindCommissionRatioDefault() {
log.info("[op:bindCommissionRatioDefault] bind ratioDefault bind");
iUserService.bindCommissionRatioDefault(); iUserService.bindCommissionRatioDefault();
return Result.ok(); return Result.ok();
} }
......
...@@ -6,6 +6,6 @@ spring: ...@@ -6,6 +6,6 @@ spring:
log: log:
level: info level: info
path: /home/logs/tob-galaxy-material path: /home/logs/yanxuan-wx-store-sharer
maxHistory: 15 maxHistory: 15
maxSize: 200MB maxSize: 200MB
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment