| | |
| | | import com.yami.trading.admin.model.UpdateWalltModel; |
| | | import com.yami.trading.bean.contract.domain.ContractOrder; |
| | | import com.yami.trading.bean.item.domain.Item; |
| | | import com.yami.trading.bean.model.CapitaltWallet; |
| | | import com.yami.trading.bean.model.Wallet; |
| | | import com.yami.trading.common.annotation.SysLog; |
| | | import com.yami.trading.common.domain.Result; |
| | | import com.yami.trading.common.exception.BusinessException; |
| | |
| | | import com.yami.trading.common.web.ResultObject; |
| | | import com.yami.trading.security.common.util.SecurityUtils; |
| | | import com.yami.trading.service.CapitaltWalletService; |
| | | import com.yami.trading.service.WalletService; |
| | | import com.yami.trading.service.contract.ContractOrderService; |
| | | import com.yami.trading.service.user.UserService; |
| | | import com.yami.trading.sys.service.SysUserService; |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | * @create: 2025-01-08 17:57 |
| | | **/ |
| | | @RestController |
| | | @RequestMapping("api/wallet") |
| | | @RequestMapping("/api/wallet") |
| | | @Api(tags = "合约账户") |
| | | public class ApiCapitaltWalletWalletController { |
| | | |
| | |
| | | @Autowired |
| | | CapitaltWalletService capitaltWalletService; |
| | | |
| | | @Autowired |
| | | WalletService walletService; |
| | | |
| | | @Autowired |
| | | private ContractOrderService contractOrderService; |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "划转") |
| | | @PostMapping("transfer.action") |
| | | public Result updateWallt(@Valid @RequestBody TransferModel model) { |
| | | @PostMapping("/transfer.action") |
| | | public Result updateWallt(@Valid TransferModel model) { |
| | | String partyId = SecurityUtils.getCurrentUserId(); |
| | | if(!StringUtils.isNotEmpty(partyId)){ |
| | | throw new YamiShopBindException("请登录!"); |
| | | } |
| | | boolean b = sysUserService.checkSafeWord(model.getSafePassword()); |
| | | if(!b){ |
| | | throw new YamiShopBindException("资金密码错误"); |
| | | } |
| | | return capitaltWalletService.updateWallt(partyId,model.getDeductAccount(),model.getReceiveAccount(),model.getMoneyRevise()); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取资产") |
| | | @PostMapping("/getassets.action") |
| | | public Result updateWallt() { |
| | | String partyId = SecurityUtils.getCurrentUserId(); |
| | | if(!StringUtils.isNotEmpty(partyId)){ |
| | | throw new YamiShopBindException("请登录!"); |
| | | } |
| | | // 获取合约账户(contract) |
| | | Wallet wallet = walletService.saveWalletByPartyId(partyId); |
| | | // 获取资金账户(capital) |
| | | CapitaltWallet capitaltWallet = capitaltWalletService.getOne(new LambdaQueryWrapper<>(CapitaltWallet.class) |
| | | .eq(CapitaltWallet::getUserId, partyId).last(" limit 1 ")); |
| | | |
| | | Map<String, BigDecimal> assets = new HashMap<>(); |
| | | assets.put("contract",wallet.getMoney()); |
| | | assets.put("capital",capitaltWallet.getMoney()); |
| | | return Result.succeed(assets); |
| | | } |
| | | |
| | | |
| | | |
| | | } |