Exemplo n.º 1
0
 public void saveCzResult() {
   Map<String, Object> resultMap = new HashMap<String, Object>();
   String uid = this.getPara("uid");
   String loginid = this.getPara("loginid");
   String mc = this.getPara("mc");
   String czje = this.getPara("czje");
   String czResult = this.getPara("czResult");
   try {
     if (StringUtil.isNull(uid) || StringUtil.isNull(loginid) || StringUtil.isNull(czje)) {
       formatInvalidParamResponse(resultMap);
     } else {
       if ("1".equals(czResult)) {
         SysUser abuser = SysUser.dao.findById(uid);
         if (null != abuser) {
           BigDecimal ud = abuser.getBigDecimal(SysUser.ZHYE);
           double f = Double.parseDouble(czje);
           ud = ud.add(BigDecimal.valueOf(f));
           abuser.set(SysUser.ZHYE, ud);
           abuser.update();
         }
       }
       LogUserDeposit lud = new LogUserDeposit();
       String ludid = StringUtil.getUuid32();
       lud.set("id", ludid);
       lud.set("userid", uid);
       lud.set("loginid", loginid);
       lud.set("mc", mc);
       lud.set("czje", czje);
       // '充值结果[1: -成功、0:  -失败     2: 支付结果确认中]',
       lud.set("status", czResult);
       lud.set("remark", mc + "手机充值" + czje + "元");
       lud.save();
       resultMap.put("result", RESULT_SUCCESS);
       resultMap.put("msg", "操作成功");
     }
   } catch (Exception e) {
     resultMap.put("result", RESULT_FAIL);
     resultMap.put("msg", "系统错误,请稍后重试!");
     e.printStackTrace();
     RestLogUtils.writeToLocal(RestLogUtils.getStackTrace(e), true);
   }
   this.renderJson(resultMap);
 }
Exemplo n.º 2
0
 /** 提现数据处理 */
 public void txAction() {
   String uid = this.getPara("uid");
   String WIDtotal_fee = StringUtil.toStr(this.getPara("WIDtotal_fee")); // 提现金额
   String WIDout_trade_no = StringUtil.toStr(this.getPara("WIDout_trade_no")); // 交易流水号
   String zffs = StringUtil.toStr(this.getPara("zzfs")); // 提现方式
   String zfbzh = StringUtil.toStr(this.getPara("zfbzh")); // 支付宝账号
   String yhkid = StringUtil.toStr(this.getPara("yhkid")); // 提现银行卡id
   String yhknum = StringUtil.toStr(this.getPara("yhknum")); // 提现银行卡卡号
   String zfpwd = StringUtil.toStr(this.getPara("zfpwd")); // 支付密码
   SysUser user = SysUser.dao.findById(uid);
   Map<String, Object> result = new HashMap<String, Object>();
   try {
     if (Db.findFirst(
                 "select count(*) ctn from sys_user_zfpwd where userid='"
                     + user.getStr("loginid")
                     + "' and zfpwd='"
                     + zfpwd
                     + "'")
             .getLong("ctn")
         == 0) {
       result.put("msg", "支付密码错误!");
       result.put("result", RESULT_FAIL);
     } else if (user.getBigDecimal("zhye").subtract(new BigDecimal(WIDtotal_fee)).doubleValue()
         < 0) { // 账户余额不足以提现
       result.put("result", RESULT_FAIL);
       result.put("msg", "账户余额不足!");
     } else {
       user.set(
           "zhye",
           user.getBigDecimal("zhye")
               .subtract(new BigDecimal(WIDtotal_fee))); // 现将金额扣除,后期提现失败,提现金额退换
       user.update();
       this.setSessionAttr("abuser", user);
       if ("0".equals(zffs)) { // 支付宝提现
         SysCzTx cztx = new SysCzTx();
         cztx.set("id", StringUtil.getUuid32());
         cztx.set("tradeno", WIDout_trade_no);
         cztx.set("type", 1); // 0-充值 1-提现 2-付款
         cztx.set("result", 0); // 0-等待 1-成功 2-失败
         cztx.set("totalfee", WIDtotal_fee);
         cztx.set("userid", user.getStr("id"));
         cztx.set("mc", user.getStr("mc"));
         cztx.set("time", DateUtil.getCurrentDate());
         cztx.set("zfbaddress", zfbzh);
         cztx.set("txtype", 0); // 提现种类 0-支付宝  1-银行卡
         cztx.save();
       } else { // 银行卡提现
         SysCzTx cztx = new SysCzTx();
         cztx.set("id", StringUtil.getUuid32());
         cztx.set("tradeno", WIDout_trade_no);
         cztx.set("type", 1); // 0-充值 1-提现 2-付款
         cztx.set("result", 0); // 0-等待 1-成功 2-失败
         cztx.set("totalfee", WIDtotal_fee);
         cztx.set("userid", user.getStr("id"));
         cztx.set("mc", user.getStr("mc"));
         cztx.set("txtype", 1); // 提现种类 0-支付宝  1-银行卡
         cztx.set("txyhkid", yhkid);
         cztx.set("txyhknum", yhknum);
         cztx.set("time", DateUtil.getCurrentDate());
         cztx.save();
       }
       result.put("msg", "提现申请已经提交,约7个工作日内到账,请您耐心等待!");
       result.put("result", RESULT_SUCCESS);
     }
   } catch (Exception e) {
     result.put("result", RESULT_FAIL);
     result.put("msg", "系统错误,请稍后重试!");
     e.printStackTrace();
     RestLogUtils.writeToLocal(RestLogUtils.getStackTrace(e), true);
   }
   this.renderJson(result);
 }
  /*商户回复 1同意退单,2申诉*/
  public void addcbReponse() {
    SysUser abuser = this.getSessionAttr("abuser");
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String str_date = df.format(new Date());
    if (abuser == null || abuser.get("id") == null) {
      redirect("/ab/login");
    } else {
      String cbid = this.getPara("cbid");
      String agree = this.getPara("agree");
      String inputRandomCode = this.getPara("captchaCode");
      String content = this.getPara("content");
      Object objMd5RandomCode = this.getSessionAttr(CaptchaRender.DEFAULT_CAPTCHA_MD5_CODE_KEY);
      // 验证验证码
      if (!CaptchaRender.validate(objMd5RandomCode.toString(), inputRandomCode)) {
        this.renderJson("1");
      }
      // 验证content
      else if (StringUtil.isNull(content) || content.length() > 100) {
        this.renderJson("2");
      } // 更新退单记录
      else {
        AbOrderChargeback cb = AbOrderChargeback.dao.findById(cbid);
        cb.set(AbOrderChargeback.REP_DESC, content);
        cb.set(AbOrderChargeback.REP_TIME, DateUtil.getCurrentDate());
        SysUser mer = SysUser.dao.findById(abuser.getStr(SysUser.ID));
        SysUser user = SysUser.dao.findById(cb.getStr(AbOrderChargeback.XDR_ID));
        // 同意
        if (agree.equals("1")) {
          // 更新退单状态
          cb.set(AbOrderChargeback.CB_STATUS, CommonStaticData.CB_TYPE6);
          cb.set(AbOrderChargeback.STATUS, CommonStaticData.CB_STATUS3);
          // 金额
          AbOrder order = AbOrder.dao.findById(cb.getStr(AbOrderChargeback.ORDER_ID));
          BigDecimal money = order.getBigDecimal(AbOrder.DDZJE);
          // 更新订单状态
          order.set(AbOrder.DDZT, "5");
          order.update();
          // 商户余额金额减少

          BigDecimal merye = mer.getBigDecimal(SysUser.ZHYE);
          mer.set(SysUser.ZHYE, merye.subtract(money));
          mer.update();
          // 用户余额增加

          BigDecimal userye = mer.getBigDecimal(SysUser.ZHYE);
          user.set(SysUser.ZHYE, userye.add(money));
          // 判断是否已经支付,如果已经支付,则扣除积分
          if ("1".equals(order.getStr(AbOrder.ZFZT))) {
            int jf = user.getInt(SysUser.JIFEN);
            int mjf = money.setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
            user.set(SysUser.JIFEN, jf - mjf);
          }
          user.update();

          String sn = order.getStr("sn");
          String userid = user.getStr("id");
          String roleid = user.getStr("role_id");
          Record record = new Record();
          record.set("id", StringUtil.getUuid32());
          record.set("user_id", userid);
          record.set("role_id", roleid);
          record.set("mes_title", "退单消息");
          record.set("mes_type", "0");
          record.set("isread", "0");
          record.set("text", "商户同意退单!订单号:" + sn);
          record.set("send_date", str_date);
          Db.save("message", record);

        } else {
          cb.set(AbOrderChargeback.CB_STATUS, CommonStaticData.CB_TYPE3);

          String userid = user.getStr("id");
          String roleid = user.getStr("role_id");
          Record record = new Record();
          record.set("id", StringUtil.getUuid32());
          record.set("user_id", userid);
          record.set("role_id", roleid);
          record.set("mes_title", "退单消息");
          record.set("mes_type", "0");
          record.set("isread", "0");
          record.set("text", "商户已提起申诉!");
          record.set("send_date", str_date);
          Db.save("message", record);
        }
        cb.update();
        this.renderJson("0");
      }
    }
  }