|
@@ -123,32 +123,28 @@ public class JyRabbitListener {
|
|
|
}
|
|
|
|
|
|
private void handleEdit(CapitalTransactionsDto dto) {
|
|
|
- CapitalTransactions capitalTransactions = capitalTransactionsDao.lambdaQuery()
|
|
|
- .eq(CapitalTransactions::getOrderId, dto.getOrderId())
|
|
|
- .one();
|
|
|
- if (capitalTransactions != null) {
|
|
|
- capitalTransactionsService.delete(Collections.singletonList(capitalTransactions.getId()));
|
|
|
-
|
|
|
- // 获取合同
|
|
|
- ContractInfo contractInfo = contractInfoDao.lambdaQuery()
|
|
|
- .eq(ContractInfo::getCapitalTransactionsId, capitalTransactions.getId()).one();
|
|
|
-
|
|
|
- if (contractInfo != null) {
|
|
|
- contractInfoService.delete(Collections.singletonList(contractInfo.getId()));
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
+ handleDelete(dto);
|
|
|
handleAdd(dto);
|
|
|
}
|
|
|
|
|
|
private void handleDelete(CapitalTransactionsDto dto) {
|
|
|
+ // 获取资金流水
|
|
|
CapitalTransactions capitalTransactions = capitalTransactionsDao.lambdaQuery()
|
|
|
- .eq(CapitalTransactions::getOrderId, dto.getOrderId())
|
|
|
- .one();
|
|
|
- if (capitalTransactions != null) {
|
|
|
- capitalTransactionsService.delete(Collections.singletonList(capitalTransactions.getId()));
|
|
|
+ .eq(CapitalTransactions::getOrderId, dto.getOrderId()).one();
|
|
|
+ if (capitalTransactions == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 删除资金流水
|
|
|
+ capitalTransactionsService.delete(Collections.singletonList(capitalTransactions.getId()));
|
|
|
+
|
|
|
+ // 获取合同
|
|
|
+ ContractInfo contractInfo = contractInfoDao.lambdaQuery()
|
|
|
+ .eq(ContractInfo::getCapitalTransactionsId, capitalTransactions.getId()).one();
|
|
|
+ if (contractInfo == null) {
|
|
|
+ return;
|
|
|
}
|
|
|
+ // 删除合同
|
|
|
+ contractInfoService.delete(Collections.singletonList(contractInfo.getId()));
|
|
|
}
|
|
|
|
|
|
}
|