|
|
@@ -989,8 +989,29 @@ public class CoinServiceImpl implements CoinService {
|
|
|
}
|
|
|
// 涨跌幅比例
|
|
|
if (StringUtils.isNotEmpty(currencyHolding.getBuyPrice()) && StringUtils.isNotEmpty(currencyHolding.getCurrentPrice())) {
|
|
|
+ BigDecimal oriChangePercentage = currencyHolding.getChangePercentage();
|
|
|
BigDecimal changePercentage = new BigDecimal(currencyHolding.getCurrentPrice()).divide(new BigDecimal(currencyHolding.getBuyPrice()), 2, RoundingMode.HALF_UP);
|
|
|
currencyHolding.setChangePercentage(changePercentage);
|
|
|
+
|
|
|
+ // 监控报警
|
|
|
+ if (oriChangePercentage != null && !"USDT".equals(currencyHolding.getSymbol())) {
|
|
|
+ BigDecimal roundedDown = changePercentage.setScale(0, RoundingMode.FLOOR);
|
|
|
+ if (changePercentage.compareTo(roundedDown) > 0 && oriChangePercentage.compareTo(roundedDown) < 0) {
|
|
|
+ String content = "<div class=\"highlight\">币种名称:" + currencyHolding.getSymbol() + "</div>" +
|
|
|
+ "<div>入场价格:" + currencyHolding.getBuyPrice() + "</div>" +
|
|
|
+ "<div>当前价格:" + currencyHolding.getCurrentPrice() + "</div>" +
|
|
|
+ "<div>入场总额:" + currencyHolding.getBuyAmount() + "</div>" +
|
|
|
+ "<div>当前总额:" + currencyHolding.getCurrentAmount() + "</div>" +
|
|
|
+ "<div>所属平台:" + currencyHolding.getExchangeCategory() + "</div>" +
|
|
|
+ "<div>买入时间:" + currencyHolding.getBuyTime() + "</div>" +
|
|
|
+ "<div class=\"gray\">涨跌幅:" + currencyHolding.getChangePercentage() + "</div>";
|
|
|
+ JSONObject params = new JSONObject();
|
|
|
+ params.put("title", "持仓币种盈利报警");
|
|
|
+ params.put("logUrl", "https://jav.lvzhiqiang.top/coin.html");
|
|
|
+ params.put("btnTxt", "详情");
|
|
|
+ SpringUtils.getBean(CoinServiceImpl.class).monitorAlarm4APP_TEXT_CARD(content, params, null);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
coinMapper.updateCurrentHolding(currencyHolding);
|