Merge branch 'master' into 日志优化
# Conflicts: # server/src/main/java/com/yoho/unions/server/service/impl/UnionServiceImpl.java
Showing
6 changed files
with
360 additions
and
115 deletions
@@ -2,7 +2,6 @@ package com.yoho.unions.dal.model; | @@ -2,7 +2,6 @@ package com.yoho.unions.dal.model; | ||
2 | 2 | ||
3 | import lombok.Data; | 3 | import lombok.Data; |
4 | 4 | ||
5 | -@Data | ||
6 | public class UnionOrders { | 5 | public class UnionOrders { |
7 | 6 | ||
8 | private String create_time; | 7 | private String create_time; |
@@ -29,4 +28,99 @@ public class UnionOrders { | @@ -29,4 +28,99 @@ public class UnionOrders { | ||
29 | 28 | ||
30 | private String update_time; | 29 | private String update_time; |
31 | 30 | ||
31 | + public String getCreate_time() { | ||
32 | + return create_time; | ||
33 | + } | ||
34 | + | ||
35 | + public void setCreate_time(String create_time) { | ||
36 | + this.create_time = create_time; | ||
37 | + } | ||
38 | + | ||
39 | + public String getParent_order_code() { | ||
40 | + return parent_order_code; | ||
41 | + } | ||
42 | + | ||
43 | + public void setParent_order_code(String parent_order_code) { | ||
44 | + this.parent_order_code = parent_order_code; | ||
45 | + } | ||
46 | + | ||
47 | + public String getOrder_code() { | ||
48 | + return order_code; | ||
49 | + } | ||
50 | + | ||
51 | + public void setOrder_code(String order_code) { | ||
52 | + this.order_code = order_code; | ||
53 | + } | ||
54 | + | ||
55 | + public String getUid() { | ||
56 | + return uid; | ||
57 | + } | ||
58 | + | ||
59 | + public void setUid(String uid) { | ||
60 | + this.uid = uid; | ||
61 | + } | ||
62 | + | ||
63 | + public String getUnionid() { | ||
64 | + return unionid; | ||
65 | + } | ||
66 | + | ||
67 | + public void setUnionid(String unionid) { | ||
68 | + this.unionid = unionid; | ||
69 | + } | ||
70 | + | ||
71 | + public String getUnion_cookie() { | ||
72 | + return union_cookie; | ||
73 | + } | ||
74 | + | ||
75 | + public void setUnion_cookie(String union_cookie) { | ||
76 | + this.union_cookie = union_cookie; | ||
77 | + } | ||
78 | + | ||
79 | + public String getOrder_amount() { | ||
80 | + return order_amount; | ||
81 | + } | ||
82 | + | ||
83 | + public void setOrder_amount(String order_amount) { | ||
84 | + this.order_amount = order_amount; | ||
85 | + } | ||
86 | + | ||
87 | + public String getPayment() { | ||
88 | + return payment; | ||
89 | + } | ||
90 | + | ||
91 | + public void setPayment(String payment) { | ||
92 | + this.payment = payment; | ||
93 | + } | ||
94 | + | ||
95 | + public String getShipping_cost() { | ||
96 | + return shipping_cost; | ||
97 | + } | ||
98 | + | ||
99 | + public void setShipping_cost(String shipping_cost) { | ||
100 | + this.shipping_cost = shipping_cost; | ||
101 | + } | ||
102 | + | ||
103 | + public String getOrder_status() { | ||
104 | + return order_status; | ||
105 | + } | ||
106 | + | ||
107 | + public void setOrder_status(String order_status) { | ||
108 | + this.order_status = order_status; | ||
109 | + } | ||
110 | + | ||
111 | + public String getOrder_type() { | ||
112 | + return order_type; | ||
113 | + } | ||
114 | + | ||
115 | + public void setOrder_type(String order_type) { | ||
116 | + this.order_type = order_type; | ||
117 | + } | ||
118 | + | ||
119 | + public String getUpdate_time() { | ||
120 | + return update_time; | ||
121 | + } | ||
122 | + | ||
123 | + public void setUpdate_time(String update_time) { | ||
124 | + this.update_time = update_time; | ||
125 | + } | ||
32 | } | 126 | } |
@@ -2,7 +2,6 @@ package com.yoho.unions.dal.model; | @@ -2,7 +2,6 @@ package com.yoho.unions.dal.model; | ||
2 | 2 | ||
3 | import lombok.Data; | 3 | import lombok.Data; |
4 | 4 | ||
5 | -@Data | ||
6 | public class UnionOrdersGoods { | 5 | public class UnionOrdersGoods { |
7 | 6 | ||
8 | private String uid; | 7 | private String uid; |
@@ -39,4 +38,139 @@ public class UnionOrdersGoods { | @@ -39,4 +38,139 @@ public class UnionOrdersGoods { | ||
39 | 38 | ||
40 | private String url; | 39 | private String url; |
41 | 40 | ||
41 | + public String getUid() { | ||
42 | + return uid; | ||
43 | + } | ||
44 | + | ||
45 | + public void setUid(String uid) { | ||
46 | + this.uid = uid; | ||
47 | + } | ||
48 | + | ||
49 | + public String getOrder_ode() { | ||
50 | + return order_ode; | ||
51 | + } | ||
52 | + | ||
53 | + public void setOrder_ode(String order_ode) { | ||
54 | + this.order_ode = order_ode; | ||
55 | + } | ||
56 | + | ||
57 | + public String getParent_order_code() { | ||
58 | + return parent_order_code; | ||
59 | + } | ||
60 | + | ||
61 | + public void setParent_order_code(String parent_order_code) { | ||
62 | + this.parent_order_code = parent_order_code; | ||
63 | + } | ||
64 | + | ||
65 | + public String getProduct_skc() { | ||
66 | + return product_skc; | ||
67 | + } | ||
68 | + | ||
69 | + public void setProduct_skc(String product_skc) { | ||
70 | + this.product_skc = product_skc; | ||
71 | + } | ||
72 | + | ||
73 | + public String getProduct_skn() { | ||
74 | + return product_skn; | ||
75 | + } | ||
76 | + | ||
77 | + public void setProduct_skn(String product_skn) { | ||
78 | + this.product_skn = product_skn; | ||
79 | + } | ||
80 | + | ||
81 | + public String getProduct_sku() { | ||
82 | + return product_sku; | ||
83 | + } | ||
84 | + | ||
85 | + public void setProduct_sku(String product_sku) { | ||
86 | + this.product_sku = product_sku; | ||
87 | + } | ||
88 | + | ||
89 | + public String getProduct_name() { | ||
90 | + return product_name; | ||
91 | + } | ||
92 | + | ||
93 | + public void setProduct_name(String product_name) { | ||
94 | + this.product_name = product_name; | ||
95 | + } | ||
96 | + | ||
97 | + public String getSort_id() { | ||
98 | + return sort_id; | ||
99 | + } | ||
100 | + | ||
101 | + public void setSort_id(String sort_id) { | ||
102 | + this.sort_id = sort_id; | ||
103 | + } | ||
104 | + | ||
105 | + public String getSort_name() { | ||
106 | + return sort_name; | ||
107 | + } | ||
108 | + | ||
109 | + public void setSort_name(String sort_name) { | ||
110 | + this.sort_name = sort_name; | ||
111 | + } | ||
112 | + | ||
113 | + public String getLast_price() { | ||
114 | + return last_price; | ||
115 | + } | ||
116 | + | ||
117 | + public void setLast_price(String last_price) { | ||
118 | + this.last_price = last_price; | ||
119 | + } | ||
120 | + | ||
121 | + public String getBuy_number() { | ||
122 | + return buy_number; | ||
123 | + } | ||
124 | + | ||
125 | + public void setBuy_number(String buy_number) { | ||
126 | + this.buy_number = buy_number; | ||
127 | + } | ||
128 | + | ||
129 | + public String getReal_pay_fee() { | ||
130 | + return real_pay_fee; | ||
131 | + } | ||
132 | + | ||
133 | + public void setReal_pay_fee(String real_pay_fee) { | ||
134 | + this.real_pay_fee = real_pay_fee; | ||
135 | + } | ||
136 | + | ||
137 | + public String getDiscount_fee() { | ||
138 | + return discount_fee; | ||
139 | + } | ||
140 | + | ||
141 | + public void setDiscount_fee(String discount_fee) { | ||
142 | + this.discount_fee = discount_fee; | ||
143 | + } | ||
144 | + | ||
145 | + public String getCommission() { | ||
146 | + return commission; | ||
147 | + } | ||
148 | + | ||
149 | + public void setCommission(String commission) { | ||
150 | + this.commission = commission; | ||
151 | + } | ||
152 | + | ||
153 | + public String getComm_type() { | ||
154 | + return comm_type; | ||
155 | + } | ||
156 | + | ||
157 | + public void setComm_type(String comm_type) { | ||
158 | + this.comm_type = comm_type; | ||
159 | + } | ||
160 | + | ||
161 | + public String getUpdate_time() { | ||
162 | + return update_time; | ||
163 | + } | ||
164 | + | ||
165 | + public void setUpdate_time(String update_time) { | ||
166 | + this.update_time = update_time; | ||
167 | + } | ||
168 | + | ||
169 | + public String getUrl() { | ||
170 | + return url; | ||
171 | + } | ||
172 | + | ||
173 | + public void setUrl(String url) { | ||
174 | + this.url = url; | ||
175 | + } | ||
42 | } | 176 | } |
1 | -package com.yoho.unions.server.service.impl; | ||
2 | - | ||
3 | -import com.yoho.unions.server.service.IOrderPushService; | ||
4 | -import com.yoho.unions.vo.OrderInfo; | ||
5 | -import com.yoho.unions.vo.OrdersGood; | ||
6 | -import net.spy.memcached.compat.log.Logger; | ||
7 | -import net.spy.memcached.compat.log.LoggerFactory; | ||
8 | - | ||
9 | -import java.math.BigDecimal; | ||
10 | -import java.net.URLEncoder; | ||
11 | -import java.util.ArrayList; | ||
12 | -import java.util.LinkedHashMap; | ||
13 | -import java.util.List; | ||
14 | -import java.util.Set; | ||
15 | - | ||
16 | -/** | ||
17 | - * 多麦推送订单数据 | ||
18 | - * Created by yoho on 2016/12/15. | ||
19 | - */ | ||
20 | -public class DuomaiServiceImpl implements IOrderPushService { | ||
21 | - | ||
22 | - static Logger logger = LoggerFactory.getLogger(DuomaiServiceImpl.class); | ||
23 | - | ||
24 | - @Override | ||
25 | - public void pushOrder(List<OrderInfo> orderInfoList){ | ||
26 | - | ||
27 | - for(OrderInfo orderInfo:orderInfoList){ | ||
28 | - //联盟id | ||
29 | - int client_id = orderInfo.getClientId(); | ||
30 | - String hash = ""; | ||
31 | - int channel = 0; | ||
32 | - if (client_id == 3017) { | ||
33 | - hash = "96613bf38393aa3d16451218f22344a8"; | ||
34 | - channel = 0; | ||
35 | - } else if (client_id == 3019) { | ||
36 | - hash = "d54be2dbc75753eb863ba6139950656b"; | ||
37 | - channel = 1; | ||
38 | - } else if (client_id == 3057) { | ||
39 | - hash = "bbf70bcaf5c52947ad26853f7cc1176d"; | ||
40 | - channel = 0; | ||
41 | - } | ||
42 | - //多麦在YOHO上的网站主标识 | ||
43 | - String euid = orderInfo.getMbrName(); | ||
44 | - String orderCode = orderInfo.getOrderCode(); | ||
45 | - int orderTime = orderInfo.getOrderTime(); | ||
46 | - BigDecimal orderAmount = orderInfo.getOrderAmount(); | ||
47 | - String orderStatus = orderInfo.getOrderStatus(); | ||
48 | - List<OrdersGood> goods = orderInfo.getOrdersGoods(); | ||
49 | - List<Integer> goodsIdList = new ArrayList<>(); | ||
50 | - StringBuffer goodId = new StringBuffer(); | ||
51 | - StringBuffer goodsName = new StringBuffer(); | ||
52 | - StringBuffer goodPrice = new StringBuffer(); | ||
53 | - StringBuffer goodNum = new StringBuffer(); | ||
54 | - //商品分类编号 | ||
55 | - StringBuffer goodCate = new StringBuffer(); | ||
56 | - //商品结算金额 price*num-优惠&折扣 | ||
57 | - StringBuffer totalPrice = new StringBuffer(); | ||
58 | - for(int i=0;i<goods.size();i++){ | ||
59 | - goodId.append(goods.get(i).getProductSkn()+ "|"); | ||
60 | - goodsName.append(goods.get(i).getProductName()+"|"); | ||
61 | - goodPrice.append(goods.get(i).getLastPrice()+"|"); | ||
62 | - goodNum.append(goods.get(i).getBuyNumber()+"|"); | ||
63 | - goodCate.append(goods.get(i).getSortId()+"|"); | ||
64 | - totalPrice.append(goods.get(i).getRealPayFee()+"|"); | ||
65 | - } | ||
66 | - | ||
67 | - LinkedHashMap<String,Object> linkedHashMap = new LinkedHashMap<>(); | ||
68 | - linkedHashMap.put("hash",hash); | ||
69 | - linkedHashMap.put("euid",euid); | ||
70 | - linkedHashMap.put("order_sn",orderCode); | ||
71 | - linkedHashMap.put("order_time",orderTime); | ||
72 | - linkedHashMap.put("orders_price",orderAmount); | ||
73 | - linkedHashMap.put("promotion_code",0); | ||
74 | - //@TODO需要订单传过来,是否新用户 | ||
75 | - linkedHashMap.put("is_new_custom",0); | ||
76 | - linkedHashMap.put("channel", channel); | ||
77 | - linkedHashMap.put("status", orderStatus); | ||
78 | - linkedHashMap.put("goods_id",goodId.toString()); | ||
79 | - linkedHashMap.put("goods_name",goodsName.toString()); | ||
80 | - linkedHashMap.put("goods_price",goodPrice.toString()); | ||
81 | - linkedHashMap.put("goods_ta",goodNum.toString()); | ||
82 | - linkedHashMap.put("goods_cate",goodCate.toString()); | ||
83 | - linkedHashMap.put("goods_cate_name",0); | ||
84 | - linkedHashMap.put("totalPrice",totalPrice.toString()); | ||
85 | - //佣金计算,月底计算一次,7%计算,数据库比例已经老的 | ||
86 | - linkedHashMap.put("rate", 0); | ||
87 | - linkedHashMap.put("commission",""); | ||
88 | - linkedHashMap.put("commission_type", 0); | ||
89 | - linkedHashMap.put("coupon", MathUtils.roundPrice(tmpReturnedOrder.coupon)); | ||
90 | - Set<String> keys = linkedHashMap.keySet(); | ||
91 | - StringBuilder builder = new StringBuilder(); | ||
92 | - for (String key : keys) { | ||
93 | - builder.append(key).append("=").append(linkedHashMap.get(key)).append("&"); | ||
94 | - } | ||
95 | - | ||
96 | - return URLEncoder.encode(builder.substring(0, builder.length() - 1), "UTF-8"); | ||
97 | - | ||
98 | - } | ||
99 | - } | ||
100 | - | ||
101 | -} | 1 | +//package com.yoho.unions.server.service.impl; |
2 | +// | ||
3 | +//import com.yoho.unions.server.service.IOrderPushService; | ||
4 | +//import com.yoho.unions.vo.OrderInfo; | ||
5 | +//import com.yoho.unions.vo.OrdersGood; | ||
6 | +//import net.spy.memcached.compat.log.Logger; | ||
7 | +//import net.spy.memcached.compat.log.LoggerFactory; | ||
8 | +// | ||
9 | +//import java.math.BigDecimal; | ||
10 | +//import java.net.URLEncoder; | ||
11 | +//import java.util.ArrayList; | ||
12 | +//import java.util.LinkedHashMap; | ||
13 | +//import java.util.List; | ||
14 | +//import java.util.Set; | ||
15 | +// | ||
16 | +///** | ||
17 | +// * 多麦推送订单数据 | ||
18 | +// * Created by yoho on 2016/12/15. | ||
19 | +// */ | ||
20 | +//public class DuomaiServiceImpl implements IOrderPushService { | ||
21 | +// | ||
22 | +// static Logger logger = LoggerFactory.getLogger(DuomaiServiceImpl.class); | ||
23 | +// | ||
24 | +// @Override | ||
25 | +// public void pushOrder(List<OrderInfo> orderInfoList){ | ||
26 | +// | ||
27 | +// for(OrderInfo orderInfo:orderInfoList){ | ||
28 | +// //联盟id | ||
29 | +// int client_id = orderInfo.getClientId(); | ||
30 | +// String hash = ""; | ||
31 | +// int channel = 0; | ||
32 | +// if (client_id == 3017) { | ||
33 | +// hash = "96613bf38393aa3d16451218f22344a8"; | ||
34 | +// channel = 0; | ||
35 | +// } else if (client_id == 3019) { | ||
36 | +// hash = "d54be2dbc75753eb863ba6139950656b"; | ||
37 | +// channel = 1; | ||
38 | +// } else if (client_id == 3057) { | ||
39 | +// hash = "bbf70bcaf5c52947ad26853f7cc1176d"; | ||
40 | +// channel = 0; | ||
41 | +// } | ||
42 | +// //多麦在YOHO上的网站主标识 | ||
43 | +// String euid = orderInfo.getMbrName(); | ||
44 | +// String orderCode = orderInfo.getOrderCode(); | ||
45 | +// int orderTime = orderInfo.getOrderTime(); | ||
46 | +// BigDecimal orderAmount = orderInfo.getOrderAmount(); | ||
47 | +// String orderStatus = orderInfo.getOrderStatus(); | ||
48 | +// List<OrdersGood> goods = orderInfo.getOrdersGoods(); | ||
49 | +// List<Integer> goodsIdList = new ArrayList<>(); | ||
50 | +// StringBuffer goodId = new StringBuffer(); | ||
51 | +// StringBuffer goodsName = new StringBuffer(); | ||
52 | +// StringBuffer goodPrice = new StringBuffer(); | ||
53 | +// StringBuffer goodNum = new StringBuffer(); | ||
54 | +// //商品分类编号 | ||
55 | +// StringBuffer goodCate = new StringBuffer(); | ||
56 | +// //商品结算金额 price*num-优惠&折扣 | ||
57 | +// StringBuffer totalPrice = new StringBuffer(); | ||
58 | +// for(int i=0;i<goods.size();i++){ | ||
59 | +// goodId.append(goods.get(i).getProductSkn()+ "|"); | ||
60 | +// goodsName.append(goods.get(i).getProductName()+"|"); | ||
61 | +// goodPrice.append(goods.get(i).getLastPrice()+"|"); | ||
62 | +// goodNum.append(goods.get(i).getBuyNumber()+"|"); | ||
63 | +// goodCate.append(goods.get(i).getSortId()+"|"); | ||
64 | +// totalPrice.append(goods.get(i).getRealPayFee()+"|"); | ||
65 | +// } | ||
66 | +// | ||
67 | +// LinkedHashMap<String,Object> linkedHashMap = new LinkedHashMap<>(); | ||
68 | +// linkedHashMap.put("hash",hash); | ||
69 | +// linkedHashMap.put("euid",euid); | ||
70 | +// linkedHashMap.put("order_sn",orderCode); | ||
71 | +// linkedHashMap.put("order_time",orderTime); | ||
72 | +// linkedHashMap.put("orders_price",orderAmount); | ||
73 | +// linkedHashMap.put("promotion_code",0); | ||
74 | +// //@TODO需要订单传过来,是否新用户 | ||
75 | +// linkedHashMap.put("is_new_custom",0); | ||
76 | +// linkedHashMap.put("channel", channel); | ||
77 | +// linkedHashMap.put("status", orderStatus); | ||
78 | +// linkedHashMap.put("goods_id",goodId.toString()); | ||
79 | +// linkedHashMap.put("goods_name",goodsName.toString()); | ||
80 | +// linkedHashMap.put("goods_price",goodPrice.toString()); | ||
81 | +// linkedHashMap.put("goods_ta",goodNum.toString()); | ||
82 | +// linkedHashMap.put("goods_cate",goodCate.toString()); | ||
83 | +// linkedHashMap.put("goods_cate_name",0); | ||
84 | +// linkedHashMap.put("totalPrice",totalPrice.toString()); | ||
85 | +// //佣金计算,月底计算一次,7%计算,数据库比例已经老的 | ||
86 | +// linkedHashMap.put("rate", 0); | ||
87 | +// linkedHashMap.put("commission",""); | ||
88 | +// linkedHashMap.put("commission_type", 0); | ||
89 | +// linkedHashMap.put("coupon", MathUtils.roundPrice(tmpReturnedOrder.coupon)); | ||
90 | +// Set<String> keys = linkedHashMap.keySet(); | ||
91 | +// StringBuilder builder = new StringBuilder(); | ||
92 | +// for (String key : keys) { | ||
93 | +// builder.append(key).append("=").append(linkedHashMap.get(key)).append("&"); | ||
94 | +// } | ||
95 | +// | ||
96 | +// return URLEncoder.encode(builder.substring(0, builder.length() - 1), "UTF-8"); | ||
97 | +// | ||
98 | +// } | ||
99 | +// } | ||
100 | +// | ||
101 | +//} |
@@ -73,7 +73,7 @@ public class GDT2ServiceImpl extends UnionServiceImpl implements IUnionService { | @@ -73,7 +73,7 @@ public class GDT2ServiceImpl extends UnionServiceImpl implements IUnionService { | ||
73 | * @param requestBO | 73 | * @param requestBO |
74 | * @return | 74 | * @return |
75 | */ | 75 | */ |
76 | - private String urlEode(ActivateUnionRequestBO requestBO) { | 76 | + public String urlEode(ActivateUnionRequestBO requestBO) { |
77 | log.info("enter GDTServiceImpl.urlEode param{} is ", requestBO); | 77 | log.info("enter GDTServiceImpl.urlEode param{} is ", requestBO); |
78 | // 根据不同的应用类型,获取不同的加密密钥和签名密钥 | 78 | // 根据不同的应用类型,获取不同的加密密钥和签名密钥 |
79 | String encryptKey = null; | 79 | String encryptKey = null; |
@@ -106,7 +106,7 @@ public class GDT2ServiceImpl extends UnionServiceImpl implements IUnionService { | @@ -106,7 +106,7 @@ public class GDT2ServiceImpl extends UnionServiceImpl implements IUnionService { | ||
106 | String url = DynamicPropertyFactory.getInstance().getStringProperty("guangdiantong.url", "").get(); | 106 | String url = DynamicPropertyFactory.getInstance().getStringProperty("guangdiantong.url", "").get(); |
107 | int conv_time = DateUtil.getCurrentTimeSecond(); | 107 | int conv_time = DateUtil.getCurrentTimeSecond(); |
108 | String client_ip = requestBO.getClientIp(); | 108 | String client_ip = requestBO.getClientIp(); |
109 | - String clickId = requestBO.getCommonUse(); | 109 | + String clickId = requestBO.getUdid(); |
110 | String appId = requestBO.getAppid(); | 110 | String appId = requestBO.getAppid(); |
111 | StringBuffer bf = new StringBuffer(); | 111 | StringBuffer bf = new StringBuffer(); |
112 | StringBuffer sf = new StringBuffer(); | 112 | StringBuffer sf = new StringBuffer(); |
@@ -9,9 +9,6 @@ import java.util.concurrent.TimeUnit; | @@ -9,9 +9,6 @@ import java.util.concurrent.TimeUnit; | ||
9 | 9 | ||
10 | import javax.annotation.Resource; | 10 | import javax.annotation.Resource; |
11 | 11 | ||
12 | -import com.yoho.unions.common.redis.RedisValueCache; | ||
13 | -import com.yoho.unions.dal.IUnionTypeDAO; | ||
14 | -import com.yoho.unions.dal.model.UnionType; | ||
15 | import org.apache.commons.collections.CollectionUtils; | 12 | import org.apache.commons.collections.CollectionUtils; |
16 | import org.apache.commons.lang3.StringUtils; | 13 | import org.apache.commons.lang3.StringUtils; |
17 | import org.apache.commons.lang3.tuple.Pair; | 14 | import org.apache.commons.lang3.tuple.Pair; |
@@ -32,15 +29,17 @@ import com.yoho.service.model.union.UnionTypeModel; | @@ -32,15 +29,17 @@ import com.yoho.service.model.union.UnionTypeModel; | ||
32 | import com.yoho.service.model.union.request.ActivateUnionRequestBO; | 29 | import com.yoho.service.model.union.request.ActivateUnionRequestBO; |
33 | import com.yoho.service.model.union.request.ClickUnionRequestBO; | 30 | import com.yoho.service.model.union.request.ClickUnionRequestBO; |
34 | import com.yoho.service.model.union.response.UnionResponse; | 31 | import com.yoho.service.model.union.response.UnionResponse; |
35 | -import com.yoho.unions.common.constant.UnionConstant; | ||
36 | import com.yoho.unions.common.enums.ClientTypeEnum; | 32 | import com.yoho.unions.common.enums.ClientTypeEnum; |
33 | +import com.yoho.unions.common.redis.RedisValueCache; | ||
37 | import com.yoho.unions.common.utils.DateUtil; | 34 | import com.yoho.unions.common.utils.DateUtil; |
38 | import com.yoho.unions.common.utils.HttpUtils; | 35 | import com.yoho.unions.common.utils.HttpUtils; |
39 | import com.yoho.unions.common.utils.SpringContextUtil; | 36 | import com.yoho.unions.common.utils.SpringContextUtil; |
40 | import com.yoho.unions.dal.IAppActivateIdfaListDAO; | 37 | import com.yoho.unions.dal.IAppActivateIdfaListDAO; |
41 | import com.yoho.unions.dal.IUnionLogsDAO; | 38 | import com.yoho.unions.dal.IUnionLogsDAO; |
39 | +import com.yoho.unions.dal.IUnionTypeDAO; | ||
42 | import com.yoho.unions.dal.model.AppActivateIdfaList; | 40 | import com.yoho.unions.dal.model.AppActivateIdfaList; |
43 | import com.yoho.unions.dal.model.UnionLogs; | 41 | import com.yoho.unions.dal.model.UnionLogs; |
42 | +import com.yoho.unions.dal.model.UnionType; | ||
44 | import com.yoho.unions.server.service.IUnionService; | 43 | import com.yoho.unions.server.service.IUnionService; |
45 | 44 | ||
46 | /** | 45 | /** |
@@ -161,9 +160,18 @@ public class UnionServiceImpl implements IUnionService { | @@ -161,9 +160,18 @@ public class UnionServiceImpl implements IUnionService { | ||
161 | String invalidTime = "activeTime"+"_"+request.getUnion_type(); | 160 | String invalidTime = "activeTime"+"_"+request.getUnion_type(); |
162 | DynamicIntProperty activeTime = DynamicPropertyFactory.getInstance().getIntProperty(invalidTime, 3); | 161 | DynamicIntProperty activeTime = DynamicPropertyFactory.getInstance().getIntProperty(invalidTime, 3); |
163 | yHRedisTemplate.longExpire(key, activeTime.get(), TimeUnit.HOURS); | 162 | yHRedisTemplate.longExpire(key, activeTime.get(), TimeUnit.HOURS); |
164 | - log.info("clickUnion set redis success with request={}", request); | ||
165 | 163 | ||
166 | 164 | ||
165 | + //把IP作为key,也保存到redis | ||
166 | + key = UNION_KEY + "_" + request.getClientIp() + "_" + request.getAppkey(); | ||
167 | + yhValueOperations.set(key, JSON.toJSONString(request)); | ||
168 | + yHRedisTemplate.longExpire(key, activeTime.get(), TimeUnit.HOURS); | ||
169 | + log.info("clickUnion set redis second success. with key={}, value={}", key, JSON.toJSONString(request)); | ||
170 | + | ||
171 | + | ||
172 | + | ||
173 | + log.info("clickUnion set redis success with request={}", request); | ||
174 | + | ||
167 | // if (union != null) { | 175 | // if (union != null) { |
168 | // //如果90天以内,已经存在点击记录,则不需要插入或更新数据库 | 176 | // //如果90天以内,已经存在点击记录,则不需要插入或更新数据库 |
169 | // log.info("clickUnion have click in 90 days with request={}", request); | 177 | // log.info("clickUnion have click in 90 days with request={}", request); |
@@ -308,6 +316,13 @@ public class UnionServiceImpl implements IUnionService { | @@ -308,6 +316,13 @@ public class UnionServiceImpl implements IUnionService { | ||
308 | // request); | 316 | // request); |
309 | // return new UnionResponse(205, "not click record"); | 317 | // return new UnionResponse(205, "not click record"); |
310 | // } | 318 | // } |
319 | + | ||
320 | + | ||
321 | + //删除redis中的点击记录 | ||
322 | + yHRedisTemplate.delete(key); | ||
323 | + | ||
324 | + //强制删除带ip的key | ||
325 | + yHRedisTemplate.delete(UNION_KEY + "_" + request.getClientIp() + "_" + request.getAppkey()); | ||
311 | 326 | ||
312 | if (union != null && union.getIsActivate() != null && union.getIsActivate().byteValue() == 1) { | 327 | if (union != null && union.getIsActivate() != null && union.getIsActivate().byteValue() == 1) { |
313 | // 如果90天之内有过激活日志,则不允许重复激活 | 328 | // 如果90天之内有过激活日志,则不允许重复激活 |
@@ -386,8 +401,7 @@ public class UnionServiceImpl implements IUnionService { | @@ -386,8 +401,7 @@ public class UnionServiceImpl implements IUnionService { | ||
386 | unionLogsDAO.insert(logs); | 401 | unionLogsDAO.insert(logs); |
387 | log.info("activateUnion add db success with request is {}, and dbData={}", request, logs); | 402 | log.info("activateUnion add db success with request is {}, and dbData={}", request, logs); |
388 | 403 | ||
389 | - //删除redis中的点击记录 | ||
390 | - yHRedisTemplate.delete(key); | 404 | + |
391 | 405 | ||
392 | // 记录日志 | 406 | // 记录日志 |
393 | JSONObject j = new JSONObject(); | 407 | JSONObject j = new JSONObject(); |
@@ -431,7 +445,10 @@ public class UnionServiceImpl implements IUnionService { | @@ -431,7 +445,10 @@ public class UnionServiceImpl implements IUnionService { | ||
431 | log.info("activateUnion in success request is {}", request); | 445 | log.info("activateUnion in success request is {}", request); |
432 | return new UnionResponse(); | 446 | return new UnionResponse(); |
433 | } | 447 | } |
434 | - url = URLDecoder.decode(url, "UTF-8"); | 448 | + if(!"3".equals(union_type)){ |
449 | + url = URLDecoder.decode(url, "UTF-8"); | ||
450 | + } | ||
451 | + | ||
435 | if (url.indexOf("?") > 0) { | 452 | if (url.indexOf("?") > 0) { |
436 | url += "&identify_id=" + click.getIdentify_id(); | 453 | url += "&identify_id=" + click.getIdentify_id(); |
437 | } else { | 454 | } else { |
@@ -39,8 +39,8 @@ public class Test { | @@ -39,8 +39,8 @@ public class Test { | ||
39 | requestBO.setAppid("490655927"); | 39 | requestBO.setAppid("490655927"); |
40 | requestBO.setClient_type("ios"); | 40 | requestBO.setClient_type("ios"); |
41 | // requestBO.setClientIp("171.213.29.236"); | 41 | // requestBO.setClientIp("171.213.29.236"); |
42 | - String url = gdt2Service.urlEode(requestBO); | ||
43 | - String url1 = url+"&identify_id=null"; | 42 | +// String url = gdt2Service.urlEode(requestBO); |
43 | +// String url1 = url+"&identify_id=null"; | ||
44 | // Pair<Integer, String> pair = HttpUtils.httpGet(url1); | 44 | // Pair<Integer, String> pair = HttpUtils.httpGet(url1); |
45 | // try{ | 45 | // try{ |
46 | // url = URLDecoder.decode(url1, "UTF-8"); | 46 | // url = URLDecoder.decode(url1, "UTF-8"); |
-
Please register or login to post a comment