| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | |
| | | @Autowired |
| | | IUserRechargeService iUserRechargeService; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | IApplyLeverServices iApplyLeverServices; |
| | | |
| | | @Autowired |
| | | private ISiteVipRobService iSiteVipRobService; |
| | | |
| | | private static final ThreadLocal<Boolean> orderCreated = ThreadLocal.withInitial(() -> false); |
| | | private final Lock lock = new ReentrantLock(); |
| | |
| | | return ServerResponse.createByErrorMsg("当前下单人数过多,请稍后重试", request); |
| | | } |
| | | buyOrderCreated.set(true); |
| | | return this.iUserPositionService.buy(stockId, buyNum, buyType, lever,profitTarget,stopLoss, request); |
| | | return this.iUserPositionService.buy(stockId, buyNum, buyType, lever,profitTarget,stopLoss,request,null); |
| | | } catch (Exception e) { |
| | | return ServerResponse.createByErrorMsg("订单异常,请稍后重试", request); |
| | | } finally{ |
| | | buyLock.unlock(); |
| | | buyOrderCreated.set(false); |
| | | } |
| | | } |
| | | @GetMapping("checkStockVip.do") |
| | | @ResponseBody |
| | | public ServerResponse checkStockVip(@RequestParam("stockId") Integer stockId, |
| | | @RequestParam("buyNum") Integer buyNum, |
| | | @RequestParam("buyType") Integer buyType, |
| | | @RequestParam("lever") Integer lever, |
| | | @RequestParam(value = "profitTarget",required = false) BigDecimal profitTarget, |
| | | @RequestParam(value = "stopLoss",required = false) BigDecimal stopLoss, HttpServletRequest request){ |
| | | return ServerResponse.createBySuccess(iUserPositionService.checkStockVip(stockId,buyNum,buyType,lever,profitTarget,stopLoss,request)); |
| | | } |
| | | //修改涨跌板 |
| | | @RequestMapping({"updateProfitTarget.do"}) |
| | |
| | | @RequestMapping({"sell.do"}) |
| | | @ResponseBody |
| | | public ServerResponse sell(HttpServletRequest request, @RequestParam("positionSn") String positionSn) { |
| | | return this.iUserPositionService.sell(positionSn, 1,request); |
| | | return this.iUserPositionService.sell(positionSn, 1); |
| | | } |
| | | |
| | | |
| | |
| | | @RequestMapping({"upload.do"}) |
| | | @ResponseBody |
| | | public ServerResponse upload(HttpSession session, @RequestParam(value = "upload_file", required = false) MultipartFile file, HttpServletRequest request) { |
| | | String path = request.getSession().getServletContext().getRealPath("upload"); |
| | | try { |
| | | String path = request.getSession().getServletContext().getRealPath("upload"); |
| | | |
| | | ServerResponse serverResponse = this.iFileUploadService.upload(file, path); |
| | | if (serverResponse.isSuccess()) { |
| | | String targetFileName = serverResponse.getData().toString(); |
| | | String url = PropertiesUtil.getProperty("ftp.server.http.prefix") + targetFileName; |
| | | ServerResponse serverResponse = this.iFileUploadService.upload(file, path); |
| | | if (serverResponse.isSuccess()) { |
| | | String targetFileName = serverResponse.getData().toString(); |
| | | String url = PropertiesUtil.getProperty("ftp.server.http.prefix") + targetFileName; |
| | | Map fileMap = Maps.newHashMap(); |
| | | fileMap.put("uri", targetFileName); |
| | | fileMap.put("url", url); |
| | | |
| | | |
| | | Map fileMap = Maps.newHashMap(); |
| | | fileMap.put("uri", targetFileName); |
| | | fileMap.put("url", url); |
| | | |
| | | return ServerResponse.createBySuccess(fileMap); |
| | | return ServerResponse.createBySuccess(fileMap); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | log.error("上传失败",e); |
| | | } |
| | | return serverResponse; |
| | | return ServerResponse.createByErrorMsg("上传失败"); |
| | | } |
| | | |
| | | |