Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
leaf-hlcm
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hlcm
leaf-hlcm
Commits
45fbfc90
Commit
45fbfc90
authored
Mar 15, 2023
by
Luochenglong
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/remote_dev' into remote_dev
parents
00a2fb9c
cff95230
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
98 additions
and
55 deletions
+98
-55
ContractSignaturesNew.java
src/main/java/com/hand/kinggrid/ContractSignaturesNew.java
+4
-3
ContractWithTemplate.java
src/main/java/com/hand/kinggrid/ContractWithTemplate.java
+12
-12
WordToPdf.java
src/main/java/leaf/plugin/word2pdf/WordToPdf.java
+32
-16
get_kinggrid_info.lwm
.../webapp/WEB-INF/classes/cont/CON620/get_kinggrid_info.lwm
+18
-0
create_content_for_collection_signatures.lsc
.../cont/CON620/create_content_for_collection_signatures.lsc
+32
-24
No files found.
src/main/java/com/hand/kinggrid/ContractSignaturesNew.java
View file @
45fbfc90
...
...
@@ -6,12 +6,13 @@ import java.io.IOException;
import
java.io.InputStream
;
import
java.security.NoSuchAlgorithmException
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.UUID
;
public
class
ContractSignaturesNew
{
public
static
String
hl_contract_signatures
(
String
file_path
,
String
sign_path
,
Object
[]
param
,
String
server_url
,
String
app_id
,
String
app_security
)
public
static
String
hl_contract_signatures
(
String
file_path
,
String
sign_path
,
Object
[]
param
,
String
server_url
,
String
app_id
,
String
app_security
,
String
datePath
)
throws
IOException
,
NoSuchAlgorithmException
{
String
contractid
=
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
);
...
...
@@ -57,7 +58,7 @@ public class ContractSignaturesNew
{
ContractWithTemplate
.
downFiles
(
json
.
getJSONArray
(
"record_saved_urls"
),
file_p
ath
,
dateP
ath
,
server_url
,
app_id
,
app_security
);
...
...
@@ -75,4 +76,4 @@ public class ContractSignaturesNew
}
return
status
;
}
}
\ No newline at end of file
}
src/main/java/com/hand/kinggrid/ContractWithTemplate.java
View file @
45fbfc90
...
...
@@ -25,7 +25,7 @@ public class ContractWithTemplate {
/**
* 信签服务器对接应用密钥
*/
// public static final String APP_SECURITY = "7lQ7GC1HSviWAFG6";
// public static final String APP_SECURITY = "7lQ7GC1HSviWAFG6";
public
static
void
main
(
String
[]
args
)
throws
IOException
{
//String contractid = "testte222211";
...
...
@@ -76,22 +76,22 @@ public class ContractWithTemplate {
FileOutputStream
fos
=
null
;
try
{
String
fileName
=
savePath
;
if
(!(
savePath
.
endsWith
(
"/"
)||
savePath
.
endsWith
(
"\\"
)))
{
fileName
+=
"/"
;
if
((!
savePath
.
endsWith
(
"/"
))
&&
(!
savePath
.
endsWith
(
"\\"
)))
{
fileName
=
fileName
+
"/"
;
}
fileName
+=
request
.
getDownFileName
();
File
file
=
new
File
(
fileName
);
//file.getParentFile().mkdirs();
fileName
=
fileName
+
request
.
getDownFileName
();
File
file
=
new
File
(
fileName
);
fos
=
new
FileOutputStream
(
file
);
//System.out.println("保存文件至:"+fileName);
request
.
result
(
fos
);
}
finally
{
if
(
fos
!=
null
){
}
finally
{
if
(
fos
!=
null
)
fos
.
close
();
}
}
}
else
{
System
.
out
.
println
(
"错误信息:"
+
request
.
resultToString
());
}
else
{
System
.
out
.
println
(
"错误信息:"
+
request
.
resultToString
());
}
}
...
...
src/main/java/leaf/plugin/word2pdf/WordToPdf.java
View file @
45fbfc90
...
...
@@ -28,7 +28,7 @@ public class WordToPdf {
// 添加jacob-1.18-x64.dll到C:\Java\jre1.7.0_79\bin目录 或者按照以下代码进行设置
// D:\work\leafProjects\MX_leasing\web\WEB-INF\server-script\jacob\jacob-1.18-x64.dll
jacobDllPath
=
webInfPath
+
"/server-script/jacob/"
+
jacobDllName
;
jacobDllPath
=
webInfPath
+
"/server-script/jacob/"
+
jacobDllName
;
System
.
setProperty
(
"jacob.dll.path"
,
jacobDllPath
);
System
.
setProperty
(
"com.jacob.debug"
,
"true"
);
logger
.
info
(
"加载的配置文件路径:"
+
jacobDllPath
);
...
...
@@ -44,9 +44,9 @@ public class WordToPdf {
try
{
ComThread
.
InitMTA
();
app
=
new
ActiveXComponent
(
"Word.Application"
);
// logger.info("Word转PDF开始启动...234");
// logger.info("Word转PDF开始启动...234");
app
.
setProperty
(
"Visible"
,
new
Variant
(
false
));
// logger.info("Word转PDF开始启动...456");
// logger.info("Word转PDF开始启动...456");
Dispatch
docs
=
app
.
getProperty
(
"Documents"
).
toDispatch
();
logger
.
info
(
"打开文档:"
+
inFilePath
);
doc
=
Dispatch
.
invoke
(
...
...
@@ -68,9 +68,9 @@ public class WordToPdf {
logger
.
info
(
"转换完成,用时:"
+
(
end
-
start
)
+
"ms"
);
flag
=
true
;
}
catch
(
Exception
e
)
{
// logger.error("error",e);
// logger.error("error",e);
logger
.
info
(
"Word转PDF出错:"
+
e
.
getMessage
());
// logger.info("Word转PDF出错:" + e.toString());
// logger.info("Word转PDF出错:" + e.toString());
flag
=
false
;
logger
.
info
(
"关闭文档"
);
if
(
app
!=
null
)
{
...
...
@@ -131,6 +131,26 @@ public class WordToPdf {
activeXComponent
.
invoke
(
"Quit"
);
return
true
;
}
public
static
boolean
exceltopdf
(
String
inFilePath
,
String
outFilePath
)
{
ActiveXComponent
activeXComponent
=
new
ActiveXComponent
(
"Excel.Application"
);
activeXComponent
.
setProperty
(
"Visible"
,
false
);
// deletePdf(outFilePath);
Dispatch
excels
=
activeXComponent
.
getProperty
(
"Workbooks"
).
toDispatch
();
Dispatch
excel
=
Dispatch
.
call
(
excels
,
"Open"
,
inFilePath
,
false
,
true
).
toDispatch
();
Dispatch
currentSheet
=
Dispatch
.
get
((
Dispatch
)
excel
,
"ActiveSheet"
).
toDispatch
();
Dispatch
pageSetup
=
Dispatch
.
get
(
currentSheet
,
"PageSetup"
)
.
toDispatch
();
//Dispatch.put(pageSetup, "Zoom", 50);
Dispatch
.
put
(
pageSetup
,
"FitToPagesTall"
,
1
);
Dispatch
.
put
(
pageSetup
,
"FitToPagesWide"
,
1
);
Dispatch
.
call
(
excel
,
"ExportAsFixedFormat"
,
0
,
outFilePath
);
Dispatch
.
call
(
excel
,
"Close"
,
false
);
activeXComponent
.
invoke
(
"Quit"
);
return
true
;
}
/**
* excel to pdf Orientation excel横向转成pdf
...
...
@@ -143,7 +163,7 @@ public class WordToPdf {
ActiveXComponent
activeXComponent
=
new
ActiveXComponent
(
"Excel.Application"
);
activeXComponent
.
setProperty
(
"Visible"
,
false
);
//
deletePdf(outFilePath);
//
deletePdf(outFilePath);
Dispatch
excels
=
activeXComponent
.
getProperty
(
"Workbooks"
).
toDispatch
();
Dispatch
excel
=
Dispatch
.
call
(
excels
,
"Open"
,
inFilePath
,
false
,
true
).
toDispatch
();
...
...
@@ -185,14 +205,10 @@ public class WordToPdf {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
jacobDllPath
=
"E:\\idea_workspace\\leaf-hlcm\\src\\main\\webapp\\WEB-INF\\server-script\\jacob\\jacob-1.19-x64.dll"
;
System
.
setProperty
(
"jacob.dll.path"
,
jacobDllPath
);
System
.
setProperty
(
"com.jacob.debug"
,
"true"
);
// word2pdf("D:\\u01\\hls_file\\excel\\8F5D12B0B1504518928FDD193C67A0A5con28168",
// "D:\\hand-Prpjects\\融资租赁合同文本-4pdf.pdf");
// cutPdf("D:\\\\hand-Prpjects\\\\付款请求书打印.pdf");
excel2pdf
(
"C:\\Users\\Administrator\\Desktop\\对账单(白云BJJ22120045).xlsx"
,
"C:\\Users\\Administrator\\Desktop\\c.pdf"
,
1
,
1
);
// excel2pdfOrientation("D:\\work\\leafProjects\\YondaTl\\src\\test.xlsx",
// "D:\\work\\leafProjects\\YondaTl\\src\\付款通知书NEW.pdf");
}
String
jacobDllPath
=
"D:\\workspace\\leaf-hlcm\\src\\main\\webapp\\WEB-INF\\server-script\\jacob\\jacob-1.19-x64.dll"
;
System
.
setProperty
(
"jacob.dll.path"
,
jacobDllPath
);
System
.
setProperty
(
"com.jacob.debug"
,
"true"
);
//exceltopdf("D:\\u01\\hls_file\\excel\\2023\\03\\对账单(张武林_LZJ20010006)202303131039.xlsx", "D:\\u01\\hls_file\\excel\\2023\\01\\f.pdf");
}
}
src/main/webapp/WEB-INF/classes/cont/CON620/get_kinggrid_info.lwm
0 → 100644
View file @
45fbfc90
<?xml version="1.0" encoding="UTF-8"?>
<bm:model
xmlns:bm=
"http://www.leaf-framework.org/schema/bm"
xmlns:f=
"leaf.database.features"
needAccessControl=
"false"
>
<bm:fields>
<bm:field
name=
"server_url"
databaseType=
"VARCHAR2"
datatype=
"java.lang.String"
/>
<bm:field
name=
"app_id"
databaseType=
"VARCHAR2"
datatype=
"java.lang.String"
/>
<bm:field
name=
"app_security"
databaseType=
"VARCHAR2"
datatype=
"java.lang.String"
/>
</bm:fields>
<bm:operations>
<bm:operation
name=
"query"
>
<bm:query-sql>
<![CDATA[
select sys_parameter_pkg.value(p_parameter_code =>
'JG_SERVER_URL') server_url,
sys_parameter_pkg.value(p_parameter_code => 'JG_APP_ID') app_id,
sys_parameter_pkg.value(p_parameter_code => 'JG_APP_SECURITY') app_security
from dual
]]>
</bm:query-sql>
</bm:operation>
</bm:operations>
</bm:model>
src/main/webapp/modules/cont/CON620/create_content_for_collection_signatures.lsc
View file @
45fbfc90
...
...
@@ -14,7 +14,7 @@
importPackage(Packages.com.itextpdf.text.pdf);
function word_to_pdf_sign(content_id) {
importPackage(Packages.com.h
l.signatures
);
importPackage(Packages.com.h
and.kinggrid
);
importPackage(Packages.java.io);
importPackage(Packages.java.util);
var attachment_batch_dl = $bm('cont.CON620.con_collection_file_download');
...
...
@@ -36,6 +36,7 @@
} else if (file_name.substring(file_name.length - 5) == '.docx') {
file_name = file_name.substring(0, file_name.length - 5);
}
println('file_path =' + file_path);
var outputfilepath = file_path + '.pdf'; // 由于wordToPdf转换后pdf文件已经带有.pdf
var wordToPdf = new WordToPdf($instance('uncertain.ocm.IObjectRegistry'), "jacob-1.19-x64.dll");
//wordToPdf.WordToPdf(file_path, outputfilepath);
...
...
@@ -43,10 +44,8 @@
// 获取pdf页数,如果是只有1页,不需要骑缝章
var pageNum = getPdfPageNum(outputfilepath);
println(pageNum);
println(1);
var con_signature_info = $bm('cont.CON620.get_con_signature_info').queryAsMap();
var con_signature_data = con_signature_info.getChildren();
println(2);
var con_signature_record;
for (var i = 0;i < con_signature_data.length;i++) {
...
...
@@ -82,26 +81,21 @@
}
}
println(param);
var sys_url_bm=$bm('cont.CON4000.get_sys_url');
var parameter_code='JG_SERVER_URL';
var SysurlQuery = sys_url_bm.queryAsMap({
parameter_code: parameter_code
});
var server_url = SysurlQuery.getChildren()[0].parameter_value;
var parameter_code='JG_APP_ID';
var SysIdQuery = sys_url_bm.queryAsMap({
parameter_code: parameter_code
});
var app_id = SysIdQuery.getChildren()[0].parameter_value;
var parameter_code='JG_APP_ID';
var SysSecurityQuery = sys_url_bm.queryAsMap({
parameter_code: parameter_code
});
var app_security = SysSecurityQuery.getChildren()[0].parameter_value;
var status = new ContractSignaturesNew.hl_contract_signatures(outputfilepath, 1,param.toArray(),server_url,app_id,app_security);
var con_signature_info = $bm('cont.CON620.get_kinggrid_info').queryAsMap();
var con_kinggrid_data = con_signature_info.getChildren()[0];
var server_url = con_kinggrid_data.server_url;
var app_id = con_kinggrid_data.app_id;
var app_security = con_kinggrid_data.app_security;
<!-- var kinggrid_info=$bm('cont.CON620.get_kinggrid_info').queryAsMap();-->
<!-- var parameter_code='JG_APP_SECURITY';-->
<!-- var SysSecurityQuery = sys_url_bm.queryAsMap({-->
<!-- parameter_code: parameter_code-->
<!-- });-->
<!-- var app_security = SysSecurityQuery.getChildren()[0].parameter_value;-->
println(outputfilepath);
var datePath = getDate();
println("datePath + " +datePath);
var status = new ContractSignaturesNew.hl_contract_signatures(outputfilepath, 1,param.toArray(),server_url,app_id,app_security,datePath);
attachment_update.update({
content_id: content_id,
...
...
@@ -171,6 +165,18 @@
return
datePath;
//
datePath =
d:/hls_test_files/fileupload/2018/04/
}
function
getDate()
{
set_parameter_file_path();
var
file_path =
$ctx.parameter.file_path;
var
now =
new
Date()
y =
now.getFullYear()
m =
now.getMonth()
+
1
m =
m
<
10
?
"0"
+
m
:
m
var
path =
file_path+"2023"
;
return
path;
}
function
write_os_to_file(file,
os)
{
var
fis =
new
FileInputStream(file);
var
b =
new
java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE,
1024
*
64);
...
...
@@ -245,7 +251,9 @@
//word转pdf并加盖公章
word_to_pdf_sign(record_data.content_id);
to_file_name =
record_data.to_file_name
+
'.pdf';
to_file_path =
to_file_path
+
'.pdf';
var
path =
getDate();
to_path =
path
+
guid_file_name_tables[0].guid_file_name
+
'con'
+
record_data.content_id;
to_file_path =
to_path
+
'.pdf';
download_file(to_file_path.toString(),to_file_name.toString());
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment