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
mingdan.ge
6 years ago
Commit
49c8c01841798a76a96aadf4771b29957791ed75
1 parent
c60518b1
加订单回调定时任务手动触发
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
25 deletions
common/src/main/resources/META-INF/spring/spring-interceptor-config.xml
dal/src/main/java/com/yoho/unions/dal/model/UnionCallbackOrder.java
dal/src/main/resources/META-INF/mybatis/UnionCallbackOrderMapper.xml
server/src/main/java/com/yoho/unions/server/restapi/UnionRest.java
server/src/main/java/com/yoho/unions/server/task/OrderCallBackTask.java
common/src/main/resources/META-INF/spring/spring-interceptor-config.xml
View file @
49c8c01
...
...
@@ -72,6 +72,7 @@
<value>
/batch/import
</value>
<value>
/mktReportForm/getMktReportForm
</value>
<value>
/UnionRest/queryUnionOrders
</value>
<value>
/UnionRest/dealOrderCallBackTask
</value>
<value>
/getProdcutDetail
</value>
<value>
/pushArticle
</value>
<value>
/UnionClickCountDayRest/delete
</value>
...
...
dal/src/main/java/com/yoho/unions/dal/model/UnionCallbackOrder.java
View file @
49c8c01
...
...
@@ -13,8 +13,6 @@ public class UnionCallbackOrder {
private
String
idfa
;
private
String
imei
;
private
Integer
orderTime
;
private
Integer
wakeupDate
;
...
...
@@ -77,14 +75,6 @@ public class UnionCallbackOrder {
this
.
idfa
=
idfa
==
null
?
null
:
idfa
.
trim
();
}
public
String
getImei
()
{
return
imei
;
}
public
void
setImei
(
String
imei
)
{
this
.
imei
=
imei
==
null
?
null
:
imei
.
trim
();
}
public
Integer
getOrderTime
()
{
return
orderTime
;
}
...
...
dal/src/main/resources/META-INF/mybatis/UnionCallbackOrderMapper.xml
View file @
49c8c01
...
...
@@ -8,7 +8,6 @@
<result
column=
"udid"
property=
"udid"
jdbcType=
"VARCHAR"
/>
<result
column=
"client_type"
property=
"clientType"
jdbcType=
"INTEGER"
/>
<result
column=
"idfa"
property=
"idfa"
jdbcType=
"VARCHAR"
/>
<result
column=
"imei"
property=
"imei"
jdbcType=
"VARCHAR"
/>
<result
column=
"order_time"
property=
"orderTime"
jdbcType=
"INTEGER"
/>
<result
column=
"wakeup_date"
property=
"wakeupDate"
jdbcType=
"INTEGER"
/>
<result
column=
"union_type"
property=
"unionType"
jdbcType=
"VARCHAR"
/>
...
...
@@ -18,7 +17,7 @@
<result
column=
"is_callback"
property=
"isCallback"
jdbcType=
"INTEGER"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
order_code, date_id, uid, udid, client_type, idfa,
imei, order_time, wakeup_date,
order_code, date_id, uid, udid, client_type, idfa,
order_time, wakeup_date,
union_type, source, create_time, callback_time, is_callback
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
...
...
@@ -42,12 +41,12 @@
<insert
id=
"insert"
parameterType=
"com.yoho.unions.dal.model.UnionCallbackOrder"
>
insert into union_callback_order (order_code, date_id, uid,
udid, client_type, idfa,
imei, order_time, wakeup_date,
order_time, wakeup_date,
union_type, source, create_time,
callback_time, is_callback)
values (#{orderCode,jdbcType=VARCHAR}, #{dateId,jdbcType=INTEGER}, #{uid,jdbcType=INTEGER},
#{udid,jdbcType=VARCHAR}, #{clientType,jdbcType=INTEGER}, #{idfa,jdbcType=VARCHAR},
#{imei,jdbcType=VARCHAR}, #{orderTime,jdbcType=INTEGER}, #{wakeupDate,jdbcType=INTEGER},
#{orderTime,jdbcType=INTEGER}, #{wakeupDate,jdbcType=INTEGER},
#{unionType,jdbcType=VARCHAR}, #{source,jdbcType=INTEGER}, #{createTime,jdbcType=INTEGER},
#{callbackTime,jdbcType=INTEGER}, #{isCallback,jdbcType=INTEGER})
</insert>
...
...
@@ -72,9 +71,6 @@
<if
test=
"idfa != null"
>
idfa,
</if>
<if
test=
"imei != null"
>
imei,
</if>
<if
test=
"orderTime != null"
>
order_time,
</if>
...
...
@@ -116,9 +112,6 @@
<if
test=
"idfa != null"
>
#{idfa,jdbcType=VARCHAR},
</if>
<if
test=
"imei != null"
>
#{imei,jdbcType=VARCHAR},
</if>
<if
test=
"orderTime != null"
>
#{orderTime,jdbcType=INTEGER},
</if>
...
...
@@ -160,9 +153,6 @@
<if
test=
"idfa != null"
>
idfa = #{idfa,jdbcType=VARCHAR},
</if>
<if
test=
"imei != null"
>
imei = #{imei,jdbcType=VARCHAR},
</if>
<if
test=
"orderTime != null"
>
order_time = #{orderTime,jdbcType=INTEGER},
</if>
...
...
@@ -194,7 +184,6 @@
udid = #{udid,jdbcType=VARCHAR},
client_type = #{clientType,jdbcType=INTEGER},
idfa = #{idfa,jdbcType=VARCHAR},
imei = #{imei,jdbcType=VARCHAR},
order_time = #{orderTime,jdbcType=INTEGER},
wakeup_date = #{wakeupDate,jdbcType=INTEGER},
union_type = #{unionType,jdbcType=VARCHAR},
...
...
server/src/main/java/com/yoho/unions/server/restapi/UnionRest.java
View file @
49c8c01
...
...
@@ -10,6 +10,7 @@ import com.yoho.unions.server.service.DingdangService;
import
com.yoho.unions.server.service.IUnionOrderService
;
import
com.yoho.unions.server.service.IUserOrdersService
;
import
com.yoho.unions.server.service.MainUnionService
;
import
com.yoho.unions.server.task.OrderCallBackTask
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Controller
;
...
...
@@ -32,6 +33,10 @@ public class UnionRest {
IUnionOrderService
unionOrderService
;
@Resource
IUserOrdersService
userOrdersService
;
@Resource
OrderCallBackTask
orderCallBackTask
;
// /**
// * 添加顶当
...
...
@@ -125,4 +130,15 @@ public class UnionRest {
}
}
/**
* 手动执行一次订单回调任务(目前只走了头条),取大数据当天插入的数据进行处理
* */
@RequestMapping
(
"/dealOrderCallBackTask"
)
@ResponseBody
public
UnionResponse
dealNewUserActivityTask
(){
log
.
info
(
"dealOrderCallBackTask."
);
orderCallBackTask
.
callback
(
true
);
return
new
UnionResponse
(
200
,
"dealOrderCallBackTask success"
);
}
}
...
...
server/src/main/java/com/yoho/unions/server/task/OrderCallBackTask.java
View file @
49c8c01
...
...
@@ -18,6 +18,7 @@ import java.util.List;
import
java.util.concurrent.TimeUnit
;
/**
* 订单回调任务(目前只走了头条)
* Created by mingdan.ge on 2019/3/28.
*/
@Component
...
...
@@ -37,6 +38,13 @@ public class OrderCallBackTask {
@Scheduled
(
cron
=
"0 0 8 * * ?"
)
// @Scheduled(cron = "0 * * * * ?")
public
void
run
()
{
callback
(
false
);
}
/**
* @param repeat 是否允许重复处理
* */
public
void
callback
(
boolean
repeat
)
{
logger
.
info
(
"start OrderCallBackTask."
);
int
dataId
=
Integer
.
valueOf
(
DateUtil
.
getToday
(
"yyyyMMdd"
));
//1、竞争任务处理者
...
...
@@ -46,7 +54,7 @@ public class OrderCallBackTask {
bo
.
setTime
(
Long
.
toString
(
System
.
currentTimeMillis
()));
String
key
=
TASK_KEY
+
dataId
;
boolean
lock
=
globalRedisValueCache
.
getLock
(
key
,
bo
,
2
,
TimeUnit
.
DAYS
);
if
(!
lock
)
{
if
(!
lock
&&!
repeat
)
{
UnionTaskBo
cacheBo
=
globalRedisValueCache
.
get
(
key
,
UnionTaskBo
.
class
);
logger
.
info
(
"The competition failure,other get task,it is {}.this is {}."
,
cacheBo
,
bo
);
return
;
...
...
@@ -69,4 +77,6 @@ public class OrderCallBackTask {
});
}
}
...
...
Please
register
or
login
to post a comment