历史札记
**********************************************************************************************************************************************
********************************** jsp页面常用语句 *************************************
**********************************************************************************************************************************************
//-------------------调用业务字典-------------------------------------------//
<sd:write property="${openGuide.status}" dicttypeid="system_yesorno"/>
<sd:radio property="notice.noticeType" dicttypeid="system_notice_type" value="${notice.noticeType}" defaultvalue="0"/> //单选
//-------------------时间格式化---------------------------------------------//
<td><s:date name="openGuide.operDate" format="yyyy-MM-dd"/></td>
//-------------------汉化机构-----------------------------------------------//
<td ><sd:orgwrite orgid="${301}"/></td>
//-------------------调用数据库汉化-----------------------------------------//
<td><sd:write property="${docCatalog}" tablename="EG_T" codecolumnname="CATALOG_ID" codevaluecolumnname="CATALOG_NAME"/></td>
//-------------------隐藏域写法---------------------------------------------//
<input type="hidden" id="filter_LED_monitDate" name="filter_LED_monitDate" value="${param['filter_LED_monitDate']}" />
//-------------------页面panel----------------------------------------------//
<st:panel title="信息列表"></st:panel>
//-------------------页面form表单------------------------------------------//
<form id="mainForm" action="monit-info!list.action" method="get" >
<table id="" class="list_table">
</table></form>
<td><input type="text" id="" name="" value="${}"/></td>
//-------------------页面序号-----------------------------------------------//
<th><input type="checkbox" id="checkTitle" name="checkTitle" />序号</th>
<s:property value="#st.count"/>
//-------------------页面返回-----------------------------------------------//
<script type="text/javascript">
//返回
function back() {
document.mainForm.action = "list.action";
document.mainForm.target = "_self";
document.mainForm.submit();
}
</script>
<input class="button2" type="button" value="返回" onclick="javascript:back();"/>
<input class="button2" type="button" value="返回" onclick="javascript:history.go(-1);"/>
//-------------------W3C标准------------------------------------------------//
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <<!-----------<iframe></iframe><frame>,框架-------------->>
//------------------按钮一般写法--------------------------------------------//
<a href="#"><input type="button" value="发布" class="button4"/></a>
<input class="button4" type="submit" value="关闭窗口" onclick="script:window.close()"/>
//------------------页面跳转标签--------------------------------------------//
<a href="http://www.baidu.com" target="_Blank">百度</a>
//------------------页面选择写法--------------------------------------------//
<c:if test="${entity.status == '1'}">
</c:if>
<c:if test="${entity.approveComm != '' && entity.approveComm != null}">
//-----------------页面保存按钮锁定----------------------------------------//
document.inputForm.subButton.disabled=true;
<input 标签需要加" id ">
_Blank是新窗口
_Self是自身
_Parent是父窗口
_Top是顶层窗口
当然也可以是自己定义的一个frame 的名字
比如
<a href="http://www.baidu.com" target="frame1">百度</a>
//-----------------页面表格控制长度----------------------------------------//
<body onload="truncateText();">
<span dispLength="60">${MSGTITLE}</span>
//-----------------页面文本框长度限制---------------------------------------//
<script src="${ctx}/common/js/common.js" type="text/javascript"></script>
<body onload="truncateText();">
<span dispLength="66">${DOC_TITLE}</span>
//-----------------页面柱状图宽度配置---------------------------------------//
rootElement.setAttribute("plotSpacePercent","80"); (注意用LIST控制)
//------------------页面Like--------------------------------------------------------//
在查询页面上写查询字段,比如<input type=”text” name=” filter_EQS_name” value= "${param[' filter_EQS_name ']} " >
关键是这个name:filter_EQS_name 其中filter为固定前缀,EQ表示equals,代表SQL语句中的”=” ,
当然还有LIKE,LT,GT,LE,GE。”S”代表你的这个字段为String类型,
GE是大于等于号(>=),GT是大于号(>),LE是小于等于号(<=),LT是小于号(<)
还可以写 I(Integer),N(Double),D(Date)等,注意:Double类型为N!
最后为你的字段在hibernate POJO中的字段名。
如果你想这个查询框既可以根据字段1模糊查询,也可以根据字段2模糊匹配,你可以这么写:name=”filter_LIKES_NAME_OR_EMAIL_OR_LOGINNAME”
在Action中你需要写:
List<PropertyFilter> filters = HibernateWebUtils. buildPropertyFilters(Struts2Utils. getRequest());//收集查询条件
调用你Manager中的search方法,你的search方法大约会是这个样子:
@Transactional(readOnly = true)
public Page<User> searchUser( final Page<User> page,
final List<PropertyFilter> filters) {
return userDao.findPage(page, filters);
}
这个方法连分页也包含了。
//----------------页面URL隐藏参数-----------------------------------//
引入:<script src="${ctx}/common/js/sinoOpen.js" type="text/javascript"></script>
<td><a href="javascript:openURLWithoutParams(detail.action?catalogId=${docCatalog}&docId=${docId}')" target="_blank">${docTitle}</a></td>
**********************************************************************************************************************************************
********************************** action层常用语句 *************************************
**********************************************************************************************************************************************
//------------------filters写法---------------------------------------------//
List<PropertyFilter> filters=HibernateWebUtils.buildPropertyFilters(Struts2Utils.getRequest());
PropertyFilter pf = new PropertyFilter("EQS_delFlag","N");
filters.add(pf);
//------------------context写法---------------------------------------------//
SpringContextHolder.getApplicationContext()
//------------------new数组-------------------------------------------------//
Map<String,Object> newMap = new HashMap<String, Object>();
private List<String> checkItem = new ArrayList<String>();
//------------------page常量------------------------------------------------//
private Page<SysscmDispatch> page = new Page<SysscmDispatch>(10);
private Page<Map<String,Object>> page = new Page<Map<String,Object>>(10);
//------------------page排序------------------------------------------------//
if (!page.isOrderBySetted()) {
page.setOrderBy("id");
page.setOrder(Page.ASC);
}
//-----------------action层调用下载 处理异常--------------------------------//
byte[] attachInfo = SysscmAdapter.getScmDocumentAttach(SpringContextHolder.getApplicationContext(), catalogId, atchId);
InputStream is = null;
try{
is = new ByteArrayInputStream(attachInfo);
LobUtils.downloadBlob(atchDisplay, is, "application/x-download");
}catch(Exception e){
e.printStackTrace();
}finally{
try{
if(is!=null){
is.close();
}
}catch(Exception e){
e.printStackTrace();
}
}
***********************************************************************************************************************************************
********************************** JS功能开发 *************************************
***********************************************************************************************************************************************
//------------------表单验证------------------------------------------------//
由eos6中的js修改……
使用方法:
1. 导入两个js文件
<script src="${ctx}/common/js/Check.js" type="text/javascript"></script>
<script src="${ctx}/common/js/CheckMsg.js" type="text/javascript"></script>
2. 设置input标签的校验属性validateAttr,如validateAttr="dataName=机构名称;maxLength=64;allowNull=false;"
3. 提交表单前调用checkForm(form)方法校验,通过返回true,否则提示信息,并返回false
其他说明:
暂时只支持校验input输入框
属性说明:
dataName 提示信息的名称
allowNull 设置为true,输入项可以为空;设置为false,输入项为必填
minValue 设置允许输入的最小值
maxValue 设置允许输入的最大值
minLength 设置允许输入的最小长度
maxLength 设置允许输入的最大长度
type 设置校验的类型(见校验类型列表)
message 设置校验未通过时的提示信息(可以用来覆盖系统默认的提示信息)
regExpr 设置正则表达式,仅在校验类型设置为formatStr时有效
totalDigit 设置充许输入数字的最大长度,仅在校验类型设置为double时有效
fracDigit 设置充许输入数字小数位的最大长度,仅在校验类型设置为double时有效
类型说明:
number 数字字符(仅包含0-9)
naturalNumber 自然数
integer 整数
float 实数
zh 汉字
letter 英文字母
IP 计算机的IP地址,正确的格式为:xxx.xxx.xxx.xxx,其中xxx为0~255之间的任意整数
port 计算机的IP地址的端口号,端口号的范围从1到65535
URL 网页地址
email 电子邮件地址
chinaMobile 移动电话号码
chinaZipcode 中国邮政编码
chinaIDNo 中华人民共和国身份证号码
formatStr 按正则表达式进行校验。正则表达式由校验属性regExpr指定
double 带长度和精度的数字。长度由校验属性totalDigit指定,精度由校验属性fracDigit指定
isNumberOrLetterOrLine 只由英文字母和数字和下划线组成
扩展类型校验:
需要在页面里实现 function f_check_扩展类型(obj){}的js方法,如:
validateAttr="allowNull=false;maxLength=32;type=unique",则需要实现的js方法为
function f_check_unique(obj){
//校验提示信息需要条用f_alert(obj,message)方法
}
在js修改 验证
document.getElementById("postilCont").attributes["validateAttr"].nodeValue = 'dataName=批注内容;allowNull=false;maxLength=512';
//-------------------fckeditor 标准配置-------------------------------------//
//配置fckeditor
function configFckeditor(){
var oFCKeditor = new FCKeditor('openRoutine.docCont'); //参数为textarea id or name
oFCKeditor.BasePath = "${ctx}/common/utils/fckeditor/" ;
oFCKeditor.Height = 400;
oFCKeditor.Value = "";
oFCKeditor.ToolbarSet = "Normal";
oFCKeditor.Config['AutoDetectLanguage'] = 'false';
oFCKeditor.ReplaceTextarea();
}
//-------------------fckeditor <textarea></textarea>表单验证是否为空--------//
<script type="text/javascript">
function check() {
var title = document.getElementById('openGuide.docCont').value;
var oEditor = FCKeditorAPI.GetInstance('openGuide.docCont');
if (title == '') {
alert("标题不能为空");
return false;
}else if(title.substring(0,1)==" "){
alert("第一个字符不能为空格!");
return false;
}else if(oEditor.GetXHTML(true) == "" ) {
alert('内容不能为空!');
return false;
}else{
true;
}
}
</script>
//----------------附件删除效果----------------------------------------------//
//附件上选择效果
function changeFile(){
var checkbox=document.getElementById("checkItem");
if(checkbox.checked){
document.getElementById("del").style.textDecoration="none";
}else{
document.getElementById("del").style.textDecoration="line-through";
}
}
//--------------返回功能----------------------------------------------------//
//返回
function back() {
document.inputForm.action = "tab.action";
document.inputForm.target = "_self";
document.inputForm.submit();
}
<input type="button" value="返回" onclick="javascript:back();" class="button2"/>
//-------------单选按钮验空-------------------------------------------------//
if(checkForm(document.inputForm)){
if(document.inputForm.correctType[0].checked == false && document.inputForm.correctType[1].checked == false
&& document.inputForm.correctType[2].checked == false && document.inputForm.correctType[3].checked == false){
alert( "错误类型:必须选择 ");
return false;
}
//-------------异步加载返回页面关闭-----------------------------------------//
<script type="text/javascript">
function save(){
if(checkForm(document.inputForm)){
if(document.inputForm.correctCategory[0].checked == false && document.inputForm.correctCategory[1].checked == false) {
alert( "错误类型:必须选择 ");
return false;
}
// 提交表单
$('#inputForm').ajaxSubmit(options);
}
return false;
}
// ***Ajax 提交***
var options = {
success: showResponse
};
// 获取登录返回值
function showResponse() {
alert("感谢您对系统的支持,我们会再最短时间内解决问题,谢谢支持!");
window.close();
}
</script>
<script type="text/javascript">
// 提交
function saveSort(){
alert("数据量较大时提交将需要一段时间,请您耐心等待!")
var idsObj = document.getElementById("sortIds");
var srcObj = document.getElementById("docList");
var srcOptions = srcObj.options;
var ids = "";
for (var i=0; i<srcOptions.length; i++){
if (i > 0){
ids += ",";
}
ids += srcOptions.item(i).value;
}
idsObj.value = ids;
var retValue = $.ajax({
async:false,
type: "POST",
url: "liii.action",
data: "sortIds=" + idsObj.value+"&oldSortIds=" + document.getElementById("oldSortIds").value,
success: function(msg){
//alert( "" + msg );
}
}).responseText;
if(retValue == "N"){
alert("保存排序失败!");
}else{
alert("保存排序成功!");
window.close();
}
}
</script>
***********************************************************************************************************************************************
********************************** manager层常用语句 *************************************
***********************************************************************************************************************************************
public void deleteMonitRule(List<String> checkItem,String operId){
try{
Date date = new Date();
for(String ruleId : checkItem){
MonitRule ruleEntity = ruleDao.get(Long.parseLong(ruleId));
ruleEntity.setDelFlag(MonitConstants.YESORNO_YES);
ruleEntity.setOperDate(date);
ruleEntity.setOperId(operId);
ruleDao.save(ruleEntity);
//删除因子表数据
List<MonitRuleItem> itemList = new ArrayList<MonitRuleItem>();
Criterion criterion = Restrictions.eq("ruleId", Long.parseLong(ruleId));
itemList = itemDao.find(criterion);
for (MonitRuleItem monitRuleItem : itemList) {
itemDao.delete(monitRuleItem.getItemId());
}
}
}catch(Exception e){
throw new ServiceException("!",e,logger);
}
}
***********************************************************************************************************************************************
********************************** DAO层常用语句 *************************************
***********************************************************************************************************************************************
PropertyFilterParser parser = new PropertyFilterParser();
andStr = parser.getWhereStrFromFilterForSql(filters);
***********************************************************************************************************************************************
********************************** sql常用语句 ************************************
***********************************************************************************************************************************************
//------------------横向变纵向写法------------------------------------------//
select a.point_type,
decode(a.point_type, '1', b.sn1, '2', b.sn2, '3', b.sn3, '4', b.sn4, 0) as monit_num,
decode(a.point_type, '1', b.sa1, '2', b.sa2, '3', b.sa3, '4', b.sa4, 0) as monit_alarm
from (select '1' as point_type
from dual
union all
select '2' as point_type
from dual
union all
select '3' as point_type
from dual
union all
select '4' as point_type from dual) a,
(select sum(decode(monit_num1, null, 0, 0, 0, 1)) as n1,
sum(decode(monit_num2, null, 0, 0, 0, 1)) as n2,
sum(decode(monit_num3, null, 0, 0, 0, 1)) as n3,
sum(decode(monit_num4, null, 0, 0, 0, 1)) as n4,
sum(decode(monit_alarm1, null, 0, 0, 0, 1)) as a1,
sum(decode(monit_alarm2, null, 0, 0, 0, 1)) as a2,
sum(decode(monit_alarm3, null, 0, 0, 0, 1)) as a3,
sum(decode(monit_alarm4, null, 0, 0, 0, 1)) as a4,
sum(decode(monit_num1, null, 0, monit_num1)) as sn1,
sum(decode(monit_num2, null, 0, monit_num2)) as sn2,
sum(decode(monit_num3, null, 0, monit_num3)) as sn3,
sum(decode(monit_num4, null, 0, monit_num4)) as sn4,
sum(decode(monit_alarm1, null, 0, monit_alarm1)) as sa1,
sum(decode(monit_alarm2, null, 0, monit_alarm2)) as sa2,
sum(decode(monit_alarm3, null, 0, monit_alarm3)) as sa3,
sum(decode(monit_alarm4, null, 0, monit_alarm4)) as sa4,
count(*) as summonit
from DOC) b
//------------------更新电子监察中详细内容图配置文件sql---------------------//
update catalog t
set t.catalog_cont =
(select catalog_cont from catalog where catalog_id = 'rx303')
where t.catalog_id like 'rx%';
update catalog t
set t.catalog_cont =
(select catalog_cont from catalog where catalog_id = 'jx303')
where t.catalog_id like 'jx%';
update eg_t_scm_catalog t
set t.catalog_cont =
(select catalog_cont from catalog where catalog_id = 'py303')
where t.catalog_id like 'py%';
//------------------查机构列表------------------------------------------------//
select t.orgid,t.orgname,t.orglevel,t.parentorgid fromRGANIZATION t
start with orgId= 99999
connect by prior orgId = parentorgid
order siblings by orgcode
//-----------------清除表数据-----------------------------------------------//
truncate table 表名;
//-----------------Oracle时间-----------------------------------------------//
TRANSFER_OPER_DATE>=to_date('2012-06-01 00:00:00','yyyy-MM-dd HH24:mi:ss')
or LETTER_OPER_DATE>=to_date('2012-06-01 00:00:00','yyyy-MM-dd HH24:mi:ss')
//-----------------查询中有中文---------------------------------------------//
cast(v1.category_name as varchar(20)) as category_name
***********************************************************************************************************************************************
********************************** 重要实现算法 **********************************
***********************************************************************************************************************************************
//----------------循环删除--处理修改过程中的删除附件------------------------//
//删除checkitem中未选中的
sopenAttchList = SysscmAdapter.getScmDocumentAttachList(SpringContextHolder.getApplicationContext(), infoId, catalogId);
if(checkItem.size() > 0){
//循环遍历找出要删的
for(SysscmDispatch sysscmDispatch : sopenAttchList){
int i = 0;
String atchId = "";
for(;i<checkItem.size();i++){
atchId = String.valueOf(sysscmDispatch.get(SopenConstants.SOPEN_ATCH_MAP_ATCH_ID));
if(atchId.equals(checkItem.get(i))){
break;
}
}
if(i>=checkItem.size()){
SysscmAdapter.deleteScmDocumentAttach(SpringContextHolder.getApplicationContext(), null, atchId, catalogId);
}
}
}
//-----------附件下载-------------------------------------------------------//
/**
* 附件下载
*/
public void getAttachInfo() {
// 机构id
orgId = FwAdapter.getFwCurrentUserOrgId();
// 目录id
catalogId = "year" + orgId;
byte[] attachInfo = SysscmAdapter.getScmDocumentAttach(SpringContextHolder.getApplicationContext(), catalogId, atchId);
InputStream is = null;
try{
is = new ByteArrayInputStream(attachInfo);
LobUtils.downloadBlob(atchDisplay, is, "application/x-download");
}catch(Exception e){
e.printStackTrace();
}finally{
try{
if(is!=null){
is.close();
}
}catch(Exception e){
e.printStackTrace();
}
}
}
//-------------将Map中value的类型有字符串数组转化为字符串------------------//
public static SysscmDispatch disPatchValueConvert(SysscmDispatch disPatch){
if(disPatch == null){
return null;
}
Map<String,Object> newMap = new HashMap<String, Object>();
String key;
Object value;
for(Entry<String, Object> entry : disPatch.entrySet()){
key = entry.getKey();
value = entry.getValue();
if(value != null){
value = ((String[])value)[0];
newMap.put(key, value);
}
}
return new SysscmDispatch(newMap);
}
//----------日期处理-------------------------------------------------------//
<form id="inputForm" name="inputForm" action="list.action" method="post" target="ifraContent">
<input type="hidden" id="catalogSite" name="catalogSite" value="${catalogSite}" />
<input type="hidden" id="filter_EQD_pubDate" name="filter_EQD_pubDate" value="${param['filter_EQD_pubDate']}"/>
<input type="hidden" id="filter_EQS_pubMonth" name="filter_EQS_pubMonth" value="${param['filter_EQS_pubMonth']}"/>
<input type="hidden" id="filter_EQS_pubYear" name="filter_EQS_pubYear" value="${param['filter_EQS_pubYear']}"/>
<input type="hidden" id="filter_GED_pubDate" name="filter_GED_pubDate" value="${param['filter_GED_pubDate']}"/>
<input type="hidden" id="filter_LED_pubDate" name="filter_LED_pubDate" value="${param['filter_LED_pubDate']}"/>
<st:panel title="查询条件">
<table class="form_table">
<tr>
<td class="form_label" width="15%">时间范围:</td>
<c:if test="${param['filter_EQS_pubYear'] != ''}">
<td >${param['filter_EQS_pubYear']}全年</td>
</c:if>
<c:if test="${param['filter_EQS_pubMonth'] != ''}">
<td >${param['filter_EQS_pubMonth']}月份</td>
</c:if>
<c:if test="${param['filter_EQD_pubDate'] != ''}">
<td >${param['filter_EQD_pubDate']}</td>
</c:if>
<c:if test="${param['filter_GED_pubDate'] != ''}">
<td >${param['filter_GED_pubDate']} 至 ${param['filter_LED_pubDate']}</td>
</c:if>
<c:if test="${param['filter_EQS_pubYear'] == '' && param['filter_EQS_pubMonth'] == '' && param['filter_EQD_pubDate'] == '' && param['filter_GED_pubDate'] == ''}">
<%
String date = DateUtils.getCurrentFormatDate(DateUtils.FORMAT_STR_yyyy_MM_dd);
String dateYear = date.substring(0,4);
String dateMonth = date.substring(0,7);
%>
<c:if test="${supervisionTime == 'day'}">
<td><%=date%></td>
</c:if>
<c:if test="${supervisionTime == 'month'}">
<td><%=dateMonth%>月份</td>
</c:if>
<c:if test="${supervisionTime == 'year'}">
<td><%=dateYear%>全年</td>
</c:if>
<c:if test="${supervisionTime == 'all'}">
<td>无限制</td>
</c:if>
</c:if>
/**
* 处理filters条件,转换时间(处理,年,年-月 转 成年-月-日到年-月-日)
* @param filters
* @return
*/
@SuppressWarnings("static-access")
public List<PropertyFilter> filterTimeShift11(List<PropertyFilter> filters){
List<PropertyFilter> retFilters = new ArrayList<PropertyFilter>();
//把年月转换成日期
int i = 0;
int j= 0;
Boolean type = false;
for(PropertyFilter filter:filters){
i++;
String filterName = filter.getPropertyName();
String filterType = String.valueOf(filter.getMatchType());
String startDateValue = null;
String endDateValue = null;
if("EQ".equals(filterType)){//如果==
if("pubMonth".equals(filterName)){//如果是按月度统计
//获取开始时间
startDateValue = (String)filter.getPropertyValue() + "-01";
//获取当月最后一天
String endDate = (String)filter.getPropertyValue();
Calendar calendar = Calendar.getInstance();
Date dateTemp = DateUtils.parse(endDate + "-01", "yyyy-MM-dd");
calendar.setTime(dateTemp);
int maxDays = calendar.getActualMaximum(calendar.DATE);
endDateValue = endDate + "-" + maxDays;
PropertyFilter filterStart = new PropertyFilter("GED_pubDate", startDateValue);
PropertyFilter filterEnd = new PropertyFilter("LED_pubDate", endDateValue);
retFilters.add(filterStart);
retFilters.add(filterEnd);
type = true;
if(type = true){
j = i-1;
}
}else{//如果是按年度统计
if("pubYear".equals(filterName)){
startDateValue = (String)filter.getPropertyValue() + "-01-01";
endDateValue = (String)filter.getPropertyValue() + "-12-31";
PropertyFilter filterStart = new PropertyFilter("GED_pubDate", startDateValue);
PropertyFilter filterEnd = new PropertyFilter("LED_pubDate", endDateValue);
retFilters.add(filterStart);
retFilters.add(filterEnd);
type = true;
if(type = true){
j = i-1;
}
}else{
retFilters.add(filter);
}
}
}
}
if(type){
filters.remove(j);
}
for(PropertyFilter filter:retFilters){
filters.add(filter);
}
return filters;
}
/**
* 将Strin串首字母转换为大写,高效
* @param fildeName
* @return
*/
private static String getMethodName(String fildeName){
byte[] items = fildeName.getBytes();
items[0] = (byte)((char)items[0]-'a'+'A');;
return new String(items);
}
//-------------------获取当前用户 ----权限---------------------------//
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
GrantedAuthority []authorities = auth.getAuthorities();
for(int i=0; i<authorities.length; i++){
String authority = authorities[i].getAuthority();
//--------------------时间处理----------------------------------------//
/**
* 天数加1
* @param newDate
* @return
*/
public Date newDate(Date newDate) {
Calendar cal = Calendar.getInstance();
cal.setTime(newDate);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0); //设置时分秒都为0
newDate = cal.getTime(); //day为2008-08-03 00:00:00
cal.add(Calendar.DAY_OF_YEAR, 1); //小时加1
Date date = cal.getTime(); //d2为2008-08-04
return date;
}
--------------------------------------------------------------------
if("day".equals(supervisionTime)){
if(filters.size() < 1 || filters ==null){
supervisionTimeBegin =date;
supervisionTimeEnd =date;
PropertyFilter timeFilter = new PropertyFilter("EQD_operDate", date);
filters.add(timeFilter);
}else{
for(PropertyFilter filter:filters){
String filterName = filter.getPropertyName();
Date propertyValue = (Date) filter.getPropertyValue();
String value = DateUtils.format(propertyValue, "yyyy-MM-dd");//时间格式转换
if("operDate".equals(filterName)){
supervisionTimeBegin =value;
supervisionTimeEnd =value;
}
}
}
}else if("month".equals(supervisionTime)){
if(filters.size() < 1 || filters ==null){
dateMonth = date.substring(0,7);
//开始时间
supervisionTimeBegin=dateMonth + "-01";
//结束时间
Calendar calendar = Calendar.getInstance();
Date dateTemp = DateUtils.parse(dateMonth + "-01", "yyyy-MM-dd");
calendar.setTime(dateTemp);
int maxDays = calendar.getActualMaximum(calendar.DATE);
supervisionTimeEnd = dateMonth + "-" + maxDays;
PropertyFilter timeFilter = new PropertyFilter("EQS_operMonth", dateMonth);
filters.add(timeFilter);
}else{
for(PropertyFilter filter:filters){
String filterName = filter.getPropertyName();
String filterValue = String.valueOf(filter.getPropertyValue());
if("operMonth".equals(filterName)){
//开始时间
supervisionTimeBegin=filterValue + "-01";
//结束时间
Calendar calendar = Calendar.getInstance();
Date dateTemp = DateUtils.parse(filterValue + "-01", "yyyy-MM-dd");
calendar.setTime(dateTemp);
int maxDays = calendar.getActualMaximum(calendar.DATE);
supervisionTimeEnd = filterValue + "-" + maxDays;
}
}
}
}else if("year".equals(supervisionTime)){
if(filters.size() < 1 || filters ==null){
dateYear = date.substring(0,4);
supervisionTimeBegin =dateYear + "-01-01";
supervisionTimeEnd =dateYear + "-12-31";
PropertyFilter timeFilter = new PropertyFilter("EQS_operYear", dateYear);
filters.add(timeFilter);
}else{
for(PropertyFilter filter:filters){
String filterName = filter.getPropertyName();
String filterValue = String.valueOf(filter.getPropertyValue());
if("operYear".equals(filterName)){
supervisionTimeBegin =filterValue + "-01-01";
supervisionTimeEnd =filterValue + "-12-31";
}
}
}
}
---------------------------------------------------------------------------------
/**
* 保存 2个list
*/
public void saveSort(){
String[] idArray = sortIds.split(",");
String[] oldArray = oldSortIds.split(",");
if(idArray != null && oldArray != null &&
idArray.length == oldArray.length ){
int i = 1;
for(String idStr : idArray){
if(StringUtils.isNotBlank(idStr)){
if(!idStr.equals(oldArray[i-1])){
sopenInfo = SysscmAdapter.getScmDocumentInfo(SpringContextHolder.getApplicationContext(), Long.parseLong(idStr));
sopenInfo.put("sortNum", i);
SysscmAdapter.setScmDocumentInfo(SpringContextHolder.getApplicationContext(), sopenInfo);
}
i++;
}
}
}
}