| | |
| | | User user = this.iUserService.getCurrentRefreshUser(request); |
| | | |
| | | if (user == null) { |
| | | return ServerResponse.createByErrorMsg("Please log in first"); |
| | | return ServerResponse.createByErrorMsg("Please log in first",request); |
| | | } |
| | | SiteSetting siteSetting = this.iSiteSettingService.getSiteSetting(); |
| | | if (buyNum.intValue() < siteSetting.getBuyMinNum().intValue()) { |
| | | return ServerResponse.createByErrorMsg("The pending order failed, and the purchased quantity was less than" + siteSetting |
| | | .getBuyMinNum() + "stocks"); |
| | | .getBuyMinNum() + "stocks",request); |
| | | } |
| | | if (buyNum.intValue() > siteSetting.getBuyMaxNum().intValue()) { |
| | | return ServerResponse.createByErrorMsg("The pending order failed because the purchased quantity was greater than" + siteSetting |
| | | .getBuyMaxNum() + "stocks"); |
| | | .getBuyMaxNum() + "stocks",request); |
| | | } |
| | | UserPendingorder userPendingorder = userPendingorderMapper.selectOne(new QueryWrapper<UserPendingorder>().eq("user_id", user.getId()).eq("stock_id", stockId).eq("status", 0)); |
| | | if (userPendingorder != null) { |
| | | return ServerResponse.createByErrorMsg("Please do not repeat the order"); |
| | | return ServerResponse.createByErrorMsg("Please do not repeat the order",request); |
| | | } |
| | | |
| | | userPendingorder = new UserPendingorder(); |
| | |
| | | userPendingorder.setStatus(0); |
| | | int ret = userPendingorderMapper.insert(userPendingorder); |
| | | if (ret > 0) { |
| | | return ServerResponse.createBySuccessMsg("If the pending order is successfully added, the order will be automatically placed if the order conditions are met"); |
| | | return ServerResponse.createBySuccessMsg("If the pending order is successfully added, the order will be automatically placed if the order conditions are met",request); |
| | | } |
| | | return ServerResponse.createByErrorMsg("Add failure"); |
| | | return ServerResponse.createByErrorMsg("Add failure",request); |
| | | |
| | | } |
| | | |
| | |
| | | User user = (User) JsonUtil.string2Obj(userJson, User.class); |
| | | UserPendingorder userPendingorder = this.userPendingorderMapper.selectById(id); |
| | | if (userPendingorder == null) { |
| | | return ServerResponse.createByErrorMsg("The pending order does not exist"); |
| | | return ServerResponse.createByErrorMsg("The pending order does not exist",request); |
| | | } |
| | | if (user.getId().intValue() != userPendingorder.getUserId().intValue()) { |
| | | return ServerResponse.createByErrorMsg("The pending order does not belong to you"); |
| | | return ServerResponse.createByErrorMsg("The pending order does not belong to you",request); |
| | | } |
| | | int delCount = this.userPendingorderMapper.deleteById(id); |
| | | if (delCount > 0) { |
| | | return ServerResponse.createByErrorMsg("Successfully deleted"); |
| | | return ServerResponse.createByErrorMsg("Successfully deleted",request); |
| | | } |
| | | return ServerResponse.createByErrorMsg("Deletion failure"); |
| | | return ServerResponse.createByErrorMsg("Deletion failure",request); |
| | | } |
| | | |
| | | return ServerResponse.createByErrorMsg("Please log in"); |
| | | return ServerResponse.createByErrorMsg("Please log in",request); |
| | | } |
| | | |
| | | |