Commit 7c6f2663 by 刘鑫

fix(容量消息变更): 发送消息变更后未同时变更调用方, 导致无法发送消息

1 parent e5a113c8
......@@ -151,7 +151,8 @@ public class CalcOrgCapacityScheduler {
double usedPercentage = (double) dto.getCapUsed() / dto.getCapTotal();
log.info("[calcOneBranch] {}小组容量已使用占比{}", groupId, usedPercentage);
if (BigDecimal.valueOf(usedPercentage).compareTo(new BigDecimal("0.8")) >= 0) {
addCapacityMsg("", "", groupId, LocalDate.parse(date, DateUtil.DATE_FORMATTER), dto.getLayer());
addCapacityMsg("", "", groupId, LocalDate.parse(date, DateUtil.DATE_FORMATTER),
dto.getLayer(), dto.getLayerId());
}
}
......@@ -196,14 +197,15 @@ public class CalcOrgCapacityScheduler {
double usedPercentage = (double) dto.getCapUsed() / dto.getCapTotal();
log.info("[calcOneBranch] {}分部容量已使用占比{}", branchId, usedPercentage);
if (BigDecimal.valueOf(usedPercentage).compareTo(new BigDecimal("0.8")) >= 0) {
addCapacityMsg("", branchId, "", LocalDate.parse(date, DateUtil.DATE_FORMATTER), dto.getLayer());
addCapacityMsg("", branchId, "", LocalDate.parse(date, DateUtil.DATE_FORMATTER),
dto.getLayer(), dto.getLayerId());
}
}
}
private void addCapacityMsg(String clusterId, String branchId, String groupId,
LocalDate targetDate, String layer) {
LocalDate targetDate, String layer, String layerId) {
MsgDTO msgDTO = new MsgDTO();
msgDTO.setType(2);
......@@ -225,10 +227,19 @@ public class CalcOrgCapacityScheduler {
msgBrand = group.getGroupName();
msgDTO.setGroupId(groupId);
}
msg = MessageFormat.format(msg, msgBrand, layer, DateTimeUtil.formatDate(targetDate));
final String capacityDate = DateTimeUtil.formatDate(targetDate);
msg = MessageFormat.format(msg, msgBrand, layer, capacityDate);
msgDTO.setContent(msg);
msgDTO.setTag(1);
msgService.add(msgDTO);
msgDTO.setCapacityLayerId(layerId);
msgDTO.setCapacityDate(capacityDate);
try {
msgService.add(msgDTO);
} catch (Exception ex) {
log.error("[addCapacityMsg] {}容量消息发送失败, 失败原因:{}", msgBrand, ex.getMessage(), ex);
}
}
private void calcAllTeamByDays(String bdate, String edate) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!