Commit b99a92f2 authored by ZWT's avatar ZWT

feat(零碳): 长庆演示系统新增功能

1.新建油田配置表同时生成相关代码及mapper文件,修改部分第三方数据抽取定时任务,增加针对不同井场开关控制逻辑,同时修改首页页面展示逻辑,通过油田配置功能区分不同首页展示功能;
2.新建定时任务配置表同时生成相关代码及mapper文件,定时任务模块增加mybatis配置,用以操作数据库,修改部分第三方数据抽取定时任务,修改使用方式使其脱离框架方便动态控制;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent cfdb72e2
......@@ -33,18 +33,12 @@
</dependency>
<!--POI end-->
<!--jxls start-->
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jxls/jxls -->
<dependency>
<groupId>org.jxls</groupId>
<artifactId>jxls</artifactId>
<version>2.4.6</version>
</dependency>
<!--jxls end-->
<dependency>
<groupId>com.belerweb</groupId>
......
......@@ -5,7 +5,6 @@ import org.jxls.expression.JexlExpressionEvaluator;
import org.jxls.transform.Transformer;
import org.jxls.util.JxlsHelper;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
......@@ -18,23 +17,6 @@ import java.util.Map;
*/
public class ExportExcelUtils {
public static void outputFileData(HttpServletResponse response, byte[] fileBuff, String fileName) throws Exception {
response.setContentType("application/octet-stream;charset=GBK");
response.setHeader("Content-disposition", "attachment;filename=" + new String(fileName.getBytes("GBK"), "iso-8859-1"));
OutputStream out = null;
try {
out = response.getOutputStream();
out.write(fileBuff);
out.flush();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (out != null)
out.close();
}
}
public static void outputFileData(byte[] fileBuff, String filePath) throws Exception {
File file = new File(filePath);
if (!file.getParentFile().exists()) {
......@@ -52,43 +34,6 @@ public class ExportExcelUtils {
}
}
/**
* 根据参数生成excel文件的二进制数据
*
* @param tempPath excel模板路径
* @param params 模板中相关参数的Map
* @return 生成文件的byte数组
*/
public static byte[] genSingleExcelFileData(String tempPath, Map<String, Object> params) {
FileInputStream fileInputStream;
try {
fileInputStream = new FileInputStream(new File(tempPath));
} catch (FileNotFoundException e) {
System.out.println("-----" + tempPath + "文件未找到,导出空数据");
return null;
}
Context context = new Context();
if (params != null) {
for (String key : params.keySet()) {
context.putVar(key, params.get(key));
}
}
ByteArrayOutputStream buff = new ByteArrayOutputStream();
try {
JxlsHelper jxlsHelper = JxlsHelper.getInstance();
Transformer transformer = jxlsHelper.createTransformer(fileInputStream, buff);
JexlExpressionEvaluator evaluator = (JexlExpressionEvaluator) transformer.getTransformationConfig().getExpressionEvaluator();
Map<String, Object> funcs = new HashMap<String, Object>();
funcs.put("utils", new JxlsUtils()); //添加自定义功能
evaluator.getJexlEngine().setFunctions(funcs);
jxlsHelper.processTemplate(context, transformer);
} catch (IOException e) {
e.printStackTrace();
}
return buff.toByteArray();
}
/**
* 根据参数生成excel文件的二进制数据
*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment