You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.7 KiB
53 lines
1.7 KiB
package com.fr.plugin.xxx.report.core; |
|
|
|
import com.fr.main.TemplateWorkBook; |
|
import com.fr.stable.ArrayUtils; |
|
import com.fr.stable.StringUtils; |
|
import com.fr.web.request.ReportletRequest; |
|
|
|
import java.util.ArrayList; |
|
import java.util.List; |
|
import java.util.Map; |
|
|
|
/** |
|
* @author 秃破天际 |
|
* @version 10.0 |
|
* Created by 秃破天际 on 2020-04-03 |
|
**/ |
|
public class ViewSheetBuilder extends RelationBuilder{ |
|
|
|
private static final String DS_NAME = "CONF_SHEET_GROUP"; |
|
private static final String COL_KEY = "id"; |
|
private static final String COL_VALUE = "group"; |
|
|
|
public ViewSheetBuilder(String dsName, String colKey, String colValue) { |
|
super(dsName, colKey, colValue); |
|
} |
|
|
|
@Override |
|
protected boolean accept(TemplateWorkBook book, ReportletRequest request) throws Exception { |
|
String groupId = (String)request.getParameter("__SHEET_GROUP__"); |
|
return StringUtils.isNotEmpty(groupId); |
|
} |
|
|
|
@Override |
|
protected void build(TemplateWorkBook book, ReportletRequest request, Map<String, String> relation) throws Exception { |
|
String groupId = (String)request.getParameter("__SHEET_GROUP__"); |
|
String [] group = split( relation.get(groupId), ","); |
|
if( 0 == group.length ){ |
|
return; |
|
} |
|
List<String> dels = new ArrayList<String>(); |
|
for(int i=0,len=book.getReportCount();i<len;i++ ){ |
|
String id = book.getReportName(i); |
|
for( int j=0; j<group.length; j++ ){ |
|
if( !ArrayUtils.contains(group,id) ){ |
|
dels.add(id); |
|
} |
|
} |
|
} |
|
for( String id : dels ){ |
|
book.removeReport(id); |
|
} |
|
} |
|
}
|
|
|