コード例 #1
0
  /** 晒单录入操作 */
  @RequestMapping("/orderInput.json")
  @ResponseBody
  public JsonResult orderInput(
      Long dynamicId,
      Long userId,
      @RequestParam(value = "stockCode") String[] stockCodes,
      @RequestParam(value = "num") Long[] nums,
      @RequestParam(value = "tradeType") String[] tradeTypes,
      @RequestParam(value = "tradePrice") Double[] tradePrices,
      String auditDesc,
      Long parentGroupId,
      HttpServletRequest request) {
    // 查询晒单的动态记录
    UserDynamicInfo userDynamicInfo = userDynamicInfoService.findById(dynamicId);
    userDynamicInfo.setAuditDesc(auditDesc);

    List<Trade> trades = new ArrayList<Trade>();
    for (int i = 0; i < stockCodes.length; i++) {
      String stockCode = stockCodes[i];
      Trade trade = new Trade();
      trade.setUserId(userId);

      Stock stock = stockService.findByStockCode(stockCode);
      trade.setStockId(stock.getStockId());
      trade.setStockCode(stockCode);
      trade.setStockName(stock.getStockName());
      if (tradePrices != null && tradePrices.length > i) {
        trade.setTradePrice(tradePrices[i]);
      }
      if (nums != null && nums.length > i) {
        trade.setTradeNumber(nums[i]);
      }
      trade.setTurnoverAmount(
          MathUtil.mul(
              (trade.getTradePrice() == null ? 0 : trade.getTradePrice()), trade.getTradeNumber()));
      trade.setTradeType(tradeTypes[i]);
      trade.setIsRevoke(TradeIsRevokeEnum.N.getCode());
      trade.setTradeDate(userDynamicInfo.getCreateDate());
      trade.setTradeTime(userDynamicInfo.getCreateDate());
      Date currDate = new java.util.Date();
      trade.setCreateDate(currDate);
      trade.setUpdateDate(currDate);
      trade.setTradeDate(currDate);
      trade.setTradeTime(currDate);
      trade.setShareholderCode(stock.getStockCode());
      trades.add(trade);
    }
    // 添加晒单
    userDynamicInfoService.addOrder(userDynamicInfo, trades, userId, parentGroupId);

    // return jsonResultHelper.buildFailJsonResult(UserDynamicInfoResultCode.SIGN_ERROR);
    return jsonResultHelper.buildSuccessJsonResult(true);
  }
コード例 #2
0
  /** 晒单作废操作 */
  @RequestMapping("/orderInputCancel.json")
  @ResponseBody
  public JsonResult orderInputCancel(Long dynamicId, String auditDesc) {
    // 查询晒单的动态记录
    UserDynamicInfo userDynamicInfo = userDynamicInfoService.findById(dynamicId);
    userDynamicInfo.setAuditDesc(auditDesc);

    // 将此条记录修改成审批通过
    userDynamicInfo.setAuditDate(new java.util.Date());
    userDynamicInfo.setAuditName(AuthUtil.getUserName());
    userDynamicInfo.setAuditStatus(UserDynamicInfoAuditStatusEnum.D.getCode());
    userDynamicInfo.setIsInput(UserDynamicInfoIsInputEnum.Y.getCode());
    userDynamicInfoService.update(userDynamicInfo);
    return jsonResultHelper.buildSuccessJsonResult(null);
  }