| | |
| | | import com.yami.trading.service.exchange.PartyBlockchainService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void saveOrUpdateAddress(String userName, String coinSymbol, String chainName, String address, String qrImage) { |
| | | List<PartyBlockchain> existing = list(Wrappers.<PartyBlockchain>query().lambda() |
| | | .eq(PartyBlockchain::getUserName, userName) |
| | | .eq(PartyBlockchain::getCoinSymbol, coinSymbol) |
| | | .eq(PartyBlockchain::getChainName, chainName)); |
| | | if (!existing.isEmpty()) { |
| | | PartyBlockchain pb = existing.get(0); |
| | | pb.setAddress(address); |
| | | if (qrImage != null) { |
| | | pb.setQrImage(qrImage); |
| | | } |
| | | updateById(pb); |
| | | } else { |
| | | PartyBlockchain pb = new PartyBlockchain(); |
| | | pb.setUserName(userName); |
| | | pb.setCoinSymbol(coinSymbol); |
| | | pb.setChainName(chainName); |
| | | pb.setAddress(address); |
| | | pb.setQrImage(qrImage); |
| | | pb.setAuto("N"); |
| | | pb.setCreateTime(new Date()); |
| | | save(pb); |
| | | } |
| | | } |
| | | |
| | | } |