Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT+08:00")); //获取东八区时间
int year = c.get(Calendar.YEAR); //获取年
int month = c.get(Calendar.MONTH) + 1; //获取月份,0表示1月份
int day = c.get(Calendar.DAY_OF_MONTH); //获取当前天数
int first = c.getActualMinimum(c.DAY_OF_MONTH); //获取本月最小天数
int last = c.getActualMaximum(c.DAY_OF_MONTH); //获取本月最大天数
int time = c.get(Calendar.HOUR_OF_DAY); //获取当前小时
int min = c.get(Calendar.MINUTE); //获取当前分钟
int xx = c.get(Calendar.SECOND); //获取当前秒
1:日期往后推一天的处理
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date endDate = sdf.parse(date);//需要处理的日期对象
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_MONTH, 1);//给日期对象加1天
newMap.put("endDate", sdf.format(calendar.getTime()));//放到map集合中
2:通过request获取参数
Map<String, Object> paramsMap = this.formatParam(request);
js参数处理:
queryParams:getParamValues('search_form');//处理表单的参数<===crud.js
initSearchMenuAndLoadData(options);//获取查询条件的值,以及显示的文本<==pageCommon.js
3:格式化
//格式化码值
oasis_style.setFormatter('datagrid_table',['inoutType','orderType','status'],formatterLookupCode);
//设置金额
oasis_style.setFormatter('datagrid_table', ['totalAmount'], oasis_style.moneyLabel);
//格式化超链接
oasis_style.setFormatter('datagrid_table', ['code'], formatterCode);
//百分比格式化
oasis_style.setFormatter('datagrid_table', ['checkPercent','invoicePercent','receivePercent'], formatPercentageLabel);
//超链接
function formatterCode(value,row){
if(isNull(value)){
return "";
}
var url=BASE_PATH+"/piPurchaseOutController/toView/"+row.id;
return '<a href="javascript:MainTab.createTab(\'view_'+value+'\', \'采购出库详情\', \''+url+'\');" style="text-decoration:underline;">'+value+'</a>';
}