|
@@ -29,6 +29,9 @@ import java.net.HttpURLConnection;
|
|
import java.net.URL;
|
|
import java.net.URL;
|
|
import java.util.Base64;
|
|
import java.util.Base64;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+import static org.jebot.constant.Constant.DATA_TYPE_CHANNEL;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
@@ -147,18 +150,13 @@ public class ComplaintHandler extends AbstractHandler {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
double oldMerchantPaymentBalance = merchantAccountBook.getPaymentBalance();
|
|
double oldMerchantPaymentBalance = merchantAccountBook.getPaymentBalance();
|
|
double oldChannelPaymentBalance = channelAccountBook.getPaymentBalance();
|
|
double oldChannelPaymentBalance = channelAccountBook.getPaymentBalance();
|
|
- double oldChannelAllPaymentBalance = channelAllAccountBook.getPaymentBalance();
|
|
|
|
double amount = payOrder.getAmount().movePointLeft(Constant.AMOUNT_MOVE_POINT).doubleValue();
|
|
double amount = payOrder.getAmount().movePointLeft(Constant.AMOUNT_MOVE_POINT).doubleValue();
|
|
double newMerchantPaymentBalance = BigDecimal.valueOf(oldMerchantPaymentBalance).movePointRight(Constant.AMOUNT_MOVE_POINT).
|
|
double newMerchantPaymentBalance = BigDecimal.valueOf(oldMerchantPaymentBalance).movePointRight(Constant.AMOUNT_MOVE_POINT).
|
|
add(payOrder.getAmount()).movePointLeft(Constant.AMOUNT_MOVE_POINT).doubleValue();
|
|
add(payOrder.getAmount()).movePointLeft(Constant.AMOUNT_MOVE_POINT).doubleValue();
|
|
double newChannelPaymentBalance = BigDecimal.valueOf(oldChannelPaymentBalance).movePointRight(Constant.AMOUNT_MOVE_POINT).
|
|
double newChannelPaymentBalance = BigDecimal.valueOf(oldChannelPaymentBalance).movePointRight(Constant.AMOUNT_MOVE_POINT).
|
|
add(payOrder.getAmount()).movePointLeft(Constant.AMOUNT_MOVE_POINT).doubleValue();
|
|
add(payOrder.getAmount()).movePointLeft(Constant.AMOUNT_MOVE_POINT).doubleValue();
|
|
- double newChannelAllPaymentBalance = BigDecimal.valueOf(oldChannelAllPaymentBalance).movePointRight(Constant.AMOUNT_MOVE_POINT).
|
|
|
|
- add(payOrder.getAmount()).movePointLeft(Constant.AMOUNT_MOVE_POINT).doubleValue();
|
|
|
|
-
|
|
|
|
//转发消息到商户群组
|
|
//转发消息到商户群组
|
|
CopyMessage sendMerchantCopyMessage = new CopyMessage(merchantGroup.getGroupId(), update.message().chat().id(), update.message().messageId());
|
|
CopyMessage sendMerchantCopyMessage = new CopyMessage(merchantGroup.getGroupId(), update.message().chat().id(), update.message().messageId());
|
|
sendMerchantCopyMessage.caption(payOrder.getMchOrderNo());
|
|
sendMerchantCopyMessage.caption(payOrder.getMchOrderNo());
|
|
@@ -188,19 +186,35 @@ public class ComplaintHandler extends AbstractHandler {
|
|
//更新通道总余额
|
|
//更新通道总余额
|
|
UpdateBalance updateChannelAllPaymentBalance = new UpdateBalance();
|
|
UpdateBalance updateChannelAllPaymentBalance = new UpdateBalance();
|
|
updateChannelAllPaymentBalance.setId(channelAllAccountBook.getId());
|
|
updateChannelAllPaymentBalance.setId(channelAllAccountBook.getId());
|
|
- updateChannelAllPaymentBalance.setOldBalance(oldChannelAllPaymentBalance);
|
|
|
|
- updateChannelAllPaymentBalance.setNewBalance(newChannelAllPaymentBalance);
|
|
|
|
|
|
+// updateChannelAllPaymentBalance.setOldBalance(oldChannelAllPaymentBalance);
|
|
|
|
+// updateChannelAllPaymentBalance.setNewBalance(newChannelAllPaymentBalance);
|
|
updateChannelAllPaymentBalance.setAmount(amount);
|
|
updateChannelAllPaymentBalance.setAmount(amount);
|
|
BotMessage channelAllMessage = new BotMessage();
|
|
BotMessage channelAllMessage = new BotMessage();
|
|
channelAllMessage.setBotGroup(channelGroup);
|
|
channelAllMessage.setBotGroup(channelGroup);
|
|
channelAllMessage.setBotUser(botMessage.getBotUser());
|
|
channelAllMessage.setBotUser(botMessage.getBotUser());
|
|
updateChannelAllPaymentBalance.setMessage(channelAllMessage);
|
|
updateChannelAllPaymentBalance.setMessage(channelAllMessage);
|
|
//构建发出投诉单号到上游群组的消息
|
|
//构建发出投诉单号到上游群组的消息
|
|
|
|
+ //根据groupId找到绑定了哪些通道
|
|
|
|
+ List<BotGroup> botGroups = this.handlerManager.getGroupRepository().findAllByGroupIdAndDataType(channelGroup.getGroupId(), DATA_TYPE_CHANNEL);
|
|
|
|
+ double oldPaymentBalance = 0;
|
|
|
|
+ for (BotGroup botGroup : botGroups) {
|
|
|
|
+ BotAccountBook accountBookchannl = handlerManager.getAccountBookRepository()
|
|
|
|
+ .findByBelongIdAndType(botGroup.getDataId(), DATA_TYPE_CHANNEL);
|
|
|
|
+ if (accountBookchannl == null) {
|
|
|
|
+ oldPaymentBalance += 0;
|
|
|
|
+ }else {
|
|
|
|
+ oldPaymentBalance += accountBookchannl.getPaymentBalance();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ oldPaymentBalance += channelAllAccountBook.getPaymentBalance();
|
|
|
|
+ double newPaymentBalance = BigDecimal.valueOf(oldPaymentBalance).movePointRight(Constant.AMOUNT_MOVE_POINT).
|
|
|
|
+ add(payOrder.getAmount()).movePointLeft(Constant.AMOUNT_MOVE_POINT).doubleValue();
|
|
StringBuilder stringBuilderChannel = new StringBuilder();
|
|
StringBuilder stringBuilderChannel = new StringBuilder();
|
|
stringBuilderChannel.append("投诉订单: ").append("\n");
|
|
stringBuilderChannel.append("投诉订单: ").append("\n");
|
|
stringBuilderChannel.append("投诉金额: ").append(amount).append("\n");
|
|
stringBuilderChannel.append("投诉金额: ").append(amount).append("\n");
|
|
- stringBuilderChannel.append("投诉前: ").append(oldChannelAllPaymentBalance).append("\n");
|
|
|
|
- stringBuilderChannel.append("投诉后: ").append(newChannelAllPaymentBalance).append("\n");
|
|
|
|
|
|
+ stringBuilderChannel.append("投诉前: ").append(oldPaymentBalance).append("\n");
|
|
|
|
+ stringBuilderChannel.append("投诉后: ").append(newPaymentBalance).append("\n");
|
|
SendMessage sendChannelMessage = new SendMessage(channelGroup.getGroupId(), stringBuilderChannel.toString());
|
|
SendMessage sendChannelMessage = new SendMessage(channelGroup.getGroupId(), stringBuilderChannel.toString());
|
|
StringBuilder stringBuilderChannelOrder = new StringBuilder();
|
|
StringBuilder stringBuilderChannelOrder = new StringBuilder();
|
|
stringBuilderChannelOrder.append("投诉订单: ").append("\n");
|
|
stringBuilderChannelOrder.append("投诉订单: ").append("\n");
|
|
@@ -253,7 +267,7 @@ public class ComplaintHandler extends AbstractHandler {
|
|
}
|
|
}
|
|
|
|
|
|
try {
|
|
try {
|
|
- handlerManager.getAccountBookService().updateMutiPaymentBalanceByIdAndPaymentBalance(updateMerchantPaymentBalance, updateChannelPaymentBalance,updateChannelAllPaymentBalance);
|
|
|
|
|
|
+ handlerManager.getAccountBookService().updateMutiPaymentBalanceByIdAndPaymentBalance(updateMerchantPaymentBalance, updateChannelPaymentBalance, updateChannelAllPaymentBalance);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error("更新商户或通道余额失败: {}", e.getMessage());
|
|
log.error("更新商户或通道余额失败: {}", e.getMessage());
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|