本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《
阿里云开发者社区用户服务协议
》和
《
阿里云开发者社区知识产权保护指引
》。如果您发现本社区中有涉嫌抄袭的内容,填写
侵权投诉表单
进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
public List getAllList(int start, int end, SearchParam param) {
StringBuffer sb=new StringBuffer();
if(Global.getWebid().equals("jsy")){
sb=new StringBuffer("select p1.*,recharge_kefu.username as recharge_kefu_username,verify_kefu.username as verify_username,p1.money,p1.money-p1.fee as total,p2.username,p2.realname,p3.name as paymentname ");
}else{
sb=new StringBuffer("select p1.*,p1.money,verify_kefu.username as verify_username,p1.money-p1.fee as total,p2.username,p2.realname,p3.name as paymentname ");
String orderSql=" order by p1.addtime desc ";
String limitSql="limit ?,?";
String searchSql=param.getSearchParamSql();
if(Global.getWebid().equals("jsy")){
sb.append(newqueryRechargeSql).append(searchSql).append(orderSql).append(limitSql);
}else{
sb.append(queryRechargeSql).append(searchSql).append(orderSql).append(limitSql);
String sql=sb.toString();
logger.debug("RechargeDao.getList():"+sql);
List list=new ArrayList();
list=this.getJdbcTemplate().query(sql, new Object[]{start,end},new AccountRechargeMapper());
return list;
public class AccountRechargeMapper extends AbstractAccountRechargeMapper implements RowMapper<AccountRecharge> {
@Override
public AccountRecharge mapRow(ResultSet rs, int num) throws SQLException {
AccountRecharge c=new AccountRecharge();
this.setProperty(rs, c);
c.setUsername(rs.getString("username"));
c.setRealname(rs.getString("realname"));
c.setPaymentname(rs.getString("paymentname"));
c.setTotal(rs.getDouble("total"));
c.setVerify_username(rs.getString("verify_username"));
if(Global.getWebid().equals("jsy")){
c.setRecharge_kefu_username(rs.getString("recharge_kefu_username"));
return c;
public List getList(long user_id, int start,int end,SearchParam param) {
StringBuffer sb=new StringBuffer();
if(Global.getWebid().equals("jsy")){
sb=new StringBuffer("select p1.*,recharge_kefu.username as recharge_kefu_username,verify_kefu.username as verify_username,p1.money,p1.money-p1.fee as total,p2.username,p2.realname,p3.name as paymentname ");
String orderSql=" order by p1.addtime desc ";
String limitSql="limit ?,?";
String searchSql=param.getSearchParamSql();
sb.append(newqueryRechargeSql).append(" and p1.user_id=? ").append(searchSql).append(orderSql).append(limitSql);
}else{
sb=new StringBuffer("select p1.*,verify_kefu.username as verify_username,p1.money,p1.money-p1.fee as total,p2.username,p2.realname,p3.name as paymentname ");
String orderSql=" order by p1.addtime desc ";
String limitSql="limit ?,?";
String searchSql=param.getSearchParamSql();
sb.append(queryRechargeSql).append(" and p1.user_id=? ").append(searchSql).append(orderSql).append(limitSql);
String sql=sb.toString();
logger.debug("getList():"+sql);
//System.out.println("================"+sql);
List list=new ArrayList();
list=this.getJdbcTemplate().query(sql, new Object[]{user_id,start,end},new AccountRechargeMapper());
return list;
查询条件包装类:
package com.wytech.model;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import com.wytech.common.enums.EnumRuleNid;
import com.wytech.common.enums.EnumRuleStatus;
import com.wytech.context.Global;
import com.wytech.util.DateUtils;
import com.wytech.util.NumberUtils;
import com.wytech.util.StringUtils;
public class SearchParam {
public String getRecommend() {
return recommend;
public void setRecommend(String recommend) {
this.recommend = recommend;
private String search="";
private String use;
private String limittime;
private String keywords;
private String dotime1;
private String dotime2;
private String succtime1;
private String succtime2;
// 2013/08/27 zhengzhiai add end 满标复审时间
private String fullVerifytime1;
private String fullVerifytime2;
private String account_type;
private String username;
private String status;
private String realname;
private String email;
private String kefu_username;
private String invite_username;
protected String qq;
private String vip_status;
private String real_status;//实名认证状态
private String email_status;//邮箱认证状态
private String phone_status;//认证状态
private String phone;
private String typename;
private String repayStatus;//repayment的状态
//用户操作日志
private String invite_userid;
private String card_id;
private String query;
private String url;
private String result;
private String paymentname;
private String audit_user;
private String account;
private String limit;
private String apr;
private String trade_no;
private String payment;
private String userPhone;
private String borrow_style;
private String verify_user;
//及时雨还款时间段设置
private String repayment_time1;
private String repayment_time2;
// v1.6.6.2 RDPROJECT-379 zza 2013-10-24 start
// 已还款时间(repayment表)
private String repayment_yestime1;
private String repayment_yestime2;
// v1.6.6.2 RDPROJECT-379 zza 2013-10-24 end
//已还款时间
private String repay_yestime1;
private String repay_yestime2;
private String user_type;
//及时雨委托协议类型
private String protocol_type;
//抽奖时间
private String gmt_create1;
//推荐标
private String recommend;
//vip赠送审核
private String vip_give_status;
//抽奖用户名
private String user_name;
private String order_number;
private String huikuan_use;
private String borrow_uid;//投标人的ID
private String nbborrow;//过滤内部表
public String getNbborrow() {
return nbborrow;
public void setNbborrow(String nbborrow) {
this.nbborrow = nbborrow;
public String getBorrow_uid() {
return borrow_uid;
public void setBorrow_uid(String borrow_uid) {
this.borrow_uid = borrow_uid;
//v1.6.7.1 RDPROJECT-354 wcw 2013-11-05 start
private String verify_start_time;
private String verify_end_time;
private int verify_type;
//v1.6.7.1 RDPROJECT-354 wcw 2013-11-05 end
//v1.6.7.1 RDPROJECT-354 wcw 2013-11-05 start
public String getVerify_start_time() {
return verify_start_time;
public void setVerify_start_time(String verify_start_time) {
this.verify_start_time = verify_start_time;
public String getVerify_end_time() {
return verify_end_time;
public void setVerify_end_time(String verify_end_time) {
this.verify_end_time = verify_end_time;
public int getVerify_type() {
return verify_type;
public void setVerify_type(int verify_type) {
this.verify_type = verify_type;
//v1.6.7.1 RDPROJECT-354 wcw 2013-11-05 start
* 奖励类型
private String awardType;
* 奖励状态
private String receive_status;
public String getHuikuan_use() {
return huikuan_use;
public void setHuikuan_use(String huikuan_use) {
this.huikuan_use = huikuan_use;
* @return the user_name
public String getUser_name() {
return user_name;
* @param user_name the user_name to set
public void setUser_name(String user_name) {
this.user_name = user_name;
* @return the vip_give_status
public String getVip_give_status() {
return vip_give_status;
* @param vip_give_status the vip_give_status to set
public void setVip_give_status(String vip_give_status) {
this.vip_give_status = vip_give_status;
// 2013/08/13 linhuimin add start
// dw_borrow_collection表的应还时间
/** 应还开始时间 */
private String repay_time1;
/** 应还结束时间 */
private String repay_time2;
* 获取repay_time1
* @return repay_time1
public String getRepay_time1() {
return repay_time1;
* 设置repay_time1
* @param repay_time1 要设置的repay_time1
public void setRepay_time1(String repay_time1) {
this.repay_time1 = repay_time1;
* 获取repay_time2
* @return repay_time2
public String getRepay_time2() {
return repay_time2;
* 设置repay_time2
* @param repay_time2 要设置的repay_time2
public void setRepay_time2(String repay_time2) {
this.repay_time2 = repay_time2;
// 2013/08/13 linhuimin add end
//文章标题
private String articlename;
private String site_id;
// v1.6.6.2 RDPROJECT-116 zza 2013-10-29 start
* 发布时间
private String publish1;
* 发布时间
private String publish2;
// v1.6.6.2 RDPROJECT-116 zza 2013-10-29 end
public String getRepayStatus() {
return repayStatus;
public void setRepayStatus(String repayStatus) {
this.repayStatus = repayStatus;
public String getSite_id() {
return site_id;
public void setSite_id(String site_id) {
this.site_id = site_id;
public String getArticlename() {
return articlename;
public void setArticlename(String articlename) {
this.articlename = articlename;
* 获取publish1
* @return publish1
public String getPublish1() {
return publish1;
* 设置publish1
* @param publish1 要设置的publish1
public void setPublish1(String publish1) {
this.publish1 = publish1;
* 获取publish2
* @return publish2
public String getPublish2() {
return publish2;
* 设置publish2
* @param publish2 要设置的publish2
public void setPublish2(String publish2) {
this.publish2 = publish2;
public String getGmt_create1() {
return gmt_create1;
public String getTypename() {
return typename;
public void setTypename(String typename) {
this.typename = typename;
public String getPhone() {
return phone;
public void setPhone(String phone) {
this.phone = phone;
public void setGmt_create1(String gmt_create1) {
this.gmt_create1 = gmt_create1;
public String getGmt_create2() {
return gmt_create2;
public void setGmt_create2(String gmt_create2) {
this.gmt_create2 = gmt_create2;
private String gmt_create2;
public String getProtocol_type() {
return protocol_type;
public void setProtocol_type(String protocol_type) {
this.protocol_type = protocol_type;
//用户类型
private String user_typeid;
//是否具有奖励
private String is_award;
//金额范围
private String account_min;
private String account_max;
private String cashTotal_min;
private String cashTotal_max;
//自动投标参数设置
private int timelimit_month_first;
private int timelimit_month_last;
private int timelimit_day_first;
private int timelimit_day_last;
private int apr_first;
private int apr_last;
private double award_first;
public int getTimelimit_month_first() {
return timelimit_month_first;
public void setTimelimit_month_first(int timelimit_month_first) {
this.timelimit_month_first = timelimit_month_first;
public int getTimelimit_month_last() {
return timelimit_month_last;
public void setTimelimit_month_last(int timelimit_month_last) {
this.timelimit_month_last = timelimit_month_last;
public int getTimelimit_day_first() {
return timelimit_day_first;
public void setTimelimit_day_first(int timelimit_day_first) {
this.timelimit_day_first = timelimit_day_first;
public int getTimelimit_day_last() {
return timelimit_day_last;
public void setTimelimit_day_last(int timelimit_day_last) {
this.timelimit_day_last = timelimit_day_last;
public int getApr_first() {
return apr_first;
public void setApr_first(int apr_first) {
this.apr_first = apr_first;
public int getApr_last() {
return apr_last;
public void setApr_last(int apr_last) {
this.apr_last = apr_last;
public double getAward_first() {
return award_first;
public void setAward_first(double award_first) {
this.award_first = award_first;
public String getCashTotal_min() {
return cashTotal_min;
public void setCashTotal_min(String cashTotal_min) {
this.cashTotal_min = cashTotal_min;
public String getCashTotal_max() {
return cashTotal_max;
public void setCashTotal_max(String cashTotal_max) {
this.cashTotal_max = cashTotal_max;
public String getUser_typeid() {
return user_typeid;
public void setUser_typeid(String user_typeid) {
this.user_typeid = user_typeid;
//审核用户名查询
private String verify_username;
public String getVerify_username() {
return verify_username;
public void setVerify_username(String verify_username) {
this.verify_username = verify_username;
public String getUser_type() {
return user_type;
public void setUser_type(String user_type) {
this.user_type = user_type;
public String getRepayment_time1() {
return repayment_time1;
public void setRepayment_time1(String repayment_time1) {
this.repayment_time1 = repayment_time1;
public String getRepayment_time2() {
return repayment_time2;
public void setRepayment_time2(String repayment_time2) {
this.repayment_time2 = repayment_time2;
* 获取repayment_yestime1
* @return repayment_yestime1
public String getRepayment_yestime1() {
return repayment_yestime1;
* 设置repayment_yestime1
* @param repayment_yestime1 要设置的repayment_yestime1
public void setRepayment_yestime1(String repayment_yestime1) {
this.repayment_yestime1 = repayment_yestime1;
* 获取repayment_yestime2
* @return repayment_yestime2
public String getRepayment_yestime2() {
return repayment_yestime2;
* 设置repayment_yestime2
* @param repayment_yestime2 要设置的repayment_yestime2
public void setRepayment_yestime2(String repayment_yestime2) {
this.repayment_yestime2 = repayment_yestime2;
public String getVerify_user() {
return verify_user;
public void setVerify_user(String verify_user) {
this.verify_user = verify_user;
private String recharge_kefu_username;
public String getRecharge_kefu_username() {
return recharge_kefu_username;
public void setRecharge_kefu_username(String recharge_kefu_username) {
this.recharge_kefu_username = recharge_kefu_username;
public String getBorrow_style() {
return borrow_style;
public void setBorrow_style(String borrow_style) {
this.borrow_style = borrow_style;
public String getAccount() {
return account;
public void setAccount(String account) {
this.account = account;
public String getLimit() {
return limit;
public void setLimit(String limit) {
this.limit = limit;
public String getApr() {
return apr;
public void setApr(String apr) {
this.apr = apr;
public String getAudit_user() {
return audit_user;
public void setAudit_user(String audit_user) {
this.audit_user = audit_user;
public String getPaymentname() {
return paymentname;
public void setPaymentname(String paymentname) {
this.paymentname = paymentname;
public String getAccount_min() {
return account_min;
public void setAccount_min(String account_min) {
this.account_min = account_min;
public String getAccount_max() {
return account_max;
public void setAccount_max(String account_max) {
this.account_max = account_max;
private int[] statusArray;
private int order;
// v1.6.7.1 RDPROJECT-141 xx 2013-11-13 start
private String indexOrderStr;//首页排序
// v1.6.7.1 RDPROJECT-141 xx 2013-11-13 end
private String type;
//V1.6.6.2 RDPROJECT-286 wcw 2013-10-15 start
//银行id
private String bank_id;
//精确搜索用户名
private String search_type;
public String getSearch_type() {
return search_type;
public void setSearch_type(String search_type) {
this.search_type = search_type;
public String getBank_id() {
return bank_id;
public void setBank_id(String bank_id) {
this.bank_id = bank_id;
//V1.6.6.2 RDPROJECT-286 wcw 2013-10-15 end
public String getSearch() {
return search;
public void setSearch(String search) {
this.search = search;
public String getQuery() {
return query;
public void setQuery(String query) {
this.query = query;
public String getUrl() {
return url;
public void setUrl(String url) {
this.url = url;
public String getResult() {
return result;
public void setResult(String result) {
this.result = result;
public String getCard_id() {
return card_id;
public void setCard_id(String card_id) {
this.card_id = card_id;
public String getInvite_userid() {
return invite_userid;
public void setInvite_userid(String invite_userid) {
this.invite_userid = invite_userid;
public String getInvite_username() {
return invite_username;
public String getQq() {
return qq;
public void setQq(String qq) {
this.qq = qq;
public String getVip_status() {
return vip_status;
public void setVip_status(String vip_status) {
this.vip_status = vip_status;
public String getType() {
return type;
public void setType(String type) {
this.type = type;
public String getTrade_no() {
return trade_no;
public void setTrade_no(String trade_no) {
this.trade_no = trade_no;
public String getIs_award() {
return is_award;
public void setIs_award(String is_award) {
this.is_award = is_award;
Map map = new HashMap();
public SearchParam() {
super();
public SearchParam(String use, String limittime, String keywords) {
super();
this.use = use;
this.limittime = limittime;
this.keywords = keywords;
public SearchParam(String use, String limittime, String keywords,
long user_id) {
super();
this.use = use;
this.limittime = limittime;
this.keywords = keywords;
public String getKefu_username() {
return kefu_username;
public void setKefu_username(String kefu_username) {
this.kefu_username = kefu_username;
public String getUse() {
return use;
public String getEmail() {
return email;
public void setEmail(String email) {
this.email = email;
public void setUse(String use) {
this.use = use;
public String getRealname() {
return realname;
public void setRealname(String realname) {
this.realname = realname;
public String getLimittime() {
return limittime;
public void setLimittime(String limittime) {
this.limittime = limittime;
public String getDotime1() {
return dotime1;
public void setDotime1(String dotime1) {
this.dotime1 = dotime1;
public String getDotime2() {
return dotime2;
public void setDotime2(String dotime2) {
this.dotime2 = dotime2;
public String getAccount_type() {
return account_type;
public String getUsername() {
return username;
public void setUsername(String username) {
this.username = username;
public String getStatus() {
return status;
public void setStatus(String status) {
this.status = status;
public void setAccount_type(String account_type) {
this.account_type = account_type;
public String getKeywords() {
return keywords;
public void setKeywords(String keywords) {
this.keywords = keywords;
public void setInvite_username(String invite_username) {
this.invite_username = invite_username;
public int getOrder() {
return order;
public void setOrder(int order) {
this.order = order;
public String getIndexOrderStr() {
return indexOrderStr;
public void setIndexOrderStr(String indexOrderStr) {
this.indexOrderStr = indexOrderStr;
public int[] getStatusArray() {
return statusArray;
public void setStatusArray(int[] statusArray) {
this.statusArray = statusArray;
public String getSucctime1() {
return succtime1;
public void setSucctime1(String succtime1) {
this.succtime1 = succtime1;
public String getSucctime2() {
return succtime2;
public void setSucctime2(String succtime2) {
this.succtime2 = succtime2;
* 获取awardType
* @return awardType
public String getAwardType() {
return awardType;
* 设置awardType
* @param awardType 要设置的awardType
public void setAwardType(String awardType) {
this.awardType = awardType;
* 获取receive_status
* @return receive_status
public String getReceive_status() {
return receive_status;
* 设置receive_status
* @param receive_status 要设置的receive_status
public void setReceive_status(String receive_status) {
this.receive_status = receive_status;
* 获取fullVerifytime1
* @return fullVerifytime1
public String getFullVerifytime1() {
return fullVerifytime1;
* 设置fullVerifytime1
* @param fullVerifytime1 要设置的fullVerifytime1
public void setFullVerifytime1(String fullVerifytime1) {
this.fullVerifytime1 = fullVerifytime1;
* 获取fullVerifytime2
* @return fullVerifytime2
public String getFullVerifytime2() {
return fullVerifytime2;
* 设置fullVerifytime2
* @param fullVerifytime2 要设置的fullVerifytime2
public void setFullVerifytime2(String fullVerifytime2) {
this.fullVerifytime2 = fullVerifytime2;
public String getPayment() {
return payment;
public void setPayment(String payment) {
this.payment = payment;
* 将所有的参数信息封装成Map
* @return
public Map toMap(){
map.put("search", "");
map.put("use", use);
map.put("time_limit", limittime);
map.put("keywords", keywords);
map.put("dotime1", dotime1);
map.put("dotime2", dotime2);
map.put("succtime1", succtime1);
map.put("succtime2", succtime2);
map.put("fullVerifytime1", fullVerifytime1);
map.put("fullVerifytime2", fullVerifytime2);
map.put("type", type);
map.put("trade_no", trade_no);
map.put("payment", payment);
map.put("order", order+"");
map.put("is_award", is_award);
map.put("cashTotal_min", cashTotal_min);
map.put("cashTotal_max", cashTotal_max);
if(!StringUtils.isBlank(recommend)){
map.put("recommend", recommend);
if(!StringUtils.isBlank(gmt_create1)){
map.put("gmt_create1", gmt_create1);
if(!StringUtils.isBlank(gmt_create2)){
map.put("gmt_create2", gmt_create2);
if(timelimit_month_first!=0){
map.put("timelimit_month_first", timelimit_month_first);
if(timelimit_month_last!=0){
map.put("timelimit_month_last", timelimit_month_last);
if(timelimit_day_first!=0){
map.put("timelimit_day_first", timelimit_day_first);
if(timelimit_day_last!=0){
map.put("timelimit_day_last", timelimit_day_last);
if(apr_first!=0){
map.put("apr_first", apr_first);
if(apr_last!=0){
map.put("apr_last", apr_last);
if(award_first!=0){
map.put("award_first", award_first);
if(account_type!=null&&!account_type.equals("0")){
map.put("account_type", account_type);
if(protocol_type!=null){
map.put("protocol_type", protocol_type);
if(!StringUtils.isBlank(borrow_style)){
map.put("borrow_style", borrow_style);
if(audit_user!=null&&!audit_user.equals("0")){
map.put("audit_user", audit_user);
if(paymentname!=null&&!paymentname.equals("0")){
map.put("paymentname", paymentname);
if(!StringUtils.isBlank(username)){
map.put("username", username);
if(!StringUtils.isBlank(user_name)){
map.put("user_name", user_name);
if(!StringUtils.isBlank(account)){
map.put("account", account);
if(!StringUtils.isBlank(apr)){
map.put("apr", apr);
if(!StringUtils.isBlank(limit)){
map.put("limit", limit);
if(!StringUtils.isBlank(repayment_time1)){
map.put("repayment_time1", repayment_time1);
if(!StringUtils.isBlank(repayment_time2)){
map.put("repayment_time2", repayment_time2);
// v1.6.6.2 RDPROJECT-379 zza 2013-10-24 start
if(!StringUtils.isBlank(repayment_yestime1)){
map.put("repayment_yestime1", repayment_yestime1);
if(!StringUtils.isBlank(repayment_yestime2)){
map.put("repayment_yestime2", repayment_yestime2);
// v1.6.6.2 RDPROJECT-379 zza 2013-10-24 end
if(!StringUtils.isBlank(repay_yestime1)){
map.put("repay_yestime1", repay_yestime1);
if(!StringUtils.isBlank(repay_yestime2)){
map.put("repay_yestime2", repay_yestime2);
if(!StringUtils.isBlank(status)){
int statusInt=NumberUtils.getInt(status);
if(statusInt>=0){
map.put("status", status);
if(!StringUtils.isBlank(vip_status)){
int statusInt=NumberUtils.getInt(vip_status);
if(statusInt>=0){
map.put("vip_status", vip_status);
if(!StringUtils.isBlank(recharge_kefu_username)){
map.put("recharge_kefu_username", recharge_kefu_username);
if(!StringUtils.isBlank(user_type)){
map.put("user_type", user_type);
if(!StringUtils.isBlank(verify_username)){
map.put("verify_username", verify_username);
map.put("realname", realname);
map.put("email", email);
map.put("kefu_name", kefu_username);
if(!StringUtils.isBlank(invite_username)){
map.put("invite_username", invite_username);
// 2013/08/13 linhuimin add start 待还款流转标增加应还时间查询
if(!StringUtils.isBlank(repay_time1)){
map.put("repay_time1", repay_time1);
if(!StringUtils.isBlank(repay_time2)){
map.put("repay_time2", repay_time2);
// 2013/08/13 linhuimin add end
if(!StringUtils.isBlank(articlename)){
map.put("articlename", articlename);
if(!StringUtils.isBlank(site_id)){
map.put("site_id", site_id);
// v1.6.6.2 RDPROJECT-116 zza 2013-10-29 start
if(!StringUtils.isBlank(publish1)){
map.put("publish1", publish1);
if(!StringUtils.isBlank(publish2)){
map.put("publish2", publish2);
// v1.6.6.2 RDPROJECT-116 zza 2013-10-29 end
//vip赠送时间状态
if(!StringUtils.isBlank(vip_give_status)){
map.put("vip_give_status", vip_give_status);
if(!StringUtils.isBlank(huikuan_use)){
map.put("huikuan", huikuan_use);
if(!StringUtils.isBlank(awardType)){
map.put("awardType", awardType);
if(!StringUtils.isBlank(receive_status)){
map.put("receive_status", receive_status);
// v1.6.6.1 RDPROJECT-190 xx 2013-09-27 start
if(!StringUtils.isBlank(repayStatus)){
map.put("repayStatus", repayStatus);
// v1.6.6.1 RDPROJECT-190 xx 2013-09-27 end
//V1.6.6.2 RDPROJECT-286 wcw 2013-10-15 start
if(!StringUtils.isBlank(bank_id)){
map.put("bank_id", bank_id);
if(!StringUtils.isBlank(search_type)){
map.put("search_type", search_type);
//V1.6.6.2 RDPROJECT-286 wcw 2013-10-15 end
//v1.6.7.1 RDPROJECT-354 wcw 2013-11-05 start
if(verify_type!=0){
map.put("verify_type", verify_type+"");
if(!StringUtils.isBlank(verify_start_time)){
map.put("verify_start_time", verify_start_time);
if(!StringUtils.isBlank(verify_end_time)){
map.put("verify_end_time", verify_end_time);
//v1.6.7.1 RDPROJECT-354 wcw 2013-11-05 end
return map;
public void addMap(String key,String value){
map.put(key, value);
public String getSearchParamSql() {
RuleModel rule=new RuleModel(Global.getRule(EnumRuleNid.TIME_HOUR_ENABLE.getValue()));
int hour_enable = 0;
if(rule != null && rule.getStatus() == EnumRuleStatus.RULE_STATUS_YES.getValue()){
hour_enable=rule.getValueIntByKey("enable");
StringBuffer sb = new StringBuffer();
if(!StringUtils.isBlank(this.recommend)) {
sb.append(" and p1.is_recommend=" + recommend.trim());
//根据用户查找
if(!StringUtils.isBlank(this.borrow_uid)) {
sb.append(" and p1.borrow_uid=" + borrow_uid);
//过滤内部标
if(!StringUtils.isBlank(this.nbborrow)) {
sb.append(" and p1.borrow_type<>" + nbborrow);
if (NumberUtils.getInt(getUse())>0) {
sb.append(" and p1.use=" + use);
if ( NumberUtils.getInt(limittime)>0) {
sb.append(" and p1.time_limit=" + limittime);
if(!StringUtils.isBlank(this.audit_user)) {
sb.append(" and m.sent_user ="+audit_user.trim());
if(!StringUtils.isBlank(this.keywords)) {
sb.append(" and p1.name like '%"
+ StringUtils.isNull(keywords) + "%'");
if(!StringUtils.isBlank(borrow_style)){
if(!borrow_style.equals("0")){
sb.append(" and p1.style="+borrow_style);
if(!StringUtils.isBlank(huikuan_use)){
if("1".endsWith(huikuan_use)){
sb.append(" and p1.cash_id = 0");
if("2".endsWith(huikuan_use)){
sb.append(" and p1.cash_id != 0");
if(!StringUtils.isBlank(recharge_kefu_username)){
sb.append(" and recharge_kefu.username="+"'"+recharge_kefu_username.trim()+"'");
String dotimeStr1=null,dotimeStr2=null;
try {
dotimeStr1=Long.toString(DateUtils.valueOf(dotime1).getTime()/1000);
} catch (Exception e) {
dotimeStr1="";
try {
Date d=DateUtils.valueOf(dotime2);
if(hour_enable!=1){
d=DateUtils.rollDay(d, 1);
dotimeStr2=Long.toString(d.getTime()/1000);
} catch (Exception e) {
dotimeStr2="";
if(!StringUtils.isBlank(dotimeStr1)) {
sb.append(" and p1.addtime>"+dotimeStr1+" ");
if(!StringUtils.isBlank(dotimeStr2)){
sb.append(" and p1.addtime<"+dotimeStr2+" ");
String succtimeStr1=null,succtimeStr2=null;
try {
succtimeStr1=Long.toString(DateUtils.valueOf(succtime1).getTime()/1000);
} catch (Exception e) {
succtimeStr1="";
try {
Date d=DateUtils.valueOf(succtime2);
if(hour_enable!=1){
d=DateUtils.rollDay(d, 1);
succtimeStr2=Long.toString(d.getTime()/1000);
} catch (Exception e) {
succtimeStr2="";
if(!StringUtils.isBlank(succtimeStr1)) {
sb.append(" and p1.verify_time>"+succtimeStr1);
if(!StringUtils.isBlank(succtimeStr2)){
sb.append(" and p1.verify_time<"+succtimeStr2);
// 2013/08/27 zhengzhiai add end 满标复审时间查询
String fullVerifytimeStr1 = null, fullVerifytimeStr2 = null;
try {
fullVerifytimeStr1 = Long.toString(DateUtils.valueOf(fullVerifytime1).getTime()/1000);
} catch (Exception e) {
fullVerifytimeStr1 = "";
try {
Date d = DateUtils.valueOf(fullVerifytime2);
if(hour_enable!=1){
d=DateUtils.rollDay(d, 1);
fullVerifytimeStr2 = Long.toString(d.getTime()/1000);
} catch (Exception e) {
fullVerifytimeStr2 = "";
if(!StringUtils.isBlank(fullVerifytimeStr1)) {
sb.append(" and p1.full_verifytime>" + fullVerifytimeStr1);
if(!StringUtils.isBlank(fullVerifytimeStr2)){
sb.append(" and p1.full_verifytime<" + fullVerifytimeStr2);
String gmt_createStr1=null,gmt_createStr2=null;
try {
gmt_createStr1=Long.toString(DateUtils.valueOf(gmt_create1).getTime()/1000);
} catch (Exception e) {
succtimeStr1="";
try {
Date d=DateUtils.valueOf(gmt_create2);
if(hour_enable!=1){
d=DateUtils.rollDay(d, 1);
gmt_createStr2=Long.toString(d.getTime()/1000);
} catch (Exception e) {
gmt_createStr2="";
if(!StringUtils.isBlank(gmt_createStr1)) {
sb.append(" and p1.gmt_create>"+gmt_createStr1);
if(!StringUtils.isBlank(gmt_createStr2)){
sb.append(" and p1.gmt_create<"+gmt_createStr2);
String repayment_timeStr1=null,repayment_timeStr2=null;
try {
repayment_timeStr1=Long.toString(DateUtils.valueOf(repayment_time1).getTime()/1000);
} catch (Exception e) {
repayment_timeStr1="";
try {
Date d=DateUtils.valueOf(repayment_time2);
if(hour_enable!=1){
d=DateUtils.rollDay(d, 1);
repayment_timeStr2=Long.toString(d.getTime()/1000);
} catch (Exception e) {
repayment_timeStr2="";
if(!StringUtils.isBlank(repayment_timeStr1)) {
sb.append(" and p3.repayment_time>"+repayment_timeStr1);
if(!StringUtils.isBlank(repayment_timeStr2)){
sb.append(" and p3.repayment_time<"+repayment_timeStr2);
// v1.6.6.2 RDPROJECT-379 zza 2013-10-24 start
String repayment_yestimeStr1 = null, repayment_yestimeStr2 = null;
try {
repayment_yestimeStr1 = Long.toString(DateUtils.valueOf(repayment_yestime1).getTime() / 1000);
} catch (Exception e) {
repayment_yestimeStr1 = "";
try {
Date d = DateUtils.valueOf(repayment_yestime2);
if (hour_enable != 1) {
d = DateUtils.rollDay(d, 1);
repayment_yestimeStr2 = Long.toString(d.getTime() / 1000);
} catch (Exception e) {
repayment_yestimeStr2 = "";
if (!StringUtils.isBlank(repayment_yestimeStr1)) {
sb.append(" and p3.repayment_yestime>" + repayment_yestimeStr1);
if (!StringUtils.isBlank(repayment_yestimeStr2)) {
sb.append(" and p3.repayment_yestime<" + repayment_yestimeStr2);
// v1.6.6.2 RDPROJECT-379 zza 2013-10-24 end
if(!StringUtils.isBlank(account_type)&&!account_type.equals("0")){
sb.append(" and p1.type=")
.append("'")
.append(account_type)
.append("'");
if(!StringUtils.isBlank(paymentname)&&!paymentname.equals("0")){
sb.append(" and p1.payment=")
.append("'")
.append(paymentname)
.append("'");
//V1.6.6.2 RDPROJECT-286 wcw 2013-10-24 start
if(!StringUtils.isBlank(username)){
if("0".equals(search_type)||StringUtils.isBlank(search_type)){
sb.append(" and p2.username like '%").append(username.trim()).append("%'");
}else{
sb.append(" and p2.username="+"'"+username+"'");
if(!StringUtils.isBlank(order_number)){
sb.append(" and p1.order_number like '%").append(order_number.trim()).append("%'");
//V1.6.6.2 RDPROJECT-286 wcw 2013-10-24 end
if(!StringUtils.isBlank(user_name)){
sb.append(" and p1.user_name like '%").append(user_name.trim()).append("%'");
if(!StringUtils.isBlank(verify_user)){
sb.append(" and p1.verify_user like '%").append(verify_user.trim()).append("%'");
if(!StringUtils.isBlank(articlename)){
sb.append(" and a.name like '%").append(articlename.trim()).append("%'");
// v1.6.6.2 RDPROJECT-116 zza 2013-10-29 start
String publishStr1 = null, publishStr2 = null;
try {
Date publish = DateUtils.valueOf(publish1);
publishStr1 = DateUtils.dateStr4(publish);
} catch (Exception e) {
publishStr1 = "";
try {
Date d = DateUtils.valueOf(publish2);
if (hour_enable != 1) {
d = DateUtils.rollDay(d, 1);
publishStr2 = DateUtils.dateStr4(d);
} catch (Exception e) {
publishStr2 = "";
if (!StringUtils.isBlank(publishStr1)) {
sb.append(" and a.publish > '" + publishStr1).append("'");
if (!StringUtils.isBlank(publishStr2)) {
sb.append(" and a.publish < '" + publishStr2).append("'");
// v1.6.6.2 RDPROJECT-116 zza 2013-10-29 end
if(statusArray!=null&&statusArray.length>1){
sb.append(" and p1.status in (").append(StringUtils.array2Str(statusArray)).append(")");
}else{
if(!StringUtils.isBlank(status)){
int statusInt=NumberUtils.getInt(status);
if(statusInt>=0){
sb.append(" and p1.status=").append(statusInt);
if(!StringUtils.isBlank(vip_status)){
int statusInt=NumberUtils.getInt(vip_status);
if(statusInt>=0){
sb.append(" and p.vip_status=").append(statusInt);
if (!StringUtils.isBlank(awardType)) {
int typeInt = NumberUtils.getInt(awardType);
if (typeInt >= 0) {
sb.append(" and p1.type = ").append(typeInt);
if (!StringUtils.isBlank(receive_status)) {
int statusInt = NumberUtils.getInt(receive_status);
if (statusInt >= 0) {
sb.append(" and p1.receive_status = ").append(statusInt);
if (!StringUtils.isBlank(realname)) {
sb.append(" and p2.realname like '%" + StringUtils.isNull(realname.trim())
+ "%'");
if (!StringUtils.isBlank(email)) {
sb.append(" and p2.email like '%" + StringUtils.isNull(email.trim()) + "%'");
if (!StringUtils.isBlank(kefu_username)) {
sb.append(" and kf.username like '%"
+ StringUtils.isNull(kefu_username.trim()) + "%'");
if(!StringUtils.isBlank(invite_username)){
sb.append(" and invite.username like '%").append(invite_username.trim()).append("%'");
if(!StringUtils.isBlank(type)){
sb.append(getTypeSql(type));
if (!StringUtils.isBlank(account)) {
sb.append(" and p1.account=" + account);
if (!StringUtils.isBlank(apr)) {
sb.append(" and p1.apr=" + apr);
if (!StringUtils.isBlank(site_id)){
sb.append(" and a.site_id=" + site_id);
if (!StringUtils.isBlank(limit)) {
sb.append(" and p1.time_limit=" + limit);
if (!StringUtils.isBlank(trade_no)) {
sb.append(" and p1.trade_no like '%"
+ StringUtils.isNull(trade_no.trim()) + "%'");
if (!StringUtils.isBlank(payment)) {
if(StringUtils.isNull(payment).equals("50")){
sb.append(" and p1.payment = '50'");
}else if(StringUtils.isNull(payment).equals("-50")){
sb.append(" and p1.payment != '50'");
}else{
sb.append(" and p1.payment = '"+payment+"'");
if (!StringUtils.isBlank(user_type)){
sb.append(" and p1.type='"
+ StringUtils.isNull(user_type) + "'");
//用户类型
if (!StringUtils.isBlank(user_typeid)){
sb.append(" and p2.type_id='"
+ StringUtils.isNull(user_typeid) + "'");
//审核用户名
if (!StringUtils.isBlank(verify_username)){
sb.append(" and p2.username like '%").append(verify_username.trim()).append("%'");
//及时雨委托协议类型
if (!StringUtils.isBlank(protocol_type)){
sb.append(" and p1.protocol_type = '"+protocol_type+"'");
* 判断是否有奖励
* 0:无限制
* 1:有
* 2:没有
if(!StringUtils.isBlank(is_award)){
if(!is_award.equals("0")&&(is_award.equals("1"))){
sb.append(" and p1.award>0");
}else if(!is_award.equals("0")&&(is_award.equals("2"))){
sb.append(" and p1.award=0");
* 金额搜索范围
if(!StringUtils.isBlank(account_min)){
sb.append(" and p1.account>="+account_min);
if(!StringUtils.isBlank(account_max)){
sb.append(" and p1.account<="+account_max);
if (!StringUtils.isBlank(cashTotal_min)) {
sb.append(" and p1.total>=" + cashTotal_min);
if (!StringUtils.isBlank(cashTotal_max)) {
sb.append(" and p1.total<=" + cashTotal_max);
// 2013/08/13 linhuimin add start 待还款流转标增加应还时间查询
String repay_timeStr1 = null;
String repay_timeStr2 = null;
try {
repay_timeStr1 = Long.toString(DateUtils.valueOf(repay_time1).getTime() / 1000);
} catch (Exception e) {
repay_timeStr1 = "";
try {
Date d = DateUtils.valueOf(repay_time2);
if(hour_enable!=1){
d=DateUtils.rollDay(d, 1);
repay_timeStr2 = Long.toString(d.getTime() / 1000);
} catch (Exception e) {
repay_timeStr2 = "";
if (!StringUtils.isBlank(repay_timeStr1)) {
sb.append(" and p3.repay_time>" + repay_timeStr1);
if (!StringUtils.isBlank(repay_timeStr2)) {
sb.append(" and p3.repay_time<" + repay_timeStr2);
if (!StringUtils.isBlank(repayStatus)) {
sb.append(" and p3.status=" + repayStatus);
// 2013/08/13 linhuimin add end
//已还时间
String repay_yestimeStr1=null,repay_yestimeStr2=null;
try {
repay_yestimeStr1=Long.toString(DateUtils.valueOf(repay_yestime1).getTime()/1000);
} catch (Exception e) {
repay_yestimeStr1="";
try {
Date d=DateUtils.valueOf(repay_yestime2);
if(hour_enable!=1){
d=DateUtils.rollDay(d, 1);
repay_yestimeStr2=Long.toString(d.getTime()/1000);
} catch (Exception e) {
repay_yestimeStr2="";
if(!StringUtils.isBlank(repay_yestimeStr1)) {
sb.append(" and p3.repay_yestime>"+repay_yestimeStr1);
if(!StringUtils.isBlank(repay_yestimeStr2)){
sb.append(" and p3.repay_yestime<"+repay_yestimeStr2);
//V1.6.6.2 RDPROJECT-286 wcw 2013-10-15 start
if(!StringUtils.isBlank(bank_id)){
sb.append(" and p1.bank="+bank_id);
//V1.6.6.2 RDPROJECT-286 wcw 2013-10-15 end
//v1.6.7.1 RDPROJECT-354 wcw 2013-11-05 start
String verifyStartTimeStr=null,verifyEndTimeStr=null;
try {
verifyStartTimeStr=Long.toString(DateUtils.valueOf(verify_start_time).getTime()/1000);
} catch (Exception e) {
verifyStartTimeStr="";
try {
Date d=DateUtils.valueOf(verify_end_time);
d=DateUtils.rollDay(d, 1);
verifyEndTimeStr=Long.toString(d.getTime()/1000);
} catch (Exception e) {
verifyEndTimeStr="";
if(!StringUtils.isBlank(verifyStartTimeStr)) {
if(verify_type==1){
sb.append(" and p4.phone_verify_time>"+verifyStartTimeStr+" ");
}else if(verify_type==2){
sb.append(" and p4.realname_verify_time>"+verifyStartTimeStr+" ");
}else if(verify_type==3){
sb.append(" and p4.video_verify_time>"+verifyStartTimeStr+" ");
}else if(verify_type==4){
sb.append(" and p4.scene_verify_time>"+verifyStartTimeStr+" ");
}else if(verify_type==5){
sb.append(" and p.vip_verify_time>"+verifyStartTimeStr+" ");
if(!StringUtils.isBlank(verifyEndTimeStr)){
if(verify_type==1){
sb.append(" and p4.phone_verify_time<"+verifyEndTimeStr+" ");
}else if(verify_type==2){
sb.append(" and p4.realname_verify_time<"+verifyEndTimeStr+" ");
}else if(verify_type==3){
sb.append(" and p4.video_verify_time<"+verifyEndTimeStr+" ");
}else if(verify_type==4){
sb.append(" and p4.scene_verify_time<"+verifyEndTimeStr+" ");
}else if(verify_type==5){
sb.append(" and p.vip_verify_time<"+verifyEndTimeStr+" ");
//v1.6.7.1 RDPROJECT-354 wcw 2013-11-05 end
return sb.toString();
private String getTypeSql(String type){
String sql=" ";
if (StringUtils.isBlank(type)) {
type = "0";
int borrowType=0;
try {
borrowType = Integer.parseInt(type);
} catch (Exception e) {
if("openaccount".equals(type)){
sql=" and p1.type = '开户' " ;
if("tender".equals(type)){
sql=" and p1.type = '投标' " ;
if("recharge".equals(type)){
sql=" and p1.type = '充值' " ;
if("cash".equals(type)){
sql=" and p1.type = '提现' " ;
if (borrowType > 100) {
sql=" and p1.type= " + borrowType ;
// if(type.equals("1")){
// sql=" and p1.is_mb=1 ";
// }else if(type.equals("2")){
// sql=" and p1.is_xin=1 ";
// }else if(type.equals("3")){
// sql=" and p1.is_fast=1 ";
// }else if(type.equals("4")){
// sql=" and p1.is_jin=1 ";
// }else if(type.equals("5")){
// sql=" and p1.is_vouch=1 ";
// }else if(type.equals("6")){
// sql=" and p1.is_art=1 ";
// }else if(type.equals("7")){
// sql=" and p1.is_charity=1 ";
// }else if(type.equals("8")){
// sql=" ";
// }else if(type.equals("9")){
// sql=" and p1.is_project=1 ";
// }else if(type.equals("10")){
// sql=" and p1.is_flow=1 ";
// }else if(type.equals("11")){
// sql=" and p1.is_student=1 ";
// }else if(type.equals("12")){
// sql=" and p1.is_offvouch=1 ";
// }else if(type.equals("13")){
// sql=" and p1.is_pledge=1 ";
// }
return sql;
* 用户查询,得到用户操作日志的查询语句的参数
* @param
* @return string
public String getUserLogSearchParamSql() {
RuleModel rule = new RuleModel(Global.getRule(EnumRuleNid.TIME_HOUR_ENABLE.getValue()));
int hour_enable = 0;
if (rule != null && rule.getStatus() == EnumRuleStatus.RULE_STATUS_YES.getValue()) {
hour_enable = rule.getValueIntByKey("enable");
StringBuffer sb = new StringBuffer();
String dotimeStr1=null,dotimeStr2=null;
if (!StringUtils.isBlank(query)) {
sb.append(" and p1.query like '%" + StringUtils.isNull(query) + "%'");
if (!StringUtils.isBlank(url)) {
sb.append(" and p1.url like '%" + StringUtils.isNull(url) + "%'");
if (!StringUtils.isBlank(result)) {
sb.append(" and p1.result like '%" + StringUtils.isNull(result) + "%'");
try {
dotimeStr1=Long.toString(DateUtils.valueOf(dotime1).getTime()/1000);
} catch (Exception e) {
dotimeStr1="";
try {
Date d=DateUtils.valueOf(dotime2);
if(hour_enable!=1){
d=DateUtils.rollDay(d, 1);
dotimeStr2=Long.toString(d.getTime()/1000);
} catch (Exception e) {
dotimeStr2="";
if(!StringUtils.isBlank(dotimeStr1)) {
sb.append(" and p1.addtime>"+dotimeStr1);
if(!StringUtils.isBlank(dotimeStr2)){
sb.append(" and p1.addtime<"+dotimeStr2);
if(!StringUtils.isBlank(username)){
sb.append(" and p2.username like '%").append(username.trim()).append("%'");
if (!StringUtils.isBlank(realname)) {
sb.append(" and p2.realname like '%" + StringUtils.isNull(realname.trim()) + "%'");
if (!StringUtils.isBlank(email)) {
sb.append(" and p2.email like '%" + StringUtils.isNull(email.trim()) + "%'");
if (!StringUtils.isBlank(invite_userid)) {
sb.append(" p2.invite_userid like '%" + StringUtils.isNull(invite_userid) + "%'");
if (!StringUtils.isBlank(card_id)) {
sb.append(" p2.card_id like '%" + StringUtils.isNull(card_id) + "%'");
return sb.toString();
public String getOrderSql(){
String orderSql="";
switch (order) {
case 0:
orderSql = " ";
break;
case 1:
orderSql = " order by p1.account+0 asc";
break;
case -1:
orderSql = " order by p1.account+0 desc";
break;
case 2:
orderSql = " order by p1.apr asc";
break;
case -2:
orderSql = " order by p1.apr desc";
break;
case 3:
orderSql = " order by scales asc";
break;
case -3:
orderSql = " order by scales desc";
break;
case 4:
orderSql = " order by p3.value asc";
break;
case -4:
orderSql = " order by p3.value desc";
break;
case 5:
orderSql=" order by p1.addtime ";
break;
case -5:
orderSql=" order by p1.addtime desc";
break;
case 6:
orderSql=" order by p1.type asc,p1.id desc";
break;
case 11:
orderSql = " order by p1.status,p1.account_yes/p1.account ,p1.addtime desc ";
break;
case 21:
orderSql = " order by t.addtime ";
break;
case -21:
orderSql = " order by p.addtime desc ";
break;
case 7:
orderSql = " order by p1.verify_time ";
break;
case -7:
//p1.apr desc, scales asc, 9月17日去掉
orderSql = " order by p1.verify_time desc ";
break;
case 8:
orderSql = " order by p1.type,p1.addtime desc ";
break;
// v1.6.6.2 RDPROJECT-123 wfl 2013-10-23 start
// case 9://和信贷排序规则
// orderSql = " order by p1.status asc, scales asc, p1.apr desc, p1.verify_time desc ";
// break;
//快速项目 进度升序审核时间降序。
case 9:
orderSql = " order by scales asc, p1.verify_time desc ";
break;
case 10://和信贷排序规则
orderSql = " order by p1.status asc, scales asc, p1.apr desc, p1.verify_time desc ";
break;
// v1.6.6.2 RDPROJECT-123 wfl 2013-10-23 start
default:
orderSql=" ";
return orderSql;
public String getUserPhone() {
return userPhone;
public void setUserPhone(String userPhone) {
this.userPhone = userPhone;
* @return the repay_yestime1
public String getRepay_yestime1() {
return repay_yestime1;
* @param repay_yestime1 the repay_yestime1 to set
public void setRepay_yestime1(String repay_yestime1) {
this.repay_yestime1 = repay_yestime1;
* @return the repay_yestime2
public String getRepay_yestime2() {
return repay_yestime2;
* @param repay_yestime2 the repay_yestime2 to set
public void setRepay_yestime2(String repay_yestime2) {
this.repay_yestime2 = repay_yestime2;
public String getReal_status() {
return real_status;
public void setReal_status(String real_status) {
this.real_status = real_status;
public String getEmail_status() {
return email_status;
public void setEmail_status(String email_status) {
this.email_status = email_status;
public String getPhone_status() {
return phone_status;
public void setPhone_status(String phone_status) {
this.phone_status = phone_status;
public String getOrder_number() {
return order_number;
public void setOrder_number(String order_number) {
this.order_number = order_number;
package com.wytech.util;
import java.security.Key;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.wytech.context.Global;
public class StringUtils {
* 如果str为null,返回“”,否则返回str
* @param str
* @return
public static String isNull(String str) {
if (str == null) {
return "";
// v1.6.7.1 去除参数前后空格 xx 2013-11-04 start
return str.trim();
// v1.6.7.1 去除参数前后空格 xx 2013-11-04 end
public static String isNull(Object o) {
if (o == null) {
return "";
String str="";
if(o instanceof String){
str=(String)o;
}else{
str=o.toString();
return str;
// v1.6.5.3 RDPROJECT-147 xx 2013.09.11 start
* 检验手机号
* @param phone
* @return
public static boolean isPhone(String phone){
phone = isNull(phone);
Pattern regex = Pattern
.compile("^((13[0-9])|(15[^4,\\D])|(18[0-9]))\\d{8}$");
Matcher matcher = regex.matcher(phone);
boolean isMatched = matcher.matches();
return isMatched;
// v1.6.5.3 RDPROJECT-147 xx 2013.09.11 end
// v1.6.6.2 注册时加强真实姓名验证 start
* 检查是否全中文,返回true 表示是 反之为否
* @param realname
* @return
public static boolean isChinese(String realname){
realname = isNull(realname);
// v1.6.7.1 RDPROJECT-423 xx 2013-11-15 start
Pattern regex = Pattern.compile("[\\u4e00-\\u9fa5]{2,25}");
// v1.6.7.1 RDPROJECT-423 xx 2013-11-15 end
Matcher matcher = regex.matcher(realname);
boolean isMatched = matcher.matches();
return isMatched;
// v1.6.6.2 注册时加强真实姓名验证 end
* 检查email是否是邮箱格式,返回true表示是,反之为否
* @param email
* @return
public static boolean isEmail(String email) {
email = isNull(email);
Pattern regex = Pattern
.compile("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
Matcher matcher = regex.matcher(email);
boolean isMatched = matcher.matches();
return isMatched;
* 检查身份证的格式,返回true表示是,反之为否
* @param email
* @return
public static boolean isCard(String cardId) {
cardId = isNull(cardId);
//身份证正则表达式(15位)
Pattern isIDCard1=Pattern.compile("^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$");
//身份证正则表达式(18位)
Pattern isIDCard2=Pattern.compile("^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([0-9]|X)$");
Matcher matcher1= isIDCard1.matcher(cardId);
Matcher matcher2= isIDCard2.matcher(cardId);
boolean isMatched = matcher1.matches()||matcher2.matches();
return isMatched;
* 判断字符串是否为整数
* @param str
* @return
public static boolean isInteger(String str) {
if (isEmpty(str)) {
return false;
Pattern regex = Pattern.compile("\\d*");
Matcher matcher = regex.matcher(str);
boolean isMatched = matcher.matches();
return isMatched;
* 判断字符串是否为数字
* @param str
* @return
public static boolean isNumber(String str) {
if (isEmpty(str)) {
return false;
Pattern regex = Pattern.compile("\\d*(.\\d*)?");
Matcher matcher = regex.matcher(str);
boolean isMatched = matcher.matches();
return isMatched;
* 判断字符串是否为空
* @param str
* @return
public static boolean isEmpty(String str) {
if (str == null || "".equals(str)) {
return true;
return false;
* 首字母大写
* @param s
* @return
public static String firstCharUpperCase(String s) {
StringBuffer sb = new StringBuffer(s.substring(0, 1).toUpperCase());
sb.append(s.substring(1, s.length()));
return sb.toString();
public static String hideChar(String str,int len){
if(str==null) return null;
char[] chars=str.toCharArray();
for(int i=1;i>chars.length-1;i++){
if(i<len){
chars[i]='*';
str=new String(chars);
return str;
public static String hideFirstChar(String str,int len){
if(str==null) return null;
char[] chars=str.toCharArray();
if(str.length()<=len){
for(int i=0;i<chars.length;i++){
chars[i]='*';
}else{
for(int i=0;i<1;i++){
chars[i]='*';
str=new String(chars);
return str;
public static String hideLastChar(String str,int len){
if(str==null) return null;
char[] chars=str.toCharArray();
if(str.length()<=len){
for(int i=0;i<chars.length;i++){
chars[i]='*';
}else{
for(int i=chars.length-1;i>chars.length-len-1;i--){
chars[i]='*';
str=new String(chars);
return str;
* @return
public static String format(String str,int len){
if(str==null) return "-";
if(str.length()<=len){
int pushlen=len-str.length();
StringBuffer sb=new StringBuffer();
for(int i=0;i<pushlen;i++){
sb.append("0");
sb.append(str);
str=sb.toString();
}else{
String newStr=str.substring(0, len);
str=newStr;
return str;
public static String contact(Object[] args){
StringBuffer sb=new StringBuffer();
for(int i=0;i<args.length;i++){
sb.append(args[i]);
if(i<args.length-1){
sb.append(",");
return sb.toString();
* 是否包含在以“,”隔开字符串内
* @param s
* @param type
* @return
public static boolean isInSplit(String s,String type){
if(isNull(s).equals("")){
return false;
List<String> list=Arrays.asList(s.split(","));
if(list.contains(type)){
return true;
return false;
public static boolean isBlank(String str){
return StringUtils.isNull(str).equals("");
public synchronized static String generateTradeNO(long userid,String type){
String s;
s = type + userid + getFullTimeStr();
return s;
public static String getFullTimeStr(){
String s=DateUtils.dateStr3(Calendar.getInstance().getTime());
return s;
public static String array2Str(Object[] arr){
StringBuffer s=new StringBuffer();
for(int i=0;i<arr.length;i++){
s.append(arr[i]);
if(i<arr.length-1){
s.append(",");
return s.toString();
public static String array2Str(int[] arr){
StringBuffer s=new StringBuffer();
for(int i=0;i<arr.length;i++){
s.append(arr[i]);
if(i<arr.length-1){
s.append(",");
return s.toString();
* 指定起始位置字符串隐藏
* @param str
* @param index1
* @param index2
* @return
public static String hideStr(String str, int index1, int index2) {
if (str == null)
return null;
String str1 = str.substring(index1, index2);
String str2 = str.substring(index2);
String str3 = "";
if (index1 > 0) {
str1 = str.substring(0, index1);
str2 = str.substring(index1, index2);
str3 = str.substring(index2);
char[] chars = str2.toCharArray();
for (int i = 0; i < chars.length; i++) {
chars[i] = '*';
str2 = new String(chars);
String str4 = str1 + str2 + str3;
return str4;
// 四舍五入保留两位小数点
public static String SetNumberFractionDigits(String str) {
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setMaximumFractionDigits(2);
nf.setMinimumFractionDigits(2);
return nf.format(Float.valueOf(str));
public static String getMonday(String the_rq){
int n=getXC_days(the_rq);
//System.out.println("n="+n);
n=n*-1;
return Q_N_Day(n,the_rq);
//获取输入日期的星期天日期
public static String getSunday(String the_rq){
int n=getXC_days(the_rq);
//System.out.println("n="+n);
n=(6-(n*-1))*-1;
return Q_N_Day(n,the_rq);
// 获得输入日期与本周一相差的天数
public static int getXC_days(String rq){
SimpleDateFormat formatYMD=new SimpleDateFormat("yyyy-MM-dd");//formatYMD表示的是yyyy-MM-dd格式
SimpleDateFormat formatD=new SimpleDateFormat("E");//"E"表示"day in week"
Date d=null;
String weekDay="";
int xcrq=0;
d=formatYMD.parse(rq);//将String 转换为符合格式的日期
weekDay=formatD.format(d);
if(weekDay.equals("星期一")){
xcrq=0;
}else{
if(weekDay.equals("星期二")){
xcrq=-1;
}else{
if(weekDay.equals("星期三")){
xcrq=-2;
}else{
if(weekDay.equals("星期四")){
xcrq=-3;
}else{
if(weekDay.equals("星期五")){
xcrq=-4;
}else{
if(weekDay.equals("星期六")){
xcrq=-5;
}else{
if(weekDay.equals("星期日")){
xcrq=-6;
}catch (Exception e){
e.printStackTrace();
return xcrq;
public static String Q_N_Day(int N,String d1){//
String []d2=d1.split("-");
int year=Integer.parseInt(d2[0]);
int month=Integer.parseInt(d2[1]);
int day=Integer.parseInt(d2[2]);
if(day-N<=0){
if(month==1){
year=year-1;
month=12;
day = day + 31-N;
}else{
month=month-1;
if (month == 2) {
if (year % 4 == 0) {
day = day + 29-N;
} else {
day = day + 28-N;
}else{
if(month==4||month==6||month==9||month==11){
day=day+30-N;
}else{
day=day+31-N;
}else{
///////////////////////////////////////////////////////////////////////////////////
if(month==12){
if((day-N)>31){
year=year+1;
month=1;
day=(day-N)-31;
}else{
day=day-N;
}else{
if (month == 2) {
if (year % 4 == 0) {
if((day-N)>29){
month++;
day=(day-N)-29;
}else{
day=day-N;
} else {
if((day-N)>28){
month++;
day=(day-N)-28;
}else{
day=day-N;
}else{
if(month==4||month==6||month==9||month==11){
if((day-N)>30){
month++;
day=(day-N)-30;
}else{
day=day-N;
}else{
if((day-N)>31){
month++;
day=(day-N)-31;
}else{
day=day-N;
//day=day-N;
String str=String.valueOf(year);
if(month<10){
str=str+"-0"+String.valueOf(month);
}else{
str=str+"-"+String.valueOf(month);
if(day<10){
str=str+"-0"+String.valueOf(day);
}else{
str=str+"-"+String.valueOf(day);
return str;
/*public static void main(String[] args) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");// 设置日期格式
String mondayString=StringUtils.getMonday(df.format(new Date()))+ " 00:00:00";
String sumdayString=StringUtils.getSunday(df.format(new Date()))+ " 23:59:59";
String monday=DateUtils.getTime(mondayString)+"";
String sumday=DateUtils.getTime(sumdayString)+"";
//System.out.println(monday);
//System.out.println(sumday);
public static String fillTemplet(String templet, String phstr, String[] paras){
StringBuffer templetSB = new StringBuffer(templet);
int i = 0;
while(templetSB.indexOf(phstr) >= 0 && i < paras.length){
templetSB.replace(templetSB.indexOf(phstr), templetSB.indexOf(phstr)+phstr.length(), paras[i]);
return templetSB.toString();
//V1.6.6.1 RDPROJECT-226 liukun 2013-09-26 start
public static String fillTemplet(String template){
//V1.6.6.1 RDPROJECT-331 liukun 2013-10-12 start
//模板中的'是非法字符,会导致无法提交,所以页面上用`代替
template = template.replace('`', '\'');
//V1.6.6.1 RDPROJECT-331 liukun 2013-10-12 end
Map<String,Object> data=Global.getTransfer();
try {
return FreemarkerUtil.renderTemplate(template, data);
} catch (Exception e) {
e.printStackTrace();
return "";
//V1.6.6.1 RDPROJECT-226 liukun 2013-09-26 end
//V1.6.5.3 RDPROJECT-142 liukun 2013-09-11 start
public static int[] strarr2intarr(String[] strarr){
int[] result = new int[strarr.length];
for(int i=0;i<strarr.length;i++)
result[i] = Integer.parseInt(strarr[i]);
return result;
//V1.6.5.3 RDPROJECT-142 liukun 2013-09-11 end
//v1.6.7.1 RDPROJECT-314 liukun 2013-11-12 start
public static String fillTemplet(String template, Map<String, Object> sendData){
//V1.6.6.1 RDPROJECT-331 liukun 2013-10-12 start
//模板中的'是非法字符,会导致无法提交,所以页面上用`代替
template = template.replace('`', '\'');
//V1.6.6.1 RDPROJECT-331 liukun 2013-10-12 end
try {
return FreemarkerUtil.renderTemplate(template, sendData);
} catch (Exception e) {
e.printStackTrace();
return "";
//v1.6.7.1 RDPROJECT-314 liukun 2013-11-12 end
* 大写字母转成“_”+小写
* @param str
* @return
public static String toUnderline(String str){
char[] charArr=str.toCharArray();
StringBuffer sb=new StringBuffer();
sb.append(charArr[0]);
for(int i=1;i<charArr.length;i++){
if(charArr[i]>='A'&&charArr[i]<='Z'){
sb.append('_').append(charArr[i]);
}else{
sb.append(charArr[i]);
return sb.toString().toLowerCase();
/* c 要填充的字符
* length 填充后字符串的总长度
* content 要格式化的字符串
* 格式化字符串,左对齐
public static String flushLeft(char c, long length, String content){
String str = "";
long cl = 0;
String cs = "";
if (content.length() > length){
str = content;
}else{
for (int i = 0; i < length - content.length(); i++){
cs = cs + c;
str = cs + content;
return str;
public static void main(String[] args){
//HashMap data = new HashMap();
//data.put("a", "123456");
//String xxx = fillTemplet("${a?c?number?string(`#.##`)}", data);
//${parseDouble(a)?}
System.out.println(flushLeft('0', 2, "1"));