Commit 171749c7 by 程裕兵

feat:env check settle

parent 92a5b3f1
...@@ -84,6 +84,7 @@ import javax.annotation.Resource; ...@@ -84,6 +84,7 @@ import javax.annotation.Resource;
import lombok.Data; import lombok.Data;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.support.TransactionTemplate; import org.springframework.transaction.support.TransactionTemplate;
...@@ -98,6 +99,9 @@ public class PayServiceImpl implements PayService { ...@@ -98,6 +99,9 @@ public class PayServiceImpl implements PayService {
private static final BigDecimal MAX_AMOUNT = new BigDecimal("10000000"); private static final BigDecimal MAX_AMOUNT = new BigDecimal("10000000");
@Value("${spring.profiles.active}")
private String env;
@Resource @Resource
private PayChannelProperties config; private PayChannelProperties config;
...@@ -334,9 +338,9 @@ public class PayServiceImpl implements PayService { ...@@ -334,9 +338,9 @@ public class PayServiceImpl implements PayService {
// 钉钉消息 // 钉钉消息
if (failCount.get() > 0) { if (failCount.get() > 0) {
DingUtil.sendCheckSettleFail(failCount.get()); DingUtil.sendCheckSettleFail(env, failCount.get());
} else { } else {
DingUtil.sendCheckSettleSuccess(); DingUtil.sendCheckSettleSuccess(env);
} }
} }
......
...@@ -16,11 +16,11 @@ public class DingUtil { ...@@ -16,11 +16,11 @@ public class DingUtil {
public static final String URL = "https://oapi.dingtalk.com/robot/send?access_token=1d52fb498b3d23687dec5aebf5907fb73acde3f29709fc672386d67451c9dfb7"; public static final String URL = "https://oapi.dingtalk.com/robot/send?access_token=1d52fb498b3d23687dec5aebf5907fb73acde3f29709fc672386d67451c9dfb7";
private static final String CHECK_SETTLE_SUCCESS = "【告警】【乐动收银自动结算记录对账】全部对账成功"; private static final String CHECK_SETTLE_SUCCESS = "%s【告警】【乐动收银自动结算记录对账】全部对账成功";
private static final String CHECK_SETTLE_FAIL = "【告警】【乐动收银自动结算记录对账】有%s家对账失败,请人工跟进"; private static final String CHECK_SETTLE_FAIL = "%s【告警】【乐动收银自动结算记录对账】有%s家对账失败,请人工跟进";
public static void sendCheckSettleFail(Integer total) { public static void sendCheckSettleFail(String env, Integer total) {
Message message = new TextMessage(String.format(CHECK_SETTLE_FAIL, total)); Message message = new TextMessage(String.format(CHECK_SETTLE_FAIL, env, total));
try { try {
DingtalkChatbotClient.send(URL, message); DingtalkChatbotClient.send(URL, message);
} catch (IOException e) { } catch (IOException e) {
...@@ -28,8 +28,8 @@ public class DingUtil { ...@@ -28,8 +28,8 @@ public class DingUtil {
} }
} }
public static void sendCheckSettleSuccess() { public static void sendCheckSettleSuccess(String env) {
Message message = new TextMessage(CHECK_SETTLE_SUCCESS); Message message = new TextMessage(String.format(CHECK_SETTLE_SUCCESS, env));
try { try {
DingtalkChatbotClient.send(URL, message); DingtalkChatbotClient.send(URL, message);
} catch (IOException e) { } catch (IOException e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment