Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gf_back
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tianchao
gf_back
Commits
95612579
Commit
95612579
authored
Nov 30, 2023
by
ZWT
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(能源管理系统): 修改架构
1.修改架构添加cse; 2.修改各微服务服务名,启动验证,完成cse注册; BREAKING CHANGE: 无 Closes 无 [skip ci]
parent
f58bfbf8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
54 deletions
+53
-54
C00-common/pps-common/src/main/java/pps/core/common/pdf/Html2Pdf.java
...ps-common/src/main/java/pps/core/common/pdf/Html2Pdf.java
+34
-40
C02-system/pps-core-system/pom.xml
C02-system/pps-core-system/pom.xml
+12
-7
D03-deploy/deploy-pps-prediction/src/main/java/app/DeployPpsPredictionApplication.java
...ion/src/main/java/app/DeployPpsPredictionApplication.java
+2
-2
D03-deploy/deploy-pps-space/src/main/java/app/DeployPpsSpaceApplication.java
...ps-space/src/main/java/app/DeployPpsSpaceApplication.java
+2
-2
D03-deploy/deploy-pps-system/src/main/java/app/DeployPpsSystemApplication.java
...-system/src/main/java/app/DeployPpsSystemApplication.java
+1
-1
D03-deploy/deploy-pps-task/src/main/java/app/DeployPpsTaskApplication.java
...-pps-task/src/main/java/app/DeployPpsTaskApplication.java
+2
-2
No files found.
C00-common/pps-common/src/main/java/pps/core/common/pdf/Html2Pdf.java
View file @
95612579
package
pps.core.common.pdf
;
import
java.io.*
;
import
java.nio.ByteBuffer
;
import
java.nio.channels.FileChannel
;
import
java.nio.charset.Charset
;
import
java.util.Map
;
import
com.itextpdf.text.BaseColor
;
import
com.itextpdf.text.Document
;
import
com.itextpdf.text.PageSize
;
import
com.itextpdf.text.pdf.BaseFont
;
import
org.apache.commons.codec.binary.Base64
;
import
org.xhtmlrenderer.pdf.ITextFontResolver
;
import
org.xhtmlrenderer.pdf.ITextRenderer
;
import
sun.misc.BASE64Decoder
;
import
java.io.*
;
import
java.util.Map
;
public
class
Html2Pdf
{
public
static
String
htmlTopdf
(
String
htmlContent
,
String
fontPath
)
throws
Exception
{
public
static
String
htmlTopdf
(
String
htmlContent
,
String
fontPath
)
throws
Exception
{
ByteArrayOutputStream
byteArrayOutputStream
=
null
;
InputStream
sbs
=
null
;
try
{
try
{
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
ITextRenderer
renderer
=
new
ITextRenderer
();
ITextFontResolver
font
=
renderer
.
getFontResolver
();
...
...
@@ -28,12 +22,12 @@ public class Html2Pdf {
renderer
.
layout
();
renderer
.
createPDF
(
byteArrayOutputStream
);
renderer
.
finishPDF
();
byte
[]
buffer
=
byteArrayOutputStream
.
toByteArray
();
byte
[]
buffer
=
byteArrayOutputStream
.
toByteArray
();
sbs
=
new
ByteArrayInputStream
(
buffer
);
return
getBase64FromInputStream
(
sbs
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
}
finally
{
if
(
byteArrayOutputStream
!=
null
)
{
try
{
byteArrayOutputStream
.
close
();
...
...
@@ -49,7 +43,8 @@ public class Html2Pdf {
}
return
null
;
}
public
static
byte
[]
htmlToPdfByte
(
String
htmlContent
,
String
fontPath
){
public
static
byte
[]
htmlToPdfByte
(
String
htmlContent
,
String
fontPath
)
{
ByteArrayOutputStream
byteArrayOutputStream
=
null
;
try
{
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
...
...
@@ -60,9 +55,9 @@ public class Html2Pdf {
renderer
.
layout
();
renderer
.
createPDF
(
byteArrayOutputStream
);
renderer
.
finishPDF
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
}
finally
{
if
(
byteArrayOutputStream
!=
null
)
{
try
{
byteArrayOutputStream
.
close
();
...
...
@@ -72,6 +67,7 @@ public class Html2Pdf {
}
return
byteArrayOutputStream
.
toByteArray
();
}
public
static
String
getBase64FromInputStream
(
InputStream
in
)
{
// 将图片文件转化为字节数组字符串,并对其进行Base64编码处理
byte
[]
data
=
null
;
...
...
@@ -99,37 +95,35 @@ public class Html2Pdf {
}
public
static
void
saveBase64strToFile
(
String
base64str
,
String
outPath
)
{
public
static
void
saveBase64strToFile
(
String
base64str
,
String
outPath
)
{
createFile
(
new
File
(
outPath
));
if
(
base64str
==
null
){
return
;
if
(
base64str
==
null
)
{
return
;
}
BASE64Decoder
decoder
=
new
BASE64Decoder
();
try
{
try
{
byte
[]
b
=
decoder
.
decodeBuffer
(
base64str
);
for
(
int
i
=
0
;
i
<
b
.
length
;++
i
)
{
if
(
b
[
i
]<
0
){
b
[
i
]+=
256
;
for
(
int
i
=
0
;
i
<
b
.
length
;
++
i
)
{
if
(
b
[
i
]
<
0
)
{
b
[
i
]
+=
256
;
}
}
OutputStream
out
=
new
FileOutputStream
(
outPath
);
out
.
write
(
b
);
out
.
flush
();
out
.
close
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
public
static
String
replaceContent
(
String
htmlContent
,
Map
<
String
,
String
>
map
)
{
public
static
String
replaceContent
(
String
htmlContent
,
Map
<
String
,
String
>
map
)
{
for
(
Map
.
Entry
<
String
,
String
>
entry
:
map
.
entrySet
())
{
htmlContent
=
htmlContent
.
replaceAll
(
entry
.
getKey
()
,
entry
.
getValue
());
htmlContent
=
htmlContent
.
replaceAll
(
entry
.
getKey
(),
entry
.
getValue
());
}
return
htmlContent
;
}
public
static
void
createFile
(
File
file
)
{
if
(
file
.
exists
())
{
System
.
out
.
println
(
"File exists"
);
...
...
@@ -150,21 +144,21 @@ public class Html2Pdf {
}
}
public
static
void
outFile
(
InputStream
input
,
String
outPath
)
{
public
static
void
outFile
(
InputStream
input
,
String
outPath
)
{
createFile
(
new
File
(
outPath
));
BufferedInputStream
in
=
null
;
BufferedOutputStream
out
=
null
;
BufferedInputStream
in
=
null
;
BufferedOutputStream
out
=
null
;
try
{
in
=
new
BufferedInputStream
(
input
);
out
=
new
BufferedOutputStream
(
new
FileOutputStream
(
outPath
));
int
len
=
-
1
;
byte
[]
b
=
new
byte
[
1024
];
while
((
len
=
in
.
read
(
b
))!=-
1
)
{
out
.
write
(
b
,
0
,
len
);
in
=
new
BufferedInputStream
(
input
);
out
=
new
BufferedOutputStream
(
new
FileOutputStream
(
outPath
));
int
len
=
-
1
;
byte
[]
b
=
new
byte
[
1024
];
while
((
len
=
in
.
read
(
b
))
!=
-
1
)
{
out
.
write
(
b
,
0
,
len
);
}
in
.
close
();
out
.
close
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
}
}
...
...
C02-system/pps-core-system/pom.xml
View file @
95612579
...
...
@@ -54,15 +54,15 @@
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
<version>
1.2.70
</version>
<version>
2.0.32
</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>gf</groupId>-->
<!-- <artifactId>fiybook-cloud</artifactId>-->
<!-- <version>1.0.0-pps</version>-->
<!-- <scope>compile</scope>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>gf</groupId>-->
<!-- <artifactId>fiybook-cloud</artifactId>-->
<!-- <version>1.0.0-pps</version>-->
<!-- <scope>compile</scope>-->
<!-- </dependency>-->
</dependencies>
<build>
<plugins>
...
...
@@ -112,5 +112,10 @@
<enabled>
true
</enabled>
</releases>
</repository>
<repository>
<id>
maven_central
</id>
<name>
Maven Central
</name>
<url>
https://repo.maven.apache.org/maven2/
</url>
</repository>
</repositories>
</project>
D03-deploy/deploy-pps-prediction/src/main/java/app/DeployPpsPredictionApplication.java
View file @
95612579
...
...
@@ -33,8 +33,8 @@ public class DeployPpsPredictionApplication {
startup
.
enable
(
XRpcFeature
.
class
);
startup
.
enable
(
XCloudHuaweiCseFeature
.
class
)
.
config
(
XCloudBundlesConf
.
with
(
XCloudBundle
.
naming
(
"pps-
base-info
"
).
addModule
(
"pps"
,
"cloud"
,
"system"
),
XCloudBundle
.
naming
(
"pps-base
-info
"
).
addModule
(
"pps"
,
"cloud"
,
"base"
),
XCloudBundle
.
naming
(
"pps-
system
"
).
addModule
(
"pps"
,
"cloud"
,
"system"
),
XCloudBundle
.
naming
(
"pps-base"
).
addModule
(
"pps"
,
"cloud"
,
"base"
),
XCloudBundle
.
naming
(
"pps-space"
).
addModule
(
"pps"
,
"cloud"
,
"space"
)
));
startup
.
run
(
args
);
...
...
D03-deploy/deploy-pps-space/src/main/java/app/DeployPpsSpaceApplication.java
View file @
95612579
...
...
@@ -33,8 +33,8 @@ public class DeployPpsSpaceApplication {
startup
.
enable
(
XRpcFeature
.
class
);
startup
.
enable
(
XCloudHuaweiCseFeature
.
class
)
.
config
(
XCloudBundlesConf
.
with
(
XCloudBundle
.
naming
(
"pps-base
-info
"
).
addModule
(
"pps"
,
"cloud"
,
"base"
),
XCloudBundle
.
naming
(
"pps-
base-info
"
).
addModule
(
"pps"
,
"cloud"
,
"system"
),
XCloudBundle
.
naming
(
"pps-base"
).
addModule
(
"pps"
,
"cloud"
,
"base"
),
XCloudBundle
.
naming
(
"pps-
system
"
).
addModule
(
"pps"
,
"cloud"
,
"system"
),
XCloudBundle
.
naming
(
"pps-prediction"
).
addModule
(
"pps"
,
"cloud"
,
"prediction"
)
)
);
...
...
D03-deploy/deploy-pps-system/src/main/java/app/DeployPpsSystemApplication.java
View file @
95612579
...
...
@@ -24,7 +24,7 @@ public class DeployPpsSystemApplication {
public
static
void
main
(
String
...
args
)
{
CounterBuilder
.
globalCounterBuilder
.
setFieldValue
(
CounterBuilder
.
DEPLOY_KEY
,
DeployPpsSystemApplication
.
class
.
getSimpleName
());
XStartup
startup
=
new
XStartupApplication
(
"pps"
);
startup
.
config
(
new
XServerConf
(
22061
).
naming
(
"pps-
base-info
"
))
startup
.
config
(
new
XServerConf
(
22061
).
naming
(
"pps-
system
"
))
.
config
(
new
XServiceConf
(
"pps"
));
startup
.
enable
(
XApiFeature
.
class
)
.
config
(
new
XApiCookieConf
(
"%4bH8s9&"
,
43200
));
...
...
D03-deploy/deploy-pps-task/src/main/java/app/DeployPpsTaskApplication.java
View file @
95612579
...
...
@@ -43,8 +43,8 @@ public class DeployPpsTaskApplication {
startup
.
enable
(
XRpcFeature
.
class
);
startup
.
enable
(
XCloudHuaweiCseFeature
.
class
)
.
config
(
XCloudBundlesConf
.
with
(
XCloudBundle
.
naming
(
"pps-
base-info
"
).
addModule
(
"pps"
,
"cloud"
,
"system"
),
XCloudBundle
.
naming
(
"pps-base
-info
"
).
addModule
(
"pps"
,
"cloud"
,
"base"
),
XCloudBundle
.
naming
(
"pps-
system
"
).
addModule
(
"pps"
,
"cloud"
,
"system"
),
XCloudBundle
.
naming
(
"pps-base"
).
addModule
(
"pps"
,
"cloud"
,
"base"
),
XCloudBundle
.
naming
(
"pps-prediction"
).
addModule
(
"pps"
,
"cloud"
,
"prediction"
),
XCloudBundle
.
naming
(
"pps-space"
).
addModule
(
"pps"
,
"cloud"
,
"space"
)
));
...
...
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