Пример #1
0
 /*用户,商户增加补充证据*/
 public void addcomplement() {
   Map<String, Object> resultMap = new HashMap<String, Object>();
   String userid = this.getPara("uid");
   String orderId = this.getPara("orderid");
   if (StringUtil.isNull(userid) || StringUtil.isNull(orderId)) {
     formatInvalidParamResponse(resultMap);
   } else {
     String cbid = this.getPara("cbid");
     String content = this.getPara("content");
     String img_url = this.getPara("apyimg");
     // 验证验证码
     // 验证content
     SysUser abuser = SysUser.dao.findById(userid);
     AbOrderChargebackItem aoci = new AbOrderChargebackItem();
     aoci.set(AbOrderChargebackItem.ID, StringUtil.getUuid32());
     aoci.set(AbOrderChargebackItem.CBID, cbid);
     aoci.set(AbOrderChargebackItem.UID, userid);
     if (CommonStaticData.USER_TYPE_MEMBER.equals(abuser.get(SysUser.ROLE_ID))) {
       aoci.set(AbOrderChargebackItem.TYPE, CommonStaticData.CB_APPLYTYPE_MEMBER);
     } else if (CommonStaticData.USER_TYPE_MERCHANT.equals(abuser.get(SysUser.ROLE_ID))) {
       aoci.set(AbOrderChargebackItem.TYPE, CommonStaticData.CB_APPLYTYPE_MERCHANT);
     } else if (CommonStaticData.USER_TYPE_SERVICE.equals(abuser.get(SysUser.ROLE_ID))) {
       aoci.set(AbOrderChargebackItem.TYPE, CommonStaticData.CB_APPLYTYPE_SERVICE);
     }
     aoci.set(AbOrderChargebackItem.CONTENT, content);
     aoci.set(AbOrderChargebackItem.DATETIME, DateUtil.getCurrentDate());
     if (img_url != null) {
       FileInputStream file = null;
       try {
         file = new FileInputStream(PathKit.getWebRootPath() + "\\upload\\" + img_url);
       } catch (FileNotFoundException e) {
         e.printStackTrace();
       }
       aoci.set(AbOrderChargebackItem.IMG_URL, img_url);
       aoci.set(AbOrderChargebackItem.IMAGE, file);
     }
     aoci.save();
     resultMap.put("result", RESULT_SUCCESS);
     resultMap.put("msg", "维权成功,请耐心等待调解结果");
   }
   renderJson(resultMap);
 }
  /*用户,商户增加补充证据*/
  public void addcomplement() {
    SysUser abuser = this.getSessionAttr("abuser");
    if (abuser == null || abuser.get("id") == null) {
      redirect("/ab/login");
    } else {
      String cbid = this.getPara("cbid");
      String inputRandomCode = this.getPara("comCaptchaCode");
      String content = this.getPara("comContent");
      String img_url = this.getPara("apyimg");
      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 {
        abuser = SysUser.dao.findById(abuser.get("id"));
        AbOrderChargebackItem aoci = new AbOrderChargebackItem();
        aoci.set(AbOrderChargebackItem.ID, StringUtil.getUuid32());
        aoci.set(AbOrderChargebackItem.CBID, cbid);
        aoci.set(AbOrderChargebackItem.UID, abuser.getStr(SysUser.ID));
        if (CommonStaticData.USER_TYPE_MEMBER.equals(abuser.get(SysUser.ROLE_ID))) {
          aoci.set(AbOrderChargebackItem.TYPE, CommonStaticData.CB_APPLYTYPE_MEMBER);
        } else if (CommonStaticData.USER_TYPE_MERCHANT.equals(abuser.get(SysUser.ROLE_ID))) {
          aoci.set(AbOrderChargebackItem.TYPE, CommonStaticData.CB_APPLYTYPE_MERCHANT);
        } else if (CommonStaticData.USER_TYPE_SERVICE.equals(abuser.get(SysUser.ROLE_ID))) {
          aoci.set(AbOrderChargebackItem.TYPE, CommonStaticData.CB_APPLYTYPE_SERVICE);
        }
        aoci.set(AbOrderChargebackItem.CONTENT, content);
        aoci.set(AbOrderChargebackItem.DATETIME, DateUtil.getCurrentDate());
        if (img_url != null) {
          FileInputStream file = null;
          try {
            file = new FileInputStream(PathKit.getWebRootPath() + "\\upload\\" + img_url);
          } catch (FileNotFoundException e) {
            e.printStackTrace();
          }
          aoci.set(AbOrderChargebackItem.IMG_URL, img_url);
          aoci.set(AbOrderChargebackItem.IMAGE, file);
        }
        aoci.save();

        String userid = abuser.getStr("id");
        String roleid = abuser.getStr("role_id");
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String str_date = df.format(new Date());
        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);

        this.renderJson("0");
      }
    }
  }