Showing
6 changed files
with
282 additions
and
0 deletions
1 | +package com.yoho.unions.dal; | ||
2 | + | ||
3 | +import com.yoho.unions.dal.model.UnionCallbackLogs; | ||
4 | + | ||
5 | +public interface IUnionCallbackLogsDAO { | ||
6 | + int deleteByPrimaryKey(Integer id); | ||
7 | + | ||
8 | + int insert(UnionCallbackLogs record); | ||
9 | + | ||
10 | + int insertSelective(UnionCallbackLogs record); | ||
11 | + | ||
12 | + UnionCallbackLogs selectByPrimaryKey(Integer id); | ||
13 | + | ||
14 | + int updateByPrimaryKeySelective(UnionCallbackLogs record); | ||
15 | + | ||
16 | + int updateByPrimaryKey(UnionCallbackLogs record); | ||
17 | +} |
1 | +package com.yoho.unions.dal.model; | ||
2 | + | ||
3 | +public class UnionCallbackLogs { | ||
4 | + private Integer id; | ||
5 | + | ||
6 | + private String unionType; | ||
7 | + | ||
8 | + private String unionName; | ||
9 | + | ||
10 | + private String url; | ||
11 | + | ||
12 | + private String result; | ||
13 | + | ||
14 | + private String idfa; | ||
15 | + | ||
16 | + private String imei; | ||
17 | + | ||
18 | + private String udid; | ||
19 | + | ||
20 | + private Integer createtime; | ||
21 | + | ||
22 | + public Integer getId() { | ||
23 | + return id; | ||
24 | + } | ||
25 | + | ||
26 | + public void setId(Integer id) { | ||
27 | + this.id = id; | ||
28 | + } | ||
29 | + | ||
30 | + public String getUnionType() { | ||
31 | + return unionType; | ||
32 | + } | ||
33 | + | ||
34 | + public void setUnionType(String unionType) { | ||
35 | + this.unionType = unionType == null ? null : unionType.trim(); | ||
36 | + } | ||
37 | + | ||
38 | + public String getUnionName() { | ||
39 | + return unionName; | ||
40 | + } | ||
41 | + | ||
42 | + public void setUnionName(String unionName) { | ||
43 | + this.unionName = unionName == null ? null : unionName.trim(); | ||
44 | + } | ||
45 | + | ||
46 | + public String getUrl() { | ||
47 | + return url; | ||
48 | + } | ||
49 | + | ||
50 | + public void setUrl(String url) { | ||
51 | + this.url = url == null ? null : url.trim(); | ||
52 | + } | ||
53 | + | ||
54 | + public String getResult() { | ||
55 | + return result; | ||
56 | + } | ||
57 | + | ||
58 | + public void setResult(String result) { | ||
59 | + this.result = result == null ? null : result.trim(); | ||
60 | + } | ||
61 | + | ||
62 | + public String getIdfa() { | ||
63 | + return idfa; | ||
64 | + } | ||
65 | + | ||
66 | + public void setIdfa(String idfa) { | ||
67 | + this.idfa = idfa == null ? null : idfa.trim(); | ||
68 | + } | ||
69 | + | ||
70 | + public String getImei() { | ||
71 | + return imei; | ||
72 | + } | ||
73 | + | ||
74 | + public void setImei(String imei) { | ||
75 | + this.imei = imei == null ? null : imei.trim(); | ||
76 | + } | ||
77 | + | ||
78 | + public String getUdid() { | ||
79 | + return udid; | ||
80 | + } | ||
81 | + | ||
82 | + public void setUdid(String udid) { | ||
83 | + this.udid = udid == null ? null : udid.trim(); | ||
84 | + } | ||
85 | + | ||
86 | + public Integer getCreatetime() { | ||
87 | + return createtime; | ||
88 | + } | ||
89 | + | ||
90 | + public void setCreatetime(Integer createtime) { | ||
91 | + this.createtime = createtime; | ||
92 | + } | ||
93 | +} |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
3 | +<mapper namespace="com.yoho.unions.dal.IUnionCallbackLogsDAO" > | ||
4 | + <resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.UnionCallbackLogs" > | ||
5 | + <id column="id" property="id" jdbcType="INTEGER" /> | ||
6 | + <result column="union_type" property="unionType" jdbcType="VARCHAR" /> | ||
7 | + <result column="union_name" property="unionName" jdbcType="VARCHAR" /> | ||
8 | + <result column="url" property="url" jdbcType="VARCHAR" /> | ||
9 | + <result column="result" property="result" jdbcType="VARCHAR" /> | ||
10 | + <result column="idfa" property="idfa" jdbcType="VARCHAR" /> | ||
11 | + <result column="imei" property="imei" jdbcType="VARCHAR" /> | ||
12 | + <result column="udid" property="udid" jdbcType="VARCHAR" /> | ||
13 | + <result column="createTime" property="createtime" jdbcType="INTEGER" /> | ||
14 | + </resultMap> | ||
15 | + <sql id="Base_Column_List" > | ||
16 | + id, union_type, union_name, url, result, idfa, imei, udid, createTime | ||
17 | + </sql> | ||
18 | + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > | ||
19 | + select | ||
20 | + <include refid="Base_Column_List" /> | ||
21 | + from union_callback_logs | ||
22 | + where id = #{id,jdbcType=INTEGER} | ||
23 | + </select> | ||
24 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > | ||
25 | + delete from union_callback_logs | ||
26 | + where id = #{id,jdbcType=INTEGER} | ||
27 | + </delete> | ||
28 | + <insert id="insert" parameterType="com.yoho.unions.dal.model.UnionCallbackLogs" > | ||
29 | + insert into union_callback_logs (id, union_type, union_name, | ||
30 | + url, result, idfa, | ||
31 | + imei, udid, createTime | ||
32 | + ) | ||
33 | + values (#{id,jdbcType=INTEGER}, #{unionType,jdbcType=VARCHAR}, #{unionName,jdbcType=VARCHAR}, | ||
34 | + #{url,jdbcType=VARCHAR}, #{result,jdbcType=VARCHAR}, #{idfa,jdbcType=VARCHAR}, | ||
35 | + #{imei,jdbcType=VARCHAR}, #{udid,jdbcType=VARCHAR}, #{createtime,jdbcType=INTEGER} | ||
36 | + ) | ||
37 | + </insert> | ||
38 | + <insert id="insertSelective" parameterType="com.yoho.unions.dal.model.UnionCallbackLogs" > | ||
39 | + insert into union_callback_logs | ||
40 | + <trim prefix="(" suffix=")" suffixOverrides="," > | ||
41 | + <if test="id != null" > | ||
42 | + id, | ||
43 | + </if> | ||
44 | + <if test="unionType != null" > | ||
45 | + union_type, | ||
46 | + </if> | ||
47 | + <if test="unionName != null" > | ||
48 | + union_name, | ||
49 | + </if> | ||
50 | + <if test="url != null" > | ||
51 | + url, | ||
52 | + </if> | ||
53 | + <if test="result != null" > | ||
54 | + result, | ||
55 | + </if> | ||
56 | + <if test="idfa != null" > | ||
57 | + idfa, | ||
58 | + </if> | ||
59 | + <if test="imei != null" > | ||
60 | + imei, | ||
61 | + </if> | ||
62 | + <if test="udid != null" > | ||
63 | + udid, | ||
64 | + </if> | ||
65 | + <if test="createtime != null" > | ||
66 | + createTime, | ||
67 | + </if> | ||
68 | + </trim> | ||
69 | + <trim prefix="values (" suffix=")" suffixOverrides="," > | ||
70 | + <if test="id != null" > | ||
71 | + #{id,jdbcType=INTEGER}, | ||
72 | + </if> | ||
73 | + <if test="unionType != null" > | ||
74 | + #{unionType,jdbcType=VARCHAR}, | ||
75 | + </if> | ||
76 | + <if test="unionName != null" > | ||
77 | + #{unionName,jdbcType=VARCHAR}, | ||
78 | + </if> | ||
79 | + <if test="url != null" > | ||
80 | + #{url,jdbcType=VARCHAR}, | ||
81 | + </if> | ||
82 | + <if test="result != null" > | ||
83 | + #{result,jdbcType=VARCHAR}, | ||
84 | + </if> | ||
85 | + <if test="idfa != null" > | ||
86 | + #{idfa,jdbcType=VARCHAR}, | ||
87 | + </if> | ||
88 | + <if test="imei != null" > | ||
89 | + #{imei,jdbcType=VARCHAR}, | ||
90 | + </if> | ||
91 | + <if test="udid != null" > | ||
92 | + #{udid,jdbcType=VARCHAR}, | ||
93 | + </if> | ||
94 | + <if test="createtime != null" > | ||
95 | + #{createtime,jdbcType=INTEGER}, | ||
96 | + </if> | ||
97 | + </trim> | ||
98 | + </insert> | ||
99 | + <update id="updateByPrimaryKeySelective" parameterType="com.yoho.unions.dal.model.UnionCallbackLogs" > | ||
100 | + update union_callback_logs | ||
101 | + <set > | ||
102 | + <if test="unionType != null" > | ||
103 | + union_type = #{unionType,jdbcType=VARCHAR}, | ||
104 | + </if> | ||
105 | + <if test="unionName != null" > | ||
106 | + union_name = #{unionName,jdbcType=VARCHAR}, | ||
107 | + </if> | ||
108 | + <if test="url != null" > | ||
109 | + url = #{url,jdbcType=VARCHAR}, | ||
110 | + </if> | ||
111 | + <if test="result != null" > | ||
112 | + result = #{result,jdbcType=VARCHAR}, | ||
113 | + </if> | ||
114 | + <if test="idfa != null" > | ||
115 | + idfa = #{idfa,jdbcType=VARCHAR}, | ||
116 | + </if> | ||
117 | + <if test="imei != null" > | ||
118 | + imei = #{imei,jdbcType=VARCHAR}, | ||
119 | + </if> | ||
120 | + <if test="udid != null" > | ||
121 | + udid = #{udid,jdbcType=VARCHAR}, | ||
122 | + </if> | ||
123 | + <if test="createtime != null" > | ||
124 | + createTime = #{createtime,jdbcType=INTEGER}, | ||
125 | + </if> | ||
126 | + </set> | ||
127 | + where id = #{id,jdbcType=INTEGER} | ||
128 | + </update> | ||
129 | + <update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.UnionCallbackLogs" > | ||
130 | + update union_callback_logs | ||
131 | + set union_type = #{unionType,jdbcType=VARCHAR}, | ||
132 | + union_name = #{unionName,jdbcType=VARCHAR}, | ||
133 | + url = #{url,jdbcType=VARCHAR}, | ||
134 | + result = #{result,jdbcType=VARCHAR}, | ||
135 | + idfa = #{idfa,jdbcType=VARCHAR}, | ||
136 | + imei = #{imei,jdbcType=VARCHAR}, | ||
137 | + udid = #{udid,jdbcType=VARCHAR}, | ||
138 | + createTime = #{createtime,jdbcType=INTEGER} | ||
139 | + where id = #{id,jdbcType=INTEGER} | ||
140 | + </update> | ||
141 | +</mapper> |
@@ -89,6 +89,9 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher | @@ -89,6 +89,9 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher | ||
89 | 89 | ||
90 | @Resource | 90 | @Resource |
91 | IUnionLogsDAO unionLogsDAO; | 91 | IUnionLogsDAO unionLogsDAO; |
92 | + | ||
93 | + @Resource | ||
94 | + IUnionCallbackLogsDAO unionCallbackLogsDAO; | ||
92 | 95 | ||
93 | @Resource | 96 | @Resource |
94 | IAppActivateIdfaListDAO appActivateIdfaListDAO; | 97 | IAppActivateIdfaListDAO appActivateIdfaListDAO; |
@@ -546,6 +549,22 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher | @@ -546,6 +549,22 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher | ||
546 | activeUnion.info("activateUnion in call url={}", url); | 549 | activeUnion.info("activateUnion in call url={}", url); |
547 | //改成httpclient方式调用 | 550 | //改成httpclient方式调用 |
548 | Pair<Integer, String> pair = HttpUtils.httpGet(url); | 551 | Pair<Integer, String> pair = HttpUtils.httpGet(url); |
552 | + | ||
553 | + try{ | ||
554 | + UnionCallbackLogs unionCallbackLogs = new UnionCallbackLogs(); | ||
555 | + unionCallbackLogs.setUnionName(mktMarketingUrl.getName()); | ||
556 | + unionCallbackLogs.setUnionType(click.getUnion_type()); | ||
557 | + unionCallbackLogs.setUdid(request.getUdid()); | ||
558 | + unionCallbackLogs.setUrl(url); | ||
559 | + unionCallbackLogs.setIdfa(request.getIdfa()); | ||
560 | + unionCallbackLogs.setImei(request.getImei()); | ||
561 | + unionCallbackLogs.setResult(pair.toString()); | ||
562 | + unionCallbackLogs.setCreatetime(DateUtils.getCurrentTimeSecond()); | ||
563 | + saveUnionCallbackLogs(unionCallbackLogs); | ||
564 | + }catch (Exception e){ | ||
565 | + log.warn("save union_callback_logs e={}", e.getMessage()); | ||
566 | + } | ||
567 | + | ||
549 | activeUnion.info("activateUnion call union success url={}, and result={}", url, pair); | 568 | activeUnion.info("activateUnion call union success url={}, and result={}", url, pair); |
550 | if (pair.getLeft() != 200) { | 569 | if (pair.getLeft() != 200) { |
551 | log.warn("callback error with request={}", request); | 570 | log.warn("callback error with request={}", request); |
@@ -573,6 +592,16 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher | @@ -573,6 +592,16 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher | ||
573 | 592 | ||
574 | } | 593 | } |
575 | 594 | ||
595 | + private void saveUnionCallbackLogs(UnionCallbackLogs unionCallbackLogs) { | ||
596 | + taskExecutor.execute(new Runnable() { | ||
597 | + @Override | ||
598 | + public void run() | ||
599 | + { | ||
600 | + unionCallbackLogsDAO.insertSelective(unionCallbackLogs); | ||
601 | + } | ||
602 | + }); | ||
603 | + } | ||
604 | + | ||
576 | @Override | 605 | @Override |
577 | public PageActivateDeviceIdRspBO queryActivateDeviceId(ActivateDeviceIdReqBO activateDeviceIdReqBO) { | 606 | public PageActivateDeviceIdRspBO queryActivateDeviceId(ActivateDeviceIdReqBO activateDeviceIdReqBO) { |
578 | log.info("enter queryActivateDeviceId. param activateDeviceIdReqBO={}", activateDeviceIdReqBO); | 607 | log.info("enter queryActivateDeviceId. param activateDeviceIdReqBO={}", activateDeviceIdReqBO); |
@@ -16,6 +16,7 @@ datasources: | @@ -16,6 +16,7 @@ datasources: | ||
16 | - com.yoho.unions.dal.IUnionLogsDAO | 16 | - com.yoho.unions.dal.IUnionLogsDAO |
17 | - com.yoho.unions.dal.IUnionClickLogsDAO | 17 | - com.yoho.unions.dal.IUnionClickLogsDAO |
18 | - com.yoho.unions.dal.IUnionActivityLogsDAO | 18 | - com.yoho.unions.dal.IUnionActivityLogsDAO |
19 | + - com.yoho.unions.dal.IUnionCallbackLogsDAO | ||
19 | 20 | ||
20 | app: | 21 | app: |
21 | servers: | 22 | servers: |
@@ -16,6 +16,7 @@ datasources: | @@ -16,6 +16,7 @@ datasources: | ||
16 | - com.yoho.unions.dal.IUnionLogsDAO | 16 | - com.yoho.unions.dal.IUnionLogsDAO |
17 | - com.yoho.unions.dal.IUnionClickLogsDAO | 17 | - com.yoho.unions.dal.IUnionClickLogsDAO |
18 | - com.yoho.unions.dal.IUnionActivityLogsDAO | 18 | - com.yoho.unions.dal.IUnionActivityLogsDAO |
19 | + - com.yoho.unions.dal.IUnionCallbackLogsDAO | ||
19 | 20 | ||
20 | 21 | ||
21 | app: | 22 | app: |
-
Please register or login to post a comment