Authored by csgyoho

Merge branch 'dev_180508_联盟红人推广' of http://git.yoho.cn/yoho30/yohobuy-union into dev_180508_联盟红人推广

... ... @@ -84,6 +84,8 @@
<value>/UnionShareRest/querySettlementRecord</value>
<value>/UnionShareRest/queryOrderList</value>
<value>/UnionShareRest/queryUnionShareOrders</value>
<value>/UnionShareRest/mqUnionShareOrder</value>
<value>/UnionShareRest/mqUnionSettleUpdate</value>
</list>
</property>
... ...
... ... @@ -54,4 +54,6 @@ public interface UnionShareOrdersMapper {
List<UnionShareOrders> selectRecentlyOrderLimitTen(@Param("uid") int uid);
List<UnionShareOrders> selectOrderList(@Param("params") UnionShareOrderReqBO unionShareOrderReqBO);
Integer selectOrderListCount(@Param("params") UnionShareOrderReqBO unionShareOrderReqBO);
}
\ No newline at end of file
... ...
... ... @@ -26,4 +26,6 @@ public interface UnionShareSettlementMapper {
int updateByPrimaryKey(UnionShareSettlement record);
List<UnionShareSettlement> selectSettlementRecordByUid(@Param("uid") int uid, @Param("start") Integer start, @Param("size") Integer size);
Integer selectSettlementRecordCount(@Param("uid") Integer uid);
}
\ No newline at end of file
... ...
... ... @@ -318,4 +318,38 @@
order by order_time desc
limit #{params.start,jdbcType=INTEGER}, #{params.size,jdbcType=INTEGER}
</select>
<select id="selectOrderListCount" resultType="java.lang.Integer">
select
count(1)
from union_share_orders
where promote_uid = #{params.uid,jdbcType=INTEGER}
<if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 0">
AND status != 100
</if>
<if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 1">
AND status = 10
</if>
<if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 2">
AND status = 20
</if>
<if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 3">
AND status IN (30,40)
</if>
<if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 0">
AND status IN (10,20,30,40)
</if>
<if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 1">
AND status = 10
</if>
<if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 2">
AND status = 20
</if>
<if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 3">
AND status IN (30,40)
</if>
<if test="params.tab1 != null and params.tab1 == 3">
AND status IN (91,92,93)
</if>
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -140,4 +140,11 @@
order by settlement_time desc
limit #{start,jdbcType=INTEGER}, #{size,jdbcType=INTEGER}
</select>
<select id="selectSettlementRecordCount" resultType="java.lang.Integer">
select
count(1)
from union_share_settlement
where promote_uid = #{uid,jdbcType=INTEGER}
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -17,7 +17,7 @@ import java.util.List;
@Component
public class UnionSettleUpdateConsumer implements YhConsumer {
private Logger logger = LoggerFactory.getLogger(UnionSettleUpdateConsumer.class);
private Logger logger = LoggerFactory.getLogger("cps_mq");
@Autowired
private IUnionShareService unionShareService;
... ...
... ... @@ -17,7 +17,7 @@ import java.util.List;
@Component
public class UnionShareOrderConsumer implements YhConsumer {
private Logger logger = LoggerFactory.getLogger(UnionShareOrderConsumer.class);
private Logger logger = LoggerFactory.getLogger("cps_mq");
@Autowired
private IUnionShareService unionShareService;
... ...
package com.yoho.unions.server.restapi;
import com.yoho.core.common.utils.JsonUtil;
import com.yoho.service.model.union.bo.ShareOrderBo;
import com.yoho.service.model.union.bo.ShareSettlementBo;
import com.yoho.service.model.union.bo.ShareUserSettlementInfoBo;
import com.yoho.service.model.union.request.UnionShareOrderReqBO;
import com.yoho.service.model.union.request.UnionShareOrderSearchReqBO;
import com.yoho.service.model.union.response.PageResponseBO;
import com.yoho.service.model.union.response.PageUnionShareOrderRspBO;
import com.yoho.service.model.union.response.UnionResponse;
import com.yoho.unions.common.ApiResponse;
... ... @@ -32,6 +35,8 @@ public class UnionShareRest {
private static Logger log = LoggerFactory.getLogger(UnionShareRest.class);
private static Logger mqlog = LoggerFactory.getLogger("cps_mq");
@Autowired
IUnionShareService unionShareService;
... ... @@ -120,7 +125,7 @@ public class UnionShareRest {
if (null == unionShareOrderReqBO || null == unionShareOrderReqBO.getUid()){
return new UnionResponse(400, "querySettlementRecord params is null");
}
List<UnionShareSettlement> unionShareSettlement = unionShareService.querySettlementRecord(unionShareOrderReqBO);
PageResponseBO<UnionShareSettlement> unionShareSettlement = unionShareService.querySettlementRecord(unionShareOrderReqBO);
return new UnionResponse(200, "querySettlementRecord success",unionShareSettlement);
}
... ... @@ -138,7 +143,48 @@ public class UnionShareRest {
if (null == unionShareOrderReqBO || null == unionShareOrderReqBO.getUid()){
return new UnionResponse(400, "queryOrderList params is null");
}
List<UnionShareOrders> unionShareOrdersList = unionShareService.queryOrderList(unionShareOrderReqBO);
PageResponseBO<UnionShareOrders> unionShareOrdersList = unionShareService.queryOrderList(unionShareOrderReqBO);
return new UnionResponse(200, "queryOrderList success",unionShareOrdersList);
}
@RequestMapping("/mqUnionShareOrder")
@ResponseBody
public UnionResponse mqUnionShareOrder(@RequestBody List<ShareOrderBo> list){
mqlog.info("UnionShareRest.mqUnionShareOrder req is {}", JsonUtil.objectToJSON(list));
try {
if (null == list) {
return new UnionResponse(500, "mqUnionShareOrder error,req is null");
}
list.forEach(l->{
try {
//订单插入或更新
unionShareService.saveOrUpdateOrder(l);
} catch (Exception e) {
mqlog.info("UnionShareRest.mqUnionShareOrder fail! bo is {}, e {}", l,e.getMessage());
}
});
} catch (Exception e) {
mqlog.warn("UnionShareRest.mqUnionShareOrder fail! str is {}, e {}",JsonUtil.objectToJSON(list),e.getMessage());
}
return new UnionResponse(200, "mqUnionShareOrder success");
}
@RequestMapping("/mqUnionSettleUpdate")
@ResponseBody
public UnionResponse mqUnionSettleUpdate(@RequestBody ShareSettlementBo bo){
mqlog.info("UnionShareRest.mqUnionSettleUpdate req is {}", bo);
try {
if (null == bo) {
return new UnionResponse(500, "mqUnionSettleUpdate error,req is null");
}
//提现结算单状态变更
unionShareService.updateSettlementStatus(bo);
} catch (Exception e) {
mqlog.warn("UnionShareRest.mqUnionSettleUpdate fail! req is {}, e {}", bo,e.getMessage());
}
return new UnionResponse(200, "mqUnionSettleUpdate success");
}
}
... ...
... ... @@ -5,6 +5,7 @@ import com.yoho.service.model.union.bo.ShareSettlementBo;
import com.yoho.service.model.union.bo.ShareUserSettlementInfoBo;
import com.yoho.service.model.union.request.UnionShareOrderReqBO;
import com.yoho.service.model.union.request.UnionShareOrderSearchReqBO;
import com.yoho.service.model.union.response.PageResponseBO;
import com.yoho.service.model.union.response.PageUnionShareOrderRspBO;
import com.yoho.unions.dal.model.UnionShareOrders;
import com.yoho.unions.dal.model.UnionShareSettlement;
... ... @@ -66,12 +67,12 @@ public interface IUnionShareService {
* @param unionShareOrderReqBO
* @return
*/
List<UnionShareSettlement> querySettlementRecord(UnionShareOrderReqBO unionShareOrderReqBO);
PageResponseBO<UnionShareSettlement> querySettlementRecord(UnionShareOrderReqBO unionShareOrderReqBO);
/**
* 订单列表
* @param unionShareOrderReqBO
* @return
*/
List<UnionShareOrders> queryOrderList(UnionShareOrderReqBO unionShareOrderReqBO);
PageResponseBO<UnionShareOrders> queryOrderList(UnionShareOrderReqBO unionShareOrderReqBO);
}
... ...
... ... @@ -4,10 +4,12 @@ import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.yoho.core.config.ConfigReader;
import com.yoho.core.rabbitmq.YhProducer;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yoho.service.model.union.bo.*;
import com.yoho.service.model.union.request.UnionShareOrderReqBO;
import com.yoho.service.model.union.request.UnionShareOrderSearchReqBO;
import com.yoho.service.model.union.response.PageResponseBO;
import com.yoho.service.model.union.response.PageUnionShareOrderRspBO;
import com.yoho.service.model.union.response.UnionShareOrderRspBO;
import com.yoho.unions.common.enums.OrderStatusEnum;
... ... @@ -49,6 +51,9 @@ import java.util.concurrent.atomic.AtomicInteger;
@Service
public class UnionShareServiceImpl implements IUnionShareService,IBusinessExportService {
private Logger logger = LoggerFactory.getLogger(UnionShareServiceImpl.class);
private Logger mqLog = LoggerFactory.getLogger("cps_mq");
private Logger settlementLog = LoggerFactory.getLogger("cps_settlement");
// private Logger mqLog = LoggerFactory.getLogger("cps_mq");
@Autowired
private UnionShareOrdersMapper unionShareOrdersMapper;
... ... @@ -332,16 +337,24 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
}
@Override
public List<UnionShareSettlement> querySettlementRecord(UnionShareOrderReqBO unionShareOrderReqBO) {
public PageResponseBO<UnionShareSettlement> querySettlementRecord(UnionShareOrderReqBO unionShareOrderReqBO) {
//先从缓存获取
String key = "settlementRecord";
UnionShareSettlementListBO cacheResult = getFromRedis(ShareOrdersKeyEnum.SETTLEMENT_LIST, unionShareOrderReqBO.getUid(),
UnionShareSettlementListBO.class, key, String.valueOf(unionShareOrderReqBO.getPage()), String.valueOf(unionShareOrderReqBO.getSize()));
PageResponseBO<UnionShareSettlement> cacheResult = getFromRedis(ShareOrdersKeyEnum.SETTLEMENT_LIST, unionShareOrderReqBO.getUid(),
PageResponseBO.class, key, String.valueOf(unionShareOrderReqBO.getPage()), String.valueOf(unionShareOrderReqBO.getSize()));
if (cacheResult != null) {
logger.debug("UnionShareServiceImpl :: querySettlementRecord get redis cache ,uid is {},cacheResult is {}",unionShareOrderReqBO.getUid(),cacheResult);
return cacheResult.getList();
return cacheResult;
}
//数据库获取
//获取总数
PageResponseBO<UnionShareSettlement> response = new PageResponseBO<>();
Integer count = unionShareSettlementMapper.selectSettlementRecordCount(unionShareOrderReqBO.getUid());
if (count <= 0){
logger.info("UnionShareServiceImpl :: querySettlementRecord count is 0");
return response;
}
//分页
List<UnionShareSettlement> unionShareSettlementList = unionShareSettlementMapper.selectSettlementRecordByUid(unionShareOrderReqBO.getUid(),
(unionShareOrderReqBO.getPage()-1)*unionShareOrderReqBO.getSize(), unionShareOrderReqBO.getSize());
if (CollectionUtils.isNotEmpty(unionShareSettlementList)){
... ... @@ -351,34 +364,56 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
unionShareSettlement.setSettlementTimeStr(DateUtils.int2DateStr(unionShareSettlement.getSettlementTime(), DateUtils.POINT_FOMARTPATTER));
}
}
response.setSize(unionShareOrderReqBO.getSize());
response.setPage(unionShareOrderReqBO.getPage());
response.setTotal(count);
if (count % unionShareOrderReqBO.getSize() == 0) {
response.setTotalPage(count/unionShareOrderReqBO.getSize());
} else {
response.setTotalPage(count/unionShareOrderReqBO.getSize()+1);
}
response.setList(unionShareSettlementList);
//设置缓存
UnionShareSettlementListBO unionShareSettlementListBO = new UnionShareSettlementListBO();
unionShareSettlementListBO.setList(unionShareSettlementList);
addToRedis(ShareOrdersKeyEnum.SETTLEMENT_LIST,unionShareOrderReqBO.getUid(),unionShareSettlementListBO,key, String.valueOf(unionShareOrderReqBO.getPage()), String.valueOf(unionShareOrderReqBO.getSize()));
return unionShareSettlementList;
addToRedis(ShareOrdersKeyEnum.SETTLEMENT_LIST,unionShareOrderReqBO.getUid(),response,key, String.valueOf(unionShareOrderReqBO.getPage()), String.valueOf(unionShareOrderReqBO.getSize()));
return response;
}
@Override
public List<UnionShareOrders> queryOrderList(UnionShareOrderReqBO unionShareOrderReqBO) {
public PageResponseBO<UnionShareOrders> queryOrderList(UnionShareOrderReqBO unionShareOrderReqBO) {
//先从缓存获取
UnionShareOrdersListBO cacheResult = getFromRedis(ShareOrdersKeyEnum.ORDER_LIST, unionShareOrderReqBO.getUid(),UnionShareOrdersListBO.class, unionShareOrderReqBO.getTab1().toString(),
PageResponseBO<UnionShareOrders> cacheResult = getFromRedis(ShareOrdersKeyEnum.ORDER_LIST, unionShareOrderReqBO.getUid(),PageResponseBO.class, unionShareOrderReqBO.getTab1().toString(),
unionShareOrderReqBO.getTab2().toString(), String.valueOf(unionShareOrderReqBO.getPage()), String.valueOf(unionShareOrderReqBO.getSize()));
if (cacheResult != null) {
logger.debug("UnionShareServiceImpl :: queryOrderList get redis cache ,uid is {},cacheResult is {}",unionShareOrderReqBO.getUid(),cacheResult);
return cacheResult.getList();
return cacheResult;
}
//数据库获取
//获取总数
PageResponseBO<UnionShareOrders> response = new PageResponseBO<>();
Integer count = unionShareOrdersMapper.selectOrderListCount(unionShareOrderReqBO);
if (count <= 0){
logger.info("UnionShareServiceImpl :: queryOrderList count is 0");
return response;
}
//分页
//tab1表示1、全部订单;2、有效订单;3、无效订单 tab2表示1、已付款;2、待结算;3、结算中
unionShareOrderReqBO.setStart((unionShareOrderReqBO.getPage()-1)*unionShareOrderReqBO.getSize());
List<UnionShareOrders> unionShareOrdersList = unionShareOrdersMapper.selectOrderList(unionShareOrderReqBO);
//处理订单列表数据
dealShareOrderList(unionShareOrdersList);
response.setSize(unionShareOrderReqBO.getSize());
response.setPage(unionShareOrderReqBO.getPage());
response.setTotal(count);
if (count % unionShareOrderReqBO.getSize() == 0) {
response.setTotalPage(count/unionShareOrderReqBO.getSize());
} else {
response.setTotalPage(count/unionShareOrderReqBO.getSize()+1);
}
response.setList(unionShareOrdersList);
//设置缓存
UnionShareOrdersListBO unionShareOrdersListBO = new UnionShareOrdersListBO();
unionShareOrdersListBO.setList(unionShareOrdersList);
addToRedis(ShareOrdersKeyEnum.ORDER_LIST,unionShareOrderReqBO.getUid(),unionShareOrdersListBO,unionShareOrderReqBO.getTab1().toString(), unionShareOrderReqBO.getTab2().toString(),
addToRedis(ShareOrdersKeyEnum.ORDER_LIST,unionShareOrderReqBO.getUid(),response,unionShareOrderReqBO.getTab1().toString(), unionShareOrderReqBO.getTab2().toString(),
String.valueOf(unionShareOrderReqBO.getPage()), String.valueOf(unionShareOrderReqBO.getSize()));
return unionShareOrdersList;
return response;
}
/**
... ... @@ -519,34 +554,34 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
*/
@Override
public BigDecimal addSettlement(Integer uid) {
logger.info("addSettlement enter,uid is {}",uid);
settlementLog.info("addSettlement enter,uid is {}",uid);
if (uid == null ) {
return null;
throw new ServiceException(ServiceError.USER_ID_ERROR);
}
//查询该用户是否为特邀用户
int count = unionShareUserMapper.selectCountByUid(uid);
if (count == 0) {
//不是特邀用户
logger.info("addSettlement end,can not find unionType,uid is {}",uid);
return null;
settlementLog.info("addSettlement end,can not find unionType,uid is {}",uid);
throw new ServiceException(ServiceError.USER_ID_ERROR);
}
//查询是否有处理中的提现
if (hasSettlement(uid)) {
//有处理中的提现单,不可提现
logger.info("addSettlement end,hasSettlement,uid is {}",uid);
return null;
settlementLog.info("addSettlement end,hasSettlement,uid is {}",uid);
throw new ServiceException(ServiceError.UNION_HASSETTLEMENT_ERROR);
}
//查询当前是否有可提现的订单
int orderCount = unionShareOrdersMapper.selectCountByCondition(uid,ShareOrdersStatusEnum.CAN_SETTLE.getCode());
if (orderCount == 0 ) {
//没有可以提现的订单
logger.info("addSettlement end,has not remaining settlement,uid is {}",uid);
return null;
settlementLog.info("addSettlement end,has not remaining settlement,uid is {}",uid);
throw new ServiceException(ServiceError.UNION_HASNOT_REMAINING_SETTLEMENT);
}
//todo 生成取现单,绑定订单,考虑是否异步操作
// 生成取现单,绑定订单
BigDecimal amount = relateSettlementAndOrder(uid);
logger.info("addSettlement end,remaining settlement is {},uid is {}",amount,uid);
settlementLog.info("addSettlement end,remaining settlement is {},uid is {}",amount,uid);
return amount;
}
... ... @@ -635,22 +670,22 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
* */
public BigDecimal relateSettlementAndOrder(int uid) {
logger.info("relateSettlementAndOrder enter,uid is {}",uid);
settlementLog.info("relateSettlementAndOrder enter,uid is {}",uid);
//生成提现编号
String settlementCode = createSettlementCode();
logger.info("relateSettlementAndOrder,uid is {},settlementCode is {}",uid,settlementCode);
settlementLog.info("relateSettlementAndOrder,uid is {},settlementCode is {}",uid,settlementCode);
//更新订单状态,由可结算变为打款中
int updateTime = DateUtil.getCurrentTimeSecond();
int count=unionShareOrdersMapper.updateStatusByUid(uid,settlementCode, ShareOrdersStatusEnum.CAN_SETTLE.getCode(), ShareOrdersStatusEnum.SETTLE.getCode(), updateTime);
if (count == 0) {
logger.info("relateSettlementAndOrder end,uid is {},settlementCode is {},There are no available orders.",uid,settlementCode);
return null;
settlementLog.info("relateSettlementAndOrder end,uid is {},settlementCode is {},There are no available orders.",uid,settlementCode);
throw new ServiceException(ServiceError.UNION_SETTLEMENT_UNAVAILABLE_ORDER_ERROR);
}
//计算提现金额
BigDecimal totalAmount=unionShareOrdersMapper.selectAmountBySettleCode(uid, settlementCode);
logger.info("relateSettlementAndOrder,uid is {},settlementCode is {},totalAmount is {}",uid,settlementCode,totalAmount);
settlementLog.info("relateSettlementAndOrder,uid is {},settlementCode is {},totalAmount is {}",uid,settlementCode,totalAmount);
//生成提现单
UnionShareSettlement insertReq = new UnionShareSettlement();
... ... @@ -662,8 +697,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
insertReq.setStatus((byte)1);//是否打款成功:1-处理中,2-已打款
int num=unionShareSettlementMapper.insertSelective(insertReq);
if (num < 1) {
//插入失败
logger.warn("relateSettlementAndOrder end,uid is {},settlementCode is {},totalAmount is {},insert nothing.",uid,settlementCode,totalAmount);
//插入失败 todo 日志记录
settlementLog.warn("relateSettlementAndOrder end,uid is {},settlementCode is {},totalAmount is {},insert nothing.",uid,settlementCode,totalAmount);
}
Set<String> orderCodes = new HashSet<>();
... ... @@ -679,20 +714,21 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
}
if (orderCodes.size() == 0) {
//不该查不到订单
logger.warn("relateSettlementAndOrder end,uid is {},settlementCode is {},totalAmount is {},can not find orders.",uid,settlementCode,totalAmount);
return null;
settlementLog.warn("relateSettlementAndOrder end,uid is {},settlementCode is {},totalAmount is {},can not find orders.",uid,settlementCode,totalAmount);
throw new ServiceException(ServiceError.UNION_SETTLEMENT_CANNOT_FIND_ORDER_ERROR);
}
//清缓存
clearShareOrderRedis(uid);
//todo 发送取现mq给erp SETTLEMENT_TOPIC
// 发送取现mq给erp SETTLEMENT_TOPIC
ShareSettlementBo bo = new ShareSettlementBo();
BeanUtils.copyProperties(insertReq,bo);
bo.setOrderCodes(orderCodes);
logger.info("relateSettlementAndOrder,send mq {} to erp,uid is {},settlementCode is {},bo is {}", SETTLEMENT_TOPIC, uid, settlementCode, bo);
mqLog.info("relateSettlementAndOrder,send mq {} to erp,uid is {},settlementCode is {},bo is {}", SETTLEMENT_TOPIC, uid, settlementCode, bo);
yhProducer.send(SETTLEMENT_TOPIC, bo);
settlementLog.info("relateSettlementAndOrder,send mq {} to erp success,uid is {},settlementCode is {},bo is {}", SETTLEMENT_TOPIC, uid, settlementCode, bo);
return totalAmount;
}
... ... @@ -708,10 +744,17 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
//是否打款成功:1-处理中,2-已打款
if (bo.getStatus() == null || bo.getStatus().intValue() != 2) {
logger.info("updateSettlementStatus end,status error changed,bo is {}",bo);
return;
}
UnionShareSettlement unionShareSettlement = unionShareSettlementMapper.selectByCode(bo.getSettlementCode());
if (unionShareSettlement == null) {
logger.info("updateSettlementStatus end,settlementCode doesn't exist,bo is {}",bo);
return;
}
if (unionShareSettlement.getStatus().intValue()==2) {
//已更新,多余mq略过
logger.info("updateSettlementStatus end,status is already changed,bo is {}",bo);
return;
}
//更新结算状态
... ...
... ... @@ -207,6 +207,37 @@
</encoder>
</appender>
<!--联盟cps分享相关mq日志-->
<appender name="CPS_MQ" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${catalina.home}/logs/%d{yyyy-MM-dd}/cps_mq.log</fileNamePattern>
<!-- 日志最大的保存天数 -->
<maxHistory>${maxHistory}</maxHistory>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>${maxFileSize}</maxFileSize>
</triggeringPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger:%line - %msg%n</pattern>
</encoder>
</appender>
<!--联盟cps分享提现日志-->
<appender name="CPS_SETTLEMENT" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${catalina.home}/logs/%d{yyyy-MM-dd}/cps_settlement.log</fileNamePattern>
<!-- 日志最大的保存天数 -->
<maxHistory>${maxHistory}</maxHistory>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>${maxFileSize}</maxFileSize>
</triggeringPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger:%line - %msg%n</pattern>
</encoder>
</appender>
<!-- 数据库操作日志 -->
<logger name="java.sql.PreparedStatement" value="DEBUG" />
<logger name="java.sql.Connection" value="DEBUG" />
... ... @@ -271,5 +302,11 @@
<logger name="pinyouPush" level="INFO" additivity="false">
<appender-ref ref="PINYOU_MATCH"/>
</logger>
<logger name="cps_mq" level="INFO" additivity="false">
<appender-ref ref="CPS_MQ"/>
</logger>
<logger name="cps_settlement" level="INFO" additivity="false">
<appender-ref ref="CPS_SETTLEMENT"/>
</logger>
</configuration>
\ No newline at end of file
... ...
... ... @@ -259,6 +259,43 @@
</encoder>
</appender>
<!--联盟cps分享相关mq日志-->
<appender name="CPS_MQ" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${yoho.logs.basedir}/${yoho.unions.env.namespace}/cps_mq.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>${yoho.logs.basedir}/${yoho.unions.env.namespace}/archived/cps_mq/cps_mq.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 100MB -->
<maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!-- keep 30 days' worth of history -->
<maxHistory>${yoho.logs.maxHistory}</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger:%line - %msg%n</pattern>
</encoder>
</appender>
<!--联盟cps分享提现日志-->
<appender name="CPS_SETTLEMENT" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${yoho.logs.basedir}/${yoho.unions.env.namespace}/cps_settlement.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>${yoho.logs.basedir}/${yoho.unions.env.namespace}/archived/cps_settlement/cps_settlement.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 100MB -->
<maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!-- keep 30 days' worth of history -->
<maxHistory>${yoho.logs.maxHistory}</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger:%line - %msg%n</pattern>
</encoder>
</appender>
<!-- 数据库操作日志 -->
<logger name="java.sql.PreparedStatement" value="${yoho.logs.level}" />
<logger name="java.sql.Connection" value="${yoho.logs.level}" />
... ... @@ -338,4 +375,11 @@
<logger name="pinyouPush" level="INFO" additivity="false">
<appender-ref ref="PINYOU_MATCH"/>
</logger>
<logger name="cps_mq" level="INFO" additivity="false">
<appender-ref ref="CPS_MQ"/>
</logger>
<logger name="cps_settlement" level="INFO" additivity="false">
<appender-ref ref="CPS_SETTLEMENT"/>
</logger>
</configuration>
\ No newline at end of file
... ...