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
e1617092
Commit
e1617092
authored
Oct 24, 2022
by
廖旭伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
流程调整
parent
091a205c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
384 additions
and
24 deletions
+384
-24
certificate-manager/src/main/java/com/mortals/xhx/common/code/CertificateType.java
...ain/java/com/mortals/xhx/common/code/CertificateType.java
+67
-0
certificate-manager/src/main/java/com/mortals/xhx/common/code/GenerateStatus.java
...main/java/com/mortals/xhx/common/code/GenerateStatus.java
+70
-0
certificate-manager/src/main/java/com/mortals/xhx/module/certificate/service/impl/CertificateCatalogServiceImpl.java
...rtificate/service/impl/CertificateCatalogServiceImpl.java
+1
-1
certificate-manager/src/main/java/com/mortals/xhx/module/certificate/web/CertificatePrintController.java
...hx/module/certificate/web/CertificatePrintController.java
+38
-3
certificate-manager/src/main/java/com/mortals/xhx/module/record/service/ApplyLogService.java
...om/mortals/xhx/module/record/service/ApplyLogService.java
+0
-1
certificate-manager/src/main/java/com/mortals/xhx/module/record/service/PrintWaitQueueService.java
...tals/xhx/module/record/service/PrintWaitQueueService.java
+17
-0
certificate-manager/src/main/java/com/mortals/xhx/module/record/service/impl/ApplyLogServiceImpl.java
...s/xhx/module/record/service/impl/ApplyLogServiceImpl.java
+25
-18
certificate-manager/src/main/java/com/mortals/xhx/module/record/service/impl/PrintWaitQueueServiceImpl.java
...module/record/service/impl/PrintWaitQueueServiceImpl.java
+166
-1
No files found.
certificate-manager/src/main/java/com/mortals/xhx/common/code/CertificateType.java
0 → 100644
View file @
e1617092
package
com.mortals.xhx.common.code
;
import
com.mortals.framework.ap.SysConstains
;
import
com.mortals.framework.common.IBaseEnum
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
public
enum
CertificateType
implements
IBaseEnum
{
ORIGINAL
(
1
,
"正本"
,
SysConstains
.
STYLE_DEFAULT
),
DUPLICATE
(
2
,
"副本"
,
SysConstains
.
STYLE_DEFAULT
),
;
private
int
value
;
private
String
desc
;
private
String
style
;
CertificateType
(
int
value
,
String
desc
,
String
style
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
this
.
style
=
style
;
}
@Override
public
int
getValue
()
{
return
this
.
value
;
}
public
String
getDesc
()
{
return
desc
;
}
public
String
getStyle
()
{
return
style
;
}
public
static
CertificateType
getByValue
(
int
value
)
{
for
(
CertificateType
e
:
CertificateType
.
values
())
{
if
(
e
.
getValue
()
==
value
)
{
return
e
;
}
}
return
null
;
}
public
static
Map
<
String
,
String
>
getEnumMap
(
int
...
eItem
)
{
Map
<
String
,
String
>
resultMap
=
new
LinkedHashMap
<
String
,
String
>();
for
(
CertificateType
item
:
CertificateType
.
values
())
{
try
{
boolean
hasE
=
false
;
for
(
int
e
:
eItem
){
if
(
item
.
getValue
()==
e
){
hasE
=
true
;
break
;
}
}
if
(!
hasE
){
resultMap
.
put
(
item
.
getValue
()+
""
,
item
.
getDesc
());
}
}
catch
(
Exception
ex
){
}
}
return
resultMap
;
}
}
certificate-manager/src/main/java/com/mortals/xhx/common/code/GenerateStatus.java
0 → 100644
View file @
e1617092
package
com.mortals.xhx.common.code
;
import
com.mortals.framework.ap.SysConstains
;
import
com.mortals.framework.common.IBaseEnum
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
/**
* 生成状态0未生成1正本2副本3正副本
*/
public
enum
GenerateStatus
implements
IBaseEnum
{
NOT
(
0
,
"未生成"
,
SysConstains
.
STYLE_DEFAULT
),
ORIGINAL
(
1
,
"正本"
,
SysConstains
.
STYLE_DEFAULT
),
DUPLICATE
(
2
,
"副本"
,
SysConstains
.
STYLE_DEFAULT
),
ALL
(
3
,
"正副本"
,
SysConstains
.
STYLE_DEFAULT
);
private
int
value
;
private
String
desc
;
private
String
style
;
GenerateStatus
(
int
value
,
String
desc
,
String
style
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
this
.
style
=
style
;
}
@Override
public
int
getValue
()
{
return
this
.
value
;
}
public
String
getDesc
()
{
return
desc
;
}
public
String
getStyle
()
{
return
style
;
}
public
static
GenerateStatus
getByValue
(
int
value
)
{
for
(
GenerateStatus
e
:
GenerateStatus
.
values
())
{
if
(
e
.
getValue
()
==
value
)
{
return
e
;
}
}
return
null
;
}
public
static
Map
<
String
,
String
>
getEnumMap
(
int
...
eItem
)
{
Map
<
String
,
String
>
resultMap
=
new
LinkedHashMap
<
String
,
String
>();
for
(
GenerateStatus
item
:
GenerateStatus
.
values
())
{
try
{
boolean
hasE
=
false
;
for
(
int
e
:
eItem
){
if
(
item
.
getValue
()==
e
){
hasE
=
true
;
break
;
}
}
if
(!
hasE
){
resultMap
.
put
(
item
.
getValue
()+
""
,
item
.
getDesc
());
}
}
catch
(
Exception
ex
){
}
}
return
resultMap
;
}
}
certificate-manager/src/main/java/com/mortals/xhx/module/certificate/service/impl/CertificateCatalogServiceImpl.java
View file @
e1617092
...
...
@@ -75,7 +75,7 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
entity
.
setOriFormContent
(
parseDocxToJson
(
entity
.
getOriginalUrl
()));
}
if
(
StringUtils
.
isNotEmpty
(
entity
.
getDuplicateUrl
())){
entity
.
set
Ori
FormContent
(
parseDocxToJson
(
entity
.
getDuplicateUrl
()));
entity
.
set
Dup
FormContent
(
parseDocxToJson
(
entity
.
getDuplicateUrl
()));
}
}
...
...
certificate-manager/src/main/java/com/mortals/xhx/module/certificate/web/CertificatePrintController.java
View file @
e1617092
...
...
@@ -17,7 +17,9 @@ import com.mortals.xhx.module.certificate.model.CertificateClassifyEntity;
import
com.mortals.xhx.module.certificate.pdu.PrintSettingPdu
;
import
com.mortals.xhx.module.certificate.service.CertificateClassifyService
;
import
com.mortals.xhx.module.record.model.ApplyLogEntity
;
import
com.mortals.xhx.module.record.model.PrintWaitQueueEntity
;
import
com.mortals.xhx.module.record.service.ApplyLogService
;
import
com.mortals.xhx.module.record.service.PrintWaitQueueService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -34,7 +36,7 @@ public class CertificatePrintController extends BaseJsonBodyController {
@Autowired
private
CertificateClassifyService
certificateClassifyService
;
@Autowired
private
ApplyLogService
applyLog
Service
;
private
PrintWaitQueueService
printWaitQueue
Service
;
@PostMapping
({
"setting/info"
})
public
Rest
<
Object
>
list
()
{
...
...
@@ -99,6 +101,38 @@ public class CertificatePrintController extends BaseJsonBodyController {
return
ret
;
}
/**
* 打印文件
*/
@RequestMapping
(
value
=
{
"do"
},
method
=
{
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@UnAuth
public
Rest
<
Object
>
print
(
Long
id
)
{
Rest
<
Object
>
ret
=
new
Rest
();
Map
<
String
,
Object
>
model
=
new
HashMap
();
String
busiDesc
=
"打印证件"
;
int
code
=
1
;
try
{
String
rsp
=
printWaitQueueService
.
doPrint
(
id
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
rsp
);
if
(
jsonObject
.
getString
(
"status"
).
equals
(
"1"
)){
model
.
put
(
"message_info"
,
busiDesc
+
"成功"
);
}
else
{
code
=
-
1
;
model
.
put
(
"message_info"
,
jsonObject
.
getString
(
"message"
));
}
model
.
put
(
"message_info"
,
busiDesc
+
"成功"
);
this
.
recordSysLog
(
this
.
request
,
busiDesc
+
" 【成功】"
);
}
catch
(
Exception
var9
)
{
code
=
-
1
;
this
.
doException
(
this
.
request
,
busiDesc
,
model
,
var9
);
}
ret
.
setCode
(
code
);
ret
.
setData
(
model
);
ret
.
setDict
(
model
.
get
(
"dict"
));
ret
.
setMsg
(
model
.
get
(
"message_info"
)
==
null
?
""
:
model
.
remove
(
"message_info"
).
toString
());
return
ret
;
}
/**
* 获取打印文件
*/
...
...
@@ -110,9 +144,10 @@ public class CertificatePrintController extends BaseJsonBodyController {
String
busiDesc
=
"查询待打印证件"
;
int
code
=
1
;
try
{
ApplyLogEntity
query
=
new
ApplyLogEntity
();
PrintWaitQueueEntity
query
=
new
PrintWaitQueueEntity
();
query
.
setPrintStatus
(
YesNoEnum
.
NO
.
getValue
());
query
.
setPickerIDCardNo
(
idCard
);
List
<
ApplyLogEntity
>
list
=
applyLog
Service
.
find
(
query
);
List
<
PrintWaitQueueEntity
>
list
=
printWaitQueue
Service
.
find
(
query
);
model
.
put
(
"data"
,
list
);
model
.
put
(
"message_info"
,
busiDesc
+
"成功"
);
this
.
recordSysLog
(
this
.
request
,
busiDesc
+
" 【成功】"
);
...
...
certificate-manager/src/main/java/com/mortals/xhx/module/record/service/ApplyLogService.java
View file @
e1617092
...
...
@@ -50,5 +50,4 @@ public interface ApplyLogService extends ICRUDService<ApplyLogEntity,Long>{
*/
void
generateAll
(
ApplyLogEntity
applyLogEntity
,
Context
context
)
throws
AppException
;
void
printApplyLog
(
Long
id
);
}
\ No newline at end of file
certificate-manager/src/main/java/com/mortals/xhx/module/record/service/PrintWaitQueueService.java
View file @
e1617092
package
com.mortals.xhx.module.record.service
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.service.ICRUDService
;
import
com.mortals.xhx.module.record.model.ApplyLogEntity
;
import
com.mortals.xhx.module.record.model.PrintWaitQueueEntity
;
/**
* PrintWaitQueueService
...
...
@@ -11,4 +14,18 @@ import com.mortals.xhx.module.record.model.PrintWaitQueueEntity;
*/
public
interface
PrintWaitQueueService
extends
ICRUDService
<
PrintWaitQueueEntity
,
Long
>{
/**
* 生成待打印证件
* @param applyLogEntity
* @param generateType
* @param context
* @throws AppException
*/
void
creatWaitQueueByApply
(
ApplyLogEntity
applyLogEntity
,
int
generateType
,
Context
context
)
throws
AppException
;
/**
* 打印文件
* @param id
*/
String
doPrint
(
Long
id
);
}
\ No newline at end of file
certificate-manager/src/main/java/com/mortals/xhx/module/record/service/impl/ApplyLogServiceImpl.java
View file @
e1617092
...
...
@@ -15,9 +15,9 @@ import com.deepoove.poi.util.RegexUtils;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.base.system.upload.service.UploadService
;
import
com.mortals.xhx.common.code.ClassifyType
;
import
com.mortals.xhx.common.code.GenerateStatus
;
import
com.mortals.xhx.common.utils.ExportDocUtil
;
import
com.mortals.xhx.common.utils.StringUtils
;
import
com.mortals.xhx.common.utils.WordUtil
;
...
...
@@ -27,7 +27,7 @@ import com.mortals.xhx.module.certificate.service.CertificateCatalogService;
import
com.mortals.xhx.module.certificate.service.CertificateClassifyService
;
import
com.mortals.xhx.module.record.model.ApplyLogQuery
;
import
com.mortals.xhx.module.record.model.DocTemplateVO
;
import
com.mortals.xhx.module.record.service.
RetainLog
Service
;
import
com.mortals.xhx.module.record.service.
PrintWaitQueue
Service
;
import
org.apache.http.entity.ContentType
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -63,23 +63,17 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
@Value
(
"${upload.path}"
)
private
String
filePath
;
@Value
(
"${upload.url:http://localhost:17215/fsm/file/commonupload?prePath=/file/uploadfile}"
)
private
String
uploadUrl
;
@Autowired
private
UploadService
uploadService
;
@Autowired
private
ParamService
paramService
;
@Autowired
private
CertificateCatalogService
certificateCatalogService
;
@Autowired
private
RetainLogService
retainLog
Service
;
private
CertificateClassifyService
certificateClassify
Service
;
@Autowired
private
CertificateClassifyService
certificateClassify
Service
;
private
PrintWaitQueueService
printWaitQueue
Service
;
@Override
protected
ApplyLogEntity
findBefore
(
ApplyLogEntity
entity
,
PageInfo
pageInfo
,
Context
context
)
throws
AppException
{
...
...
@@ -135,12 +129,19 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
if
(
entity
.
getCatalogId
()==
null
){
throw
new
AppException
(
"目录ID不能为空"
);
}
super
.
validData
(
entity
,
context
);
}
@Override
protected
void
saveBefore
(
ApplyLogEntity
entity
,
Context
context
)
throws
AppException
{
entity
.
setGenerateStatus
(
GenerateStatus
.
NOT
.
getValue
());
}
@Override
public
String
previewOriginal
(
ApplyLogEntity
applyLogEntity
,
Context
context
)
throws
AppException
{
validData
(
applyLogEntity
,
context
);
CertificateCatalogEntity
catalog
=
certificateCatalogService
.
get
(
applyLogEntity
.
getCatalogId
());
applyLogEntity
.
setCatalogCode
(
catalog
.
getCatalogCode
());
DocTemplateVO
docTemplate
=
new
DocTemplateVO
(
catalog
.
getOriginalUrl
(),
applyLogEntity
.
getOriFormContent
());
return
preview
(
docTemplate
,
context
);
}
...
...
@@ -149,6 +150,7 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
public
String
previewDuplicate
(
ApplyLogEntity
applyLogEntity
,
Context
context
)
throws
AppException
{
validData
(
applyLogEntity
,
context
);
CertificateCatalogEntity
catalog
=
certificateCatalogService
.
get
(
applyLogEntity
.
getCatalogId
());
applyLogEntity
.
setCatalogCode
(
catalog
.
getCatalogCode
());
DocTemplateVO
docTemplate
=
new
DocTemplateVO
(
catalog
.
getDuplicateUrl
(),
catalog
.
getDupFormContent
());
return
preview
(
docTemplate
,
context
);
}
...
...
@@ -157,32 +159,38 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
public
void
generateOriginal
(
ApplyLogEntity
applyLogEntity
,
Context
context
)
throws
AppException
{
validData
(
applyLogEntity
,
context
);
CertificateCatalogEntity
catalog
=
certificateCatalogService
.
get
(
applyLogEntity
.
getCatalogId
());
applyLogEntity
.
setCatalogCode
(
catalog
.
getCatalogCode
());
DocTemplateVO
docTemplate
=
new
DocTemplateVO
(
catalog
.
getOriginalUrl
(),
applyLogEntity
.
getOriFormContent
());
String
paths
=
preview
(
docTemplate
,
context
);
String
[]
vals
=
paths
.
split
(
";"
);
applyLogEntity
.
setOriginalUrl
(
vals
[
1
]);
applyLogEntity
.
setOriPreview
(
vals
[
0
]);
applyLogEntity
.
setCreateTime
(
new
Date
());
if
(
context
!=
null
&&
context
.
getUser
()!=
null
)
{
applyLogEntity
.
setCreateUserId
(
context
.
getUser
().
getId
());
}
applyLogEntity
.
setGenerateStatus
(
GenerateStatus
.
ORIGINAL
.
getValue
());
dao
.
insert
(
applyLogEntity
);
retainLogService
.
creatRetainLog
(
applyLogEntity
,
context
);
printWaitQueueService
.
creatWaitQueueByApply
(
applyLogEntity
,
GenerateStatus
.
ORIGINAL
.
getValue
()
,
context
);
}
@Override
public
void
generateDuplicate
(
ApplyLogEntity
applyLogEntity
,
Context
context
)
{
validData
(
applyLogEntity
,
context
);
CertificateCatalogEntity
catalog
=
certificateCatalogService
.
get
(
applyLogEntity
.
getCatalogId
());
applyLogEntity
.
setCatalogCode
(
catalog
.
getCatalogCode
());
DocTemplateVO
docTemplate
=
new
DocTemplateVO
(
catalog
.
getDuplicateUrl
(),
applyLogEntity
.
getDupFormContent
());
String
paths
=
preview
(
docTemplate
,
context
);
String
[]
vals
=
paths
.
split
(
";"
);
applyLogEntity
.
setDuplicateUrl
(
vals
[
1
]);
applyLogEntity
.
setDupPreview
(
vals
[
0
]);
applyLogEntity
.
setCreateTime
(
new
Date
());
if
(
context
!=
null
&&
context
.
getUser
()!=
null
)
{
applyLogEntity
.
setCreateUserId
(
context
.
getUser
().
getId
());
}
applyLogEntity
.
setGenerateStatus
(
GenerateStatus
.
DUPLICATE
.
getValue
());
dao
.
insert
(
applyLogEntity
);
retainLogService
.
creatRetainLog
(
applyLogEntity
,
context
);
printWaitQueueService
.
creatWaitQueueByApply
(
applyLogEntity
,
GenerateStatus
.
DUPLICATE
.
getValue
()
,
context
);
}
@Override
...
...
@@ -192,10 +200,12 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
}
validData
(
applyLogEntity
,
context
);
CertificateCatalogEntity
catalog
=
certificateCatalogService
.
get
(
applyLogEntity
.
getCatalogId
());
applyLogEntity
.
setCatalogCode
(
catalog
.
getCatalogCode
());
DocTemplateVO
docTemplate
=
new
DocTemplateVO
(
catalog
.
getOriginalUrl
(),
applyLogEntity
.
getOriFormContent
());
String
paths
=
preview
(
docTemplate
,
context
);
String
[]
vals
=
paths
.
split
(
";"
);
applyLogEntity
.
setOriginalUrl
(
vals
[
1
]);
applyLogEntity
.
setOriPreview
(
vals
[
0
]);
CertificateClassifyEntity
classifyEntity
=
certificateClassifyService
.
get
(
catalog
.
getClassifyId
());
if
(
classifyEntity
!=
null
&&
classifyEntity
.
getClassifyType
()==
ClassifyType
.
PRINCIPAL_AND_VICE
.
getValue
())
{
docTemplate
.
setFormContent
(
applyLogEntity
.
getDupFormContent
());
...
...
@@ -203,18 +213,15 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
String
paths1
=
preview
(
docTemplate
,
context
);
String
[]
vals1
=
paths1
.
split
(
";"
);
applyLogEntity
.
setDuplicateUrl
(
vals1
[
1
]);
applyLogEntity
.
setDupPreview
(
vals1
[
0
]);
}
applyLogEntity
.
setCreateTime
(
new
Date
());
if
(
context
!=
null
&&
context
.
getUser
()!=
null
)
{
applyLogEntity
.
setCreateUserId
(
context
.
getUser
().
getId
());
}
applyLogEntity
.
setGenerateStatus
(
GenerateStatus
.
ALL
.
getValue
());
dao
.
insert
(
applyLogEntity
);
retainLogService
.
creatRetainLog
(
applyLogEntity
,
context
);
}
@Override
public
void
printApplyLog
(
Long
id
)
{
printWaitQueueService
.
creatWaitQueueByApply
(
applyLogEntity
,
GenerateStatus
.
ALL
.
getValue
(),
context
);
}
private
String
preview
(
DocTemplateVO
docTemplate
,
Context
context
){
...
...
certificate-manager/src/main/java/com/mortals/xhx/module/record/service/impl/PrintWaitQueueServiceImpl.java
View file @
e1617092
package
com.mortals.xhx.module.record.service.impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.util.HttpUtil
;
import
com.mortals.xhx.common.code.*
;
import
com.mortals.xhx.module.certificate.model.CertificateCatalogEntity
;
import
com.mortals.xhx.module.certificate.model.CertificateClassifyEntity
;
import
com.mortals.xhx.module.record.dao.PrintLogDao
;
import
com.mortals.xhx.module.record.dao.RetainLogDao
;
import
com.mortals.xhx.module.record.model.ApplyLogEntity
;
import
com.mortals.xhx.module.record.model.PrintLogEntity
;
import
com.mortals.xhx.module.record.model.RetainLogEntity
;
import
com.mortals.xhx.module.record.service.PrintLogService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.exception.AppException
;
...
...
@@ -6,6 +19,11 @@ import com.mortals.framework.model.Context;
import
com.mortals.xhx.module.record.dao.PrintWaitQueueDao
;
import
com.mortals.xhx.module.record.model.PrintWaitQueueEntity
;
import
com.mortals.xhx.module.record.service.PrintWaitQueueService
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* PrintWaitQueueService
* 证照打印记录 service实现
...
...
@@ -15,5 +33,152 @@ import com.mortals.xhx.module.record.service.PrintWaitQueueService;
*/
@Service
(
"printWaitQueueService"
)
public
class
PrintWaitQueueServiceImpl
extends
AbstractCRUDServiceImpl
<
PrintWaitQueueDao
,
PrintWaitQueueEntity
,
Long
>
implements
PrintWaitQueueService
{
/** 系统ip端口 */
@Value
(
"${system.ip:http://192.168.0.98:11075/}"
)
private
String
ip
;
/** 打印api接口地址 */
@Value
(
"${print.aip:http://192.168.0.58:8037/api/print/GetHardWareInfo?GetType=78}"
)
private
String
printApi
;
/** 打印机设备ip */
@Value
(
"${system.print:192.168.0.11}"
)
private
String
printIp
;
@Autowired
private
PrintLogDao
printLogDao
;
@Autowired
private
RetainLogDao
retainLogDao
;
@Override
public
void
creatWaitQueueByApply
(
ApplyLogEntity
applyLogEntity
,
int
generateType
,
Context
context
)
throws
AppException
{
//CertificateCatalogEntity catalogEntity = certificateCatalogService.get(applyLogEntity.getCatalogId());
if
(
generateType
==
GenerateStatus
.
ALL
.
getValue
()){
PrintWaitQueueEntity
original
=
creatWaitQueue
(
applyLogEntity
,
GenerateStatus
.
ORIGINAL
.
getValue
());
dao
.
insert
(
original
);
PrintWaitQueueEntity
duplicate
=
creatWaitQueue
(
applyLogEntity
,
GenerateStatus
.
DUPLICATE
.
getValue
());
dao
.
insert
(
duplicate
);
}
else
{
PrintWaitQueueEntity
printWaitQueueEntity
=
creatWaitQueue
(
applyLogEntity
,
generateType
);
dao
.
insert
(
printWaitQueueEntity
);
}
}
private
PrintWaitQueueEntity
creatWaitQueue
(
ApplyLogEntity
applyLogEntity
,
int
generateType
){
PrintWaitQueueEntity
waitQueueEntity
=
new
PrintWaitQueueEntity
();
waitQueueEntity
.
setApplyId
(
applyLogEntity
.
getId
());
waitQueueEntity
.
setCatalogId
(
applyLogEntity
.
getCatalogId
());
waitQueueEntity
.
setCatalogCode
(
applyLogEntity
.
getCatalogCode
());
waitQueueEntity
.
setCertificateName
(
applyLogEntity
.
getCertificateName
());
waitQueueEntity
.
setCertificateCode
(
applyLogEntity
.
getCertificateCode
());
waitQueueEntity
.
setEnterpriseName
(
applyLogEntity
.
getEnterpriseName
());
waitQueueEntity
.
setHolderName
(
applyLogEntity
.
getHolderName
());
waitQueueEntity
.
setHolderIDCardNo
(
applyLogEntity
.
getHolderIDCardNo
());
waitQueueEntity
.
setPickerName
(
applyLogEntity
.
getPickerName
());
waitQueueEntity
.
setPickerIDCardNo
(
applyLogEntity
.
getPickerIDCardNo
());
if
(
generateType
==
GenerateStatus
.
DUPLICATE
.
getValue
())
{
waitQueueEntity
.
setCertificateType
(
CertificateType
.
DUPLICATE
.
getValue
());
waitQueueEntity
.
setPreviewUrl
(
applyLogEntity
.
getDupPreview
());
waitQueueEntity
.
setCertificateUrl
(
applyLogEntity
.
getDuplicateUrl
());
}
else
{
waitQueueEntity
.
setCertificateType
(
CertificateType
.
ORIGINAL
.
getValue
());
waitQueueEntity
.
setPreviewUrl
(
applyLogEntity
.
getOriPreview
());
waitQueueEntity
.
setCertificateUrl
(
applyLogEntity
.
getOriginalUrl
());
}
waitQueueEntity
.
setPrintStatus
(
YesNoEnum
.
NO
.
getValue
());
waitQueueEntity
.
setCreateUserId
(
applyLogEntity
.
getCreateUserId
());
waitQueueEntity
.
setCreateTime
(
new
Date
());
return
waitQueueEntity
;
}
@Override
public
String
doPrint
(
Long
id
)
{
PrintWaitQueueEntity
waitQueueEntity
=
this
.
dao
.
get
(
id
);
if
(
waitQueueEntity
==
null
){
throw
new
AppException
(
"数据不存在或已修改"
);
}
String
rootPath
=
this
.
ip
.
endsWith
(
"/"
)
?
this
.
ip
:
this
.
ip
+
"/"
;
String
filePath
=
rootPath
+
waitQueueEntity
.
getCertificateUrl
();
Map
<
String
,
String
>
printParameter
=
new
HashMap
<>();
printParameter
.
put
(
"printername"
,
"测试打印机"
);
//打印机名称
printParameter
.
put
(
"printerip"
,
printIp
);
//打印机网络地址
printParameter
.
put
(
"printerpapersource"
,
"1"
);
//打印机纸盒
printParameter
.
put
(
"printerfile"
,
filePath
);
//打印文件网络地址格式为doc文件或pdf文件
try
{
//String rsp = HttpUtil.doPost(printApi, printParameter);
String
rsp
=
"{\n"
+
" \"status\": \"1\",\n"
+
" \"message\": \"打印成功\",\n"
+
" }"
;
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
rsp
);
if
(
jsonObject
.
getString
(
"status"
).
equals
(
"1"
)){
doPrintAfter
(
waitQueueEntity
,
1
);
}
else
{
doPrintAfter
(
waitQueueEntity
,-
1
);
//throw new AppException(jsonObject.getString("message"));
}
PrintWaitQueueEntity
data
=
new
PrintWaitQueueEntity
();
data
.
setId
(
id
);
data
.
setPrintStatus
(
YesNoEnum
.
YES
.
getValue
());
data
.
setUpdateTime
(
new
Date
());
dao
.
update
(
data
);
return
rsp
;
}
catch
(
Throwable
e
){
log
.
error
(
"调用远程打印api接口出错"
,
e
);
throw
new
AppException
(
"调用远程打印api接口出错"
);
}
}
private
void
doPrintAfter
(
PrintWaitQueueEntity
waitQueueEntity
,
int
printResult
){
RetainLogEntity
retainLogEntity
=
new
RetainLogEntity
();
Date
now
=
new
Date
();
retainLogEntity
.
setCatalogId
(
waitQueueEntity
.
getCatalogId
());
retainLogEntity
.
setCatalogCode
(
waitQueueEntity
.
getCatalogCode
());
retainLogEntity
.
setCertificateName
(
waitQueueEntity
.
getCertificateName
());
retainLogEntity
.
setCertificateCode
(
waitQueueEntity
.
getCertificateCode
());
retainLogEntity
.
setEnterpriseName
(
waitQueueEntity
.
getEnterpriseName
());
retainLogEntity
.
setHolderName
(
waitQueueEntity
.
getHolderName
());
retainLogEntity
.
setHolderIDCardNo
(
waitQueueEntity
.
getHolderIDCardNo
());
retainLogEntity
.
setCertificateStatus
(
CertificateStatus
.
NORMAL
.
getValue
());
retainLogEntity
.
setCreateUserId
(
waitQueueEntity
.
getCreateUserId
());
retainLogEntity
.
setCreateTime
(
now
);
PrintLogEntity
printLogEntity
=
new
PrintLogEntity
();
printLogEntity
.
setCatalogId
(
waitQueueEntity
.
getCatalogId
());
printLogEntity
.
setCatalogCode
(
waitQueueEntity
.
getCatalogCode
());
if
(
waitQueueEntity
.
getCertificateType
()==
CertificateType
.
ORIGINAL
.
getValue
()){
printLogEntity
.
setOriginalCount
(
1
);
printLogEntity
.
setDuplicateCount
(
0
);
retainLogEntity
.
setOriginalCount
(
1
);
retainLogEntity
.
setDuplicateCount
(
0
);
retainLogEntity
.
setOriginalUrl
(
waitQueueEntity
.
getCertificateUrl
());
}
else
{
printLogEntity
.
setOriginalCount
(
0
);
printLogEntity
.
setDuplicateCount
(
1
);
retainLogEntity
.
setOriginalCount
(
0
);
retainLogEntity
.
setDuplicateCount
(
1
);
retainLogEntity
.
setDuplicateUrl
(
waitQueueEntity
.
getCertificateUrl
());
}
printLogEntity
.
setCertificateName
(
waitQueueEntity
.
getCertificateName
());
printLogEntity
.
setCertificateCode
(
waitQueueEntity
.
getCertificateCode
());
printLogEntity
.
setEnterpriseName
(
waitQueueEntity
.
getEnterpriseName
());
printLogEntity
.
setHolderName
(
waitQueueEntity
.
getHolderName
());
printLogEntity
.
setHolderIDCardNo
(
waitQueueEntity
.
getHolderIDCardNo
());
printLogEntity
.
setPickerName
(
waitQueueEntity
.
getPickerName
());
printLogEntity
.
setPickerIDCardNo
(
waitQueueEntity
.
getPickerIDCardNo
());
printLogEntity
.
setPrintDate
(
now
);
printLogEntity
.
setCreateUserId
(
waitQueueEntity
.
getCreateUserId
());
printLogEntity
.
setCreateTime
(
now
);
if
(
printResult
==
1
){
//打印成功
printLogEntity
.
setPrintStatus
(
PrintStatus
.
SUCCESS
.
getValue
());
retainLogDao
.
insert
(
retainLogEntity
);
}
else
{
printLogEntity
.
setPrintStatus
(
PrintStatus
.
FAIL
.
getValue
());
}
printLogDao
.
insert
(
printLogEntity
);
}
}
\ No newline at end of file
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