Authored by chenchao

1. add junit test

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