BiddingOrderNoBidRemindTask.java
3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package com.glsx.task.schedule;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.glsx.common.constants.ResultCodeEnum;
import com.glsx.common.feign.client.OrderClient;
import com.glsx.common.feign.client.UserClient;
import com.glsx.common.utils.PropertiesUtil;
import com.glsx.task.constants.Constants;
/**
*
* @Title BiddingOrderTask.java
* @Package com.glsx.task.schedule
* @Description TODO 竞价单定时任务:超过3小时无人报价的竞价单,则通过浏览器级别弹窗对拥有该单数据权限的普通账号进行推送
* @author zhanghj
* @date 2019年8月16日 下午5:43:25
* @version 1.0.0
*/
public class BiddingOrderNoBidRemindTask extends QuartzJobBean{
private static final Logger logger = LoggerFactory.getLogger(BiddingOrderNoBidRemindTask.class);
@Autowired
private OrderClient orderClient;
@Autowired
private UserClient userClient;
@Override
protected void executeInternal(JobExecutionContext context)
throws JobExecutionException {
// TODO Auto-generated method stub
logger.info("开始执行竞价单超时定时任务提醒");
Integer hour = Integer.parseInt(PropertiesUtil.getProperty(Constants.ORDER_BIDDING_ORDER_NO_BID_REMIND_HOUR, "3"));
Integer minute = hour * 60;
Integer timeInterval = 5;
JSONObject result = orderClient.getBiddingOrderNoBidRemindList(minute, timeInterval);
JSONArray orderArray = new JSONArray();
if (result != null && result.getIntValue("code") == ResultCodeEnum.SUCCESS.getCode()) {
orderArray = result.getJSONArray("data");
}
JSONObject managerResult = userClient.getOnlineManagerList();
JSONArray userArray = new JSONArray();
if (managerResult != null && managerResult.getIntValue("code") == ResultCodeEnum.SUCCESS.getCode()) {
userArray = managerResult.getJSONArray("data");
}
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
for (int j = 0; j < userArray.size(); j++) {
Integer mId = userArray.getInteger(j);
for (int i = 0; i < orderArray.size(); i++) {
Integer managerId = orderArray.getJSONObject(i).getInteger(
"shopId");
if (managerId.equals(mId)) {
Map<String, Object> map = new HashMap<String, Object>();
String shopName = orderArray.getJSONObject(i).getString(
"merchantName");
String orderSn = orderArray.getJSONObject(i).getString(
"orderSn");
String serviceTypes = orderArray.getJSONObject(i)
.getString("serviceTypes");
map.put("hour", hour);
map.put("managerId", managerId);
map.put("orderSn", orderSn);
map.put("shopName", shopName);
map.put("serviceTypes", serviceTypes);
list.add(map);
}
}
}
if (list.size() > 0) {
logger.info("竞价单超时可发送列表"+ JSON.toJSONString(list));
userClient.sendBiddingOrderNoBidRemindMsg(JSON.toJSONString(list));
}
logger.info("结束执行竞价单超时定时任务提醒");
}
}