Toggle navigation
Toggle navigation
This project
Loading...
Sign in
YOHOBUY
/
yohobuy-union
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
zhengwen.ge
9 years ago
Commit
445caaa82e7790438fa1c8284591e38bccb2c649
1 parent
68e94e84
增加排重逻辑
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
2 deletions
dal/src/main/java/com/yoho/unions/dal/IUnionLogsDAO.java
dal/src/main/resources/META-INF/mybatis/UnionLogsMapper.xml
server/src/main/java/com/yoho/unions/server/service/impl/GDTServiceImpl.java
dal/src/main/java/com/yoho/unions/dal/IUnionLogsDAO.java
View file @
445caaa
package
com
.
yoho
.
unions
.
dal
;
import
org.apache.ibatis.annotations.Param
;
import
com.yoho.unions.dal.model.UnionLogs
;
...
...
@@ -16,4 +18,8 @@ public interface IUnionLogsDAO {
int
updateByPrimaryKeySelective
(
UnionLogs
record
);
int
updateByPrimaryKey
(
UnionLogs
record
);
UnionLogs
selectIOS
(
@Param
(
"appId"
)
String
appId
,
@Param
(
"idfa"
)
String
idfa
,
@Param
(
"clientType"
)
String
clientType
);
UnionLogs
selectAndroid
(
@Param
(
"appId"
)
String
appId
,
@Param
(
"imei"
)
String
imei
,
@Param
(
"clientType"
)
String
clientType
);
}
...
...
dal/src/main/resources/META-INF/mybatis/UnionLogsMapper.xml
View file @
445caaa
...
...
@@ -59,4 +59,20 @@
client_type=#{clientType}
where id = #{id,jdbcType=INTEGER}
</update>
<select
id=
"selectIOS"
resultMap=
"BaseResultMap"
parameterType=
"com.yoho.unions.dal.model.UnionLogs"
>
select
<include
refid=
"Base_Column_List"
/>
from union_logs
where app_id = #{appId,jdbcType=VARCHAR} and
idfa = #{idfa,jdbcType=VARCHAR} and
client_type=#{clientType}
</select>
<select
id=
"selectAndroid"
resultMap=
"BaseResultMap"
parameterType=
"com.yoho.unions.dal.model.UnionLogs"
>
select
<include
refid=
"Base_Column_List"
/>
from union_logs
where app_id = #{appId,jdbcType=VARCHAR} and
imei = #{imei,jdbcType=VARCHAR} and
client_type=#{clientType}
</select>
</mapper>
\ No newline at end of file
...
...
server/src/main/java/com/yoho/unions/server/service/impl/GDTServiceImpl.java
View file @
445caaa
...
...
@@ -72,12 +72,25 @@ public class GDTServiceImpl implements MainUnionService {
@Override
public
UnionResponseBO
activeUnion
(
ActivateUnionRequestBO
request
)
{
log
.
info
(
"activateUnion with param is{}"
,
request
);
UnionResponseBO
response
=
check
(
request
);
if
(!
response
.
getIsSuccess
())
{
return
response
;
}
UnionLogs
logs
=
new
UnionLogs
();
//去重,排除重复激活
if
(
ClientTypeEnum
.
IPHONE
.
getName
().
equalsIgnoreCase
(
request
.
getClient_type
())){
logs
=
unionLogsDAO
.
selectIOS
(
String
.
valueOf
(
request
.
getAppid
()),
request
.
getIdfa
(),
request
.
getClient_type
());
if
(
null
!=
logs
&&
logs
.
getIsActivate
()==
1
){
return
response
;
}
}
else
{
logs
=
unionLogsDAO
.
selectAndroid
(
String
.
valueOf
(
request
.
getAppid
()),
request
.
getImei
(),
request
.
getClient_type
());
if
(
null
!=
logs
&&
logs
.
getIsActivate
()==
1
){
return
response
;
}
}
log
.
info
(
"activateUnion with param is{}"
,
request
);
// 对url进行加密,拼接
String
url
=
urlEode
(
request
);
...
...
@@ -109,7 +122,14 @@ public class GDTServiceImpl implements MainUnionService {
unionLogs
.
setIsActivate
((
byte
)
1
);
unionLogs
.
setCreateTime
(
DateUtil
.
getCurrentTimeSecond
());
unionLogs
.
setUpdateTime
(
DateUtil
.
getCurrentTimeSecond
());
log
.
debug
(
"add to unionLogs db with param is {}"
,
unionLogs
);
if
(
logs
!=
null
&&
logs
.
getIsActivate
()
==
0
){
unionLogs
.
setId
(
logs
.
getId
());
unionLogsDAO
.
updateByPrimaryKey
(
unionLogs
);
}
else
{
unionLogsDAO
.
insert
(
unionLogs
);
}
response
=
new
UnionResponseBO
(
true
,
msg
);
}
// 广点通返回错误
...
...
@@ -118,6 +138,14 @@ public class GDTServiceImpl implements MainUnionService {
unionLogs
.
setCreateTime
(
DateUtil
.
getCurrentTimeSecond
());
unionLogs
.
setUpdateTime
(
DateUtil
.
getCurrentTimeSecond
());
response
=
new
UnionResponseBO
(
false
,
msg
);
if
(
logs
!=
null
&&
logs
.
getIsActivate
()
==
0
){
logs
.
setUpdateTime
(
DateUtil
.
getCurrentTimeSecond
());
logs
.
setIsActivate
((
byte
)
0
);
unionLogs
.
setId
(
logs
.
getId
());
unionLogsDAO
.
updateByPrimaryKey
(
unionLogs
);
}
else
{
unionLogsDAO
.
insert
(
unionLogs
);
}
}
}
else
{
// 激活失败
...
...
@@ -125,8 +153,16 @@ public class GDTServiceImpl implements MainUnionService {
unionLogs
.
setCreateTime
(
DateUtil
.
getCurrentTimeSecond
());
unionLogs
.
setUpdateTime
(
DateUtil
.
getCurrentTimeSecond
());
response
=
new
UnionResponseBO
(
false
,
"激活失败"
);
if
(
logs
!=
null
&&
logs
.
getIsActivate
()
==
0
){
logs
.
setUpdateTime
(
DateUtil
.
getCurrentTimeSecond
());
logs
.
setIsActivate
((
byte
)
1
);
unionLogs
.
setId
(
logs
.
getId
());
unionLogsDAO
.
updateByPrimaryKey
(
unionLogs
);
}
else
{
unionLogsDAO
.
insert
(
unionLogs
);
}
}
unionLogsDAO
.
insert
(
unionLogs
);
return
response
;
}
...
...
Please
register
or
login
to post a comment