Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
certificate-print
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
廖旭伟
certificate-print
Commits
12cb4438
Commit
12cb4438
authored
Mar 29, 2023
by
廖旭伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加二维码控件
parent
ebb4b7b1
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
686 additions
and
12 deletions
+686
-12
certificate-manager/pom.xml
certificate-manager/pom.xml
+6
-1
certificate-manager/src/main/java/com/mortals/xhx/common/code/ComponentEnum.java
.../main/java/com/mortals/xhx/common/code/ComponentEnum.java
+2
-1
certificate-manager/src/main/java/com/mortals/xhx/common/formdesign/DesignComponent.java
...va/com/mortals/xhx/common/formdesign/DesignComponent.java
+3
-0
certificate-manager/src/main/java/com/mortals/xhx/common/formdesign/component/DesignQrcodeComponent.java
...hx/common/formdesign/component/DesignQrcodeComponent.java
+55
-0
certificate-manager/src/main/java/com/mortals/xhx/common/utils/QrCodeUtil.java
...rc/main/java/com/mortals/xhx/common/utils/QrCodeUtil.java
+420
-0
certificate-manager/src/main/java/com/mortals/xhx/module/business/service/impl/BusinessLicenseServiceImpl.java
...ule/business/service/impl/BusinessLicenseServiceImpl.java
+175
-6
certificate-manager/src/main/java/com/mortals/xhx/module/record/service/impl/ApplyLogServiceImpl.java
...s/xhx/module/record/service/impl/ApplyLogServiceImpl.java
+25
-4
No files found.
certificate-manager/pom.xml
View file @
12cb4438
...
@@ -178,7 +178,12 @@
...
@@ -178,7 +178,12 @@
<artifactId>
hutool-all
</artifactId>
<artifactId>
hutool-all
</artifactId>
<version>
5.7.14
</version>
<version>
5.7.14
</version>
</dependency>
</dependency>
</dependencies>
<dependency>
<groupId>
com.google.zxing
</groupId>
<artifactId>
javase
</artifactId>
<version>
3.4.1
</version>
</dependency>
</dependencies>
<build>
<build>
<resources>
<resources>
...
...
certificate-manager/src/main/java/com/mortals/xhx/common/code/ComponentEnum.java
View file @
12cb4438
...
@@ -18,7 +18,8 @@ public enum ComponentEnum {
...
@@ -18,7 +18,8 @@ public enum ComponentEnum {
DATE
(
"date"
,
"日期选择栏"
),
DATE
(
"date"
,
"日期选择栏"
),
AREA
(
"area"
,
"区域选择栏"
),
AREA
(
"area"
,
"区域选择栏"
),
IMAGE
(
"@image"
,
"图片选择"
),
IMAGE
(
"@image"
,
"图片选择"
),
DYNAMIC_TABLE
(
"dt"
,
"动态表格"
);
DYNAMIC_TABLE
(
"dt"
,
"动态表格"
),
QRCODE
(
"@qrcode"
,
"二维码输入框"
);
private
String
value
;
private
String
value
;
private
String
desc
;
private
String
desc
;
...
...
certificate-manager/src/main/java/com/mortals/xhx/common/formdesign/DesignComponent.java
View file @
12cb4438
...
@@ -42,6 +42,9 @@ public abstract class DesignComponent {
...
@@ -42,6 +42,9 @@ public abstract class DesignComponent {
// else if (type.equals(ComponentEnum.AREA.getValue())) {
// else if (type.equals(ComponentEnum.AREA.getValue())) {
// return new AreaComponent(type);
// return new AreaComponent(type);
// }
// }
else
if
(
type
.
equals
(
ComponentEnum
.
QRCODE
.
getValue
()))
{
return
new
DesignQrcodeComponent
(
type
);
}
else
{
else
{
throw
new
AppException
(
String
.
format
(
"不支持当前组件类型,Type:%s"
,
type
));
throw
new
AppException
(
String
.
format
(
"不支持当前组件类型,Type:%s"
,
type
));
}
}
...
...
certificate-manager/src/main/java/com/mortals/xhx/common/formdesign/component/DesignQrcodeComponent.java
0 → 100644
View file @
12cb4438
package
com.mortals.xhx.common.formdesign.component
;
import
com.google.common.collect.Lists
;
import
com.mortals.xhx.common.code.ComponentEnum
;
import
com.mortals.xhx.common.formdesign.DesignComponent
;
import
com.mortals.xhx.common.formdesign.ListItem
;
import
com.mortals.xhx.common.pdu.gen.component.ComponentCons
;
/**
* 二维码输入框
*/
public
class
DesignQrcodeComponent
extends
DesignComponent
{
public
DesignQrcodeComponent
(
String
type
)
{
super
(
type
);
}
@Override
public
ListItem
buildDefaultComponent
(
ComponentCons
cons
)
{
ListItem
columnsItem
=
new
ListItem
();
columnsItem
.
setId
(
cons
.
getVal
());
columnsItem
.
set_id
(
cons
.
getVal
());
columnsItem
.
setCompType
(
"input"
);
columnsItem
.
setCompName
(
cons
.
getLabel
());
columnsItem
.
setCompIcon
(
"input"
);
columnsItem
.
setEle
(
"el-input"
);
columnsItem
.
setViewType
(
"text"
);
columnsItem
.
setConfig
(
true
);
columnsItem
.
setShowLabel
(
true
);
columnsItem
.
setLabel
(
cons
.
getLabel
());
columnsItem
.
setLabelWidth
(
120
);
columnsItem
.
setPlaceholder
(
"请输入"
+
cons
.
getLabel
());
columnsItem
.
setRequired
(
true
);
columnsItem
.
setMaxLength
(
50
);
columnsItem
.
setGutter
(
15
);
columnsItem
.
setSpan
(
24
);
columnsItem
.
setWidth
(
"100%"
);
columnsItem
.
setClearable
(
true
);
columnsItem
.
setDisabled
(
false
);
columnsItem
.
setReadonly
(
false
);
columnsItem
.
setStatus
(
"normal"
);
columnsItem
.
setPrefixIcon
(
""
);
columnsItem
.
setRules
(
Lists
.
newArrayList
());
columnsItem
.
setRulesType
(
"default"
);
columnsItem
.
setAppend
(
""
);
columnsItem
.
setPrepend
(
""
);
columnsItem
.
setLayout
(
"colItem"
);
return
columnsItem
;
}
@Override
public
String
getType
()
{
return
ComponentEnum
.
QRCODE
.
getValue
();
}
}
certificate-manager/src/main/java/com/mortals/xhx/common/utils/QrCodeUtil.java
0 → 100644
View file @
12cb4438
package
com.mortals.xhx.common.utils
;
import
cn.hutool.core.codec.Base64
;
import
cn.hutool.core.util.StrUtil
;
import
com.google.zxing.BarcodeFormat
;
import
com.google.zxing.EncodeHintType
;
import
com.google.zxing.MultiFormatWriter
;
import
com.google.zxing.client.j2se.MatrixToImageWriter
;
import
com.google.zxing.common.BitMatrix
;
import
com.google.zxing.oned.Code128Writer
;
import
com.google.zxing.qrcode.QRCodeWriter
;
import
com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
;
import
com.mortals.framework.util.StringUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
javax.imageio.ImageIO
;
import
javax.servlet.http.HttpServletResponse
;
import
java.awt.*
;
import
java.awt.font.TextAttribute
;
import
java.awt.image.BufferedImage
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author:
* @date: 2022/12/27 20:26
*/
@Slf4j
public
class
QrCodeUtil
{
/**
* 默认宽度
*/
private
static
final
int
WIDTH
=
300
;
/**
* 默认高度
*/
private
static
final
int
HEIGHT
=
300
;
/**
* 默认文件格式
*/
private
static
final
String
FORMAT
=
"png"
;
/**
* 条形码宽度
*/
private
static
final
int
QR_WIDTH
=
106
;
/**
* 条形码高度
*/
private
static
final
int
QR_HEIGHT
=
75
;
/**
* 加文字 条形码
*/
private
static
final
int
WORDHEIGHT
=
240
;
/**
* 一些默认参数
*/
private
static
final
Map
<
EncodeHintType
,
Object
>
HINTS
=
new
HashMap
();
static
{
// 字符编码
HINTS
.
put
(
EncodeHintType
.
CHARACTER_SET
,
"utf-8"
);
// 容错等级 L、M、Q、H 其中 L 为最低, H 为最高
HINTS
.
put
(
EncodeHintType
.
ERROR_CORRECTION
,
ErrorCorrectionLevel
.
H
);
// 二维码与图片边距
HINTS
.
put
(
EncodeHintType
.
MARGIN
,
2
);
}
/**
* 生成 图片缓冲
*
* @param vaNumber VA 码
* @return 返回BufferedImage
* @author fxbin
*/
public
static
BufferedImage
getBarCode
(
String
vaNumber
)
{
Code128Writer
writer
=
new
Code128Writer
();
//为了无边距,需设置宽度为条码自动生成规则的宽度
int
width
=
writer
.
encode
(
vaNumber
).
length
;
//条码放大倍数
int
codeMultiples
=
1
;
//获取条码内容的宽,不含两边距,当EncodeHintType.MARGIN为0时即为条码宽度
int
codeWidth
=
width
*
codeMultiples
;
int
height
=
(
int
)
(
width
*
0.7
);
try
{
// 编码内容, 编码类型, 宽度, 高度, 设置参数
BitMatrix
bitMatrix
=
writer
.
encode
(
vaNumber
,
BarcodeFormat
.
CODE_128
,
codeWidth
,
height
,
HINTS
);
return
MatrixToImageWriter
.
toBufferedImage
(
bitMatrix
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
/**
* 生成图片的条形码
*
* @param content 内容
* @param paths 路径
*/
public
static
void
generateBarCodeFile
(
String
content
,
String
paths
)
{
Code128Writer
writer
=
new
Code128Writer
();
BitMatrix
bitMatrix
=
writer
.
encode
(
content
,
BarcodeFormat
.
CODE_128
,
WIDTH
,
QR_HEIGHT
,
HINTS
);
Path
path
=
Paths
.
get
(
paths
);
if
(!
StrUtil
.
isEmpty
(
content
))
{
try
{
MatrixToImageWriter
.
writeToPath
(
bitMatrix
,
FORMAT
,
path
);
}
catch
(
IOException
e
)
{
log
.
error
(
"生成条形码失败:{}"
,
e
.
getMessage
());
}
}
}
/**
* 生成文件流的条形码
*
* @param content 内容
* @param response 响应体
* @return 流
*/
public
static
OutputStream
generateBarCodeStream
(
String
content
,
HttpServletResponse
response
)
{
Code128Writer
writer
=
new
Code128Writer
();
OutputStream
outputStream
=
null
;
BitMatrix
bitMatrix
=
writer
.
encode
(
content
,
BarcodeFormat
.
CODE_128
,
WIDTH
,
QR_HEIGHT
,
HINTS
);
if
(!
StrUtil
.
isEmpty
(
content
))
{
try
{
// 字节输出流
outputStream
=
response
.
getOutputStream
();
MatrixToImageWriter
.
writeToStream
(
bitMatrix
,
FORMAT
,
outputStream
);
return
outputStream
;
}
catch
(
IOException
e
)
{
log
.
error
(
"生成条形码失败:{}"
,
e
.
getMessage
());
}
finally
{
if
(
outputStream
!=
null
)
{
try
{
outputStream
.
close
();
}
catch
(
IOException
e
)
{
log
.
error
(
"流关闭失败:{}"
,
e
.
getMessage
());
}
}
}
}
return
null
;
}
/**
* 把带logo的二维码下面加上文字
*
* @param image 条形码图片
* @param words 文字
* @return 返回BufferedImage
* @author fxbin
*/
public
static
BufferedImage
insertWords
(
BufferedImage
image
,
String
words
)
{
// 新的图片,把带logo的二维码下面加上文字
if
(
StringUtils
.
isNotEmpty
(
words
))
{
int
width
=
image
.
getWidth
();
int
height
=
(
int
)
(
width
*
0.7
);
Map
<
TextAttribute
,
Object
>
hm
=
new
HashMap
<>();
hm
.
put
(
TextAttribute
.
WEIGHT
,
TextAttribute
.
WEIGHT_BOLD
);
// 定义加粗
hm
.
put
(
TextAttribute
.
SIZE
,
12
);
// 定义字号
hm
.
put
(
TextAttribute
.
FAMILY
,
"微软雅黑"
);
// 定义字体名
Font
font
=
new
Font
(
hm
);
Graphics2D
graphics
=
image
.
createGraphics
();
graphics
.
setFont
(
font
);
int
fontHeight
=
graphics
.
getFontMetrics
().
getHeight
();
int
totalHeight
=
height
+
fontHeight
;
graphics
.
dispose
();
BufferedImage
outImage
=
new
BufferedImage
(
width
,
totalHeight
,
BufferedImage
.
TYPE_INT_RGB
);
Graphics2D
g2d
=
outImage
.
createGraphics
();
// 抗锯齿
setGraphics2D
(
g2d
);
// 设置白色
setColorWhite
(
g2d
);
// 画条形码到新的面板
g2d
.
drawImage
(
image
,
0
,
0
,
image
.
getWidth
(),
image
.
getHeight
(),
null
);
// 画文字到新的面板
Color
color
=
new
Color
(
0
,
0
,
0
);
g2d
.
setColor
(
color
);
// 字体、字型、字号
g2d
.
setFont
(
font
);
//todo 文字换行显示,需要重新计算高度
/* FontMetrics fontMetrics = g2d.getFontMetrics();
int strWidth = fontMetrics.stringWidth(words);
//测量是否需要换行
StringBuilder sb = new StringBuilder();
int textLength = words.length();
int totalWidth = fontMetrics.stringWidth(words); //文本的总长度,用于判断是否超出了范围
if (totalWidth > width) {
int nowWidth = 0; //目前一行写的长度
//遍历当前文本行
for (int i = 0; i < textLength; i++) {
sb.append(words.charAt(i));
int oneWordWidth = fontMetrics.charWidth(words.charAt(i)); //获取单个字符的长度
int tempWidth = oneWordWidth + nowWidth; //判断目前的一行加上这个字符的长度是否超出了总长度
if (tempWidth > width) {
//如果超出了一行的总长度,则要换成下一行 并画当前行
//int writeY = y + alreadyWriteLine * (textHeight + heightSpace);
y = drawAlignString(graphics2D, sb.toString(), align, x, y, lineWidth, lineHeight, tempWidth);
sb = new StringBuilder();
nowWidth = 0;
} else {
nowWidth = tempWidth;
}
}
}*/
//文字长度
int
strWidth
=
g2d
.
getFontMetrics
().
stringWidth
(
words
);
//总长度减去文字长度的一半 (居中显示)
int
wordStartX
=
(
width
-
strWidth
)
/
2
;
//height + (outImage.getHeight() - height) / 2 + 12
int
wordStartY
=
height
+
15
;
// 画文字
g2d
.
drawString
(
words
,
wordStartX
,
wordStartY
);
g2d
.
dispose
();
outImage
.
flush
();
return
outImage
;
}
return
null
;
}
/**
* 设置 Graphics2D 属性 (抗锯齿)
*
* @param g2d Graphics2D提供对几何形状、坐标转换、颜色管理和文本布局更为复杂的控制
*/
private
static
void
setGraphics2D
(
Graphics2D
g2d
)
{
g2d
.
setRenderingHint
(
RenderingHints
.
KEY_ANTIALIASING
,
RenderingHints
.
VALUE_ANTIALIAS_ON
);
g2d
.
setRenderingHint
(
RenderingHints
.
KEY_STROKE_CONTROL
,
RenderingHints
.
VALUE_STROKE_DEFAULT
);
Stroke
s
=
new
BasicStroke
(
1
,
BasicStroke
.
CAP_ROUND
,
BasicStroke
.
JOIN_MITER
);
g2d
.
setStroke
(
s
);
}
/**
* 设置背景为白色
*
* @param g2d Graphics2D提供对几何形状、坐标转换、颜色管理和文本布局更为复杂的控制
*/
private
static
void
setColorWhite
(
Graphics2D
g2d
)
{
g2d
.
setColor
(
Color
.
white
);
g2d
.
fillRect
(
0
,
0
,
600
,
600
);
//g2d.setBackground(new Color(255, 255, 255));
//设置笔刷
g2d
.
setColor
(
Color
.
BLACK
);
}
/**
* 生成base64的二维码
*
* @param content 内容
* @return base64二维码
*/
public
static
String
generateBarCodeBase64
(
String
content
)
{
String
base64
;
ByteArrayOutputStream
os
=
new
ByteArrayOutputStream
();
Code128Writer
writer
=
new
Code128Writer
();
BitMatrix
bitMatrix
=
writer
.
encode
(
content
,
BarcodeFormat
.
CODE_128
,
WIDTH
,
HEIGHT
,
HINTS
);
if
(!
StrUtil
.
isEmpty
(
content
))
{
try
{
BufferedImage
bufferedImage
=
MatrixToImageWriter
.
toBufferedImage
(
bitMatrix
);
ImageIO
.
write
(
bufferedImage
,
FORMAT
,
os
);
base64
=
Base64
.
encode
(
os
.
toByteArray
());
return
base64
;
}
catch
(
Exception
e
)
{
log
.
error
(
"生成二维码失败:{}"
,
e
.
getMessage
());
}
finally
{
try
{
os
.
flush
();
os
.
close
();
}
catch
(
IOException
e
)
{
log
.
error
(
"流关闭失败:{}"
,
e
.
getMessage
());
}
}
}
return
null
;
}
/**
* 生成图片的二维码
*
* @param content 内容
*/
public
static
BufferedImage
generateQrCode
(
String
content
,
int
width
)
{
MultiFormatWriter
writer
=
new
MultiFormatWriter
();
if
(!
StrUtil
.
isEmpty
(
content
))
{
try
{
BitMatrix
bitMatrix
=
writer
.
encode
(
content
,
BarcodeFormat
.
QR_CODE
,
width
,
width
,
HINTS
);
return
MatrixToImageWriter
.
toBufferedImage
(
bitMatrix
);
}
catch
(
Exception
e
)
{
log
.
error
(
"生成二维码失败:{}"
,
e
.
getMessage
());
}
}
return
null
;
}
/**
* 生成图片的二维码
*
* @param content 内容
* @param paths 路径
*/
public
static
void
generateQrCodeFile
(
String
content
,
String
paths
)
{
MultiFormatWriter
writer
=
new
MultiFormatWriter
();
if
(!
StrUtil
.
isEmpty
(
content
))
{
try
{
// 字节输出流
BitMatrix
bitMatrix
=
writer
.
encode
(
content
,
BarcodeFormat
.
QR_CODE
,
WIDTH
,
HEIGHT
,
HINTS
);
Path
path
=
Paths
.
get
(
paths
);
MatrixToImageWriter
.
writeToPath
(
bitMatrix
,
FORMAT
,
path
);
}
catch
(
Exception
e
)
{
log
.
error
(
"生成二维码失败:{}"
,
e
.
getMessage
());
}
}
}
/**
* 生成文件流的二维码
*
* @param content 内容
* @param response 响应体
* @return 流
*/
public
static
OutputStream
generateQrCodeStream
(
String
content
,
HttpServletResponse
response
)
{
MultiFormatWriter
writer
=
new
MultiFormatWriter
();
OutputStream
outputStream
=
null
;
if
(!
StrUtil
.
isEmpty
(
content
))
{
try
{
// 字节输出流
BitMatrix
bitMatrix
=
writer
.
encode
(
content
,
BarcodeFormat
.
QR_CODE
,
WIDTH
,
HEIGHT
,
HINTS
);
outputStream
=
response
.
getOutputStream
();
MatrixToImageWriter
.
writeToStream
(
bitMatrix
,
FORMAT
,
outputStream
);
return
outputStream
;
}
catch
(
Exception
e
)
{
log
.
error
(
"生成二维码失败:{}"
,
e
.
getMessage
());
}
finally
{
if
(
outputStream
!=
null
)
{
try
{
outputStream
.
close
();
}
catch
(
IOException
e
)
{
log
.
error
(
"流关闭失败:{}"
,
e
.
getMessage
());
}
}
}
}
return
null
;
}
/**
* 生成base64的二维码
*
* @param content 内容
* @return base64二维码
*/
public
static
String
generateQrCodeBase64
(
String
content
)
{
String
base64
;
ByteArrayOutputStream
os
=
new
ByteArrayOutputStream
();
if
(!
StrUtil
.
isEmpty
(
content
))
{
try
{
QRCodeWriter
writer
=
new
QRCodeWriter
();
BitMatrix
bitMatrix
=
writer
.
encode
(
content
,
BarcodeFormat
.
QR_CODE
,
WIDTH
,
HEIGHT
,
HINTS
);
BufferedImage
bufferedImage
=
MatrixToImageWriter
.
toBufferedImage
(
bitMatrix
);
ImageIO
.
write
(
bufferedImage
,
FORMAT
,
os
);
base64
=
Base64
.
encode
(
os
.
toByteArray
());
return
base64
;
}
catch
(
Exception
e
)
{
log
.
error
(
"生成二维码失败:{}"
,
e
.
getMessage
());
}
finally
{
try
{
os
.
flush
();
os
.
close
();
}
catch
(
IOException
e
)
{
log
.
error
(
"流关闭失败:{}"
,
e
.
getMessage
());
}
}
}
return
null
;
}
public
static
void
main
(
String
[]
args
)
throws
IOException
{
//QrCodeUtil.generateBarCodeFile("2004171839281004aadddfffffddffgfggf", "E:\\pic\\jpg\\1.png");
// BufferedImage barCode = QrCodeUtil.getBarCode("123456789123456789");
// BufferedImage bufferedImage = QrCodeUtil.insertWords(barCode, "891234567891234567");
// ImageIO.write(bufferedImage,"png",new File("D:\\mortals\\app\\data\\test\\123.png"));
QrCodeUtil
.
generateQrCodeFile
(
"https://pics7.baidu.com/feed/cc11728b4710b9127b860294afb21408934522f4.jpeg@f_auto?token=6ef8230f0103fcd054294bff35ff9292"
,
"D:\\mortals\\app\\data\\test\\789.png"
);
}
}
\ No newline at end of file
certificate-manager/src/main/java/com/mortals/xhx/module/business/service/impl/BusinessLicenseServiceImpl.java
View file @
12cb4438
...
@@ -6,6 +6,7 @@ import com.mortals.framework.common.code.TaskExcuteStrategy;
...
@@ -6,6 +6,7 @@ import com.mortals.framework.common.code.TaskExcuteStrategy;
import
com.mortals.framework.common.code.TaskInterimExcuteStatus
;
import
com.mortals.framework.common.code.TaskInterimExcuteStatus
;
import
com.mortals.framework.service.ITaskExcuteService
;
import
com.mortals.framework.service.ITaskExcuteService
;
import
com.mortals.framework.springcloud.service.IApplicationStartedService
;
import
com.mortals.framework.springcloud.service.IApplicationStartedService
;
import
com.mortals.framework.util.DataUtil
;
import
com.mortals.framework.util.DateUtils
;
import
com.mortals.framework.util.DateUtils
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.framework.util.SystemUtil
;
import
com.mortals.framework.util.SystemUtil
;
...
@@ -42,18 +43,25 @@ import java.util.concurrent.Executors;
...
@@ -42,18 +43,25 @@ import java.util.concurrent.Executors;
@Service
(
"businessLicenseService"
)
@Service
(
"businessLicenseService"
)
public
class
BusinessLicenseServiceImpl
extends
AbstractCRUDServiceImpl
<
BusinessLicenseDao
,
BusinessLicenseEntity
,
Long
>
implements
BusinessLicenseService
{
public
class
BusinessLicenseServiceImpl
extends
AbstractCRUDServiceImpl
<
BusinessLicenseDao
,
BusinessLicenseEntity
,
Long
>
implements
BusinessLicenseService
{
/** 营业执照目录(内资公司)id*/
@Value
(
"${catalog.business.nzgs:1}"
)
private
long
nzgs
;
/** 营业执照目录(内资分公司)id*/
@Value
(
"${catalog.business.nzgs:2}"
)
private
long
nzgfs
;
/** 营业执照目录(个人)id*/
/** 营业执照目录(个人)id*/
@Value
(
"${catalog.business.personal:
1
}"
)
@Value
(
"${catalog.business.personal:
3
}"
)
private
long
personal
;
private
long
personal
;
/** 营业执照目录(有限责任公司)id*/
/** 营业执照目录(有限责任公司)id*/
@Value
(
"${catalog.business.liabilityCompany:
2
}"
)
@Value
(
"${catalog.business.liabilityCompany:
4
}"
)
private
long
liabilityCompany
;
private
long
liabilityCompany
;
/** 营业执照目录(股份有限公司)id*/
/** 营业执照目录(股份有限公司)id*/
@Value
(
"${catalog.business.stockCompany:
3
}"
)
@Value
(
"${catalog.business.stockCompany:
5
}"
)
private
long
stockCompany
;
private
long
stockCompany
;
@Autowired
@Autowired
private
ApplyLogService
applyLogService
;
private
ApplyLogService
applyLogService
;
...
@@ -80,26 +88,61 @@ public class BusinessLicenseServiceImpl extends AbstractCRUDServiceImpl<Business
...
@@ -80,26 +88,61 @@ public class BusinessLicenseServiceImpl extends AbstractCRUDServiceImpl<Business
applyLogPdu
.
setHolderIDCardNo
(
businessLicenseEntity
.
getCredentialsCode
());
applyLogPdu
.
setHolderIDCardNo
(
businessLicenseEntity
.
getCredentialsCode
());
applyLogPdu
.
setEnterpriseName
(
businessLicenseEntity
.
getTypeSizeName
());
applyLogPdu
.
setEnterpriseName
(
businessLicenseEntity
.
getTypeSizeName
());
applyLogPdu
.
setPrivateID
(
"https://www.gsxt.gov.cn"
);
applyLogPdu
.
setPrivateID
(
"https://www.gsxt.gov.cn"
);
if
(
businessLicenseEntity
.
getComposingForm
().
indexOf
(
"个人经营"
)>
0
){
String
catalogType
=
""
;
if
(
businessLicenseEntity
.
getComposingForm
().
indexOf
(
"内资公司"
)>
0
){
applyLogPdu
.
setCatalogId
(
nzgs
);
catalogType
=
"nzgs"
;
applyLogPdu
.
setCertificateCode
(
businessLicenseEntity
.
getCredentialsCode
());
applyLogPdu
.
setCertificateName
(
businessLicenseEntity
.
getTypeSizeName
());
applyLogPdu
.
setHolderType
(
HolderType
.
PERSON
.
getValue
());
}
else
if
(
businessLicenseEntity
.
getComposingForm
().
indexOf
(
"内资分公司"
)>
0
){
applyLogPdu
.
setCatalogId
(
nzgfs
);
catalogType
=
"nzgfs"
;
applyLogPdu
.
setCertificateCode
(
businessLicenseEntity
.
getCredentialsCode
());
applyLogPdu
.
setCertificateName
(
businessLicenseEntity
.
getTypeSizeName
());
applyLogPdu
.
setHolderType
(
HolderType
.
PERSON
.
getValue
());
}
else
if
(
businessLicenseEntity
.
getComposingForm
().
indexOf
(
"个人经营"
)>
0
){
applyLogPdu
.
setCatalogId
(
personal
);
applyLogPdu
.
setCatalogId
(
personal
);
catalogType
=
"personal"
;
applyLogPdu
.
setCertificateCode
(
businessLicenseEntity
.
getCredentialsCode
());
applyLogPdu
.
setCertificateCode
(
businessLicenseEntity
.
getCredentialsCode
());
applyLogPdu
.
setCertificateName
(
businessLicenseEntity
.
getTypeSizeName
());
applyLogPdu
.
setCertificateName
(
businessLicenseEntity
.
getTypeSizeName
());
applyLogPdu
.
setHolderType
(
HolderType
.
PERSON
.
getValue
());
applyLogPdu
.
setHolderType
(
HolderType
.
PERSON
.
getValue
());
}
else
if
(
businessLicenseEntity
.
getComposingForm
().
indexOf
(
"有限责任公司"
)>
0
){
}
else
if
(
businessLicenseEntity
.
getComposingForm
().
indexOf
(
"有限责任公司"
)>
0
){
applyLogPdu
.
setCatalogId
(
liabilityCompany
);
applyLogPdu
.
setCatalogId
(
liabilityCompany
);
catalogType
=
"liabilityCompany"
;
applyLogPdu
.
setCertificateCode
(
businessLicenseEntity
.
getCredentialsCode
());
applyLogPdu
.
setCertificateCode
(
businessLicenseEntity
.
getCredentialsCode
());
applyLogPdu
.
setCertificateName
(
businessLicenseEntity
.
getTypeSizeName
());
applyLogPdu
.
setCertificateName
(
businessLicenseEntity
.
getTypeSizeName
());
applyLogPdu
.
setHolderType
(
HolderType
.
LEGAL
.
getValue
());
applyLogPdu
.
setHolderType
(
HolderType
.
LEGAL
.
getValue
());
//TODO
//TODO
}
else
if
(
businessLicenseEntity
.
getComposingForm
().
indexOf
(
"股份公司"
)>
0
){
}
else
if
(
businessLicenseEntity
.
getComposingForm
().
indexOf
(
"股份公司"
)>
0
){
applyLogPdu
.
setCatalogId
(
stockCompany
);
applyLogPdu
.
setCatalogId
(
stockCompany
);
catalogType
=
"stockCompany"
;
applyLogPdu
.
setCertificateCode
(
businessLicenseEntity
.
getCredentialsCode
());
applyLogPdu
.
setCertificateCode
(
businessLicenseEntity
.
getCredentialsCode
());
applyLogPdu
.
setCertificateName
(
businessLicenseEntity
.
getTypeSizeName
());
applyLogPdu
.
setCertificateName
(
businessLicenseEntity
.
getTypeSizeName
());
applyLogPdu
.
setHolderType
(
HolderType
.
LEGAL
.
getValue
());
applyLogPdu
.
setHolderType
(
HolderType
.
LEGAL
.
getValue
());
//TODO
//TODO
}
}
if
(
businessLicenseEntity
.
getDyZb
()==
1
)
{
if
(
businessLicenseEntity
.
getDyZb
()==
1
)
{
applyLogPdu
.
setFormContent
(
personalJson
(
businessLicenseEntity
,
1
));
switch
(
catalogType
){
case
"nzgs"
:
applyLogPdu
.
setFormContent
(
nzgsJson
(
businessLicenseEntity
,
1
));
break
;
case
"nzfgs"
:
applyLogPdu
.
setFormContent
(
nzfgsJson
(
businessLicenseEntity
,
1
));
break
;
case
"personal"
:
applyLogPdu
.
setFormContent
(
personalJson
(
businessLicenseEntity
,
1
));
break
;
case
"liabilityCompany"
:
applyLogPdu
.
setFormContent
(
liabilityCompanyJson
(
businessLicenseEntity
,
1
));
break
;
case
"stockCompany"
:
applyLogPdu
.
setFormContent
(
stockCompanyJson
(
businessLicenseEntity
,
1
));
break
;
default
:
applyLogPdu
.
setFormContent
(
personalJson
(
businessLicenseEntity
,
1
));
}
applyLogPdu
.
setCertificateName
(
applyLogPdu
.
getCertificateName
()+
"【营业执照正本】"
);
applyLogPdu
.
setCertificateName
(
applyLogPdu
.
getCertificateName
()+
"【营业执照正本】"
);
}
}
applyLogService
.
apiSaveApplyLog
(
applyLogPdu
);
applyLogService
.
apiSaveApplyLog
(
applyLogPdu
);
...
@@ -132,7 +175,7 @@ public class BusinessLicenseServiceImpl extends AbstractCRUDServiceImpl<Business
...
@@ -132,7 +175,7 @@ public class BusinessLicenseServiceImpl extends AbstractCRUDServiceImpl<Business
}
}
/**
/**
*
*
营业执照个体
* @param businessLicenseEntity
* @param businessLicenseEntity
* @param qrCodeType 1正本二维码 2副本二维码
* @param qrCodeType 1正本二维码 2副本二维码
* @return
* @return
...
@@ -165,4 +208,130 @@ public class BusinessLicenseServiceImpl extends AbstractCRUDServiceImpl<Business
...
@@ -165,4 +208,130 @@ public class BusinessLicenseServiceImpl extends AbstractCRUDServiceImpl<Business
return
formContent
.
toJSONString
();
return
formContent
.
toJSONString
();
}
}
/***
* 内资公司
* @param businessLicenseEntity
* @param qrCodeType
* @return
*/
private
String
nzgsJson
(
BusinessLicenseEntity
businessLicenseEntity
,
int
qrCodeType
){
JSONObject
formContent
=
new
JSONObject
();
formContent
.
put
(
"i_1_信用代码"
,
businessLicenseEntity
.
getBusinessLicense
());
formContent
.
put
(
"i_2_单位名称"
,
businessLicenseEntity
.
getTypeSizeName
());
formContent
.
put
(
"i_3_单位类型"
,
businessLicenseEntity
.
getComposingForm
());
formContent
.
put
(
"i_4_法定代表人"
,
businessLicenseEntity
.
getProprietorName
());
formContent
.
put
(
"i_10_注册资本"
,
businessLicenseEntity
.
getRegisteredCapital
());
String
zcrq
=
businessLicenseEntity
.
getStartDate
();
formContent
.
put
(
"i_5_成立日期"
,
zcrq
);
formContent
.
put
(
"i_6_住所"
,
businessLicenseEntity
.
getManageLocation
());
//formContent.put("i_8_登记机关","某某某市场监督管理局");
formContent
.
put
(
"i_7_年"
,
dateFromt
(
businessLicenseEntity
.
getStartDate
()).
get
(
"year"
));
formContent
.
put
(
"i_8_月"
,
dateFromt
(
businessLicenseEntity
.
getStartDate
()).
get
(
"month"
));
formContent
.
put
(
"i_9_日"
,
dateFromt
(
businessLicenseEntity
.
getStartDate
()).
get
(
"day"
));
formContent
.
put
(
"t_1_经营范围"
,
businessLicenseEntity
.
getManageRange
());
if
(
qrCodeType
==
1
)
{
formContent
.
put
(
"@image_1_二维码"
,
businessLicenseEntity
.
getQrCodeOriginalBase64
());
}
else
{
formContent
.
put
(
"@image_1_二维码"
,
businessLicenseEntity
.
getQrCodeDuplicateBase64
());
}
return
formContent
.
toJSONString
();
}
/***
* 内资分公司
* @param businessLicenseEntity
* @param qrCodeType
* @return
*/
private
String
nzfgsJson
(
BusinessLicenseEntity
businessLicenseEntity
,
int
qrCodeType
){
JSONObject
formContent
=
new
JSONObject
();
formContent
.
put
(
"i_1_信用代码"
,
businessLicenseEntity
.
getBusinessLicense
());
formContent
.
put
(
"i_2_单位名称"
,
businessLicenseEntity
.
getTypeSizeName
());
formContent
.
put
(
"i_3_单位类型"
,
businessLicenseEntity
.
getComposingForm
());
formContent
.
put
(
"i_4_负责人"
,
businessLicenseEntity
.
getProprietorName
());
String
zcrq
=
businessLicenseEntity
.
getStartDate
();
formContent
.
put
(
"i_5_成立日期"
,
zcrq
);
formContent
.
put
(
"i_6_经营场所"
,
businessLicenseEntity
.
getManageLocation
());
//formContent.put("i_8_登记机关","某某某市场监督管理局");
formContent
.
put
(
"i_7_年"
,
dateFromt
(
businessLicenseEntity
.
getStartDate
()).
get
(
"year"
));
formContent
.
put
(
"i_8_月"
,
dateFromt
(
businessLicenseEntity
.
getStartDate
()).
get
(
"month"
));
formContent
.
put
(
"i_9_日"
,
dateFromt
(
businessLicenseEntity
.
getStartDate
()).
get
(
"day"
));
formContent
.
put
(
"t_1_经营范围"
,
businessLicenseEntity
.
getManageRange
());
if
(
qrCodeType
==
1
)
{
formContent
.
put
(
"@image_1_二维码"
,
businessLicenseEntity
.
getQrCodeOriginalBase64
());
}
else
{
formContent
.
put
(
"@image_1_二维码"
,
businessLicenseEntity
.
getQrCodeDuplicateBase64
());
}
return
formContent
.
toJSONString
();
}
/**
* 营业执照(有限责任公司)
* @param businessLicenseEntity
* @param qrCodeType 1正本二维码 2副本二维码
* @return
*/
private
String
liabilityCompanyJson
(
BusinessLicenseEntity
businessLicenseEntity
,
int
qrCodeType
){
JSONObject
formContent
=
new
JSONObject
();
formContent
.
put
(
"i_1_执照编码"
,
businessLicenseEntity
.
getBusinessLicense
());
formContent
.
put
(
"i_2_单位名称"
,
businessLicenseEntity
.
getTypeSizeName
());
formContent
.
put
(
"i_3_单位类型"
,
"有限责任公司"
);
formContent
.
put
(
"i_4_法定代表人"
,
businessLicenseEntity
.
getProprietorName
());
formContent
.
put
(
"i_5_组成形式"
,
businessLicenseEntity
.
getComposingForm
());
String
zcrq
=
businessLicenseEntity
.
getStartDate
();
if
(
StringUtils
.
isNotEmpty
(
businessLicenseEntity
.
getEndDate
())){
zcrq
=
zcrq
+
" 至 "
+
businessLicenseEntity
.
getEndDate
();
}
else
{
zcrq
=
zcrq
+
" 至 长期"
;
}
formContent
.
put
(
"i_6_注册日期"
,
zcrq
);
formContent
.
put
(
"i_7_经营场所"
,
businessLicenseEntity
.
getManageLocation
());
formContent
.
put
(
"i_8_登记机关"
,
"某某某市场监督管理局"
);
formContent
.
put
(
"i_9_年"
,
dateFromt
(
businessLicenseEntity
.
getStartDate
()).
get
(
"year"
));
formContent
.
put
(
"i_10_月"
,
dateFromt
(
businessLicenseEntity
.
getStartDate
()).
get
(
"month"
));
formContent
.
put
(
"i_11_日"
,
dateFromt
(
businessLicenseEntity
.
getStartDate
()).
get
(
"day"
));
formContent
.
put
(
"t_1_经营范围"
,
businessLicenseEntity
.
getManageRange
());
if
(
qrCodeType
==
1
)
{
formContent
.
put
(
"@image_1_二维码"
,
businessLicenseEntity
.
getQrCodeOriginalBase64
());
}
else
{
formContent
.
put
(
"@image_1_二维码"
,
businessLicenseEntity
.
getQrCodeDuplicateBase64
());
}
return
formContent
.
toJSONString
();
}
/**
* 营业执照(股份有限公司)
* @param businessLicenseEntity
* @param qrCodeType 1正本二维码 2副本二维码
* @return
*/
private
String
stockCompanyJson
(
BusinessLicenseEntity
businessLicenseEntity
,
int
qrCodeType
){
JSONObject
formContent
=
new
JSONObject
();
formContent
.
put
(
"i_1_执照编码"
,
businessLicenseEntity
.
getBusinessLicense
());
formContent
.
put
(
"i_2_单位名称"
,
businessLicenseEntity
.
getTypeSizeName
());
formContent
.
put
(
"i_3_单位类型"
,
"个体工商户"
);
formContent
.
put
(
"i_4_经营者名称"
,
businessLicenseEntity
.
getProprietorName
());
formContent
.
put
(
"i_5_组成形式"
,
businessLicenseEntity
.
getComposingForm
());
String
zcrq
=
businessLicenseEntity
.
getStartDate
();
if
(
StringUtils
.
isNotEmpty
(
businessLicenseEntity
.
getEndDate
())){
zcrq
=
zcrq
+
" 至 "
+
businessLicenseEntity
.
getEndDate
();
}
else
{
zcrq
=
zcrq
+
" 至 长期"
;
}
formContent
.
put
(
"i_6_注册日期"
,
zcrq
);
formContent
.
put
(
"i_7_经营场所"
,
businessLicenseEntity
.
getManageLocation
());
formContent
.
put
(
"i_8_登记机关"
,
"某某某市场监督管理局"
);
formContent
.
put
(
"i_9_年"
,
dateFromt
(
businessLicenseEntity
.
getStartDate
()).
get
(
"year"
));
formContent
.
put
(
"i_10_月"
,
dateFromt
(
businessLicenseEntity
.
getStartDate
()).
get
(
"month"
));
formContent
.
put
(
"i_11_日"
,
dateFromt
(
businessLicenseEntity
.
getStartDate
()).
get
(
"day"
));
formContent
.
put
(
"t_1_经营范围"
,
businessLicenseEntity
.
getManageRange
());
if
(
qrCodeType
==
1
)
{
formContent
.
put
(
"@image_1_二维码"
,
businessLicenseEntity
.
getQrCodeOriginalBase64
());
}
else
{
formContent
.
put
(
"@image_1_二维码"
,
businessLicenseEntity
.
getQrCodeDuplicateBase64
());
}
return
formContent
.
toJSONString
();
}
}
}
\ No newline at end of file
certificate-manager/src/main/java/com/mortals/xhx/module/record/service/impl/ApplyLogServiceImpl.java
View file @
12cb4438
...
@@ -21,10 +21,7 @@ import com.mortals.xhx.base.system.upload.service.UploadService;
...
@@ -21,10 +21,7 @@ import com.mortals.xhx.base.system.upload.service.UploadService;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.common.code.*
;
import
com.mortals.xhx.common.code.*
;
import
com.mortals.xhx.common.utils.ExportDocUtil
;
import
com.mortals.xhx.common.utils.*
;
import
com.mortals.xhx.common.utils.ImageBase64
;
import
com.mortals.xhx.common.utils.StringUtils
;
import
com.mortals.xhx.common.utils.WordUtil
;
import
com.mortals.xhx.module.certificate.model.CertificateCatalogEntity
;
import
com.mortals.xhx.module.certificate.model.CertificateCatalogEntity
;
import
com.mortals.xhx.module.certificate.model.CertificateClassifyEntity
;
import
com.mortals.xhx.module.certificate.model.CertificateClassifyEntity
;
import
com.mortals.xhx.module.certificate.pdu.ApplyLogPdu
;
import
com.mortals.xhx.module.certificate.pdu.ApplyLogPdu
;
...
@@ -209,6 +206,7 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
...
@@ -209,6 +206,7 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
CertificateCatalogEntity
catalog
=
certificateCatalogService
.
get
(
applyLogEntity
.
getCatalogId
());
CertificateCatalogEntity
catalog
=
certificateCatalogService
.
get
(
applyLogEntity
.
getCatalogId
());
applyLogEntity
.
setCatalogCode
(
catalog
.
getCatalogCode
());
applyLogEntity
.
setCatalogCode
(
catalog
.
getCatalogCode
());
applyLogEntity
.
setCatalogName
(
catalog
.
getCatalogName
());
applyLogEntity
.
setCatalogName
(
catalog
.
getCatalogName
());
applyLogEntity
.
setFormTemplate
(
catalog
.
getFormContent
());
DocTemplateVO
docTemplate
=
new
DocTemplateVO
(
catalog
.
getTemplateUrl
(),
applyLogEntity
.
getFormContent
());
DocTemplateVO
docTemplate
=
new
DocTemplateVO
(
catalog
.
getTemplateUrl
(),
applyLogEntity
.
getFormContent
());
String
paths
=
preview
(
docTemplate
,
context
);
String
paths
=
preview
(
docTemplate
,
context
);
String
[]
vals
=
paths
.
split
(
";"
);
String
[]
vals
=
paths
.
split
(
";"
);
...
@@ -306,6 +304,25 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
...
@@ -306,6 +304,25 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
if
(
entry
.
getKey
().
indexOf
(
"dt_"
)
!=
-
1
)
{
if
(
entry
.
getKey
().
indexOf
(
"dt_"
)
!=
-
1
)
{
builder
.
bind
(
entry
.
getKey
(),
new
MultipleRowTableRenderPolicy
());
builder
.
bind
(
entry
.
getKey
(),
new
MultipleRowTableRenderPolicy
());
}
}
//二维码输入框处理
if
(
entry
.
getKey
().
indexOf
(
"@qrcode"
)
!=
-
1
)
{
try
{
String
filePath
=
rootPath
+
"file/qrcode/"
;
String
qrcodeName
=
new
Date
().
getTime
()
+
".png"
;
File
pathDir
=
new
File
(
filePath
);
if
(!
pathDir
.
exists
())
{
pathDir
.
mkdirs
();
}
String
imagepath
=
filePath
+
qrcodeName
;
QrCodeUtil
.
generateQrCodeFile
(
entry
.
getValue
().
toString
(),
imagepath
);
PictureRenderData
pictureRenderData
=
Pictures
.
ofStream
(
new
FileInputStream
(
imagepath
),
PictureType
.
PNG
)
.
size
(
100
,
100
).
create
();
addMap
.
put
(
StrUtil
.
removePrefixIgnoreCase
(
entry
.
getKey
(),
"@"
),
pictureRenderData
);
//entry.setValue(pictureRenderData);
}
catch
(
FileNotFoundException
e
)
{
log
.
error
(
"error"
,
e
);
}
}
});
});
if
(
addMap
.
size
()>
0
){
if
(
addMap
.
size
()>
0
){
data
.
putAll
(
addMap
);
data
.
putAll
(
addMap
);
...
@@ -330,6 +347,10 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
...
@@ -330,6 +347,10 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
//转换预览图片
//转换预览图片
String
fileName
=
RandomUtil
.
randomNumbers
(
12
)
+
".jpg"
;
String
fileName
=
RandomUtil
.
randomNumbers
(
12
)
+
".jpg"
;
String
preView
=
this
.
filePath
+
"/preview/"
+
fileName
;
String
preView
=
this
.
filePath
+
"/preview/"
+
fileName
;
File
preViewPathDir
=
new
File
(
this
.
filePath
+
"/preview/"
);
if
(!
preViewPathDir
.
exists
())
{
preViewPathDir
.
mkdirs
();
}
WordUtil
.
convertWordToJPEG
(
mergedoc
,
preView
);
WordUtil
.
convertWordToJPEG
(
mergedoc
,
preView
);
log
.
info
(
"preView:"
+
"/preview/"
+
fileName
);
log
.
info
(
"preView:"
+
"/preview/"
+
fileName
);
//下载地址拼装
//下载地址拼装
...
...
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