Commit 4d1825c6 by 刘运星

change: 日志配置

parent 28e775af
package com.netease.yanxuan.wx.store.sharer.biz.service.impl;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.netease.yanxuan.wx.store.sharer.biz.config.DrmSharerConfig;
......@@ -24,15 +32,9 @@ import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatShare
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatSharerListVO;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatSharerRegisterBindVO;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatUserInfoVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
/**
* @Description 用户-业务实现类
......@@ -83,6 +85,12 @@ public class UserServiceImpl implements IUserService {
@Override
public SharerInfoVO refreshUserInfo() {
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();
sharerInfoLqw.eq(SharerInfo::getOpenId, loginUserInfo.getOpenId());
......
......@@ -22,6 +22,7 @@
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%p] [%X{XTraceId}] %m%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${patternValue}</pattern>
......@@ -30,36 +31,106 @@
</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">
<fileNamePattern>${log.path}/default.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxHistory>${log.maxHistory}</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>${log.maxSize}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<fileNamePattern>${log.path}/stdinfo.log.%d{yyyy-MM-dd}.gz</fileNamePattern>
<maxHistory>60</maxHistory>
</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>
<pattern>${patternValue}</pattern>
<pattern>${log.pattern}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/stdwarn.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 name="default_ASYNC" class="ch.qos.logback.classic.AsyncAppender">
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
<appender name="asyn-stdwarn" class="ch.qos.logback.classic.AsyncAppender">
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
<queueSize>256</queueSize>
<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}/stderr.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 -->
<queueSize>512</queueSize>
<!-- 提取调用者数据 -->
<includeCallerData>true</includeCallerData>
<!-- 添加附加的appender,最多只能添加一个 -->
<appender-ref ref="default"/>
<queueSize>256</queueSize>
<discardingThreshold>0</discardingThreshold>
<appender-ref ref="stderr" />
</appender>
<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>
<root level="${log.level}">
<appender-ref ref="console"/>
<appender-ref ref="default_ASYNC"/>
<appender-ref ref="asyn-stdinfo" />
<appender-ref ref="asyn-stdwarn" />
<appender-ref ref="asyn-stderr" />
</root>
</configuration>
......
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.constant.WeChatApi;
import com.netease.yanxuan.wx.store.sharer.integration.core.WeChatContextHolder;
......@@ -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.model.bo.WeChatSetSharerCommissionBO;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatCoreVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
/**
* @Description 设置推客的分佣比例信息
......@@ -48,6 +51,9 @@ public class WeChatShopSetSharerCommissionRequest implements IWeChatRequest {
.commission_type(CommissionTypeEnum.PLATFORM.getCode())
.commission_ratio(commissionRatio)
.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;
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.constant.WeChatApi;
import com.netease.yanxuan.wx.store.sharer.integration.core.WeChatContextHolder;
......@@ -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.meta.model.bo.WeChatSetSharerProductCommissionBO;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatCoreVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
/**
* @Description 设置推客的单个商品的分佣比例信息
......@@ -47,6 +50,9 @@ public class WeChatShopSetSharerProductCommissionRequest implements IWeChatReque
.product_id(productId)
.commission_ratio(commissionRatio)
.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;
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.constant.WeChatApi;
import com.netease.yanxuan.wx.store.sharer.integration.core.WeChatContextHolder;
......@@ -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.meta.model.bo.WeChatSharerListBO;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatSharerListVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
/**
* @Description 获取机构绑定的推客信息
......@@ -47,6 +50,9 @@ public class WeChatShopSharerListRequest implements IWeChatRequest {
.next_key(nextKey)
.page_size(pageSize)
.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;
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.constant.WeChatApi;
import com.netease.yanxuan.wx.store.sharer.integration.core.WeChatContextHolder;
......@@ -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.meta.model.bo.WeChatSharerRegisterBindBO;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatSharerRegisterBindVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
/**
* @Description 微信凭证请求
......@@ -46,6 +49,9 @@ public class WeChatShopSharerRegisterBindRequest implements IWeChatRequest {
.is_simple_register(true)
.sharer_openid(sharerOpenid)
.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;
}
}
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.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.UserTokenVO;
import com.netease.yanxuan.wx.store.sharer.biz.service.IUserService;
import com.netease.yanxuan.wx.store.sharer.common.core.Result;
import lombok.RequiredArgsConstructor;
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 lombok.extern.slf4j.Slf4j;
/**
* @Description 用户-控制器
......@@ -21,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
@RequiredArgsConstructor
@RestController
@RequestMapping("/sharer/user")
@Slf4j
public class UserController extends BaseController {
private final IUserService iUserService;
......@@ -65,6 +69,7 @@ public class UserController extends BaseController {
*/
@PostMapping("/bindCommissionRatioDefault")
public Result<UserCommissionRatioVO> bindCommissionRatioDefault() {
log.info("[op:bindCommissionRatioDefault] bind ratioDefault bind");
iUserService.bindCommissionRatioDefault();
return Result.ok();
}
......
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