SendMessageBiz.java
2.19 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
package com.cjs.cms.biz.pub;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cjs.cms.dao.pub.SendMessageLogDao;
@Service
public class SendMessageBiz {
Logger log = LogManager.getLogger();
@Autowired
private SendMessageLogDao logDao;
/**
* 更新短信状态
* @param args
* @return
*
*/
public String callBack(String args) {
String result = "接收成功";
Map<String, Object> param = new HashMap<String, Object>();
log.info("更新短信状态:" + args);
if (StringUtils.isBlank(args)) {
log.error("参数为空");
return "参数为空";
}
String message[] = args.split(";");
if (message.length == 0) {
log.error("参数为空");
return "参数为空";
}
for (String arg : message) {
if (StringUtils.isBlank(arg)) {
log.error("参数不正确");
return "参数不正确";
}
String sendMessage[] = arg.split(",");
if (sendMessage.length < 4) {
log.error("参数位数不对");
return "参数位数不对";
}
String sendResult = sendMessage[0];
// String phoneNumber = sendMessage[1];
String sendStatus = sendMessage[2];
String sendAt = sendMessage[3];
param.put("sendResult", sendResult);
List<Map<String, Object>> messageList = logDao.queryByStatus(param);
if (messageList.size() == 0) {
log.error(sendResult + "查询不到信息");
return sendResult + "查询不到信息";
}
for (Map<String, Object> map : messageList) {
map.put("sendStatus", sendStatus);
map.put("sendAt", sendAt);
logDao.update(map);
}
}
return result;
}
}