From 08ec05022cb32446b4e03fe52b475d3e80d926cb Mon Sep 17 00:00:00 2001
From: Roxy <842305786@qq.com>
Date: Thu, 10 Dec 2020 17:34:45 +0800
Subject: [PATCH 1/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=9D=9E=E4=BA=A7?=
=?UTF-8?q?=E5=93=81=E5=86=85=E7=BD=AE=E7=9A=84=E8=87=AA=E5=AE=9A=E4=B9=89?=
=?UTF-8?q?=E5=87=BD=E6=95=B0=20java=E6=96=87=E4=BB=B6=20=E5=B7=B2?=
=?UTF-8?q?=E7=BB=8F=E5=92=8Cmanto=E6=B2=9F=E9=80=9A=20=E5=88=A0=E9=99=A4?=
=?UTF-8?q?=E5=86=85=E5=AE=B9=EF=BC=9ACellSum.java=E3=80=81DateDiff.java?=
=?UTF-8?q?=E3=80=81FlagHtmlColor.java=E3=80=81gauthority.java=E3=80=81IRR?=
=?UTF-8?q?.java=E3=80=81ReportCheck.java=E3=80=81StringCat.java=E3=80=81S?=
=?UTF-8?q?tringImage.java=E3=80=81SubSection.java=E3=80=81Ubm.java?=
=?UTF-8?q?=E3=80=81Widget2Image.java?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/main/java/com/fr/function/CellSum.java | 14 --
src/main/java/com/fr/function/DateDiff.java | 67 --------
.../java/com/fr/function/FlagHtmlColor.java | 67 --------
src/main/java/com/fr/function/IRR.java | 152 ------------------
.../java/com/fr/function/ReportCheck.java | 142 ----------------
src/main/java/com/fr/function/StringCat.java | 15 --
.../java/com/fr/function/StringImage.java | 59 -------
src/main/java/com/fr/function/SubSection.java | 45 ------
src/main/java/com/fr/function/Ubm.java | 25 ---
.../java/com/fr/function/Widget2Image.java | 105 ------------
src/main/java/com/fr/test/gauthority.java | 77 ---------
11 files changed, 768 deletions(-)
delete mode 100644 src/main/java/com/fr/function/CellSum.java
delete mode 100644 src/main/java/com/fr/function/DateDiff.java
delete mode 100644 src/main/java/com/fr/function/FlagHtmlColor.java
delete mode 100644 src/main/java/com/fr/function/IRR.java
delete mode 100644 src/main/java/com/fr/function/ReportCheck.java
delete mode 100644 src/main/java/com/fr/function/StringCat.java
delete mode 100644 src/main/java/com/fr/function/StringImage.java
delete mode 100644 src/main/java/com/fr/function/SubSection.java
delete mode 100644 src/main/java/com/fr/function/Ubm.java
delete mode 100644 src/main/java/com/fr/function/Widget2Image.java
delete mode 100644 src/main/java/com/fr/test/gauthority.java
diff --git a/src/main/java/com/fr/function/CellSum.java b/src/main/java/com/fr/function/CellSum.java
deleted file mode 100644
index e0b860d..0000000
--- a/src/main/java/com/fr/function/CellSum.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.fr.function;
-
-import com.fr.base.Utils;
-import com.fr.script.AbstractFunction;
-
-public class CellSum extends AbstractFunction {
- public Object run(Object[] args) {
- String sum = Utils.objectToNumber(new SUM().run(args), false)
- .toString(); // 直接调用FR内部的SUM方法
- String result = "所在单元格为:" + this.getCalculator().getCurrentColumnRow()
- + ";总和为:" + sum; // 获取当前单元格拼出最终结果
- return result;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/fr/function/DateDiff.java b/src/main/java/com/fr/function/DateDiff.java
deleted file mode 100644
index 3066667..0000000
--- a/src/main/java/com/fr/function/DateDiff.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.fr.function;
-
-import com.fr.script.AbstractFunction;
-import com.fr.stable.Primitive;
-import java.util.Date;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class DateDiff extends AbstractFunction
-{
- private static final long serialVersionUID = -2863679010825725885L;
- public String format = null;
- private Long dif = Long.valueOf(0L);
-
- public Object run(Object[] paramArrayOfObject)
- {
- try
- {
- Long localLong1 = Long.valueOf(((Date)paramArrayOfObject[0]).getTime());
- Long localLong2 = Long.valueOf(((Date)paramArrayOfObject[1]).getTime());
- this.dif = Long.valueOf(localLong2.longValue() - localLong1.longValue());
- this.format = ((String)paramArrayOfObject[2]);
- replace("((?i)y)", Long.valueOf(31536000000L));
- replace("((?i)q)", Long.valueOf(7776000000L));
- replace("M", Long.valueOf(2592000000L));
- replace("((?i)w)", Long.valueOf(604800000L));
- replace("((?i)d)", Long.valueOf(86400000L));
- replace("((?i)h)", Long.valueOf(3600000L));
- replace("m", Long.valueOf(60000L));
- replace("((?i)s)", Long.valueOf(1000L));
- try
- {
- return Long.valueOf(Long.parseLong(this.format));
- }
- catch (Exception localException2)
- {
- return this.format;
- }
- }
- catch (Exception localException1)
- {
- }
- return Primitive.ERROR_VALUE;
- }
-
- public void replace(String paramString, Long paramLong)
- {
- Pattern localPattern = Pattern.compile(paramString + "\\{\\d*?\\}");
- Matcher localMatcher = localPattern.matcher(this.format);
- int i = (int)(this.dif.longValue() / paramLong.longValue());
- int j = 1;
- while (localMatcher.find())
- {
- String str1 = localMatcher.group();
- str1 = str1.replaceAll(paramString + "\\{", "");
- str1 = str1.replaceAll("\\}", "");
- int k = Integer.parseInt(str1);
- String str2 = String.format("%0" + k + "d", new Object[] { Integer.valueOf(i) });
- if (j != 0)
- {
- j = 0;
- this.dif = Long.valueOf(this.dif.longValue() - i * paramLong.longValue());
- }
- this.format = this.format.replaceFirst(paramString + "\\{\\d*?\\}", str2);
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/fr/function/FlagHtmlColor.java b/src/main/java/com/fr/function/FlagHtmlColor.java
deleted file mode 100644
index 76da40b..0000000
--- a/src/main/java/com/fr/function/FlagHtmlColor.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.fr.function;
-import com.fr.script.AbstractFunction;
-import com.fr.stable.Primitive;
-public class FlagHtmlColor extends AbstractFunction {
- public Object run(Object[] args) {
- String txt="";
- String color="";
- String flag="";
- if(null==args||args.length==0){
- return Primitive.ERROR_NAME;
- }else if(args.length==1){
- txt=args[0].toString();
- color="red";
- flag="N";
- }else if(args.length==2){
- txt=args[0].toString();
- color=args[1].toString();
- flag="N";
- }else{
- txt=args[0].toString();
- color=args[1].toString();
- flag=args[2].toString();
- }
- String result=getHtmlStr(txt, color, flag);
- return result;
- }
- public String getHtmlStr(String txt,String color,String flag){
- String starthtml="";
- String endhtml="";
- StringBuffer sb=new StringBuffer();
- int len=txt.length();
- if("N".equalsIgnoreCase(flag)){//数字
- for(int i=0;i='0'&&c<='9'){
- String str=starthtml+c+endhtml;
- sb.append(str);
- }else{
- sb.append(c);
- }
- }
- }else if("C".equalsIgnoreCase(flag)){//字母
- for(int i=0;i='a'&&c<='z')||(c>='A'&&c<='Z')){
- String str=starthtml+c+endhtml;
- sb.append(str);
- }else{
- sb.append(c);
- }
- }
- } else if("Z".equalsIgnoreCase(flag)){//中文
- for(int i=0;i= 0x4E00 && c <= 0x9FA5){
- String str=starthtml+c+endhtml;
- sb.append(str);
- }else{
- sb.append(c);
- }
- }
- }else{
- return txt;
- }
- return sb.toString();
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/fr/function/IRR.java b/src/main/java/com/fr/function/IRR.java
deleted file mode 100644
index 46bdb96..0000000
--- a/src/main/java/com/fr/function/IRR.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package com.fr.function;
-
-import java.math.BigDecimal;
-
-import com.fr.general.FArray;
-import com.fr.general.GeneralUtils;
-import com.fr.script.AbstractFunction;
-
-public class IRR extends AbstractFunction {
-
- private static final long serialVersionUID = 7634415917398642321L;
- private static final String ERROR_VALUE = "#NUM!";
-
-
- @Override
- public Object run(Object[] args) {
- try{
- if(1 == args.length){
- return run( transArr( (FArray) args[0] ) );
- }else if(2 == args.length){
- return run( transArr( (FArray) args[0] ), trans( args[1] ) );
- }
- }catch(Exception e){
- System.out.println(e);
- }
- return ERROR_VALUE;
- }
-
- /**
- * 将其他类型的数字转换为大数(保证精度)
- * @param ele
- * @return
- */
- private static BigDecimal trans(Object ele){
- try{
- String val = GeneralUtils.objectToString(ele);
- return new BigDecimal(val);
- }catch(Exception e){
-
- }
- return (BigDecimal) ele;
- }
-
- /**
- * 将数组转换为大数数组
- * @param in
- * @return
- */
- private static FArray transArr(FArray in){
- FArray rt = new FArray();
- for(int i=0;i cashflow){
- return run( cashflow, new BigDecimal(0.1d) );
- }
-
- private static BigDecimal run(FArray cashflow,BigDecimal guess){
- BigDecimal maxrate = initRateMax(cashflow,guess);
- BigDecimal minrate = initRateMin(cashflow,guess);
- for( int i=0; i cashflow,BigDecimal guess){
- for( int i=0; i cashflow,BigDecimal guess){
- for( int i=0; i cashflow,BigDecimal rate){
- BigDecimal npv = ZERO;
- BigDecimal rpowj = ONE;//(1+r)^0
- BigDecimal radd1 = rate.add(ONE);//1+r
- for( int j=0; j 0) {
- for (int i = 0; i < parasArray.length(); i++) {
- jo = parasArray.getJSONObject(i);
- parameterMap.put(jo.get("name"), jo.get("value"));
- }
- }
- // 执行报表
- rworkbook = workbook.execute(parameterMap, new WriteActor());
- // 保存下来
- wMap.put(cptname + parasArray.toString(), new TpObj(rworkbook,
- System.currentTimeMillis()));
- }
- // 获取报表结果中对应Cell的值
- ResultReport report = rworkbook.getResultReport(0);
- CellElement cellElement = ((WB) report).getCellElement(colnumber, rownumber);
- returnValue = cellElement.getValue().toString();
- if(cellElement.getValue() instanceof ResultFormula) {
- returnValue = ((ResultFormula)cellElement.getValue()).getResult().toString();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return returnValue;
- }
-
- class TpObj {
- private ResultWorkBook rworkbook = null;
- private long exeTime = System.currentTimeMillis();
-
- public TpObj(ResultWorkBook rworkbook, long exeTime) {
- this.setRworkbook(rworkbook);
- this.setExeTime(exeTime);
- }
-
- public ResultWorkBook getRworkbook() {
- return rworkbook;
- }
-
- public void setRworkbook(ResultWorkBook rworkbook) {
- this.rworkbook = rworkbook;
- }
-
- public long getExeTime() {
- return exeTime;
- }
-
- public void setExeTime(long exeTime) {
- this.exeTime = exeTime;
- }
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/com/fr/function/StringCat.java b/src/main/java/com/fr/function/StringCat.java
deleted file mode 100644
index 00cbf16..0000000
--- a/src/main/java/com/fr/function/StringCat.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.fr.function;
-
-import com.fr.script.AbstractFunction;
-
-public class StringCat extends AbstractFunction {
- public Object run(Object[] args) {
- String result = "";
- Object para;
- for (int i = 0; i < args.length; i++) {
- para = args[i];
- result += para.toString();
- }
- return result;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/fr/function/StringImage.java b/src/main/java/com/fr/function/StringImage.java
deleted file mode 100644
index 1345f16..0000000
--- a/src/main/java/com/fr/function/StringImage.java
+++ /dev/null
@@ -1,59 +0,0 @@
-//图片在下文字在上
-package com.fr.function;
-
-import com.fr.base.GraphHelper;
-import com.fr.data.core.db.BinaryObject;
-import com.fr.log.FineLoggerFactory;
-import com.fr.script.AbstractFunction;
-import com.fr.stable.CoreGraphHelper;
-import javax.imageio.ImageIO;
-import java.awt.Graphics2D;
-import java.awt.Image;
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-
-
-/**
- * 图片在下文字在上
- */
-public class StringImage extends AbstractFunction {
- @Override
- public Object run(Object[] args) {
- Image result = null;
- int p = 0;
- Object[] ob = new Object[2];
- for (int i = 0; (i < args.length && p <= 1); i++) {
- if (args[i] == null) {
- continue;
- }
- ob[p] = args[i];
- p++;
-
- }
-
- if (ob[1] instanceof BinaryObject) {
- BinaryObject binaryObject = (BinaryObject) ob[1];
- try {
- result = initStringImage((String) ob[0], ImageIO.read(binaryObject.getInputStream()));
- } catch (IOException e) {
- e.printStackTrace();
- }
- } else if (ob[1] instanceof Image) {
- result = initStringImage((String) ob[0], (Image) ob[1]);
- } else {
- FineLoggerFactory.getLogger().warn("Unsupported type of " + ob[1].getClass());
- }
-
- return result;
- }
-
- private Image initStringImage(String name, Image image) {
- BufferedImage splashBuffedImage = CoreGraphHelper.toBufferedImage(image);
- Graphics2D splashG2d = splashBuffedImage.createGraphics();
- double centerX = 25;
- double centerY = 25;
- GraphHelper.drawString(splashG2d, name, centerX, centerY);
- return splashBuffedImage;
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/com/fr/function/SubSection.java b/src/main/java/com/fr/function/SubSection.java
deleted file mode 100644
index a502c9c..0000000
--- a/src/main/java/com/fr/function/SubSection.java
+++ /dev/null
@@ -1,45 +0,0 @@
-//SubSection函数-Oracle查询参数个数限制
-package com.fr.function;
-
-import com.fr.general.FArray;
-import com.fr.script.AbstractFunction;
-
-public class SubSection extends AbstractFunction {
- public Object run(Object[] args) {
- // 获取第一个对象,即取得传入的参数
- Object para = args[0];
- String parastr = para.toString();
- // 由于是复选参数,因此要去掉前后的"("和")"
- if (parastr.startsWith("(") && parastr.endsWith(")")) {
- parastr = parastr.substring(1, parastr.length() - 1);
- }
- // 将字符串转为","分割的数组
- String test[] = parastr.split(",");
- int len = test.length;
- int loopnum = len / 500;
- if (len % 500 != 0) {
- loopnum += 1;
- }
- ;
- // 返回的值是数组,需要定义成我们内部的类型FArray
- FArray result = new FArray();
- String str = "";
- int k = 1;
- for (int i = 0; i < loopnum; i++) {
- for (int j = 500 * i; j < 500 * (i + 1) && j < len; j++) {
- if (k != 500 && j != (len - 1)) {
- str += test[j] + ",";
- } else {
- str += test[j];
- }
- k++;
- }
- // 每500个形成一组并在每组外部加上"("和")"
- str = "(" + str + ")";
- result.add(str);
- str = "";
- k = 1;
- }
- return result;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/fr/function/Ubm.java b/src/main/java/com/fr/function/Ubm.java
deleted file mode 100644
index 12d7aaf..0000000
--- a/src/main/java/com/fr/function/Ubm.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// 自定义函数Unicode编码转化为中文
-package com.fr.function;
-
-import com.fr.script.AbstractFunction;
-
-public class Ubm extends AbstractFunction {
- public Object run(Object[] args) {
- String str = args[0].toString();
- String st = "";
- StringBuffer buffer = new StringBuffer();
- while (str.length() > 0) {
- if (str.startsWith("%u")) {
- st = str.substring(2, 6);
- char ch = (char) Integer.parseInt(String.valueOf(st), 16);
- buffer.append(new Character(ch).toString());
- str = str.substring(6);
- } else {
- st = str.substring(0, str.indexOf("%u"));
- buffer.append(st);
- str = str.substring(st.length());
- }
- }
- return buffer.toString();
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/fr/function/Widget2Image.java b/src/main/java/com/fr/function/Widget2Image.java
deleted file mode 100644
index b809ce6..0000000
--- a/src/main/java/com/fr/function/Widget2Image.java
+++ /dev/null
@@ -1,105 +0,0 @@
-// 导出打印单选按钮及复选框
-package com.fr.function;
-
-import com.fr.base.AbstractPainter;
-import com.fr.base.BaseUtils;
-import com.fr.base.GraphHelper;
-import com.fr.base.Style;
-import com.fr.general.FArray;
-import com.fr.general.FRFont;
-import com.fr.script.AbstractFunction;
-import com.fr.stable.Primitive;
-import com.fr.stable.StringUtils;
-
-import java.awt.Color;
-import java.awt.FontMetrics;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.Image;
-
-public class Widget2Image extends AbstractFunction {
- public Object run(Object[] args) {
- if (args.length < 3)
- return Primitive.NULL;
- // 第一个参数:控件类型,不区分大小写
- String type = args[0].toString().toLowerCase();
- if (!("checkbox".equals(type) || "radiobutton".equals(type)))
- return Primitive.ERROR_VALUE;
- // 第二个参数:控件按钮个数
- int num = Integer.parseInt(args[1].toString());
- // 第三个参数:按钮组的值,哪些被选中
- String selection = args[2].toString();
- // 第四个参数:可选参数,按钮组对应的显示值数组
- FArray textArray = new FArray();
- if (args.length == 4 && args[3] instanceof FArray) {
- textArray = (FArray) args[3];
- }
- return new WidgetPaint(type, num, selection, textArray);
- }
-
- public static class WidgetPaint extends AbstractPainter {
- public static String CHECK_ON = "/com/fr/web/images/checkon.gif";
- public static String CHECK_OFF = "/com/fr/web/images/checkoff.gif";
- public static String RADIO_ON = "/com/fr/web/images/radioon.gif";
- public static String RADIO_OFF = "/com/fr/web/images/radiooff.gif";
- public static FRFont DEFUALT_FONT = FRFont.getInstance();
- public static FontMetrics FontMetrics = GraphHelper
- .getFontMetrics(DEFUALT_FONT);
- private String type;
- private int num;
- private String selection;
- private FArray textArray;
-
- {
- DEFUALT_FONT = DEFUALT_FONT.applyForeground(Color.BLACK);
- }
-
- public WidgetPaint(String type, int num, String selection,
- FArray textArray) {
- this.type = type;
- this.num = num;
- this.selection = selection;
- this.textArray = textArray;
- }
-
- private String resolveText(int i) {
- if (i < this.textArray.length()) {
- return this.textArray.elementAt(i).toString();
- }
- return StringUtils.EMPTY;
- }
-
- public void paint(Graphics g, int width, int height, int resolution,
- Style style) {
- String OFF = CHECK_OFF;
- String ON = CHECK_ON;
- if ("radiobutton".equals(type)) {
- OFF = RADIO_OFF;
- ON = RADIO_ON;
- }
- Image[] checkOFFON = {BaseUtils.readImage(OFF),
- BaseUtils.readImage(ON)};
- int[] imgWidths = {checkOFFON[0].getWidth(null),
- checkOFFON[1].getWidth(null)};
- int[] imgHeights = {checkOFFON[0].getHeight(null),
- checkOFFON[1].getHeight(null)};
- Graphics2D g2d = (Graphics2D) g;
- g2d.setFont(FRFont.getInstance());
- g2d.setPaint(Color.BLACK);
- int x = 2;
- int y = (height - imgHeights[0]) / 2;
- String select = selection;
- for (int i = 0; i < num; i++) {
- int bit = Integer.parseInt(select.substring(i, i + 1));
- g2d.drawImage(checkOFFON[bit], x, y, imgWidths[bit],
- imgHeights[bit], null);
- x += imgWidths[bit] + 2;
- String text = resolveText(i);
- g2d.setBackground(Color.BLACK);
- g2d.drawString(text, (float) x, (float) (y + FontMetrics
- .getAscent()));
- x += FontMetrics.stringWidth(text) + 2;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/fr/test/gauthority.java b/src/main/java/com/fr/test/gauthority.java
deleted file mode 100644
index 19dd38d..0000000
--- a/src/main/java/com/fr/test/gauthority.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package com.fr.test;
-
-import com.fr.base.FRContext;
-import com.fr.base.Formula;
-import com.fr.general.FArray;
-import com.fr.json.JSONObject;
-import com.fr.script.AbstractFunction;
-import com.fr.script.Calculator;
-import com.fr.stable.Primitive;
-
-public class gauthority extends AbstractFunction {
- public gauthority() {
- }
-
- public Object run(Object[] args) {
- int[] newArgs = new int[args.length];
-
- for (int i = 0; i < args.length; ++i) {
- if (!(args[i] instanceof Integer) || (Integer) args[i] <= 0) {
- return Primitive.ERROR_NAME;
- }
-
- newArgs[i] = (Integer) args[i];
- }
-
- FArray res = new FArray();
- Calculator ca = this.getCalculator();
- Formula f = new Formula("$fr_userposition");
-
- try {
- Object dp = ca.eval(f);
- if (dp instanceof FArray) {
- FArray fa = (FArray) dp;
-
- for (int i = 0; i < fa.length(); ++i) {
- JSONObject jo = (JSONObject) fa.elementAt(i);
- String dName = jo.getString("jobTitle");
- if (newArgs.length == 0) {
- res.add(dName);
- } else {
- String[] dNames = dName.split(",");
- res.add(this.buildRes(dNames, newArgs));
- }
- }
- }
- } catch (Exception var12) {
- FRContext.getLogger().error(var12.getMessage(), var12);
- }
-
- return res;
- }
-
- private String buildRes(String[] dNames, int[] args) {
- StringBuffer sb = new StringBuffer();
-
- for (int i = 0; i < args.length; ++i) {
- int index = args[i];
- if (dNames.length >= index) {
- sb.append(dNames[index - 1]).append(",");
- }
- }
-
- return sb.substring(0, sb.length() > 0 ? sb.length() - 1 : 0);
- }
-
- public Type getType() {
- return OTHER;
- }
-
- public String getCN() {
- return "GETUSERDEPARTMENTS():返回角色部门\n示例:\nGETUSERDEPARTMENTS():返回角色所有部门,若多个部门则数组\nGETUSERDEPARTMENTS(3,2):返回角色该部门的第三层和第二层名字,\n若多个部门则返回数组,若没有第三层则只显示第二层";
- }
-
- public String getEN() {
- return "";
- }
-}
From 4d23fc467abcad1e1aa0ac0deec927934fc2ae66 Mon Sep 17 00:00:00 2001
From: Rosie <3392418386@qq.com>
Date: Tue, 15 Dec 2020 14:08:15 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E7=BD=91=E7=BB=9C?=
=?UTF-8?q?=E6=8A=A5=E8=A1=A8-https://help.fanruan.com/finereport/doc-view?=
=?UTF-8?q?-685.html=20=E5=B8=AE=E5=8A=A9=E6=96=87=E6=A1=A3=E4=B8=AD?=
=?UTF-8?q?=E4=BA=8C=E6=AC=A1=E5=BC=80=E5=8F=91=E6=A8=A1=E5=9D=97=EF=BC=8C?=
=?UTF-8?q?=E7=A8=8B=E5=BA=8F=E7=BD=91=E7=BB=9C=E6=8A=A5=E8=A1=A8=E6=96=87?=
=?UTF-8?q?=E6=A1=A3=E4=B8=AD=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8=E7=9A=84?=
=?UTF-8?q?=E7=A4=BA=E4=BE=8B=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../com/fr/demo/SimpleReportletDemoFrm.java | 34 +++++++++++++++++++
1 file changed, 34 insertions(+)
create mode 100644 src/main/java/com/fr/demo/SimpleReportletDemoFrm.java
diff --git a/src/main/java/com/fr/demo/SimpleReportletDemoFrm.java b/src/main/java/com/fr/demo/SimpleReportletDemoFrm.java
new file mode 100644
index 0000000..437c889
--- /dev/null
+++ b/src/main/java/com/fr/demo/SimpleReportletDemoFrm.java
@@ -0,0 +1,34 @@
+package com.fr.demo;
+
+import java.util.Map;
+import javax.servlet.http.HttpServletRequest;
+
+import com.fr.form.main.Form;
+import com.fr.form.main.FormIO;
+import com.fr.web.weblet.Formlet;
+
+
+public class SimpleReportletDemoFrm extends Formlet {
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public void setParameterMap(Map arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ protected Form createForm(HttpServletRequest request) throws Exception {
+ Form form = null;
+ //模板的相对路径
+ String tplPath = "//doc//frm//决策报表入门.frm";
+ this.setTplPath(tplPath);
+ try {
+ form = FormIO.readForm(tplPath);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return form;
+ }
+
+}
\ No newline at end of file
From cb4e9b9a7e45d2db8f269d83591a4adcfd94db44 Mon Sep 17 00:00:00 2001
From: Rosie <3392418386@qq.com>
Date: Tue, 15 Dec 2020 15:11:51 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E7=BD=91=E7=BB=9C?=
=?UTF-8?q?=E6=8A=A5=E8=A1=A8-https://help.fanruan.com/finereport/doc-view?=
=?UTF-8?q?-685.html=20=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8=E7=A4=BA?=
=?UTF-8?q?=E4=BE=8B=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/main/java/com/fr/demo/SimpleReportletDemoFrm.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/fr/demo/SimpleReportletDemoFrm.java b/src/main/java/com/fr/demo/SimpleReportletDemoFrm.java
index 437c889..a3862fd 100644
--- a/src/main/java/com/fr/demo/SimpleReportletDemoFrm.java
+++ b/src/main/java/com/fr/demo/SimpleReportletDemoFrm.java
@@ -5,12 +5,12 @@ import javax.servlet.http.HttpServletRequest;
import com.fr.form.main.Form;
import com.fr.form.main.FormIO;
+import com.fr.log.FineLoggerFactory;
import com.fr.web.weblet.Formlet;
public class SimpleReportletDemoFrm extends Formlet {
- @SuppressWarnings("rawtypes")
@Override
public void setParameterMap(Map arg0) {
// TODO Auto-generated method stub
@@ -26,7 +26,7 @@ public class SimpleReportletDemoFrm extends Formlet {
try {
form = FormIO.readForm(tplPath);
} catch (Exception e) {
- e.printStackTrace();
+ FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return form;
}
From bff933481e54ff32e1b7d907c1f91cab605bb4e0 Mon Sep 17 00:00:00 2001
From: zack
Date: Fri, 15 Jan 2021 15:15:31 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20=E4=BF=AE?=
=?UTF-8?q?=E5=A4=8D=E4=B8=80=E4=BA=9Bdemo=E7=BC=96=E8=AF=91=E9=97=AE?=
=?UTF-8?q?=E9=A2=98,=E5=B7=B2=E7=BB=8F=E7=A8=8B=E5=BA=8F=E6=95=B0?=
=?UTF-8?q?=E6=8D=AE=E9=9B=86=E9=80=BB=E8=BE=91=E4=B8=8D=E4=B8=A5=E8=B0=A8?=
=?UTF-8?q?=E9=97=AE=E9=A2=98(getColumnName=E5=8F=AF=E8=83=BD=E6=8A=A5?=
=?UTF-8?q?=E9=94=99NPE)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/main/java/com/fr/data/ParamTableDataDemo.java | 2 ++
src/main/java/com/fr/output/OutputExcel.java | 2 +-
src/main/java/com/fr/privilege/RSAUtil.java | 15 ++++++++-------
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/main/java/com/fr/data/ParamTableDataDemo.java b/src/main/java/com/fr/data/ParamTableDataDemo.java
index ba217bf..b5c2cd8 100644
--- a/src/main/java/com/fr/data/ParamTableDataDemo.java
+++ b/src/main/java/com/fr/data/ParamTableDataDemo.java
@@ -50,11 +50,13 @@ public class ParamTableDataDemo extends AbstractTableData {
*/
@Override
public int getColumnCount() {
+ init();
return columnNum;
}
@Override
public String getColumnName(int columnIndex) {
+ init();
return columnNames[columnIndex];
}
diff --git a/src/main/java/com/fr/output/OutputExcel.java b/src/main/java/com/fr/output/OutputExcel.java
index 72d6469..2df1026 100644
--- a/src/main/java/com/fr/output/OutputExcel.java
+++ b/src/main/java/com/fr/output/OutputExcel.java
@@ -9,9 +9,9 @@ import com.fr.stable.ArrayUtils;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
-import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
diff --git a/src/main/java/com/fr/privilege/RSAUtil.java b/src/main/java/com/fr/privilege/RSAUtil.java
index 5a5d848..53cfff3 100644
--- a/src/main/java/com/fr/privilege/RSAUtil.java
+++ b/src/main/java/com/fr/privilege/RSAUtil.java
@@ -1,5 +1,8 @@
package com.fr.privilege;
+import com.fr.third.org.bouncycastle.jce.provider.BouncyCastleProvider;
+
+import javax.crypto.Cipher;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -19,8 +22,6 @@ import java.security.spec.InvalidKeySpecException;
import java.security.spec.RSAPrivateKeySpec;
import java.security.spec.RSAPublicKeySpec;
-import javax.crypto.Cipher;
-
/**
* RSA 工具类。提供加密,解密,生成密钥对等方法。
* 需要到http://www.bouncycastle.org下载bcprov-jdk14-123.jar。
@@ -36,7 +37,7 @@ public class RSAUtil {
public static KeyPair generateKeyPair() throws Exception {
try {
KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance("RSA",
- new org.bouncycastle.jce.provider.BouncyCastleProvider());
+ new BouncyCastleProvider());
final int KEY_SIZE = 1024;// 没什么好说的了,这个值关系到块加密的大小,可以更改,但是不要太大,否则效率会低
keyPairGen.initialize(KEY_SIZE, new SecureRandom());
KeyPair keyPair = keyPairGen.generateKeyPair();
@@ -79,7 +80,7 @@ public class RSAUtil {
KeyFactory keyFac = null;
try {
keyFac = KeyFactory.getInstance("RSA",
- new org.bouncycastle.jce.provider.BouncyCastleProvider());
+ new BouncyCastleProvider());
} catch (NoSuchAlgorithmException ex) {
throw new Exception(ex.getMessage());
}
@@ -106,7 +107,7 @@ public class RSAUtil {
KeyFactory keyFac = null;
try {
keyFac = KeyFactory.getInstance("RSA",
- new org.bouncycastle.jce.provider.BouncyCastleProvider());
+ new BouncyCastleProvider());
} catch (NoSuchAlgorithmException ex) {
throw new Exception(ex.getMessage());
}
@@ -133,7 +134,7 @@ public class RSAUtil {
public static byte[] encrypt(PublicKey pk, byte[] data) throws Exception {
try {
Cipher cipher = Cipher.getInstance("RSA",
- new org.bouncycastle.jce.provider.BouncyCastleProvider());
+ new BouncyCastleProvider());
cipher.init(Cipher.ENCRYPT_MODE, pk);
int blockSize = cipher.getBlockSize();// 获得加密块大小,如:加密前数据为128个byte,而key_size=1024
// 加密块大小为127
@@ -177,7 +178,7 @@ public class RSAUtil {
public static byte[] decrypt(PrivateKey pk, byte[] raw) throws Exception {
try {
Cipher cipher = Cipher.getInstance("RSA",
- new org.bouncycastle.jce.provider.BouncyCastleProvider());
+ new BouncyCastleProvider());
cipher.init(cipher.DECRYPT_MODE, pk);
int blockSize = cipher.getBlockSize();
ByteArrayOutputStream bout = new ByteArrayOutputStream(64);