| | |
| | | if (user == null) { |
| | | return ServerResponse.createByErrorMsg("平仓失败,用户不存在"); |
| | | } |
| | | UserAssets userAssets = userAssetsMapper.selectOne(new LambdaQueryWrapper<UserAssets>() |
| | | .eq(UserAssets::getUserId, userPosition.getUserId()) |
| | | .eq(UserAssets::getAccectType, "JP") |
| | | ); |
| | | if(userAssets.getAmountToBeCovered().compareTo(BigDecimal.ZERO) > 0){ |
| | | return ServerResponse.createByErrorMsg("用户待补资金未补齐,禁止平仓"); |
| | | } |
| | | if (userPosition.getSellOrderId() != null) { |
| | | return ServerResponse.createByErrorMsg("平仓失败, 订单已平仓"); |
| | | } |
| | |
| | | public ServerResponse sell(String positionSn, int doType, Integer number,HttpServletRequest request) { |
| | | UserPosition userPosition = this.userPositionMapper.findPositionBySn(positionSn); |
| | | if(null == number || number <= 0 || number > userPosition.getOrderNum()){ |
| | | return ServerResponse.createByErrorMsg("请输入正确的平仓数", request); |
| | | String msg = "请输入正确的平仓数"; |
| | | if(request.getHeader("lang").equals("ja")){ |
| | | msg ="正しい決済価格を入力してください"; |
| | | return ServerResponse.createByErrorMsg(msg); |
| | | }else{ |
| | | return ServerResponse.createByErrorMsg(msg, request); |
| | | } |
| | | } |
| | | // 手续费率 |
| | | BigDecimal siitteBuyFee = new BigDecimal(iStockConfigServices.queryByKey(EConfigKey.SELL_HANDLING_CHARGE.getCode()).getCValue()); |