Authored by chenchao

1. add junit test

2. finish de-serialize config 4 buyer penalty
@@ -14,4 +14,6 @@ public interface MetaConfigMapper { @@ -14,4 +14,6 @@ public interface MetaConfigMapper {
14 int updateByPrimaryKeySelective(MetaConfig record); 14 int updateByPrimaryKeySelective(MetaConfig record);
15 15
16 int updateByPrimaryKey(MetaConfig record); 16 int updateByPrimaryKey(MetaConfig record);
  17 +
  18 + MetaConfig selectByCode(String code);
17 } 19 }
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 <result column="desc" jdbcType="VARCHAR" property="desc" /> 10 <result column="desc" jdbcType="VARCHAR" property="desc" />
11 </resultMap> 11 </resultMap>
12 <sql id="Base_Column_List"> 12 <sql id="Base_Column_List">
13 - id, code, title, value, create_time, desc 13 + id, code, title, `value`, create_time, `desc`
14 </sql> 14 </sql>
15 <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> 15 <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
16 select 16 select
@@ -18,13 +18,22 @@ @@ -18,13 +18,22 @@
18 from meta_config 18 from meta_config
19 where id = #{id,jdbcType=INTEGER} 19 where id = #{id,jdbcType=INTEGER}
20 </select> 20 </select>
  21 +
  22 +
  23 + <select id="selectByCode" parameterType="java.lang.String" resultMap="BaseResultMap">
  24 + select
  25 + <include refid="Base_Column_List" />
  26 + from meta_config
  27 + where code = #{code,jdbcType=VARCHAR}
  28 + </select>
  29 +
21 <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> 30 <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
22 delete from meta_config 31 delete from meta_config
23 where id = #{id,jdbcType=INTEGER} 32 where id = #{id,jdbcType=INTEGER}
24 </delete> 33 </delete>
25 <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.MetaConfig" useGeneratedKeys="true"> 34 <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.MetaConfig" useGeneratedKeys="true">
26 - insert into meta_config (code, title, value,  
27 - create_time, desc) 35 + insert into meta_config (code, title, `value`,
  36 + create_time, `desc`)
28 values (#{code,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{value,jdbcType=VARCHAR}, 37 values (#{code,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{value,jdbcType=VARCHAR},
29 #{createTime,jdbcType=INTEGER}, #{desc,jdbcType=VARCHAR}) 38 #{createTime,jdbcType=INTEGER}, #{desc,jdbcType=VARCHAR})
30 </insert> 39 </insert>
@@ -38,13 +47,13 @@ @@ -38,13 +47,13 @@
38 title, 47 title,
39 </if> 48 </if>
40 <if test="value != null"> 49 <if test="value != null">
41 - value, 50 + `value`,
42 </if> 51 </if>
43 <if test="createTime != null"> 52 <if test="createTime != null">
44 create_time, 53 create_time,
45 </if> 54 </if>
46 <if test="desc != null"> 55 <if test="desc != null">
47 - desc, 56 + `desc`,
48 </if> 57 </if>
49 </trim> 58 </trim>
50 <trim prefix="values (" suffix=")" suffixOverrides=","> 59 <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -75,13 +84,13 @@ @@ -75,13 +84,13 @@
75 title = #{title,jdbcType=VARCHAR}, 84 title = #{title,jdbcType=VARCHAR},
76 </if> 85 </if>
77 <if test="value != null"> 86 <if test="value != null">
78 - value = #{value,jdbcType=VARCHAR}, 87 + `value` = #{value,jdbcType=VARCHAR},
79 </if> 88 </if>
80 <if test="createTime != null"> 89 <if test="createTime != null">
81 create_time = #{createTime,jdbcType=INTEGER}, 90 create_time = #{createTime,jdbcType=INTEGER},
82 </if> 91 </if>
83 <if test="desc != null"> 92 <if test="desc != null">
84 - desc = #{desc,jdbcType=VARCHAR}, 93 + `desc` = #{desc,jdbcType=VARCHAR},
85 </if> 94 </if>
86 </set> 95 </set>
87 where id = #{id,jdbcType=INTEGER} 96 where id = #{id,jdbcType=INTEGER}
@@ -90,9 +99,9 @@ @@ -90,9 +99,9 @@
90 update meta_config 99 update meta_config
91 set code = #{code,jdbcType=VARCHAR}, 100 set code = #{code,jdbcType=VARCHAR},
92 title = #{title,jdbcType=VARCHAR}, 101 title = #{title,jdbcType=VARCHAR},
93 - value = #{value,jdbcType=VARCHAR}, 102 + `value` = #{value,jdbcType=VARCHAR},
94 create_time = #{createTime,jdbcType=INTEGER}, 103 create_time = #{createTime,jdbcType=INTEGER},
95 - desc = #{desc,jdbcType=VARCHAR} 104 + `desc` = #{desc,jdbcType=VARCHAR}
96 where id = #{id,jdbcType=INTEGER} 105 where id = #{id,jdbcType=INTEGER}
97 </update> 106 </update>
98 </mapper> 107 </mapper>
  1 +package com.yohoufo.order.model.dto;
  2 +
  3 +import lombok.Data;
  4 +
  5 +import java.math.BigDecimal;
  6 +import java.util.Collection;
  7 +import java.util.Map;
  8 +
  9 +/**
  10 + * Created by chao.chen on 2019/1/3.
  11 + */
  12 +@Data
  13 +public class BuyerPenalty {
  14 +
  15 + @Data
  16 + public static class Range{
  17 + BigDecimal min;
  18 + BigDecimal max;
  19 + }
  20 +
  21 + @Data
  22 + public static class Fee{
  23 + Integer index;
  24 + Range timeRange;
  25 + BigDecimal rate;
  26 + Range moneyRange;
  27 + }
  28 +
  29 + @Data
  30 + public static class TriggerCase{
  31 + String name;
  32 + Collection<Fee> stagedCollection;
  33 + }
  34 +
  35 + @Data
  36 + public static class StockCase{
  37 + String stockTypeName;
  38 + Map<String, TriggerCase> triggerCaseMap;
  39 + }
  40 +
  41 + Map<String, StockCase> stockCaseMap;
  42 +}
  1 +package com.yohoufo.order.service.impl;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.yohobuy.ufo.model.order.common.MetaConfigKey;
  5 +import com.yohoufo.dal.order.MetaConfigMapper;
  6 +import com.yohoufo.dal.order.model.MetaConfig;
  7 +import com.yohoufo.order.model.dto.BuyerPenalty;
  8 +import org.slf4j.Logger;
  9 +import org.slf4j.LoggerFactory;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.stereotype.Service;
  12 +
  13 +import java.util.Objects;
  14 +
  15 +/**
  16 + * Created by chao.chen on 2019/1/3.
  17 + */
  18 +@Service
  19 +public class MetaConfigService {
  20 +
  21 + private final Logger logger = LoggerFactory.getLogger(getClass());
  22 +
  23 + @Autowired
  24 + private MetaConfigMapper metaConfigMapper;
  25 +
  26 + /**
  27 + * TODO use cache
  28 + * @return
  29 + */
  30 + public BuyerPenalty getBuyerPenalty(){
  31 + String key = MetaConfigKey.BUYER_PENALTY;
  32 + BuyerPenalty bp = new BuyerPenalty();
  33 + MetaConfig metaConfig = metaConfigMapper.selectByCode(key);
  34 + if (Objects.nonNull(metaConfig)){
  35 + String value = metaConfig.getValue();
  36 + try{
  37 + bp = JSONObject.parseObject(value, BuyerPenalty.class);
  38 + }catch (Exception ex){
  39 + logger.warn("in getBuyerPenalty parse config value fail, key {} value {}", key, value);
  40 + }
  41 + }
  42 + return bp;
  43 + }
  44 +
  45 +}
  1 +package com.yohoufo.order.stateMachine;
  2 +
  3 +import com.yohobuy.ufo.model.order.common.OrderStatus;
  4 +
  5 +/**
  6 + * Created by chao.chen on 2019/1/3.
  7 + */
  8 +public class BuyerOrderStateMachine {
  9 +
  10 + private static class InitFactory{
  11 + static StateMachine<OrderStatus,OrderStatus> stateMachine;
  12 + static {
  13 +
  14 + OrderStatus[][] datas = new OrderStatus[][]{
  15 + {OrderStatus.WAITING_PAY, OrderStatus.HAS_PAYED},
  16 + {OrderStatus.WAITING_PAY, OrderStatus.BUYER_CANCEL_BEFORE_PAY},
  17 + {OrderStatus.WAITING_PAY, OrderStatus.BUYER_CANCEL_TIMEOUT},
  18 + {OrderStatus.HAS_PAYED, OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE},
  19 + {OrderStatus.HAS_PAYED, OrderStatus.BUYER_CANCEL_BEFORE_SELLER_DELIVER},
  20 +
  21 + };
  22 + StateConfiguration<OrderStatus,OrderStatus> configuration = new StateConfiguration();
  23 + for (OrderStatus[] data: datas) {
  24 + OrderStatus t = data[1], s = data[0];
  25 + configuration.permit(t, s, t);
  26 + }
  27 + stateMachine = new StateMachine(configuration);
  28 + }
  29 + }
  30 +
  31 +
  32 + public StateReference<OrderStatus> getStateReference(OrderStatus buyOrderTrigger){
  33 + return InitFactory.stateMachine.getStateReference(buyOrderTrigger);
  34 + }
  35 +
  36 +
  37 +
  38 +}
@@ -3,6 +3,6 @@ package com.yohoufo.order.stateMachine; @@ -3,6 +3,6 @@ package com.yohoufo.order.stateMachine;
3 /** 3 /**
4 * Created by chao.chen on 2019/1/3. 4 * Created by chao.chen on 2019/1/3.
5 */ 5 */
6 -public interface Func<R> {  
7 - R call(); 6 +public interface Func<StateReference,T> {
  7 + StateReference call(T trigger);
8 } 8 }
  1 +package com.yohoufo.order.stateMachine;
  2 +
  3 +
  4 +
  5 +import java.util.HashMap;
  6 +import java.util.Map;
  7 +import java.util.Objects;
  8 +
  9 +/**
  10 + * Created by chao.chen on 2019/1/3.
  11 + */
  12 +public class StateConfiguration<S,T> {
  13 +
  14 + Map<T,StateReference<S>> trigger2StateMap = new HashMap<T, StateReference<S>>();
  15 +
  16 +
  17 + public StateConfiguration<S, T> permit(T trigger,S source, S target) {
  18 +
  19 + return publicPermit(trigger, source, target);
  20 + }
  21 +
  22 + private StateConfiguration<S, T> publicPermit(T trigger,S source, S target) {
  23 + trigger2StateMap.put(trigger,new StateReference(source, target));
  24 + return this;
  25 + }
  26 +
  27 + StateReference<S> getStateReference(T t){
  28 + StateReference<S> sr = trigger2StateMap.get(t);
  29 + if (Objects.isNull(sr)){
  30 + return null;
  31 + }
  32 + return sr;
  33 + }
  34 +}
@@ -5,16 +5,20 @@ package com.yohoufo.order.stateMachine; @@ -5,16 +5,20 @@ package com.yohoufo.order.stateMachine;
5 */ 5 */
6 public class StateMachine<S, T> { 6 public class StateMachine<S, T> {
7 7
8 - protected final Func<S> stateAccessor; 8 + protected final Func<StateReference<S>, T> stateAccessor;
9 9
10 10
11 - public StateMachine(){  
12 - stateAccessor = new Func<S>() { 11 + public StateMachine(StateConfiguration<S,T> configuration){
  12 + stateAccessor = new Func<StateReference<S>,T>() {
13 @Override 13 @Override
14 - public S call() {  
15 - return null; 14 + public StateReference<S> call(T trigger) {
  15 + return configuration.getStateReference(trigger);
16 } 16 }
17 }; 17 };
18 } 18 }
19 19
  20 + public StateReference<S> getStateReference(T trigger){
  21 + return stateAccessor.call(trigger);
  22 + }
  23 +
20 } 24 }
  1 +package com.yohoufo.order.stateMachine;
  2 +
  3 +import lombok.AllArgsConstructor;
  4 +import lombok.Data;
  5 +
  6 +/**
  7 + * Created by chao.chen on 2019/1/3.
  8 + */
  9 +@Data
  10 +@AllArgsConstructor
  11 +public class StateReference<S> {
  12 + private S source;
  13 +
  14 + private S target;
  15 +
  16 +}
  1 +package com.yohoufo.order;
  2 +
  3 +
  4 +import org.junit.runner.RunWith;
  5 +import org.junit.runners.BlockJUnit4ClassRunner;
  6 +
  7 +@RunWith(BlockJUnit4ClassRunner.class)
  8 +public class BaseTest{
  9 +
  10 +
  11 +
  12 +}
  1 +package com.yohoufo.order;
  2 +
  3 +import org.junit.runner.RunWith;
  4 +import org.springframework.test.context.ContextConfiguration;
  5 +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
  6 +
  7 +/**
  8 + * Created by chao.chen on 2019/1/4.
  9 + */
  10 +@RunWith(SpringJUnit4ClassRunner.class)
  11 +@ContextConfiguration(locations = {
  12 + "classpath*:META-INF/spring/mybatis-datasource.xml",
  13 + "classpath*:META-INF/spring/spring*.xml"})
  14 +public class BaseWebTest {
  15 +}
  1 +package com.yohoufo.order.service;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.yohobuy.ufo.model.order.common.MetaConfigKey;
  5 +import com.yohoufo.order.BaseTest;
  6 +import com.yohoufo.order.model.dto.BuyerPenalty;
  7 +import org.junit.Test;
  8 +import org.slf4j.helpers.MessageFormatter;
  9 +
  10 +import java.math.BigDecimal;
  11 +import java.util.ArrayList;
  12 +import java.util.Collection;
  13 +import java.util.HashMap;
  14 +import java.util.Map;
  15 +
  16 +/**
  17 + * Created by chao.chen on 2019/1/4.
  18 + */
  19 +public class BuyerPenaltyTest extends BaseTest {
  20 + @Test
  21 + public void createValue4BuyPenalty(){
  22 + int index = 0;
  23 + BuyerPenalty bp = new BuyerPenalty();
  24 + BuyerPenalty.TriggerCase triggerCase = new BuyerPenalty.TriggerCase();
  25 + triggerCase.setName("beforeSellerDeliver");
  26 + Collection<BuyerPenalty.Fee> fees = new ArrayList<>();
  27 + BuyerPenalty.Fee before60mFee = new BuyerPenalty.Fee();
  28 + BuyerPenalty.Range mr = new BuyerPenalty.Range();
  29 + mr.setMin(new BigDecimal(38));
  30 + before60mFee.setMoneyRange(mr);
  31 + BuyerPenalty.Range tr = new BuyerPenalty.Range();
  32 + tr.setMin(new BigDecimal(0));
  33 + tr.setMax(new BigDecimal(3600));
  34 + before60mFee.setTimeRange(tr);
  35 + before60mFee.setRate(new BigDecimal(0.01).setScale(2, BigDecimal.ROUND_HALF_UP));
  36 + before60mFee.setIndex(++index);
  37 + fees.add(before60mFee);
  38 +
  39 + //after 60m
  40 + BuyerPenalty.Fee after60m = new BuyerPenalty.Fee();
  41 + BuyerPenalty.Range mr1 = new BuyerPenalty.Range();
  42 + mr1.setMin(new BigDecimal(68));
  43 + after60m.setMoneyRange(mr1);
  44 + BuyerPenalty.Range tr1 = new BuyerPenalty.Range();
  45 + tr1.setMin(new BigDecimal(3600));
  46 + after60m.setTimeRange(tr1);
  47 + after60m.setRate(new BigDecimal(0.02).setScale(2, BigDecimal.ROUND_HALF_UP));
  48 + after60m.setIndex(++index);
  49 + fees.add(after60m);
  50 +
  51 + triggerCase.setStagedCollection(fees);
  52 +
  53 +
  54 +
  55 + BuyerPenalty.TriggerCase triggerCase1 = new BuyerPenalty.TriggerCase();
  56 + triggerCase1.setName("beforeDepotReceive");
  57 + BuyerPenalty.Fee bdrFee = new BuyerPenalty.Fee();
  58 + BuyerPenalty.Range bdrmr = new BuyerPenalty.Range();
  59 + bdrmr.setMin(new BigDecimal(88));
  60 + bdrFee.setMoneyRange(bdrmr);
  61 + bdrFee.setRate(new BigDecimal(0.03).setScale(2, BigDecimal.ROUND_HALF_UP));
  62 + Collection<BuyerPenalty.Fee> bdrfees = new ArrayList<>();
  63 + bdrfees.add(bdrFee);
  64 + triggerCase1.setStagedCollection(bdrfees);
  65 +
  66 +
  67 + Map<String,BuyerPenalty.TriggerCase> map = new HashMap<>();
  68 + map.put(triggerCase.getName(), triggerCase);
  69 + map.put(triggerCase1.getName(), triggerCase1);
  70 +
  71 + BuyerPenalty.StockCase stockCase = new BuyerPenalty.StockCase();
  72 + stockCase.setStockTypeName("goodsInStock");
  73 + stockCase.setTriggerCaseMap(map);
  74 +
  75 + Map<String,BuyerPenalty.StockCase> stockCaseMap = new HashMap<>();
  76 + stockCaseMap.put(stockCase.getStockTypeName(), stockCase);
  77 + bp.setStockCaseMap(stockCaseMap);
  78 +
  79 +
  80 + String message = MessageFormatter.arrayFormat("meta config key {} =========> value {}",
  81 + new Object[]{MetaConfigKey.BUYER_PENALTY,
  82 + JSONObject.toJSONString(bp)}).getMessage();
  83 + System.out.println(message);
  84 + }
  85 +}
  1 +package com.yohoufo.order.service;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.yohobuy.ufo.model.order.common.MetaConfigKey;
  5 +import com.yohoufo.order.BaseTest;
  6 +import com.yohoufo.order.BaseWebTest;
  7 +import com.yohoufo.order.model.dto.BuyerPenalty;
  8 +import com.yohoufo.order.service.impl.MetaConfigService;
  9 +import org.junit.Test;
  10 +import org.slf4j.helpers.MessageFormatter;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +
  13 +import java.math.BigDecimal;
  14 +import java.util.ArrayList;
  15 +import java.util.Collection;
  16 +import java.util.HashMap;
  17 +import java.util.Map;
  18 +
  19 +/**
  20 + * Created by chao.chen on 2019/1/4.
  21 + */
  22 +public class MetaConfigServiceTest extends BaseWebTest {
  23 +
  24 + @Autowired
  25 + private MetaConfigService metaConfigService;
  26 +
  27 + @Test
  28 + public void testGetBuyerPenalty(){
  29 + BuyerPenalty buyerPenalty = metaConfigService.getBuyerPenalty();
  30 + System.out.println(buyerPenalty);
  31 + }
  32 +
  33 +
  34 +}
  1 +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2 + xmlns:rabbit="http://www.springframework.org/schema/rabbit"
  3 + xmlns="http://www.springframework.org/schema/beans"
  4 + xsi:schemaLocation="http://www.springframework.org/schema/rabbit
  5 + http://www.springframework.org/schema/rabbit/spring-rabbit.xsd
  6 + http://www.springframework.org/schema/beans
  7 + http://www.springframework.org/schema/beans/spring-beans.xsd">
  8 +
  9 +
  10 + <!--<bean id="simpleMessageConverter-common" class="org.springframework.amqp.support.converter.SimpleMessageConverter"/>-->
  11 +
  12 +
  13 + <!--<rabbit:connection-factory id="rabbitmq-connectionFactory-common" addresses="${rabbit_common:127.0.0.1:5672}"-->
  14 + <!--username="${rabbit_common_user:yoho}" password="${rabbit_common_password:yoho}"-->
  15 + <!--virtual-host="${rabbit_vhost:yoho}"/>-->
  16 +
  17 + <!--<rabbit:template id="amqpTemplate-common" connection-factory="rabbitmq-connectionFactory-common"-->
  18 + <!--message-converter="simpleMessageConverter-common"/>-->
  19 +
  20 + <!--&lt;!&ndash;发送消息 &ndash;&gt;-->
  21 + <!--<bean id="producerTemplate-common" class="com.yoho.gateway.common.mq.YhProducerTemplateCommon">-->
  22 + <!--<property name="amqpTemplate" ref="amqpTemplate-common"/>-->
  23 + <!--<property name="asyncEnable" value="false"></property>-->
  24 + <!--</bean>-->
  25 +
  26 +</beans>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<beans xmlns="http://www.springframework.org/schema/beans"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
  4 + xmlns:context="http://www.springframework.org/schema/context"
  5 + xmlns:aop="http://www.springframework.org/schema/aop"
  6 + xmlns:task="http://www.springframework.org/schema/task"
  7 + xsi:schemaLocation="http://www.springframework.org/schema/beans
  8 + http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
  9 + http://www.springframework.org/schema/context
  10 + http://www.springframework.org/schema/context/spring-context-3.1.xsd
  11 + http://www.springframework.org/schema/aop
  12 + http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
  13 + http://www.springframework.org/schema/task
  14 + http://www.springframework.org/schema/task/spring-task.xsd">
  15 +
  16 + <bean id="resourceAsyncTaskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
  17 + <!-- 线程池维护线程的最大数量 -->
  18 + <property name="maxPoolSize" value="50" />
  19 + <!-- 缓存队列 -->
  20 + <property name="queueCapacity" value="500" />
  21 + <!-- 对拒绝task的处理策略 -->
  22 + <property name="rejectedExecutionHandler">
  23 + <bean class="com.yohoufo.common.task.DiscardPolicyRejectedExecutionHandler" />
  24 + </property>
  25 + </bean>
  26 +
  27 +</beans>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:task="http://www.springframework.org/schema/task" xmlns:util="http://www.springframework.org/schema/util"
  3 + xmlns:aop="http://www.springframework.org/schema/aop" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns="http://www.springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p"
  4 + xsi:schemaLocation="http://www.springframework.org/schema/beans
  5 + http://www.springframework.org/schema/beans/spring-beans.xsd
  6 + http://www.springframework.org/schema/context
  7 + http://www.springframework.org/schema/context/spring-context.xsd
  8 + http://www.springframework.org/schema/util
  9 + http://www.springframework.org/schema/util/spring-util.xsd
  10 + http://www.springframework.org/schema/aop
  11 + http://www.springframework.org/schema/aop/spring-aop.xsd
  12 + http://www.springframework.org/schema/mvc
  13 + http://www.springframework.org/schema/mvc/spring-mvc.xsd
  14 + http://www.springframework.org/schema/task
  15 + http://www.springframework.org/schema/task/spring-task.xsd">
  16 + <aop:aspectj-autoproxy />
  17 + <context:property-placeholder ignore-resource-not-found="true" location="classpath*:config.properties" />
  18 +
  19 + <context:component-scan base-package="com.yohoufo" />
  20 +
  21 + <!-- 启动SpringMVC的注解功能,完成请求和注解POJO的映射 -->
  22 + <mvc:annotation-driven>
  23 + <mvc:message-converters register-defaults="false">
  24 + <ref bean="stringConverter" />
  25 + <ref bean="jsonConverter" />
  26 + </mvc:message-converters>
  27 + </mvc:annotation-driven>
  28 +
  29 + <bean id="stringRedisSerializer"
  30 + class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
  31 +
  32 +
  33 + <!-- byte[] 转换器 -->
  34 + <bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter"/>
  35 +
  36 + <!--字符串转换器 -->
  37 + <bean id="stringConverter" class="org.springframework.http.converter.StringHttpMessageConverter">
  38 + <property name="supportedMediaTypes">
  39 + <list>
  40 + <value>text/plain;charset=UTF-8</value>
  41 + <value>text/html;charset=UTF-8</value>
  42 + </list>
  43 + </property>
  44 + </bean>
  45 +
  46 + <!-- json转换器 application/json -->
  47 + <bean id="jsonConverter" class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
  48 + <property name="supportedMediaTypes" value="application/json;charset=UTF-8"/>
  49 + <property name="fastJsonConfig" ref="fastJsonConfig" />
  50 + </bean>
  51 +
  52 + <bean id="fastJsonConfig" class="com.alibaba.fastjson.support.config.FastJsonConfig">
  53 + <property name="serializerFeatures">
  54 + <array value-type="com.alibaba.fastjson.serializer.SerializerFeature">
  55 + <value>WriteEnumUsingToString</value>
  56 + <value>DisableCircularReferenceDetect</value>
  57 + </array>
  58 + </property>
  59 + </bean>
  60 + <bean id="DisableCircularReferenceDetect" class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean">
  61 + <property name="staticField" value="com.alibaba.fastjson.serializer.SerializerFeature.DisableCircularReferenceDetect"></property>
  62 + </bean>
  63 +
  64 +
  65 + <!-- 配置MultipartResolver 用于文件上传 使用spring的CommosMultipartResolver -->
  66 + <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
  67 + <property name="defaultEncoding" value="UTF-8"></property>
  68 + <property name="resolveLazily" value="true"></property>
  69 + </bean>
  70 +
  71 +
  72 + <task:annotation-driven executor="myExecutor"
  73 + scheduler="myScheduler" />
  74 + <task:executor id="myExecutor" pool-size="5" />
  75 + <task:scheduler id="myScheduler" pool-size="10" />
  76 +
  77 + <bean id="handlebarsViewResolver" class="com.github.jknack.handlebars.springmvc.HandlebarsViewResolver">
  78 + <property name="prefix" value="classpath:/conf/template" />
  79 + <property name="suffix" value=".html" />
  80 + <property name="contentType" value="text/html;charset=UTF-8" />
  81 + </bean>
  82 +
  83 + <!-- api文档配置 start -->
  84 + <!-- api文档配置 注解扫描器 -->
  85 + <bean id="yohoApiAnnotationScanner" class="com.yoho.tools.docs.YohoApiAnnotationScanner" >
  86 + <!-- api文档配置 类名过滤器(正则)多个模式用英文逗号隔开 -->
  87 + <property name="classFilterReg" value="${yoho.api.docs.filter:^.*$}" />
  88 + <property name="scanSwitch" value="${yoho.api.docs.switch:off}" />
  89 + </bean>
  90 + <!-- api文档配置 end -->
  91 +
  92 + <bean id="ufoServiceCaller" class="com.yohoufo.common.caller.UfoServiceCaller" />
  93 +
  94 +
  95 + <bean id="eventBusPublisher" class="com.yohoufo.common.alarm.EventBusPublisher">
  96 + <constructor-arg name="executor" ref="executor"/>
  97 + </bean>
  98 +
  99 + <task:executor id="executor" pool-size="20" />
  100 +
  101 + <!--Spring mvc 拦截器-->
  102 + <mvc:interceptors>
  103 + <ref bean="trace.traceInterceptor"/>
  104 + <ref bean="threadProfileInterceptor"/>
  105 + <ref bean="localIpInterceptor" />
  106 + <ref bean="securityInterceptor" />
  107 + <ref bean="signatureVerifyInterceptor" />
  108 + <ref bean="innerApiInterceptor" />
  109 + </mvc:interceptors>
  110 +
  111 +</beans>
  1 +# 预存保证金
  2 +deposit.prestore=999
  3 +# 保证金充值列表
  4 +deposit.recharge.list=1000,2000,5000,10000
  5 +
  6 +# 芝麻认证开始开关,如果为false,芝麻认知直接返回通过
  7 +zhimacert.switch=true
  8 +# ******************** service call timeout in mil-seconds ********************
  9 +service.call.connectReqTimeout=6000
  10 +service.call.socketTimeout=6000
  11 +service.call.connectTimeout=6000
  12 +
  13 +yoho.logs.basedir=Data
  14 +ufo.gateway.env.namespace=logs
  15 +yoho.logs.maxFileSize=100MB
  16 +yoho.logs.maxHistory=15
  17 +
  18 +
  19 +# ******************** search restful ********************
  20 +ip.port.search.server=192.168.102.216:8080
  21 +
  22 +
  23 +#\u914d\u7f6e\u5b89\u5168\u7684\u9650\u5236\u6b21\u6570
  24 +login.ip.limit.times=-1
  25 +login.loginfailed.limit.time=10
  26 +login.skip.modify.weakPwd=Y
  27 +# if true, client_security check may be disabled.
  28 +is_debug_enable=true
  29 +# ******************** hystrix**********************
  30 +#his property sets the time in milliseconds after which the caller will observe a timeout and walk away from the command execution.
  31 +hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=10000
  32 +hystrix.command.default.circuitBreaker.requestVolumeThreshold=100
  33 +#This property sets the error percentage at or above which the circuit should trip open and start short-circuiting requests to fallback logic.
  34 +hystrix.command.default.circuitBreaker.errorThresholdPercentage=75
  35 +
  36 +
  37 +hystrix.threadpool.default.coreSize=30
  38 +hystrix.threadpool.default.maxQueueSize=50000
  39 +# an artificial maximum queue size at which rejections will occur even if maxQueueSize has not been reached
  40 +hystrix.threadpool.default.queueSizeRejectionThreshold=45000
  41 +
  42 +#zookeeper address
  43 +zkAddress=192.168.102.45:2181
  44 +#zkAddress=192.168.102.45:2181
  45 +# web context
  46 +web.context=ufo-gateway
  47 +
  48 +#\u5bc6\u7801AES\u52a0\u5bc6\u5bc6\u94a5
  49 +password.aes.key=yoho9646yoho9646
  50 +
  51 +
  52 +#用户uic服务地址
  53 +uic.service.url=http://java-yoho-uic.test3.ingress.dev.yohocorp.com/uic
  54 +#消息盒子-baseurl
  55 +inbox.baseurl=http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway/?debug=XYZ
  56 +#signature encrypt key salt
  57 +gateway.signature.key.salt=mQyMTMwZjlmZTZmYjY4UjkNmYwZGM0OTk0Y
  58 +trace.enabled=false
  59 +
  60 +# yoho api docs
  61 +yoho.api.docs.switch=off
  62 +yoho.api.docs.filter=^.*$
  63 +
  64 +#qZone request token
  65 +qZone.request.token=w5Rfz6sDZGn52cWq2a
  66 +
  67 +sdk.ak=LTAIekrpZAi32NJP
  68 +sdk.aks=7PFg0ZW4rX7ViGQ3jNghHvL7G5E2pU
  69 +sdk.instanceId=ba35b368-b0ae-4019-8509-c538aaf4a790
  70 +sdk.instanceName=yohopic
  71 +
  72 +
  73 +yoho.recovery.zkPath=/yh/config/recovery
  74 +
  75 +
  76 +wechat.app.partnerid=1218934901
  77 +wechat.app.partnerkey=b22de5cfd0ded341e0516505f72649a9
  78 +wechat.app.appid=wx049fdaa3ba9cdd7a
  79 +
  80 +wechat.notifyurl=http://testapi.yohops.com/payment/weixin_notify
  81 +
  82 +alipay.notifyurl=http://testapi.yohops.com/payment/alipay_notify
  83 +
  84 +erp-gateway.url=http://java-yoho-erp-gateway.test3.ingress.dev.yohocorp.com/erp-gateway
  85 +
  86 +redis.readonly.proxy.address=192.168.102.45
  87 +redis.readonly.proxy.auth=redis9646
  88 +redis.readonly.proxy.port=6379
  89 +redis.proxy.address=192.168.102.45
  90 +redis.proxy.auth=redis9646
  91 +redis.proxy.port=6379
  92 +
  93 +order.seller.earnestmoney.min=1
  94 +order.seller.earnestmoney.max=200
  95 +order.seller.packageFee=0.1
  96 +order.seller.appraiseFee=0.1
  97 +order.seller.goodsPaymentRate=0.05
  98 +order.seller.earnestMoneyRate=0.2
  99 +order.seller.payChannelRate=0.0006
  100 +
  101 +order.buyer.compensate.before_seller_deliver=38
  102 +order.buyer.compensate.before_depot_receive=68
  103 +
  104 +order.buyer.cancelWhenSellerDelivery.money=68
  105 +order.buyer.cancelWhenSellerUnDelivery.money=38
  106 +order.buyer.cancelWhenSellerDelivery.sellerGetMoneyRate=0.8
  107 +order.buyer.cancelWhenSellerUnDelivery.sellerGetMoneyRate=0.8
  108 +
  109 +
  110 +
  111 +uic.url=http://java-yoho-uic.test3.ingress.dev.yohocorp.com/uic
  112 +yoho.message.controller.url=http://message-controller.yohoops.org/yoho-message-controller
  113 +
  114 +#rabbit address for transaction compensate
  115 +rabbit_host=192.168.102.45:5672
  116 +rabbit_user=yoho
  117 +rabbit_password=yoho
  118 +
  119 +
  120 +yoho.gateway.url=http://api-test3.dev.yohocorp.com
  1 +datasources:
  2 + ufo_passport:
  3 + servers:
  4 + - 192.168.102.219:3306
  5 + - 192.168.102.219:3306
  6 + username: yh_test
  7 + password: 9nm0icOwt6bMHjMusIfMLw==
  8 + daos:
  9 + - com.yohoufo.dal.user.IUserAuthorizeHistoryDao
  10 + - com.yohoufo.dal.user.IUserAuthorizeInfoDao
  11 + - com.yohoufo.dal.user.IZhiMaCertDao
  12 +
  13 + ufo_product:
  14 + servers:
  15 + - 192.168.102.219:3306
  16 + - 192.168.102.219:3306
  17 + username: yh_test
  18 + password: 9nm0icOwt6bMHjMusIfMLw==
  19 + daos:
  20 + - com.yohoufo.dal.product.StoragePriceMapper
  21 + - com.yohoufo.dal.product.StorageMapper
  22 + - com.yohoufo.dal.product.ProductMapper
  23 + - com.yohoufo.dal.product.GoodsMapper
  24 + - com.yohoufo.dal.product.GoodsImagesMapper
  25 + - com.yohoufo.dal.product.SizeMapper
  26 + - com.yohoufo.dal.product.BrandMapper
  27 + - com.yohoufo.dal.product.BrandSeriesMapper
  28 + - com.yohoufo.dal.product.ProductSortMapper
  29 + - com.yohoufo.dal.product.SearchWordMapper
  30 + - com.yohoufo.dal.product.SaleCategoryMapper
  31 + - com.yohoufo.dal.product.IdentifyRecordsMapper
  32 + - com.yohoufo.dal.product.IdentifyRelationMapper
  33 + - com.yohoufo.dal.product.ProductChainMapper
  34 +
  35 + ufo_order:
  36 + servers:
  37 + - 192.168.102.219:3306
  38 + - 192.168.102.219:3306
  39 + username: yh_test
  40 + password: 9nm0icOwt6bMHjMusIfMLw==
  41 + daos:
  42 + - com.yohoufo.dal.order.BuyerOrderGoodsMapper
  43 + - com.yohoufo.dal.order.BuyerOrderMapper
  44 + - com.yohoufo.dal.order.BuyerOrderMetaMapper
  45 + - com.yohoufo.dal.order.ExpressRecordMapper
  46 + - com.yohoufo.dal.order.ExpressInfoMapper
  47 + - com.yohoufo.dal.order.SellerOrderGoodsMapper
  48 + - com.yohoufo.dal.order.SellerOrderMapper
  49 + - com.yohoufo.dal.order.SellerOrderMetaMapper
  50 + - com.yohoufo.dal.order.OrdersPayMapper
  51 + - com.yohoufo.dal.order.OrdersPayRefundMapper
  52 + - com.yohoufo.dal.order.ExpressCompanyMapper
  53 + - com.yohoufo.dal.order.AppraiseAddressMapper
  54 + - com.yohoufo.dal.order.TradeBillsMapper
  55 + - com.yohoufo.dal.order.OrdersPayTransferMapper
  56 + - com.yohoufo.dal.order.ManualTransferMapper
  57 + - com.yohoufo.dal.order.MachineIdGenerateMapper
  58 + - com.yohoufo.dal.order.SkupBatchMapper
  59 + - com.yohoufo.dal.order.SellerWalletMapper
  60 + - com.yohoufo.dal.order.SellerWalletDetailMapper
  61 + - com.yohoufo.dal.order.OrderCouponMapper
  62 + - com.yohoufo.dal.order.EntrySellerRechargeOrderMapper
  63 + - com.yohoufo.dal.order.StoredSellerMapper
  64 + - com.yohoufo.dal.order.SuperEntrySellerMapper
  65 + - com.yohoufo.dal.order.QiniuLiveRecordMapper
  66 + - com.yohoufo.dal.order.SellerOrderGoodsViewMapper
  67 + - com.yohoufo.dal.order.SellerTaskMapper
  68 + - com.yohoufo.dal.order.SellerTaskDetailMapper
  69 + - com.yohoufo.dal.order.OrdersPrePayMapper
  70 + - com.yohoufo.dal.order.MetaConfigMapper
  71 +
  72 + ufo_promotion:
  73 + servers:
  74 + - 192.168.102.219:3306
  75 + - 192.168.102.219:3306
  76 + username: yh_test
  77 + password: 9nm0icOwt6bMHjMusIfMLw==
  78 + daos:
  79 + - com.yohoufo.dal.promotion.CouponMapper
  80 + - com.yohoufo.dal.promotion.CouponProductLimitMapper
  81 + - com.yohoufo.dal.promotion.CouponTypeMapper
  82 + - com.yohoufo.dal.promotion.UserCouponMapper
  83 +
  84 + ufo_resource:
  85 + servers:
  86 + - 192.168.102.219:3306
  87 + - 192.168.102.219:3306
  88 + username: yh_test
  89 + password: 9nm0icOwt6bMHjMusIfMLw==
  90 + daos:
  91 + - com.yohoufo.dal.resource.ResourcesContentDataMapper
  92 + - com.yohoufo.dal.resource.ResourcesContentMapper
  93 + - com.yohoufo.dal.resource.ResourcesMapper
  94 + - com.yohoufo.dal.resource.ConfigTypeMapper
  95 + - com.yohoufo.dal.resource.ResourcesGoodsPoolMapper
  96 +readOnlyInSlave: true
  1 +#UFO鉴定中心默认头像
  2 +ufo.product.defaultAuthHeadIcon=http://head.static.yhbimg.com/yhb-head/2018/12/28/14/01384244a3ca86fa5345df87c59317b81f.png?imageView2/{mode}/w/{width}/h/{height}
  3 +#UFO用户的默认头像
  4 +ufo.product.defaultUserHeadIcon=http://head.static.yhbimg.com/yhb-head/2018/12/28/14/0160773bb87685aade796ea4f94e0587cf.png?imageView2/{mode}/w/{width}/h/{height}
  5 +
  6 +#UFO propaganda video info
  7 +ufo.order.initVideo = http://flv01.static.yhbimg.com/ufo/live/mp4/9827059662848_1545892263.mp4
  8 +ufo.order.initVideoPic = http://img11.static.yhbimg.com/goodsimg/2018/12/28/17/01d30dbfc038ffffc2fc9506dcf9da164f.jpg
  9 +ufo.order.initVideoDesc = \u5ba3\u4f20\u89c6\u9891
  10 +ufo.order.initVideoTime = 1546272000
  11 +ufo.order.realDesc = \u9274\u5b9a\u7ed3\u679c\uff1a\u771f
  1 +<configuration>
  2 + <!-- 日志最大的历史 7天 -->
  3 + <property name="yoho.logs.maxHistory" value="7" />
  4 + <!-- 日志最大的文件大小 10MB -->
  5 + <property name="yoho.logs.maxFileSize" value="10MB" />
  6 + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
  7 + <encoder>
  8 + <pattern>[%X{X-B3-TraceId:-},%X{X-B3-SpanId:-},%X{X-Span-Export:-}] - %-5level [%thread] %logger{35} - %m%n</pattern>
  9 + </encoder>
  10 + </appender>
  11 +
  12 + <!-- 登录时,如果一个IP在一定时间内登录次数过多,记录日志 appender -->
  13 +
  14 + <appender name="WARN_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
  15 + <file>debug.log</file>
  16 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  17 + <!-- daily rollover -->
  18 + <fileNamePattern>debug.%d{yyyy-MM-dd}.%i.log.gz
  19 + </fileNamePattern>
  20 + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
  21 + <!-- or whenever the file size reaches 100MB -->
  22 + <maxFileSize>10KB</maxFileSize>
  23 + </timeBasedFileNamingAndTriggeringPolicy>
  24 + <!-- keep 30 days' worth of history -->
  25 + <maxHistory>30</maxHistory>
  26 + </rollingPolicy>
  27 + </appender>
  28 +
  29 + <appender name="RECOMMEND_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
  30 + <file>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/recommend.log</file>
  31 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  32 + <!-- daily rollover -->
  33 + <fileNamePattern>
  34 + ${yoho.logs.basedir}/${ufo.gateway.env.namespace}/archived/recommend.%d{yyyy-MM-dd}.%i.log.gz
  35 + </fileNamePattern>
  36 + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
  37 + <!-- or whenever the file size reaches 100MB -->
  38 + <maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
  39 + </timeBasedFileNamingAndTriggeringPolicy>
  40 + <!-- keep 30 days' worth of history -->
  41 + <maxHistory>${yoho.logs.maxHistory}</maxHistory>
  42 + </rollingPolicy>
  43 + <encoder>
  44 + <pattern>%-1relative - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}:%line -- %msg%n</pattern>
  45 + </encoder>
  46 + </appender>
  47 +
  48 + <appender name="LOGIN_LOW_CLIENT_TYPE_RECORD" class="ch.qos.logback.core.rolling.RollingFileAppender">
  49 + <file>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/login_low_clientType_record.log</file>
  50 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  51 + <!-- daily rollover -->
  52 + <fileNamePattern>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/archived/login_low_clientType_record.%d{yyyy-MM-dd}.%i.log.gz
  53 + </fileNamePattern>
  54 + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
  55 + <!-- or whenever the file size reaches 100MB -->
  56 + <maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
  57 + </timeBasedFileNamingAndTriggeringPolicy>
  58 + <!-- keep 30 days' worth of history -->
  59 + <maxHistory>${yoho.logs.maxHistory}</maxHistory>
  60 + </rollingPolicy>
  61 +
  62 + <encoder>
  63 + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
  64 + </encoder>
  65 +</appender>
  66 +
  67 +
  68 + <appender name="GRAPH_VERIFY_SWITCH" class="ch.qos.logback.core.rolling.RollingFileAppender">
  69 + <file>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/graph_verify_switch.log</file>
  70 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  71 + <!-- daily rollover -->
  72 + <fileNamePattern>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/archived/graph_verify_switch.%d{yyyy-MM-dd}.%i.log.gz
  73 + </fileNamePattern>
  74 + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
  75 + <!-- or whenever the file size reaches 100MB -->
  76 + <maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
  77 + </timeBasedFileNamingAndTriggeringPolicy>
  78 + <!-- keep 30 days' worth of history -->
  79 + <maxHistory>${yoho.logs.maxHistory}</maxHistory>
  80 + </rollingPolicy>
  81 +
  82 + <encoder>
  83 + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
  84 + </encoder>
  85 + </appender>
  86 +
  87 + <appender name="LOGIN_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
  88 + <file>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/login.log</file>
  89 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  90 + <!-- daily rollover -->
  91 + <fileNamePattern>
  92 + ${yoho.logs.basedir}/${ufo.gateway.env.namespace}/archived/login.%d{yyyy-MM-dd}.%i.log.gz
  93 + </fileNamePattern>
  94 + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
  95 + <!-- or whenever the file size reaches 100MB -->
  96 + <maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
  97 + </timeBasedFileNamingAndTriggeringPolicy>
  98 + <!-- keep 30 days' worth of history -->
  99 + <maxHistory>${yoho.logs.maxHistory}</maxHistory>
  100 + </rollingPolicy>
  101 + <encoder>
  102 + <pattern>%-1relative - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}:%line -- %msg%n</pattern>
  103 + </encoder>
  104 + </appender>
  105 +
  106 + <appender name="SESSION_LOGIN_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
  107 + <file>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/session-login.log</file>
  108 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  109 + <!-- daily rollover -->
  110 + <fileNamePattern>
  111 + ${yoho.logs.basedir}/${ufo.gateway.env.namespace}/archived/session-login.%d{yyyy-MM-dd}.%i.log.gz
  112 + </fileNamePattern>
  113 + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
  114 + <!-- or whenever the file size reaches 100MB -->
  115 + <maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
  116 + </timeBasedFileNamingAndTriggeringPolicy>
  117 + <!-- keep 30 days' worth of history -->
  118 + <maxHistory>${yoho.logs.maxHistory}</maxHistory>
  119 + </rollingPolicy>
  120 + <encoder>
  121 + <pattern>%-1relative - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}:%line -- %msg%n</pattern>
  122 + </encoder>
  123 + </appender>
  124 +
  125 + <!-- DEBUG级别日志 appender -->
  126 + <appender name="ORDER_CLOSE" class="ch.qos.logback.core.rolling.RollingFileAppender">
  127 + <file>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/order-close.log</file>
  128 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  129 + <!-- daily rollover -->
  130 + <fileNamePattern>
  131 + ${yoho.logs.basedir}/${ufo.gateway.env.namespace}/archived/order-close.%d{yyyy-MM-dd}.%i.log.gz
  132 + </fileNamePattern>
  133 + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
  134 + <!-- or whenever the file size reaches 100MB -->
  135 + <maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
  136 + </timeBasedFileNamingAndTriggeringPolicy>
  137 + <!-- keep 30 days' worth of history -->
  138 + <maxHistory>${yoho.logs.maxHistory}</maxHistory>
  139 + </rollingPolicy>
  140 + <encoder>
  141 + <pattern>%-1relative - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}:%line -- %msg%n</pattern>
  142 + </encoder>
  143 + </appender>
  144 +
  145 + <appender name="MQ_CONSUMER" class="ch.qos.logback.core.rolling.RollingFileAppender">
  146 + <file>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/mq-consumer.log</file>
  147 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  148 + <!-- 按天回滚 daily -->
  149 + <fileNamePattern>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/archived/mq-consumer.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
  150 + <!-- 日志最大的历史 60天 -->
  151 + <maxHistory>${yoho.logs.maxHistory}</maxHistory>
  152 + </rollingPolicy>
  153 + <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
  154 + <maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
  155 + </triggeringPolicy>
  156 + <encoder>
  157 + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
  158 + </encoder>
  159 + </appender>
  160 +
  161 + <appender name="MQ_PRODUCER" class="ch.qos.logback.core.rolling.RollingFileAppender">
  162 + <file>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/mq-producer.log</file>
  163 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  164 + <!-- 按天回滚 daily -->
  165 + <fileNamePattern>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/archived/mq-producer.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
  166 + <!-- 日志最大的历史 60天 -->
  167 + <maxHistory>${yoho.logs.maxHistory}</maxHistory>
  168 + </rollingPolicy>
  169 + <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
  170 + <maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
  171 + </triggeringPolicy>
  172 + <encoder>
  173 + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
  174 + </encoder>
  175 + </appender>
  176 +
  177 +
  178 + <appender name="SELLER_ORDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
  179 + <file>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/seller-order.log</file>
  180 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  181 + <!-- 按天回滚 daily -->
  182 + <fileNamePattern>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/archived/seller-order.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
  183 + <!-- 日志最大的历史 60天 -->
  184 + <maxHistory>${yoho.logs.maxHistory}</maxHistory>
  185 + </rollingPolicy>
  186 + <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
  187 + <maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
  188 + </triggeringPolicy>
  189 + <encoder>
  190 + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
  191 + </encoder>
  192 + </appender>
  193 +
  194 +
  195 + <appender name="BUYER_ORDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
  196 + <file>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/buyer-order.log</file>
  197 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  198 + <!-- 按天回滚 daily -->
  199 + <fileNamePattern>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/archived/buyer-order.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
  200 + <!-- 日志最大的历史 60天 -->
  201 + <maxHistory>${yoho.logs.maxHistory}</maxHistory>
  202 + </rollingPolicy>
  203 + <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
  204 + <maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
  205 + </triggeringPolicy>
  206 + <encoder>
  207 + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
  208 + </encoder>
  209 + </appender>
  210 +
  211 + <logger name="org.apache.zookeeper.ClientCnxn" level="WARN" />
  212 + <!-- 登录时,如果一个IP在一定时间内登录次数过多,记录日志 appender -->
  213 + <logger name="ipLoginMoreLog" level="INFO" additivity="false">
  214 + <appender-ref ref="IP_LOGIN_MORE_LOG" />
  215 + </logger>
  216 + <logger name="org.apache.zookeeper.ClientCnxn" level="WARN" />
  217 + <logger name="com.yoho.core.rest.client.finder.zookeeper.CuratorXDiscoveryClientWrapper" level="INFO" />
  218 +
  219 + <!-- resources -->
  220 + <logger name="TRACE" additivity="true">
  221 + <level value="TRACE"/>
  222 + <appender-ref ref="STDOUT"/>
  223 + </logger>
  224 + <root level="INFO">
  225 + <appender-ref ref="STDOUT" />
  226 + <appender-ref ref="WARN_LOG" />
  227 + </root>
  228 + <!-- 推荐位 大数据采集 -->
  229 + <logger name="recommendLogger" additivity="true">
  230 + <level value="INFO"/>
  231 + <appender-ref ref="RECOMMEND_LOG"/>
  232 + </logger>
  233 +
  234 +
  235 + <!-- 3.8.1 之前的版本记录日志-->
  236 + <logger name="loginLowClientRecord" additivity="true">
  237 + <level value="INFO"/>
  238 + <appender-ref ref="LOGIN_LOW_CLIENT_TYPE_RECORD"/>
  239 + </logger>
  240 +
  241 + <logger name="graphVerify_switch" additivity="true">
  242 + <level value="INFO"/>
  243 + <appender-ref ref="GRAPH_VERIFY_SWITCH"/>
  244 + </logger>
  245 +
  246 + <!-- 用户登录日志 -->
  247 + <logger name="loginLog" additivity="true">
  248 + <level value="INFO"/>
  249 + <appender-ref ref="LOGIN_LOG"/>
  250 + </logger>
  251 +
  252 + <!-- 用户session登录日志 -->
  253 + <logger name="sessionLoginLog" additivity="false">
  254 + <level value="INFO"/>
  255 + <appender-ref ref="SESSION_LOGIN_LOG"/>
  256 + </logger>
  257 +
  258 +
  259 + <logger name="com.ufo.gateway.controller.product.ProductCacheFinder" additivity="true">
  260 + <level value="DEBUG"/>
  261 + <appender-ref ref="DEBUG_LOG"/>
  262 + </logger>
  263 +
  264 + <!-- 订单取消日志 -->
  265 + <logger name="orderCloseLog" level="INFO" additivity="false">
  266 + <appender-ref ref="ORDER_CLOSE" />
  267 + </logger>
  268 +
  269 + <!-- MQ消费日志 -->
  270 + <logger name="mqConsumerLog" level="INFO" additivity="false">
  271 + <appender-ref ref="MQ_CONSUMER" />
  272 + </logger>
  273 +
  274 + <!-- MQ生产日志 -->
  275 + <logger name="mqProducerLog" level="INFO" additivity="false">
  276 + <appender-ref ref="MQ_PRODUCER" />
  277 + </logger>
  278 +
  279 +
  280 + <logger name="sellerOrderLog" level="INFO" additivity="false">
  281 + <appender-ref ref="SELLER_ORDER" />
  282 + </logger>
  283 +
  284 + <logger name="buyerOrderLog" level="INFO" additivity="false">
  285 + <appender-ref ref="BUYER_ORDER" />
  286 + </logger>
  287 +</configuration>
  1 +consumer:
  2 + - address: 192.168.102.45:5672
  3 + username: yoho
  4 + password: yoho
  5 + consumers:
  6 + - class: com.yohoufo.order.mq.consumer.SellerOrderAutoCancelDelayMsgConsumer
  7 + topic: sellerOrder.autoCancel
  8 + delay:
  9 + interval: 15
  10 +
  11 + - class: com.yohoufo.order.mq.consumer.BuyerOrderAutoCancelDelayMsgConsumer
  12 + topic: buyerOrder.autoCancel
  13 + delay:
  14 + interval: 10
  15 +
  16 + - class: com.yohoufo.order.mq.consumer.BuyerOrderConfirmDelayMsgConsumer
  17 + topic: buyerOrder.autoConfirm
  18 + delay:
  19 + interval: 10080
  20 +
  21 + - class: com.yohoufo.order.mq.consumer.SellerOrderCancelDeliverDelayMsgConsumer
  22 + topic: sellerOrder.autoCancelDeliver
  23 + delay:
  24 + interval: 2160
  25 +
  26 + - class: com.yohoufo.order.mq.consumer.NotPaidNoticeDelayMsgConsumer
  27 + topic: order.notPaidNotice
  28 + delay:
  29 + interval: 5
  30 +
  31 + #更新物流调拨信息
  32 + - address: 192.168.102.45:5672
  33 + username: yoho
  34 + password: yoho
  35 + consumers:
  36 + - class: com.yohoufo.order.mq.consumer.ExpressInfoUpdateConsumer
  37 + topic: ufo.order.updateExpressInfo
  38 +
  39 +producer:
  40 + - address: 192.168.102.45:5672
  41 + producers:
  42 + - bean: browseProducer #only once named in classpath
  43 +
  44 + - address: 192.168.102.45:5672
  45 + producers:
  46 + - bean: yhProducer
  47 +
  48 + - address: 192.168.102.45:5672
  49 + producers:
  50 + - bean: ufoExpressInfoProducer
  51 +
  52 + - address: 192.168.103.58:5672
  53 + username: yoho
  54 + password: yoho
  55 + producers:
  56 + - bean: tradeMqProducer
  57 + persistent: true
  58 + confirmcallback: orderMessageConfirmCallback
  1 +redis:
  2 + gwNoSyncRedis :
  3 + servers:
  4 + - 192.168.102.45:6379
  5 + auth: redis9646
  6 + gwRecoveryRedis :
  7 + servers:
  8 + - 192.168.102.45:6379
  9 + auth: redis9646
  10 +# cleanMq:
  11 +# addresses:
  12 +# ${rabbit.cacheclean.producer.host}
  13 + yohoNoSyncRedis :
  14 + servers:
  15 + - 192.168.102.45:6379
  16 + auth: redis9646
  17 +# cleanMq:
  18 +# addresses:
  19 +# 192.168.102.45:5672