forked from fanruan/finekit
zack
5 years ago
13 changed files with 96 additions and 136 deletions
@ -1,46 +1,24 @@
|
||||
package com.fanruan.api.function.shell; |
||||
|
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.stable.script.FunctionDef; |
||||
|
||||
/** |
||||
* 自定义函数封装 |
||||
* ClassName FineFunc |
||||
* |
||||
* @Author zack |
||||
* @Date 2019/8/23 |
||||
* @Version 10.0 |
||||
* 自定义函数实体 |
||||
*/ |
||||
public class FineFunc { |
||||
private String name;//函数名
|
||||
private String description;//描述
|
||||
private String className;//完整类名
|
||||
|
||||
public FineFunc(String name, String description, String className) { |
||||
this.name = name; |
||||
this.description = description; |
||||
this.className = className; |
||||
} |
||||
|
||||
public FineFunc(String name, String className) { |
||||
this(name, StringUtils.EMPTY, className); |
||||
public class FineFunc extends FunctionDef { |
||||
public FineFunc() { |
||||
} |
||||
|
||||
public String getName() { |
||||
return name; |
||||
public FineFunc(String name, String descrption) { |
||||
super(name, descrption); |
||||
} |
||||
|
||||
public void setName(String name) { |
||||
this.name = name; |
||||
} |
||||
|
||||
public String getDescription() { |
||||
return description; |
||||
} |
||||
|
||||
public void setDescription(String description) { |
||||
this.description = description; |
||||
} |
||||
|
||||
public String getClassName() { |
||||
return className; |
||||
} |
||||
|
||||
public void setClassName(String className) { |
||||
this.className = className; |
||||
public FineFunc(String name, String description, String className) { |
||||
super(name, description, className); |
||||
} |
||||
} |
@ -1,75 +0,0 @@
|
||||
package com.fanruan.api.report.analy; |
||||
|
||||
import com.fanruan.api.report.analy.data.TreeNode; |
||||
import com.fr.cache.list.IntList; |
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.report.cell.ResultCellElement; |
||||
import com.fr.report.cell.WidgetAttrElem; |
||||
import com.fr.report.web.button.form.TreeNodeToggleButton; |
||||
import com.fr.report.worksheet.AnalysisRWorkSheet; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Iterator; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 数据分析相关的业务类,此类是为了接盘AnalyKit中的庞杂的私有方法,增强AnalyKit的可读性 |
||||
*/ |
||||
public class AnalyKitHelper { |
||||
|
||||
public static Map<Integer, TreeNode> generateNodeTree(AnalysisRWorkSheet resultWS) { |
||||
int rowSize = resultWS.getRowCount(); |
||||
Map<Integer, TreeNode> nodeMap = new HashMap<Integer, TreeNode>(); |
||||
|
||||
for (int rowIndex = 0; rowIndex < rowSize; rowIndex++) {//遍历行
|
||||
ResultCellElement treeNodeCell = findToggleCell(resultWS, rowIndex); |
||||
if (treeNodeCell != null) { |
||||
Widget widget = ((WidgetAttrElem) treeNodeCell).getWidget(); |
||||
IntList sonList = ((TreeNodeToggleButton) widget).getRelativeIndexList(); |
||||
if (sonList != null && sonList.size() > 1) { |
||||
if (sonList.get(0) == -1) { |
||||
//折叠行
|
||||
if (nodeMap.containsKey(treeNodeCell.getRow())) { |
||||
continue; |
||||
} |
||||
buildNodeMap(resultWS, treeNodeCell, nodeMap, -1); |
||||
} else { |
||||
//折叠列 暂不处理
|
||||
} |
||||
} |
||||
} |
||||
} |
||||
return nodeMap; |
||||
} |
||||
|
||||
private static ResultCellElement findToggleCell(AnalysisRWorkSheet reportCase, int rowIndex) { |
||||
Iterator cellIterator = reportCase.getRow(rowIndex); |
||||
while (cellIterator.hasNext()) { |
||||
ResultCellElement tmpCell = (ResultCellElement) cellIterator.next(); |
||||
if (tmpCell instanceof WidgetAttrElem) { |
||||
if (((WidgetAttrElem) tmpCell).getWidget() instanceof TreeNodeToggleButton) { |
||||
return tmpCell; |
||||
} |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
private static void buildNodeMap(AnalysisRWorkSheet reportCase, ResultCellElement cellElment, Map<Integer, TreeNode> nodeMap, int parent) { |
||||
if (cellElment == null) { |
||||
return; |
||||
} |
||||
TreeNodeToggleButton toggleButton = (TreeNodeToggleButton) ((WidgetAttrElem) cellElment).getWidget(); |
||||
int self = cellElment.getRow(); |
||||
IntList sonList = toggleButton.getRelativeIndexList(); |
||||
if (sonList != null && sonList.size() > 1) { |
||||
if (sonList.get(0) == -1) {//折叠行
|
||||
nodeMap.put(self, new TreeNode(self, parent, sonList)); |
||||
int size = sonList.size(); |
||||
for (int i = 0; i < size; i++) { |
||||
buildNodeMap(reportCase, findToggleCell(reportCase, sonList.get(i)), nodeMap, self); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,4 +1,4 @@
|
||||
package com.fanruan.api.util.shell; |
||||
package com.fanruan.api.util.trans; |
||||
|
||||
/** |
||||
* 抽象短信体 |
@ -1,4 +1,4 @@
|
||||
package com.fanruan.api.util.shell; |
||||
package com.fanruan.api.util.trans; |
||||
|
||||
import com.fr.base.sms.SMSManager; |
||||
import com.fr.json.JSONArray; |
@ -1,4 +1,4 @@
|
||||
package com.fanruan.api.util.shell; |
||||
package com.fanruan.api.util.trans; |
||||
|
||||
import com.fr.base.EmailAttachment; |
||||
import org.jetbrains.annotations.Nullable; |
@ -1,4 +1,4 @@
|
||||
package com.fanruan.api.util.shell; |
||||
package com.fanruan.api.util.trans; |
||||
|
||||
import com.fr.base.sms.SMSManager; |
||||
import com.fr.json.JSONObject; |
Loading…
Reference in new issue