コード例 #1
0
ファイル: User.java プロジェクト: Delicate90/mj_logistics
 public static JSONObject headerEdit(String username, File header) {
   JSONObject items = new JSONObject();
   boolean rs = false;
   if (!username.equals("")) {
     Record user =
         Db.findFirst("SELECT * FROM b_user WHERE username = ? AND status = 1", username);
     if (user != null) {
       System.out.println(header.getName());
       String fileName =
           "head_"
               + username
               + String.valueOf(System.currentTimeMillis())
               + "."
               + header.getName().split("\\.")[1];
       String QNToken = qiNiuKit.getUpToken();
       boolean qnRs = new qiNiuKit().uploadFile(header, fileName, QNToken);
       if (qnRs) {
         user.set("head", qiNiuKit.headSave(fileName));
         rs = Db.update("b_user", user);
         if (rs) {
           user =
               Db.findFirst(
                   "SELECT bu.*,fur.content AS roleValue,fus.content AS sexValue FROM b_user AS bu LEFT JOIN f_user_role AS fur ON bu.role = fur.id LEFT JOIN f_user_sex AS fus ON bu.sex = fus.id WHERE bu.username = ? AND bu.status = 1",
                   username);
           items.put("user", user.toJson());
         }
       }
     }
   }
   items.put("rs", rs);
   return items;
 }
コード例 #2
0
 /** 获取订单对应的维权列表 */
 public void acc() {
   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 {
     AbOrder order = AbOrder.dao.findById(orderId);
     if (order == null) {
       AbTcExpressOrder tc = AbTcExpressOrder.dao.findById(orderId);
       if (tc != null) {
         order = AbOrder.dao.findFirst("select * from ab_order where sn = ?", tc.getStr("sn"));
         if (order != null) {
           orderId = order.getStr("id");
         }
       }
     }
     Record r =
         Db.findFirst(
             "SELECT aocb.*,tu.mc FROM ab_order_chargeback AS aocb,sys_user  AS tu WHERE aocb.apply_id = tu.id AND  aocb.order_id=?",
             new Object[] {orderId});
     resultMap.put("result", RESULT_SUCCESS);
     resultMap.put("msg", "查询成功");
     resultMap.put("data", r);
   }
   renderJson(resultMap);
 }
コード例 #3
0
ファイル: Order.java プロジェクト: ccivo100/fire
 /**
  * @描述 查询Report 详细内容
  *
  * @param where
  * @param paras
  * @return
  */
 public Record findReportById(String where, Object... paras) {
   return Db.findFirst(
       getSql("order.findOrderInfoBySelect")
           + blank
           + getSql("order.findOrderInfoByFrom")
           + getWhere(where),
       paras);
 }
コード例 #4
0
ファイル: Order.java プロジェクト: ccivo100/fire
  /**
   * @描述 查询order 管理员
   *
   * @param where
   * @param paras
   * @return
   */
  public Record query(String where, Object... paras) {

    return Db.findFirst(
        getSql("order.findOfferQueryBySelect")
            + getSql("order.findOfferQueryByFrom")
            + getWhere(where),
        paras);
  }
コード例 #5
0
ファイル: ProjectController.java プロジェクト: lyc0202/res
 public void getProjectInfo() {
   Map<String, String> mapParam = ParamUtil.convertStringParamToMapParam(getPara());
   String projectId = mapParam.get("projectId");
   Record record = Db.findFirst("SELECT * FROM T_PROJECT T WHERE T.ID = ?", projectId);
   record.set("PROJECT_TYPE", getRealType(record.getStr("PROJECT_TYPE")));
   setAttr("project", record);
   renderJsp("/mainPage/gcgk.jsp");
 }
コード例 #6
0
ファイル: User.java プロジェクト: Delicate90/mj_logistics
 public static JSONObject login(String username, String validateNum, String deviceId) {
   JSONObject items = new JSONObject();
   boolean rs = false;
   if (!username.equals("") && !validateNum.equals("") && !deviceId.equals("")) {
     // status 0=初始化 1=正常
     Record user =
         Db.findFirst(
             "SELECT bu.*,fur.content AS roleValue,fus.content AS sexValue FROM b_user AS bu LEFT JOIN f_user_role AS fur ON bu.role = fur.id LEFT JOIN f_user_sex AS fus ON bu.sex = fus.id WHERE bu.username = ? AND bu.validateNum = ? AND bu.status < 2",
             username,
             validateNum);
     Long nowTime = System.currentTimeMillis();
     // validate时会初始化b_user 这里null 一定有误
     if (user != null) {
       if ((nowTime - user.getTimestamp("validateTime").getTime()) < 300000) {
         Db.update(
             "UPDATE b_user SET validateNum = ? , status = 1 WHERE username = ?",
             "----",
             user.getStr("username"));
         items.put("user", user.toJson());
         String agentToken = Token.add(username, deviceId);
         items.put("agentToken", agentToken);
         Record auth =
             Db.findFirst(
                 "SELECT * FROM b_auth WHERE username = ? AND role = ?",
                 username,
                 user.getInt("role"));
         if (auth != null) {
           items.put("auth", auth.toJson());
         } else {
           auth = new Record();
           auth.set("username", username).set("role", user.getInt("role")).set("status", 0);
           boolean authRs = Db.save("b_auth", auth);
           if (authRs) {
             items.put("auth", auth.toJson());
           }
         }
         rs = true;
       }
     }
   }
   items.put("rs", rs);
   return items;
 }
コード例 #7
0
ファイル: User.java プロジェクト: Delicate90/mj_logistics
  public Record init(String username) {

    Record user = Db.findFirst("SELECT * FROM b_users WHERE username = ? AND status = 0");
    if (user == null) {
      // user初始化
      user = new Record();
      user.set("username", username).set("mobile", username).set("status", 0);
      Db.save("b_user", user);
    }
    return user;
  }
コード例 #8
0
 /**
  * 删除
  *
  * @param ids
  * @return
  */
 public boolean delete(String ids) {
   Record record =
       Db.findFirst(
           "select count(*) as counts from pt_department where parentdepartmentids=?", ids);
   Long counts = record.getNumber("counts").longValue();
   if (counts > 1) {
     return false;
   }
   Department.dao.deleteById(ids);
   return true;
 }
コード例 #9
0
ファイル: StockAllot.java プロジェクト: rsyuxiangyang/ecp
 /** 判断是否已经提交 */
 public boolean isSubmit(String id) {
   String[] ids = id.split(",");
   StringBuffer ids_ = new StringBuffer();
   List<String> parame = new ArrayList<String>();
   for (String id_ : ids) {
     ids_.append("?,");
     parame.add(id_);
   }
   ids_.append("'-'");
   Record r =
       Db.findFirst(
           "select count(1) ct from "
               + tableName
               + " where id in("
               + ids_.toString()
               + ") and submit_status>0",
           parame.toArray());
   return (r != null && r.getLong("ct") > 0);
 }
コード例 #10
0
ファイル: User.java プロジェクト: Delicate90/mj_logistics
 public static JSONObject edit(
     String username,
     int role,
     String name,
     String nickName,
     int sex,
     String mobile,
     String area,
     String address) {
   JSONObject items = new JSONObject();
   boolean rs = false;
   if (!username.equals("")) {
     Record user =
         Db.findFirst("SELECT * FROM b_user WHERE username = ? AND status = 1", username);
     Record auth = null;
     if (user != null) {
       if (role != 0) {
         user.set("role", role);
         auth = Db.findFirst("SELECT * FROM b_auth WHERE username = ?", username);
         auth.set("role", role);
         Db.update("b_auth", auth);
       }
       if (!name.equals("")) {
         user.set("name", name);
       }
       if (!nickName.equals("")) {
         user.set("nickName", nickName);
       }
       if (!address.equals("")) {
         user.set("address", address);
       }
       if (!area.equals("")) {
         String[] areas = area.split("\\|");
         if (areas.length > 1) {
           String[] location = areas[1].split("\\-");
           user.set("lon", location[0]);
           user.set("lat", location[1]);
         }
         String[] province_city_area = areas[0].split("\\-");
         user.set("province", province_city_area[0]);
         System.out.println(province_city_area[0]);
         System.out.println(province_city_area[1]);
         user.set("city", province_city_area[1]);
         if (province_city_area.length > 2) {
           user.set("area", province_city_area[2]);
         }
       }
       if (sex != 0) {
         user.set("sex", sex);
       }
       rs = Db.update("b_user", user);
       if (rs) {
         user =
             Db.findFirst(
                 "SELECT bu.*,fur.content AS roleValue,fus.content AS sexValue FROM b_user AS bu LEFT JOIN f_user_role AS fur ON bu.role = fur.id LEFT JOIN f_user_sex AS fus ON bu.sex = fus.id WHERE bu.username = ? AND bu.status = 1",
                 username);
         items.put("user", user.toJson());
       }
     }
   }
   items.put("rs", rs);
   return items;
 }
コード例 #11
0
  @Before(AccessAbInterceptor.class)
  public void list_order_cxtj() {
    SysUser abuser = this.getSessionAttr("abuser");
    String kssj = StringUtil.toStr(this.getPara("kssj"));
    String jzsj = StringUtil.toStr(this.getPara("jzsj"));
    String ddzt = StringUtil.toStr(this.getPara("ddzt"));
    String queryType = StringUtil.toStr(this.getPara("queryType"));
    //		String lastDate = StringUtil.toStr(this.getPara("lastDate"));
    if (queryType.equals("")) {
      queryType = "dayQuery";
      setAttr("queryType", queryType);
    }

    Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.DATE, -1); // 得到前一天
    Date date = calendar.getTime();
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    String str_lastDate = df.format(date);

    String sql =
        "select ao.*,tc.style style,tc.min_price min_price,tc.max_price max_price,tc.pay_type from ab_order ao left join ab_tc_express_order tc on tc.sn=ao.sn where qdrid='"
            + abuser.getStr("id")
            + "' ";
    if ("day".equals(queryType)) {
      // 日报表
      sql += " and qdsj>='" + DateUtil.getCurrentDate("yyyy-MM-dd") + " 00:00:00'";
      sql += " and qdsj<='" + DateUtil.getCurrentDate("yyyy-MM-dd") + " 59:59:59'";
    } else if ("week".equals(queryType)) {
      // 周报表
      sql +=
          " and qdsj>='" + DateUtil.format(DateUtil.getMondayOfWeek(), "yyyy-MM-dd") + " 00:00:00'";
      sql +=
          " and qdsj<='" + DateUtil.format(DateUtil.getSundayOfWeek(), "yyyy-MM-dd") + " 59:59:59'";
    } else if ("month".equals(queryType)) {
      // 月报表
      sql += " and qdsj>='" + DateUtil.getCurrentDate("yyyy-MM") + "-01 00:00:00'";
      sql +=
          " and qdsj<='"
              + DateUtil.format(DateUtil.getLastDayOfMonth(), "yyyy-MM-dd")
              + " 59:59:59'";
    } else if ("dayQuery".equals(queryType)) {
      if (kssj.length() > 0) {
        sql += " and qdsj>='" + kssj + " 00:00:00'";
      }
      if (jzsj.length() > 0) {
        sql += " and qdsj<='" + jzsj + " 59:59:59'";
      }
    } else if ("monthWeekQuery".equals(queryType)) {
      String query_year_begin = getPara("query_year_begin");
      String query_month_begin = getPara("query_month_begin");
      String query_year_end = getPara("query_year_end");
      String query_month_end = getPara("query_month_end");
      sql += " and qdsj>='" + query_year_begin + "-" + query_month_begin + "-01 00:00:00'";
      sql += " and qdsj<='" + query_year_end + "-" + query_month_end + "-31 59:59:59'";
    }
    if (!ddzt.equals("-1") && !ddzt.equals("")) {
      sql += " and ddzt='" + ddzt + "' ";
    }
    sql += "  order by xdsj desc";
    PageUtil listpage = DbPage.paginate(this.getParaToInt("curPage", 1), 14, sql);

    sql =
        "SELECT qdrid,qdrname,COUNT(id) cnt,SUM(ddzje) je,SUBSTR(qdsj,1,10) rq FROM ab_order WHERE qdrid='"
            + abuser.getStr("id")
            + "' ";

    List<Record> listtj = null;
    if ("day".equals(queryType)) {
      // 日报表
      sql += " and qdsj>='" + DateUtil.getCurrentDate("yyyy-MM-dd") + " 00:00:00'";
      sql += " and qdsj<='" + DateUtil.getCurrentDate("yyyy-MM-dd") + " 59:59:59'";
    } else if ("week".equals(queryType)) {
      // 周报表
      sql +=
          " and qdsj>='" + DateUtil.format(DateUtil.getMondayOfWeek(), "yyyy-MM-dd") + " 00:00:00'";
      sql +=
          " and qdsj<='" + DateUtil.format(DateUtil.getSundayOfWeek(), "yyyy-MM-dd") + " 59:59:59'";
    } else if ("month".equals(queryType)) {
      // 月报表
      sql += " and qdsj>='" + DateUtil.getCurrentDate("yyyy-MM") + "-01 00:00:00'";
      sql +=
          " and qdsj<='"
              + DateUtil.format(DateUtil.getLastDayOfMonth(), "yyyy-MM-dd")
              + " 59:59:59'";
    } else if ("dayQuery".equals(queryType)) {
      if (kssj.length() > 0) {
        sql += " and qdsj>='" + kssj + " 00:00:00'";
      }
      if (jzsj.length() > 0) {
        sql += " and qdsj<='" + jzsj + " 59:59:59'";
      }
    } else if ("monthWeekQuery".equals(queryType)) {
      String query_year_begin = getPara("query_year_begin");
      String query_month_begin = getPara("query_month_begin");
      String query_year_end = getPara("query_year_end");
      String query_month_end = getPara("query_month_end");
      sql += " and qdsj>='" + query_year_begin + "-" + query_month_begin + "-01 00:00:00'";
      sql += " and qdsj<='" + query_year_end + "-" + query_month_end + "-31 59:59:59'";
    }
    if (!ddzt.equals("-1") && !ddzt.equals("")) {
      sql += " and ddzt='" + ddzt + "' ";
    }
    sql += "  GROUP BY SUBSTR(qdsj,1,10)";
    listtj = Db.find(sql);

    Record r = null;
    sql =
        "SELECT COUNT(id) totleorder,IFNULL(SUM(ddzje),0) totalmoney FROM ab_order WHERE qdrid='"
            + abuser.getStr("id")
            + "'";
    if ("day".equals(queryType)) {
      // 日报表
      sql += " and qdsj>='" + DateUtil.getCurrentDate("yyyy-MM-dd") + " 00:00:00'";
      sql += " and qdsj<='" + DateUtil.getCurrentDate("yyyy-MM-dd") + " 59:59:59'";
    } else if ("week".equals(queryType)) {
      // 周报表
      sql +=
          " and qdsj>='" + DateUtil.format(DateUtil.getMondayOfWeek(), "yyyy-MM-dd") + " 00:00:00'";
      sql +=
          " and qdsj<='" + DateUtil.format(DateUtil.getSundayOfWeek(), "yyyy-MM-dd") + " 59:59:59'";
    } else if ("month".equals(queryType)) {
      // 月报表
      sql += " and qdsj>='" + DateUtil.getCurrentDate("yyyy-MM") + "-01 00:00:00'";
      sql +=
          " and qdsj<='"
              + DateUtil.format(DateUtil.getLastDayOfMonth(), "yyyy-MM-dd")
              + " 59:59:59'";
    } else if ("dayQuery".equals(queryType)) {
      if (kssj.length() > 0) {
        sql += " and qdsj>='" + kssj + " 00:00:00'";
      }
      if (jzsj.length() > 0) {
        sql += " and qdsj<='" + jzsj + " 59:59:59'";
      }
    } else if ("monthWeekQuery".equals(queryType)) {
      String query_year_begin = getPara("query_year_begin");
      String query_month_begin = getPara("query_month_begin");
      String query_year_end = getPara("query_year_end");
      String query_month_end = getPara("query_month_end");
      sql += " and qdsj>='" + query_year_begin + "-" + query_month_begin + "-01 00:00:00'";
      sql += " and qdsj<='" + query_year_end + "-" + query_month_end + "-31 59:59:59'";
    }
    if (!ddzt.equals("-1")) {
      sql += " and ddzt='" + ddzt + "' ";
    }
    r = Db.findFirst(sql);
    this.keepPara();
    this.setAttr("r", r);
    this.setAttr("listtj", listtj);
    this.setAttr("listpage", listpage);
    this.render("/ab/ywy/list_order_cxtj.html");
  }
コード例 #12
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);
 }
コード例 #13
0
ファイル: RoleSvc.java プロジェクト: RainerChao/TrainReserve
 /**
  * 获取角色授权的菜单
  *
  * <p>2015年4月28日 下午5:01:54 flyfox [email protected]
  *
  * @param roleid
  * @return
  */
 public String getMemus(int roleid) {
   String sql = " select group_concat(menuid) as menus from sys_role_menu where roleid = ?";
   Record record = Db.findFirst(sql, roleid);
   String menus = record.getStr("menus");
   return menus;
 }