Exemplo n.º 1
0
  /**
   * 查找托管计划
   *
   * @return
   */
  public TrusteeshipCommodity findPlanById(Long id) {

    IpoTrusteeshipCommodity dbShipCommodity = shipCommodityMapper.findById(id);
    TrusteeshipCommodity entity = new TrusteeshipCommodity();
    BeanUtils.copyProperties(dbShipCommodity, entity);
    return entity;
  }
Exemplo n.º 2
0
  /**
   * 分页查询查询托管商品计划
   *
   * @param pageNo
   * @param pageSize
   * @param commodity
   * @return
   */
  public List<TrusteeshipCommodity> queryPlanForPage(
      String pageNoStr, String pageSizeStr, TrusteeshipCommodity commodity) {

    int startIndex = PageUtil.getStartIndex(pageNoStr, pageSizeStr);
    int endIndex = PageUtil.getEndIndex(pageNoStr, pageSizeStr);
    List<IpoTrusteeshipCommodity> dbList =
        shipCommodityMapper.queryApplyForPage(startIndex, endIndex, commodity);
    List<TrusteeshipCommodity> dataList = new ArrayList<TrusteeshipCommodity>();
    for (IpoTrusteeshipCommodity item : dbList) {
      TrusteeshipCommodity entity = new TrusteeshipCommodity();
      BeanUtils.copyProperties(item, entity);
      dataList.add(entity);
    }
    return dataList;
  }
Exemplo n.º 3
0
  /**
   * 新增商户申购的托管商品
   *
   * @param trusteeship
   * @return
   */
  @Transactional
  public int saveApply(Trusteeship trusteeship) {
    Long planId = trusteeship.getTrusteeshipCommodityId();
    IpoTrusteeshipCommodity shipCommodity = shipCommodityMapper.findById(planId);
    BigDecimal purchaseRate = shipCommodity.getPurchaseRate();
    Long applyAmount = trusteeship.getApplyAmount();
    // 约定入库数量等于申请数量,只能全部审核通过或全部审核不通过
    Long instorageAmount = applyAmount;
    trusteeship.setInstorageAmount(instorageAmount);
    trusteeship.setCreateDate(new Date());
    trusteeship.setState(TrusteeshipConstant.State.APPLY.getCode());
    Long effectiveAmount =
        new BigDecimal(instorageAmount)
            .multiply(purchaseRate)
            .divide(new BigDecimal(100))
            .longValue();
    trusteeship.setEffectiveAmount(effectiveAmount);
    trusteeship.setPositionAmount(instorageAmount - effectiveAmount);

    return shipMapper.insertApply(trusteeship);
  }
Exemplo n.º 4
0
 /**
  * 添加托管计划
  *
  * @param commodity
  */
 @Transactional
 public void savePlan(TrusteeshipCommodity commodity) {
   commodity.setCreateDate(new Date());
   shipCommodityMapper.insert(commodity);
 }
Exemplo n.º 5
0
 /**
  * 删除托管计划
  *
  * @param id
  */
 @Transactional
 public void deletePlan(TrusteeshipCommodity commodity) {
   commodity.setUpdateDate(new Date());
   shipCommodityMapper.deleteById(commodity);
 }
Exemplo n.º 6
0
 /**
  * 查询可申购的托管计划数量
  *
  * @param commodity
  * @return
  */
 public long queryPlanForCount(TrusteeshipCommodity commodity) {
   long count = shipCommodityMapper.queryApplyForCount(commodity);
   return count;
 }