totalAmount = (double)Math.round(totalAmount*100)/100; //11月20 zj新增,处理27163.96+50000.0 = 77163.95999999999 这种bug
随机数
//Random rand = new Random();
//int randNum = rand.nextInt(100000000); // 生成随机数
//String num = randNum + "";
字符串判断
if (StringUtils.isNotEmpty(status)) {
}
获取登录用户信息
String cancelUser = SessionContextUserEntity.currentUser().getUserId(); //获取登录用户信息
校验list是否为空
if (!RcUtil.isEmpty(waitAuditEvaluatesAgain)) {}
三元符
sp.addParameter("PI_REMARK", remark == null ? "" : remark);
后台操作数据库方法
首先在 Fros Tools 中 写 的 查询sql 或 修改 sql 自动生成 xml文件 和 条件类 和 存值类
之后 在后台可以按照下面进行 方法调用
后台操作数据库方法1:直接在后台写 sql语句
StringBuffer sb = new StringBuffer("insert into TMP_ARP_FREIGHTID(FREIGHT_ID)VALUES('");
sb.append(frtId);
sb.append("')");
sqlQueryManager.executeSQL(sb.toString(), "", true);
2:
StringBuffer strbuf = new StringBuffer();
String ret =null;
for (String cashIds : ids) {
strbuf.append(",'");
strbuf.append(cashIds.toString());//水单ID
strbuf.append("'");
}
String str =strbuf.toString().substring(1);
String sql = "UPDATE ARP_CASH_MOVEMENT ACM SET ACM.CASH_PURPOSE ='"+cashPurpose+"' WHERE 1=1 AND ACM.CASH_MOVEMENT_ID IN ("+str+")";
ret=sqlQueryManager.executeSQL(sql, "", true);
return ret;
生成查询sql三个文件后 后台调用查询方法
//调用查询方法
SelectArpCashInvoiceQueryCondition condition = new SelectArpCashInvoiceQueryCondition();
List<SelectArpCashInvoiceQueryItem> invoiceList = this.dao.query(condition,SelectArpCashInvoiceQueryItem.class);
Java后台select数据传给jsp的两种方法
/**
* 根据对账单号获取发票信息
*/
public List<BystatementNofindFreightQueryItem> queryFreightBystatementNo(String statementNo) {
String[] statementNos =statementNo.split(",");
BystatementNofindFreightQueryCondition condition = new BystatementNofindFreightQueryCondition();
condition.setStatementNo(statementNos);
List<BystatementNofindFreightQueryItem> list = this.dao.query(condition, BystatementNofindFreightQueryItem.class);
return list;
}
/**
* 根据发票编号获取费用
*/
public List<String> queryFrtCurrencyByInvoiceIds(String invoiceId){
List<String> invoiceIds = new ArrayList<String>();
String[] arrayId = invoiceId.split(",");
for (int i = 0; i < arrayId.length; i++) {
invoiceIds.add(arrayId[i]);
}
StringBuffer strbuf = new StringBuffer();
List<String> currency=new ArrayList<String>();
for (int k = 0; k < invoiceIds.size(); k++) {
strbuf.append(",'");
strbuf.append(invoiceIds.get(k));
strbuf.append("'");
}
String sqlString = " select distinct af.PAYMENT_APPLY_STATUS from arp_freight af where af.invoice_id in("
+ strbuf.toString().substring(1) + ")";
sqlQueryManager.executeSQL(sqlString, null, true);
+ model.getCashNo() + "'";
String exportFlag = sqlQueryManager.getColumnData(strExecuteSql, "", "");
List<Object[]> list = sqlQueryManager
.getSqlResultList(sqlString, "");
for(int i=0;i<list.size();i++){
currency.add(list.get(i)[0].toString());
}
return currency;
}
数据权限过滤在查询SQL增加这个过滤条件
<<and exists (select 1 from VW_SYS_DATA_AUTHORITY vw where eap.eiap_org_id = vw.acc_org_id and vw.USER_UUID =:userUuid)>>
后台方法返回void 空时, 可用 throw new RuntimeException("选中的记录中含有已冲销的水单不能删除!"); 用作页面提示
两个相似属性的对象之间的赋值方法:
获取当前登录用户的信息
SessionContextUserEntity scue = SessionContextUserEntity.currentUser();
java中对象互相转换
PropertyUtils.copyProperties(ebsPaymentOrderModel, wechatPayStatusQueryItem);
获取登录用户信息
String cancelUser = SessionContextUserEntity.currentUser().getUserId(); //获取登录用户信息
校验list是否为空
if (!RcUtil.isEmpty(waitAuditEvaluatesAgain)) {} //校验list是否为空
获取昨天 前天 大前天的时间
date = DateUtil.addDays(date,-2);
date = DateUtil.addDays(date,-3);