|
@@ -67,7 +67,7 @@ public class MessageHandle {
|
67
|
67
|
* @param messageType 消息类型
|
68
|
68
|
*/
|
69
|
69
|
private void processItem(TaRotation item, String tmp, String messageType, String sourceName) {
|
70
|
|
- StringBuilder stringBuilder = new StringBuilder();
|
|
70
|
+ String newTmp = null;
|
71
|
71
|
TaMessage taMessage = new TaMessage();
|
72
|
72
|
Map<String, String> params = new HashMap<>();
|
73
|
73
|
|
|
@@ -76,17 +76,19 @@ public class MessageHandle {
|
76
|
76
|
taMessage.setMessageId(uuid);
|
77
|
77
|
taMessage.setSourceId(item.getRotationId());
|
78
|
78
|
|
79
|
|
- // 使用描述性强的常量代替硬编码值
|
80
|
|
- stringBuilder.append(tmp); // 假设warningTmp或promptTmp已经定义且包含插入点
|
81
|
|
- stringBuilder.insert(Constants.numI, item.getEmployeeNum());
|
82
|
|
- int insertPos = item.getEmployeeNum().length() + Constants.nameI;
|
83
|
|
- stringBuilder.insert(insertPos, item.getEmployeeName());
|
84
|
|
- taMessage.setContentSent(stringBuilder.toString());
|
|
79
|
+// // 使用描述性强的常量代替硬编码值
|
|
80
|
+// stringBuilder.insert(Constants.numI, item.getEmployeeNum());
|
|
81
|
+// int insertPos = item.getEmployeeNum().length() + Constants.nameI;
|
|
82
|
+// stringBuilder.insert(insertPos, item.getEmployeeName());
|
|
83
|
+ String employeeNum = item.getEmployeeNum();
|
|
84
|
+ String employeeName = item.getEmployeeName();
|
|
85
|
+ newTmp = tmp.replace("code", employeeNum).replace("name", employeeName);
|
|
86
|
+ taMessage.setContentSent(newTmp);
|
85
|
87
|
taMessage.setSourceName(sourceName);
|
86
|
88
|
taMessage.setWaringType(messageType);
|
87
|
89
|
params.put("sourceName", sourceName);
|
88
|
90
|
params.put("waringType", messageType);
|
89
|
|
- params.put("contentSent", stringBuilder.toString());
|
|
91
|
+ params.put("contentSent", newTmp);
|
90
|
92
|
Long count = taMessageService.countBy("source_id", item.getRotationId(), true);
|
91
|
93
|
if (count == 0) {
|
92
|
94
|
taMessageMapper.insert(taMessage);
|
|
@@ -109,7 +111,6 @@ public class MessageHandle {
|
109
|
111
|
}
|
110
|
112
|
|
111
|
113
|
private void processItemLeaves(TaMandatoryLeave item, String tmp, String messageType, String sourceName) {
|
112
|
|
- StringBuilder stringBuilder = new StringBuilder();
|
113
|
114
|
TaMessage taMessage = new TaMessage();
|
114
|
115
|
Map<String, String> params = new HashMap<>();
|
115
|
116
|
|
|
@@ -117,17 +118,22 @@ public class MessageHandle {
|
117
|
118
|
taMessage.setMessageId(uuid);
|
118
|
119
|
taMessage.setSourceId(item.getLeaveId());
|
119
|
120
|
|
120
|
|
- // 使用描述性强的常量代替硬编码值
|
121
|
|
- stringBuilder.append(tmp); // 假设warningTmp或promptTmp已经定义且包含插入点
|
122
|
|
- stringBuilder.insert(Constants.numI, item.getEmployeeNum());
|
123
|
|
- int insertPos = item.getEmployeeNum().length() + Constants.nameI;
|
124
|
|
- stringBuilder.insert(insertPos, item.getEmployeeName());
|
125
|
|
- taMessage.setContentSent(stringBuilder.toString());
|
|
121
|
+// // 使用描述性强的常量代替硬编码值
|
|
122
|
+ StringBuilder sb = new StringBuilder(tmp);
|
|
123
|
+ // 假设warningTmp或promptTmp已经定义且包含插入点
|
|
124
|
+// stringBuilder.insert(Constants.numI, item.getEmployeeNum());
|
|
125
|
+// int insertPos = item.getEmployeeNum().length() + Constants.nameI;
|
|
126
|
+// stringBuilder.insert(insertPos, item.getEmployeeName());
|
|
127
|
+ String employeeNum = item.getEmployeeNum();
|
|
128
|
+ String employeeName = item.getEmployeeName();
|
|
129
|
+ String newTmp = null;
|
|
130
|
+ newTmp = tmp.replace("code", employeeNum).replace("name", employeeName);
|
|
131
|
+ taMessage.setContentSent(newTmp);
|
126
|
132
|
taMessage.setSourceName(sourceName);
|
127
|
133
|
taMessage.setWaringType(messageType);
|
128
|
134
|
params.put("sourceName", "taMandatoryLeave");
|
129
|
135
|
params.put("waringType", "prompt");
|
130
|
|
- params.put("contentSent", stringBuilder.toString());
|
|
136
|
+ params.put("contentSent", newTmp);
|
131
|
137
|
Long count = taMessageService.countBy("source_id", item.getLeaveId(), true);
|
132
|
138
|
if (count == 0) {
|
133
|
139
|
taMessageMapper.insert(taMessage);
|