예제 #1
0
  public String edit() {
    info.setEditUserNo(UserHelper.getEditUserNo());
    int id = 0;
    if (this.getOper().equalsIgnoreCase("add")) {
      info.setInUserNo(UserHelper.getEditUserNo());
      id = PaymentRefundModel.add(info);
      if (id > 0) {
        this.setErrDesc(String.valueOf(id));
      } else {
        this.setErrCode("add failed");
        this.setErrDesc("add failed");
      }

    } else {
      if (info.getId() == 0) {
        this.setErrCode("NoID");
        this.setErrDesc("NoID");
      } else {
        if (this.getOper().equalsIgnoreCase("edit")) {
          PaymentRefund paymentRefund = PaymentRefundModel.getInfo(info.getId());
          info.setSalesNo(paymentRefund.getSalesNo());
          info.setP2pProductNo(paymentRefund.getP2pProductNo());
          // info.setP2pCustomerNo(paymentRefund.getP2pCustomerNo());
          info.setCustomerNo(paymentRefund.getCustomerNo());
          info.setPayerNo(paymentRefund.getPayerNo());
          if (PaymentRefundModel.update(info) > 0) {
            this.setErrDesc(String.valueOf(info.getId()));
          } else {
            this.setErrCode("update failed");
            this.setErrDesc("update failed");
          }
        }
      }
    }

    return SUCCESS;
  }
예제 #2
0
  public String ajaxSendSms() {

    if (StringHelper.isNullOrEmpty(this.ids)) {
      this.setErrCode("NoID");
      this.setErrDesc("请选择数据");
      return SUCCESS;
    } else {
      String[] ids = this.ids.split(",");
      List<String> idList = Arrays.asList(ids);
      for (String id : idList) {
        PaymentRefund paymentRefund = PaymentRefundModel.getInfo(Integer.parseInt(id));
        String cellphone = "";
        try {
          if (paymentRefund.getPayType() == 1) {
            cellphone = P2pCustomerModel.getInfo(paymentRefund.getP2pCustomerNo()).getCellphone();
          } else {
            cellphone =
                CustomerPersonalModel.getInfo(paymentRefund.getCustomerNo()).getCellphone1();
          }
        } catch (Exception e) {
          this.setErrCode("0000");
          this.setErrDesc("没有手机号");
        }
        String productName = P2pProductModel.getInfo(paymentRefund.getP2pProductNo()).getName();
        int times = PaymentRefundModel.getTimesIsUseBySalesNo(paymentRefund.getSalesNo());
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        int result = 0;
        if (Integer.parseInt(this.type) == 1) {
          String money = Double.toString(paymentRefund.getPayMoney());
          if (paymentRefund.getTimes() == times) {
            result =
                SmsModel.smsProductExpire(
                    cellphone, sdf.format(paymentRefund.getActualPayTime()), productName, money);
          } else {
            result =
                SmsModel.smsProductInterest(
                    cellphone,
                    sdf.format(paymentRefund.getActualPayTime()),
                    productName,
                    money,
                    String.valueOf(paymentRefund.getTimes()));
          }
        }
        if (Integer.parseInt(this.type) == 2) {
          result =
              SmsModel.smsContinueInvestment(
                  cellphone,
                  sdf.format(paymentRefund.getActualPayTime()),
                  productName,
                  String.valueOf(paymentRefund.getInterest()),
                  String.valueOf(paymentRefund.getSalesMoney()));
        }
        if (result > 0) {
          paymentRefund.setIsSendSms(2);
          PaymentRefundModel.update(paymentRefund);
          this.setErrCode("0000");
          this.setErrDesc("操作成功");
          if (paymentRefund.getTimes()
              == PaymentRefundModel.getTimesIsUseBySalesNo(paymentRefund.getSalesNo())) {
            SalesModel.updateStatus(paymentRefund.getSalesNo(), SalesStatus.payment);
          }
        } else {
          this.setErrDesc("操作失败");
        }
      }
    }
    return SUCCESS;
  }