Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
one-certificate-system
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
赵啸非
one-certificate-system
Commits
c8608cc8
Commit
c8608cc8
authored
Aug 07, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加目录字段
parent
d1d1ad72
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
134 additions
and
125 deletions
+134
-125
one-certificate-manager/src/main/java/com/mortals/xhx/module/record/service/impl/ApplyLogServiceImpl.java
...s/xhx/module/record/service/impl/ApplyLogServiceImpl.java
+134
-125
No files found.
one-certificate-manager/src/main/java/com/mortals/xhx/module/record/service/impl/ApplyLogServiceImpl.java
View file @
c8608cc8
...
...
@@ -56,19 +56,21 @@ import java.util.*;
import
java.util.stream.Collectors
;
/**
* ApplyLogService
* 证照申请 service实现
*
* @author zxfei
* @date 2022-10-14
*/
* ApplyLogService
* 证照申请 service实现
*
* @author zxfei
* @date 2022-10-14
*/
@Service
(
"applyLogService"
)
public
class
ApplyLogServiceImpl
extends
AbstractCRUDServiceImpl
<
ApplyLogDao
,
ApplyLogEntity
,
Long
>
implements
ApplyLogService
{
@Value
(
"${upload.path}"
)
private
String
filePath
;
/** 应用公网地址 */
/**
* 应用公网地址
*/
@Value
(
"${serviceUrl:http://one.scsmile.cn/h5/#?id=}"
)
private
String
serviceUrl
;
...
...
@@ -94,18 +96,18 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
private
CertificateChildService
certificateChildService
;
@Override
protected
void
removeAfter
(
Long
[]
ids
,
Context
context
,
int
result
)
throws
AppException
{
for
(
Long
id
:
ids
)
{
protected
void
removeAfter
(
Long
[]
ids
,
Context
context
,
int
result
)
throws
AppException
{
for
(
Long
id
:
ids
)
{
PrintWaitQueueEntity
condition
=
new
PrintWaitQueueEntity
();
condition
.
setApplyId
(
id
);
printWaitQueueService
.
remove
(
condition
,
context
);
printWaitQueueService
.
remove
(
condition
,
context
);
}
}
@Override
public
ApplyLogEntity
get
(
Long
key
,
Context
context
)
throws
AppException
{
ApplyLogEntity
entity
=
this
.
dao
.
get
(
key
);
if
(
entity
!=
null
)
{
if
(
entity
!=
null
)
{
List
<
ChildLicenseEntity
>
childs
=
childLicenseService
.
find
(
new
ChildLicenseQuery
().
applyId
(
key
).
processStatus
(
ProcessStatusEnum
.
已处理
.
getValue
()).
childStatus
(
StatusEnum
.
ENABLE
.
getValue
()));
entity
.
setChildLicense
(
childs
);
}
...
...
@@ -115,8 +117,8 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
@Override
protected
ApplyLogEntity
findBefore
(
ApplyLogEntity
entity
,
PageInfo
pageInfo
,
Context
context
)
throws
AppException
{
ApplyLogQuery
query
=
new
ApplyLogQuery
();
BeanUtils
.
copyProperties
(
entity
,
query
);
if
(
StringUtils
.
isNotEmpty
(
entity
.
getQuery
()))
{
BeanUtils
.
copyProperties
(
entity
,
query
);
if
(
StringUtils
.
isNotEmpty
(
entity
.
getQuery
()))
{
StringBuffer
condition
=
new
StringBuffer
(
"%"
);
condition
.
append
(
entity
.
getQuery
()).
append
(
"%"
);
ApplyLogQuery
condition1
=
new
ApplyLogQuery
();
...
...
@@ -132,50 +134,56 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
return
query
;
}
private
void
fillSubData
(
List
<
ApplyLogEntity
>
list
)
{
List
<
Long
>
idList
=
list
.
stream
().
map
(
i
->
i
.
getId
()).
collect
(
Collectors
.
toList
());
if
(
ObjectUtils
.
isEmpty
(
idList
))
return
;
ChildLicenseQuery
childLicenseQuery
=
new
ChildLicenseQuery
();
childLicenseQuery
.
setApplyIdList
(
idList
);
Map
<
Long
,
List
<
ChildLicenseEntity
>>
certificateChildListMap
=
childLicenseService
.
find
(
childLicenseQuery
).
parallelStream
().
collect
(
Collectors
.
groupingBy
(
ChildLicenseEntity:
:
getApplyId
));
list
.
forEach
(
item
->
item
.
setChildLicense
(
certificateChildListMap
.
get
(
item
.
getId
())));
}
@Override
protected
void
findAfter
(
ApplyLogEntity
params
,
PageInfo
pageInfo
,
Context
context
,
List
<
ApplyLogEntity
>
list
)
throws
AppException
{
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
for
(
ApplyLogEntity
entity:
list
){
List
<
ChildLicenseEntity
>
childLicenseList
=
childLicenseService
.
find
(
new
ChildLicenseQuery
().
applyId
(
entity
.
getId
()));
// if(CollectionUtils.isEmpty(childLicenseList)){
// entity.setProcessStatus("0/0");
// }else {
// Map<Integer, List<ChildLicenseEntity>> group = childLicenseList.stream().collect(Collectors.groupingBy(x -> x.getProcessStatus()));
// int pCount = CollectionUtils.isEmpty(group.get(1)) ? 0 : group.get(1).size();
// entity.setProcessStatus(pCount + "/" + childLicenseList.size());
// }
int
childSum
=
0
;
int
pCount
=
0
;
List
<
CertificateDocumentPdu
>
documentEntityList
=
new
ArrayList
<>();
for
(
ChildLicenseEntity
item:
childLicenseList
){
CertificateDocumentEntity
documentEntity
=
new
CertificateDocumentEntity
();
BeanUtils
.
copyProperties
(
item
,
documentEntity
);
documentEntity
.
setId
(
item
.
getDocumentId
());
documentEntity
.
setStatus
(
StatusEnum
.
DISABLE
.
getValue
());
if
(
item
.
getChildStatus
()==
StatusEnum
.
ENABLE
.
getValue
()){
documentEntity
.
setStatus
(
StatusEnum
.
ENABLE
.
getValue
());
childSum
++;
if
(
item
.
getProcessStatus
()==
ProcessStatusEnum
.
已处理
.
getValue
().
intValue
()){
pCount
++;
}
List
<
Long
>
idList
=
list
.
stream
().
map
(
i
->
i
.
getId
()).
collect
(
Collectors
.
toList
());
if
(
ObjectUtils
.
isEmpty
(
idList
))
return
;
ChildLicenseQuery
childLicenseQuery
=
new
ChildLicenseQuery
();
childLicenseQuery
.
setApplyIdList
(
idList
);
Map
<
Long
,
List
<
ChildLicenseEntity
>>
childLicenseListMap
=
childLicenseService
.
find
(
childLicenseQuery
).
parallelStream
().
collect
(
Collectors
.
groupingBy
(
ChildLicenseEntity:
:
getApplyId
));
for
(
ApplyLogEntity
entity
:
list
)
{
//List<ChildLicenseEntity> childLicenseList = childLicenseService.find(new ChildLicenseQuery().applyId(entity.getId()));
List
<
ChildLicenseEntity
>
childLicenseList
=
childLicenseListMap
.
get
(
entity
.
getId
());
int
childSum
=
0
;
int
pCount
=
0
;
List
<
CertificateDocumentPdu
>
documentEntityList
=
new
ArrayList
<>();
for
(
ChildLicenseEntity
item
:
childLicenseList
)
{
CertificateDocumentEntity
documentEntity
=
new
CertificateDocumentEntity
();
BeanUtils
.
copyProperties
(
item
,
documentEntity
);
documentEntity
.
setId
(
item
.
getDocumentId
());
documentEntity
.
setStatus
(
StatusEnum
.
DISABLE
.
getValue
());
if
(
item
.
getChildStatus
()
==
StatusEnum
.
ENABLE
.
getValue
())
{
documentEntity
.
setStatus
(
StatusEnum
.
ENABLE
.
getValue
());
childSum
++;
if
(
item
.
getProcessStatus
()
==
ProcessStatusEnum
.
已处理
.
getValue
().
intValue
())
{
pCount
++;
}
CertificateDocumentPdu
pdu
=
new
CertificateDocumentPdu
();
BeanUtils
.
copyProperties
(
documentEntity
,
pdu
);
documentEntityList
.
add
(
pdu
);
}
entity
.
setProcessStatus
(
pCount
+
"/"
+
childSum
);
entity
.
setChildCertificate
(
documentEntityList
);
CertificateDocumentPdu
pdu
=
new
CertificateDocumentPdu
();
BeanUtils
.
copyProperties
(
documentEntity
,
pdu
);
documentEntityList
.
add
(
pdu
);
}
entity
.
setProcessStatus
(
pCount
+
"/"
+
childSum
);
entity
.
setChildCertificate
(
documentEntityList
);
}
}
@Override
protected
void
validData
(
ApplyLogEntity
entity
,
Context
context
)
throws
AppException
{
if
(
StringUtils
.
isEmpty
(
entity
.
getCertificateCode
()))
{
entity
.
setCertificateCode
(
DateUtils
.
getCurrDateTime
(
"yyyyMMddHHmmss"
)
+
RandomUtil
.
randomNumbers
(
4
));
if
(
StringUtils
.
isEmpty
(
entity
.
getCertificateCode
()))
{
entity
.
setCertificateCode
(
DateUtils
.
getCurrDateTime
(
"yyyyMMddHHmmss"
)
+
RandomUtil
.
randomNumbers
(
4
));
//throw new AppException("许可证编号不能为空");
}
// if(entity.getIssueTime()==null){
...
...
@@ -190,7 +198,7 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
// if(StringUtils.isEmpty(entity.getAuthority())){
// throw new AppException("制证机关不能为空");
// }
if
(
entity
.
getId
()==
null
)
{
if
(
entity
.
getId
()
==
null
)
{
if
(
StringUtils
.
isEmpty
(
entity
.
getSocialCode
()))
{
entity
.
setSocialCode
(
DateUtils
.
getCurrDateTime
(
"yyyyMMddHHmmss"
)
+
RandomUtil
.
randomNumbers
(
4
));
//throw new AppException("统一社会信用代码不能为空");
...
...
@@ -199,27 +207,27 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
if
(
temp
!=
null
)
{
throw
new
AppException
(
"统一社会信用代码重复"
);
}
}
else
{
}
else
{
entity
.
setSocialCode
(
null
);
}
// if(StringUtils.isEmpty(entity.getLicenseProject())){
// throw new AppException("许可项目不能为空");
// }
if
(
StringUtils
.
isEmpty
(
entity
.
getEnterpriseName
()))
{
if
(
StringUtils
.
isEmpty
(
entity
.
getEnterpriseName
()))
{
throw
new
AppException
(
"市场主体名称不能为空"
);
}
// if(StringUtils.isEmpty(entity.getIndustryName())){
// throw new AppException("行业名称不能为空");
// }
if
(
entity
.
getCatalogId
()==
null
)
{
if
(
entity
.
getCatalogId
()
==
null
)
{
throw
new
AppException
(
"目录ID不能为空"
);
}
super
.
validData
(
entity
,
context
);
}
private
void
createFormContent
(
ApplyLogEntity
applyLogEntity
){
private
void
createFormContent
(
ApplyLogEntity
applyLogEntity
)
{
JSONObject
formContentJson
=
new
JSONObject
();
formContentJson
.
put
(
"i_1_市场主体名称"
,
applyLogEntity
.
getEnterpriseName
());
formContentJson
.
put
(
"i_1_市场主体名称"
,
applyLogEntity
.
getEnterpriseName
());
// formContentJson.put("i_2_许可证编号",applyLogEntity.getCertificateCode());
// formContentJson.put("i_3_统一社会信用代码",applyLogEntity.getSocialCode());
// formContentJson.put(" i_5_法定代表人(负责人)",applyLogEntity.getLegalPerson());
...
...
@@ -228,11 +236,11 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
// formContentJson.put("i_10_许可项目",applyLogEntity.getLicenseProject());
// formContentJson.put("i_11_制证日期", DateUtils.getStrDate(applyLogEntity.getIssueTime()));
// formContentJson.put("i_14_制证机关",applyLogEntity.getAuthority());
formContentJson
.
put
(
"@qrcode_1_二维码"
,
applyLogEntity
.
getSocialCode
());
if
(
CollectionUtils
.
isNotEmpty
(
applyLogEntity
.
getChildCertificate
()))
{
formContentJson
.
put
(
"@qrcode_1_二维码"
,
applyLogEntity
.
getSocialCode
());
if
(
CollectionUtils
.
isNotEmpty
(
applyLogEntity
.
getChildCertificate
()))
{
int
index
=
1
;
for
(
int
i
=
0
;
i
<
applyLogEntity
.
getChildCertificate
().
size
();
i
++)
{
if
(
applyLogEntity
.
getChildCertificate
().
get
(
i
).
getStatus
()==
1
)
{
for
(
int
i
=
0
;
i
<
applyLogEntity
.
getChildCertificate
().
size
();
i
++)
{
if
(
applyLogEntity
.
getChildCertificate
().
get
(
i
).
getStatus
()
==
1
)
{
formContentJson
.
put
(
"i_"
+
index
+
"_子证"
,
applyLogEntity
.
getChildCertificate
().
get
(
i
).
getShortName
());
index
++;
}
...
...
@@ -241,9 +249,10 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
applyLogEntity
.
setFormContent
(
formContentJson
.
toJSONString
());
}
@Override
public
ApplyLogEntity
save
(
ApplyLogEntity
applyLogEntity
,
Context
context
)
throws
AppException
{
validData
(
applyLogEntity
,
context
);
validData
(
applyLogEntity
,
context
);
createFormContent
(
applyLogEntity
);
Long
oldId
=
null
;
boolean
is_record
=
false
;
...
...
@@ -252,49 +261,49 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
applyLogEntity
.
setCatalogName
(
catalog
.
getCatalogName
());
applyLogEntity
.
setFormTemplate
(
catalog
.
getFormContent
());
CertificateIndustryEntity
industryEntity
=
certificateIndustryService
.
get
(
catalog
.
getIndustryId
());
applyLogEntity
.
setIndustryName
(
industryEntity
==
null
?
""
:
industryEntity
.
getIndustryName
());
DocTemplateVO
docTemplate
=
new
DocTemplateVO
(
catalog
.
getTemplateFileUrl
(),
applyLogEntity
.
getFormContent
());
applyLogEntity
.
setIndustryName
(
industryEntity
==
null
?
""
:
industryEntity
.
getIndustryName
());
DocTemplateVO
docTemplate
=
new
DocTemplateVO
(
catalog
.
getTemplateFileUrl
(),
applyLogEntity
.
getFormContent
());
try
{
String
rootPath
=
this
.
filePath
.
endsWith
(
"/"
)
?
this
.
filePath
:
this
.
filePath
+
"/"
;
String
filePath
=
rootPath
+
"certificate/qrcode/"
;
String
qrcodeName
=
applyLogEntity
.
getSocialCode
()
+
".png"
;
String
qrcodeName
=
applyLogEntity
.
getSocialCode
()
+
".png"
;
File
pathDir
=
new
File
(
filePath
);
if
(!
pathDir
.
exists
())
{
pathDir
.
mkdirs
();
}
String
imagepath
=
filePath
+
qrcodeName
;
String
qrCode
=
serviceUrl
+
applyLogEntity
.
getSocialCode
();
QrCodeUtil
.
generateQrCodeFile
(
qrCode
,
imagepath
);
applyLogEntity
.
setQRCode
(
"/certificate/qrcode/"
+
qrcodeName
);
String
qrCode
=
serviceUrl
+
applyLogEntity
.
getSocialCode
();
QrCodeUtil
.
generateQrCodeFile
(
qrCode
,
imagepath
);
applyLogEntity
.
setQRCode
(
"/certificate/qrcode/"
+
qrcodeName
);
//entry.setValue(pictureRenderData);
}
catch
(
Exception
e
)
{
log
.
error
(
"error"
,
e
);
}
docTemplate
.
setQrCode
(
applyLogEntity
.
getQRCode
());
boolean
hasPDF
=
false
;
if
(
catalog
.
getIsPdf
()!=
null
&&
catalog
.
getIsPdf
()==
1
)
{
if
(
catalog
.
getIsPdf
()
!=
null
&&
catalog
.
getIsPdf
()
==
1
)
{
hasPDF
=
true
;
}
String
paths
=
preview
(
docTemplate
,
context
,
hasPDF
);
String
paths
=
preview
(
docTemplate
,
context
,
hasPDF
);
String
[]
vals
=
paths
.
split
(
";"
);
if
(
vals
.
length
==
3
)
{
if
(
vals
.
length
==
3
)
{
//有pdf时
applyLogEntity
.
setCertificateUrl
(
vals
[
2
]);
applyLogEntity
.
setPreviewUrl
(
vals
[
1
]);
}
if
(
vals
.
length
==
2
)
{
if
(
vals
.
length
==
2
)
{
//无pdf时
applyLogEntity
.
setCertificateUrl
(
vals
[
0
]);
applyLogEntity
.
setPreviewUrl
(
vals
[
1
]);
}
applyLogEntity
.
setCreateTime
(
new
Date
());
applyLogEntity
.
setRecordStatus
(
YesNoEnum
.
NO
.
getValue
());
if
(
context
!=
null
&&
context
.
getUser
()!=
null
)
{
if
(
context
!=
null
&&
context
.
getUser
()
!=
null
)
{
applyLogEntity
.
setCreateUserId
(
context
.
getUser
().
getId
());
}
applyLogEntity
.
setGenerateStatus
(
GenerateStatus
.
ORIGINAL
.
getValue
());
if
(
applyLogEntity
.
getId
()!=
null
&&
applyLogEntity
.
getRecordId
()!=
null
)
{
if
(
applyLogEntity
.
getId
()
!=
null
&&
applyLogEntity
.
getRecordId
()
!=
null
)
{
applyLogEntity
.
setOperType
(
OperTypeEnum
.
UPDATE
.
getValue
());
oldId
=
applyLogEntity
.
getId
();
is_record
=
true
;
...
...
@@ -303,7 +312,7 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
recordEntity
.
setUpdateUserId
(
applyLogEntity
.
getCreateUserId
());
recordEntity
.
setUpdateTime
(
applyLogEntity
.
getCreateTime
());
recordDao
.
update
(
recordEntity
);
}
else
{
}
else
{
applyLogEntity
.
setOperType
(
OperTypeEnum
.
SAVE
.
getValue
());
RecordEntity
recordEntity
=
new
RecordEntity
();
recordEntity
.
setCatalogId
(
catalog
.
getId
());
...
...
@@ -316,7 +325,7 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
applyLogEntity
.
setRecordId
(
recordEntity
.
getId
());
}
dao
.
insert
(
applyLogEntity
);
if
(
is_record
)
{
if
(
is_record
)
{
ApplyLogEntity
updata
=
new
ApplyLogEntity
();
updata
.
setId
(
oldId
);
updata
.
setRecordStatus
(
YesNoEnum
.
YES
.
getValue
());
...
...
@@ -324,11 +333,11 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
dao
.
update
(
updata
);
PrintWaitQueueEntity
condition
=
new
PrintWaitQueueEntity
();
condition
.
setApplyId
(
oldId
);
printWaitQueueService
.
remove
(
condition
,
context
);
printWaitQueueService
.
remove
(
condition
,
context
);
}
//插入子证联报
childLicenseService
.
createChildLicense
(
applyLogEntity
,
oldId
,
context
);
printWaitQueueService
.
creatWaitQueueByApply
(
applyLogEntity
,
GenerateStatus
.
ORIGINAL
.
getValue
(),
context
);
childLicenseService
.
createChildLicense
(
applyLogEntity
,
oldId
,
context
);
printWaitQueueService
.
creatWaitQueueByApply
(
applyLogEntity
,
GenerateStatus
.
ORIGINAL
.
getValue
(),
context
);
applyLogEntity
.
setFormContent
(
null
);
applyLogEntity
.
setFormTemplate
(
null
);
return
applyLogEntity
;
...
...
@@ -336,64 +345,64 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
@Override
public
String
previewOriginal
(
ApplyLogEntity
applyLogEntity
,
Context
context
)
throws
AppException
{
validData
(
applyLogEntity
,
context
);
validData
(
applyLogEntity
,
context
);
CertificateCatalogEntity
catalog
=
certificateCatalogService
.
get
(
applyLogEntity
.
getCatalogId
());
applyLogEntity
.
setCatalogCode
(
catalog
.
getCatalogCode
());
DocTemplateVO
docTemplate
=
new
DocTemplateVO
(
catalog
.
getTemplateFileUrl
(),
applyLogEntity
.
getFormContent
());
return
preview
(
docTemplate
,
context
,
false
);
DocTemplateVO
docTemplate
=
new
DocTemplateVO
(
catalog
.
getTemplateFileUrl
(),
applyLogEntity
.
getFormContent
());
return
preview
(
docTemplate
,
context
,
false
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
generateOriginal
(
ApplyLogEntity
applyLogEntity
,
Context
context
)
throws
AppException
{
validData
(
applyLogEntity
,
context
);
validData
(
applyLogEntity
,
context
);
Long
oldId
=
null
;
boolean
is_record
=
false
;
CertificateCatalogEntity
catalog
=
certificateCatalogService
.
get
(
applyLogEntity
.
getCatalogId
());
applyLogEntity
.
setCatalogCode
(
catalog
.
getCatalogCode
());
applyLogEntity
.
setCatalogName
(
catalog
.
getCatalogName
());
applyLogEntity
.
setFormTemplate
(
catalog
.
getFormContent
());
DocTemplateVO
docTemplate
=
new
DocTemplateVO
(
catalog
.
getTemplateFileUrl
(),
applyLogEntity
.
getFormContent
());
DocTemplateVO
docTemplate
=
new
DocTemplateVO
(
catalog
.
getTemplateFileUrl
(),
applyLogEntity
.
getFormContent
());
boolean
hasPDF
=
false
;
if
(
catalog
.
getIsPdf
()!=
null
&&
catalog
.
getIsPdf
()==
1
)
{
if
(
catalog
.
getIsPdf
()
!=
null
&&
catalog
.
getIsPdf
()
==
1
)
{
hasPDF
=
true
;
}
String
paths
=
preview
(
docTemplate
,
context
,
hasPDF
);
String
paths
=
preview
(
docTemplate
,
context
,
hasPDF
);
String
[]
vals
=
paths
.
split
(
";"
);
if
(
vals
.
length
==
3
)
{
if
(
vals
.
length
==
3
)
{
//有pdf时
applyLogEntity
.
setCertificateUrl
(
vals
[
2
]);
applyLogEntity
.
setPreviewUrl
(
vals
[
1
]);
}
if
(
vals
.
length
==
2
)
{
if
(
vals
.
length
==
2
)
{
//无pdf时
applyLogEntity
.
setCertificateUrl
(
vals
[
0
]);
applyLogEntity
.
setPreviewUrl
(
vals
[
1
]);
}
applyLogEntity
.
setCreateTime
(
new
Date
());
applyLogEntity
.
setRecordStatus
(
YesNoEnum
.
NO
.
getValue
());
if
(
context
!=
null
&&
context
.
getUser
()!=
null
)
{
if
(
context
!=
null
&&
context
.
getUser
()
!=
null
)
{
applyLogEntity
.
setCreateUserId
(
context
.
getUser
().
getId
());
}
try
{
String
rootPath
=
this
.
filePath
.
endsWith
(
"/"
)
?
this
.
filePath
:
this
.
filePath
+
"/"
;
String
filePath
=
rootPath
+
"certificate/qrcode/"
;
String
qrcodeName
=
applyLogEntity
.
getCertificateCode
()
+
".png"
;
String
qrcodeName
=
applyLogEntity
.
getCertificateCode
()
+
".png"
;
File
pathDir
=
new
File
(
filePath
);
if
(!
pathDir
.
exists
())
{
pathDir
.
mkdirs
();
}
String
imagepath
=
filePath
+
qrcodeName
;
String
qrCode
=
serviceUrl
+
applyLogEntity
.
getSocialCode
();
QrCodeUtil
.
generateQrCodeFile
(
qrCode
,
imagepath
);
applyLogEntity
.
setQRCode
(
"/certificate/qrcode/"
+
qrcodeName
);
String
qrCode
=
serviceUrl
+
applyLogEntity
.
getSocialCode
();
QrCodeUtil
.
generateQrCodeFile
(
qrCode
,
imagepath
);
applyLogEntity
.
setQRCode
(
"/certificate/qrcode/"
+
qrcodeName
);
//entry.setValue(pictureRenderData);
}
catch
(
Exception
e
)
{
log
.
error
(
"error"
,
e
);
}
applyLogEntity
.
setGenerateStatus
(
GenerateStatus
.
ORIGINAL
.
getValue
());
if
(
applyLogEntity
.
getId
()!=
null
&&
applyLogEntity
.
getRecordId
()!=
null
)
{
if
(
applyLogEntity
.
getId
()
!=
null
&&
applyLogEntity
.
getRecordId
()
!=
null
)
{
applyLogEntity
.
setOperType
(
OperTypeEnum
.
UPDATE
.
getValue
());
oldId
=
applyLogEntity
.
getId
();
is_record
=
true
;
...
...
@@ -402,7 +411,7 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
recordEntity
.
setUpdateUserId
(
applyLogEntity
.
getCreateUserId
());
recordEntity
.
setUpdateTime
(
applyLogEntity
.
getCreateTime
());
recordDao
.
update
(
recordEntity
);
}
else
{
}
else
{
applyLogEntity
.
setOperType
(
OperTypeEnum
.
SAVE
.
getValue
());
RecordEntity
recordEntity
=
new
RecordEntity
();
recordEntity
.
setCatalogId
(
catalog
.
getId
());
...
...
@@ -415,7 +424,7 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
applyLogEntity
.
setRecordId
(
recordEntity
.
getId
());
}
dao
.
insert
(
applyLogEntity
);
if
(
is_record
)
{
if
(
is_record
)
{
ApplyLogEntity
updata
=
new
ApplyLogEntity
();
updata
.
setId
(
oldId
);
updata
.
setRecordStatus
(
YesNoEnum
.
YES
.
getValue
());
...
...
@@ -423,14 +432,14 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
dao
.
update
(
updata
);
PrintWaitQueueEntity
condition
=
new
PrintWaitQueueEntity
();
condition
.
setApplyId
(
oldId
);
printWaitQueueService
.
remove
(
condition
,
context
);
printWaitQueueService
.
remove
(
condition
,
context
);
}
//插入子证联报
childLicenseService
.
createChildLicense
(
applyLogEntity
,
oldId
,
context
);
printWaitQueueService
.
creatWaitQueueByApply
(
applyLogEntity
,
GenerateStatus
.
ORIGINAL
.
getValue
(),
context
);
childLicenseService
.
createChildLicense
(
applyLogEntity
,
oldId
,
context
);
printWaitQueueService
.
creatWaitQueueByApply
(
applyLogEntity
,
GenerateStatus
.
ORIGINAL
.
getValue
(),
context
);
}
private
String
preview
(
DocTemplateVO
docTemplate
,
Context
context
,
boolean
hasPDF
)
{
private
String
preview
(
DocTemplateVO
docTemplate
,
Context
context
,
boolean
hasPDF
)
{
String
rootPath
=
this
.
filePath
.
endsWith
(
"/"
)
?
this
.
filePath
:
this
.
filePath
+
"/"
;
//转换表单参数为map集合
ObjectMapper
mapper
=
new
ObjectMapper
();
...
...
@@ -449,7 +458,7 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
try
{
PictureRenderData
pictureRenderData
=
Pictures
.
ofStream
(
new
FileInputStream
(
imagepath
),
PictureType
.
JPEG
)
.
size
(
120
,
120
).
create
();
addMap
.
put
(
StrUtil
.
removePrefixIgnoreCase
(
entry
.
getKey
(),
"@"
),
pictureRenderData
);
addMap
.
put
(
StrUtil
.
removePrefixIgnoreCase
(
entry
.
getKey
(),
"@"
),
pictureRenderData
);
//entry.setValue(pictureRenderData);
}
catch
(
FileNotFoundException
e
)
{
log
.
error
(
"error"
,
e
);
...
...
@@ -498,14 +507,14 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
String
imagepath
=
rootPath
+
docTemplate
.
getQrCode
();
PictureRenderData
pictureRenderData
=
Pictures
.
ofStream
(
new
FileInputStream
(
imagepath
),
PictureType
.
PNG
)
.
size
(
100
,
100
).
create
();
addMap
.
put
(
StrUtil
.
removePrefixIgnoreCase
(
entry
.
getKey
(),
"@"
),
pictureRenderData
);
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
);
}
//查询是否有多选框,
...
...
@@ -522,7 +531,7 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
MultipartFile
multipartFile
=
new
MockMultipartFile
(
templateName
,
templateName
,
ContentType
.
APPLICATION_OCTET_STREAM
.
toString
(),
byteArrayOutputStream
.
toByteArray
());
String
mergedocPath
=
uploadService
.
saveFileUpload
(
multipartFile
,
"/mergedoc"
,
context
==
null
?
null
:
context
.
getUser
());
String
mergedocPath
=
uploadService
.
saveFileUpload
(
multipartFile
,
"/mergedoc"
,
context
==
null
?
null
:
context
.
getUser
());
log
.
info
(
"mergedocPath:"
+
mergedocPath
);
String
mergedoc
=
rootPath
+
mergedocPath
;
//转换预览图片
...
...
@@ -534,15 +543,15 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
}
WordUtil
.
convertWordToJPEG
(
mergedoc
,
preView
);
log
.
info
(
"preView:"
+
"/preview/"
+
fileName
);
if
(
hasPDF
)
{
String
pdfName
=
mergedocPath
.
substring
(
0
,
mergedocPath
.
indexOf
(
"."
))
+
".pdf"
;
if
(
hasPDF
)
{
String
pdfName
=
mergedocPath
.
substring
(
0
,
mergedocPath
.
indexOf
(
"."
))
+
".pdf"
;
String
pdfPath
=
rootPath
+
pdfName
;
WordUtil
.
convertWordToPDF
(
mergedoc
,
pdfPath
);
//PdfUtil.docxToPdf(mergedoc, pdfPath);
//下载地址拼装
String
returnStr
=
mergedocPath
+
";"
+
"/preview/"
+
fileName
+
";"
+
pdfName
;
return
returnStr
;
}
else
{
}
else
{
//下载地址拼装
String
returnStr
=
mergedocPath
+
";"
+
"/preview/"
+
fileName
;
return
returnStr
;
...
...
@@ -567,20 +576,20 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
@Override
public
List
<
ApplyLogEntity
>
ApplyRecord
(
Long
applyId
)
throws
AppException
{
ApplyLogEntity
applyLogEntity
=
this
.
dao
.
get
(
applyId
);
if
(
applyLogEntity
==
null
)
{
if
(
applyLogEntity
==
null
)
{
throw
new
AppException
(
"数据不存在"
);
}
UserEntity
userEntity
=
userService
.
get
(
applyLogEntity
.
getCreateUserId
());
ApplyLogEntity
query
=
new
ApplyLogEntity
();
query
.
setRecordId
(
applyLogEntity
.
getRecordId
());
List
<
ApplyLogEntity
>
list
=
dao
.
getList
(
query
);
for
(
ApplyLogEntity
entity:
list
)
{
for
(
ApplyLogEntity
entity
:
list
)
{
OperTypeEnum
operTypeEnum
=
OperTypeEnum
.
getByValue
(
entity
.
getOperType
());
if
(
operTypeEnum
!=
null
)
{
entity
.
setOperTypeName
(
operTypeEnum
.
getDesc
()
+
entity
.
getCertificateName
());
if
(
operTypeEnum
!=
null
)
{
entity
.
setOperTypeName
(
operTypeEnum
.
getDesc
()
+
entity
.
getCertificateName
());
}
if
(
userEntity
!=
null
)
{
if
(
userEntity
!=
null
)
{
entity
.
setCreateUserName
(
userEntity
.
getRealName
());
}
}
...
...
@@ -588,15 +597,15 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
}
@Override
public
String
importData
(
List
<
Map
<
Integer
,
Object
>>
dataList
,
Map
<
String
,
String
>
fileMap
,
Long
catalogId
,
Long
templateId
,
Context
context
)
throws
AppException
{
if
(
catalogId
==
null
)
{
public
String
importData
(
List
<
Map
<
Integer
,
Object
>>
dataList
,
Map
<
String
,
String
>
fileMap
,
Long
catalogId
,
Long
templateId
,
Context
context
)
throws
AppException
{
if
(
catalogId
==
null
)
{
throw
new
AppException
(
"目录ID不能为空"
);
}
CertificateCatalogEntity
catalog
=
certificateCatalogService
.
get
(
catalogId
);
if
(
catalog
==
null
)
{
if
(
catalog
==
null
)
{
throw
new
AppException
(
"目录ID不正确"
);
}
if
(
templateId
==
null
)
{
if
(
templateId
==
null
)
{
throw
new
AppException
(
"目录模板ID不能为空"
);
}
...
...
@@ -604,7 +613,7 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
JSONArray
formList
=
formContent
.
getJSONArray
(
"list"
);
Map
<
Integer
,
Object
>
header
=
dataList
.
get
(
0
);
//表头
List
<
ApplyLogEntity
>
applyLogList
=
new
ArrayList
<>();
for
(
int
r
=
1
;
r
<
dataList
.
size
();
r
++)
{
for
(
int
r
=
1
;
r
<
dataList
.
size
();
r
++)
{
Map
<
Integer
,
Object
>
row
=
dataList
.
get
(
r
);
ApplyLogEntity
entity
=
new
ApplyLogEntity
();
entity
.
setCatalogId
(
catalogId
);
...
...
@@ -614,9 +623,9 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
entity
.
setCertificateName
(
String
.
valueOf
(
row
.
get
(
1
)));
entity
.
setHolderName
(
String
.
valueOf
(
row
.
get
(
2
)));
HolderType
holderType
=
HolderType
.
getByDesc
(
String
.
valueOf
(
row
.
get
(
3
)));
entity
.
setHolderType
(
holderType
==
null
?
HolderType
.
LEGAL_AND_PERSON
.
getValue
():
holderType
.
getValue
());
entity
.
setHolderType
(
holderType
==
null
?
HolderType
.
LEGAL_AND_PERSON
.
getValue
()
:
holderType
.
getValue
());
HolderIdType
holderIdType
=
HolderIdType
.
getByDesc
(
String
.
valueOf
(
row
.
get
(
4
)));
entity
.
setHolderIdType
(
holderIdType
==
null
?
HolderIdType
.
ID_CARD
.
getValue
():
holderIdType
.
getValue
());
entity
.
setHolderIdType
(
holderIdType
==
null
?
HolderIdType
.
ID_CARD
.
getValue
()
:
holderIdType
.
getValue
());
entity
.
setHolderIDCardNo
(
String
.
valueOf
(
row
.
get
(
5
)));
entity
.
setPickerName
(
String
.
valueOf
(
row
.
get
(
6
)));
entity
.
setPickerIDCardNo
(
String
.
valueOf
(
row
.
get
(
7
)));
...
...
@@ -624,36 +633,36 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
try
{
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
entity
.
setIssueTime
(
formatter
.
parse
(
String
.
valueOf
(
row
.
get
(
8
))));
}
catch
(
ParseException
e
)
{
}
catch
(
ParseException
e
)
{
entity
.
setIssueTime
(
new
Date
());
}
entity
.
setPrivateID
(
String
.
valueOf
(
row
.
get
(
9
)));
entity
.
setEnterpriseName
(
String
.
valueOf
(
row
.
get
(
10
)));
JSONObject
formJson
=
new
JSONObject
();
int
formSize
=
row
.
size
();
for
(
int
i
=
11
;
i
<
formSize
;
i
++)
{
for
(
int
i
=
11
;
i
<
formSize
;
i
++)
{
String
key
=
String
.
valueOf
(
header
.
get
(
i
));
String
value
=
String
.
valueOf
(
row
.
get
(
i
));
if
(
key
.
indexOf
(
"@image"
)
!=
-
1
){
if
(
key
.
indexOf
(
"@image"
)
!=
-
1
)
{
int
rowNum
=
r
+
1
;
//excel表头是从第二行开始读,索引需要加1
String
imageKey
=
rowNum
+
","
+
i
;
String
imagePath
=
fileMap
.
get
(
imageKey
);
if
(
StringUtils
.
isNotEmpty
(
imagePath
))
{
if
(
StringUtils
.
isNotEmpty
(
imagePath
))
{
value
=
imagePath
;
}
}
formJson
.
put
(
key
,
value
);
for
(
int
j
=
0
;
j
<
formList
.
size
();
j
++)
{
JSONObject
jsonObject
=
formList
.
getJSONObject
(
j
);
if
(
jsonObject
.
getString
(
"_id"
).
equals
(
String
.
valueOf
(
header
.
get
(
i
))))
{
jsonObject
.
put
(
"value"
,
value
);
if
(
jsonObject
.
getString
(
"_id"
).
equals
(
String
.
valueOf
(
header
.
get
(
i
))))
{
jsonObject
.
put
(
"value"
,
value
);
break
;
}
}
}
entity
.
setFormContent
(
formJson
.
toJSONString
());
entity
.
setFormTemplate
(
formContent
.
toJSONString
());
if
(
context
!=
null
&&
context
.
getUser
()!=
null
)
{
if
(
context
!=
null
&&
context
.
getUser
()
!=
null
)
{
entity
.
setCreateUserId
(
context
.
getUser
().
getId
());
}
entity
.
setCreateTime
(
new
Date
());
...
...
@@ -663,11 +672,11 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
int
failureNum
=
0
;
StringBuilder
successMsg
=
new
StringBuilder
();
StringBuilder
failureMsg
=
new
StringBuilder
();
for
(
ApplyLogEntity
applyLogEntity:
applyLogList
)
{
for
(
ApplyLogEntity
applyLogEntity
:
applyLogList
)
{
try
{
this
.
generateOriginal
(
applyLogEntity
,
context
);
successNum
++;
}
catch
(
Exception
var11
)
{
}
catch
(
Exception
var11
)
{
this
.
log
.
error
(
"导入异常"
,
var11
);
++
failureNum
;
}
...
...
@@ -685,7 +694,7 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
@Override
public
ApplyLogEntity
getBySocialCode
(
String
socialCode
)
throws
AppException
{
ApplyLogEntity
entity
=
this
.
selectOne
(
new
ApplyLogQuery
().
socialCode
(
socialCode
));
if
(
entity
!=
null
)
{
if
(
entity
!=
null
)
{
List
<
ChildLicenseEntity
>
childs
=
childLicenseService
.
find
(
new
ChildLicenseQuery
().
applyId
(
entity
.
getId
()).
processStatus
(
ProcessStatusEnum
.
已处理
.
getValue
()).
childStatus
(
StatusEnum
.
ENABLE
.
getValue
()));
entity
.
setChildLicense
(
childs
);
}
...
...
@@ -695,9 +704,9 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
@Override
protected
void
updateAfter
(
ApplyLogEntity
entity
,
Context
context
)
throws
AppException
{
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getChildLicense
()))
{
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getChildLicense
()))
{
//更新子证件状态
childLicenseService
.
update
(
entity
.
getChildLicense
(),
context
);
childLicenseService
.
update
(
entity
.
getChildLicense
(),
context
);
}
...
...
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