|
@@ -41,24 +41,24 @@ public class WalletFeignServiceImpl implements WalletFeignService {
|
|
|
|
|
|
|
|
@NotNull
|
|
@NotNull
|
|
|
private Wallet findWallet(String oid, @NotNull WalletType walletType, String shopId, String userId){
|
|
private Wallet findWallet(String oid, @NotNull WalletType walletType, String shopId, String userId){
|
|
|
- Wallet wallet = null;
|
|
|
|
|
|
|
+ Wallet findWallet = null;;
|
|
|
|
|
+ Wallet wallet = new Wallet();;
|
|
|
if (walletType.equals(WalletType.User)){
|
|
if (walletType.equals(WalletType.User)){
|
|
|
- wallet = walletDao.findByUserIdAndOid(userId, oid);
|
|
|
|
|
|
|
+ findWallet = walletDao.findByUserIdAndOidAndWalletType(userId, oid, walletType);
|
|
|
|
|
+ wallet.setUserId(userId);
|
|
|
}
|
|
}
|
|
|
if (walletType.equals(WalletType.Shop)){
|
|
if (walletType.equals(WalletType.Shop)){
|
|
|
- wallet = walletDao.findByShopIdAndOid(shopId, oid);
|
|
|
|
|
|
|
+ findWallet = walletDao.findByShopIdAndOidAndWalletType(shopId, oid, walletType);
|
|
|
|
|
+ wallet.setShopId(shopId);
|
|
|
}
|
|
}
|
|
|
- if (wallet!=null){
|
|
|
|
|
- return wallet;
|
|
|
|
|
|
|
+ if (findWallet!=null){
|
|
|
|
|
+ return findWallet;
|
|
|
}
|
|
}
|
|
|
- wallet = new Wallet();
|
|
|
|
|
wallet.setOid(oid);
|
|
wallet.setOid(oid);
|
|
|
wallet.setAmount(BigDecimal.ZERO);
|
|
wallet.setAmount(BigDecimal.ZERO);
|
|
|
wallet.setAmount(BigDecimal.ZERO);
|
|
wallet.setAmount(BigDecimal.ZERO);
|
|
|
wallet.setDataState(DataState.Enable);
|
|
wallet.setDataState(DataState.Enable);
|
|
|
wallet.setWalletType(walletType);
|
|
wallet.setWalletType(walletType);
|
|
|
- wallet.setShopId(shopId);
|
|
|
|
|
- wallet.setUserId(userId);
|
|
|
|
|
walletDao.save(wallet);
|
|
walletDao.save(wallet);
|
|
|
return wallet;
|
|
return wallet;
|
|
|
}
|
|
}
|