Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
extend
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
park
extend
Commits
55e3e63b
You need to sign in or sign up before continuing.
Commit
55e3e63b
authored
Jul 22, 2020
by
牟邦恺
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
添加驾驶证图片反面查看
parent
41c57542
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
3 deletions
+44
-3
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/DrivingLicenseController.java
+13
-3
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/CredentialsImageService.java
+10
-0
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/CredentialsImageServiceImpl.java
+21
-0
No files found.
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/DrivingLicenseController.java
View file @
55e3e63b
...
...
@@ -5,6 +5,7 @@ import com.hikcreate.common.sdk.exception.BusinessException;
import
com.hikcreate.common.sdk.response.apiparam.Response
;
import
com.hikcreate.common.sdk.response.apiparam.ResponseGenerator
;
import
com.hikcreate.common.sdk.response.statuscode.StatusCode
;
import
com.hikcreate.edl.common.image.builder.domain.DlBackImageDO
;
import
com.hikcreate.edl.common.image.builder.domain.DlImageDO
;
import
com.hikcreate.edl.pub.web.mobile.domain.CredentialsImageService
;
import
com.hikcreate.edl.pub.web.mobile.domain.DrivingLicenseService
;
...
...
@@ -34,6 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.util.Objects
;
/**
* 驾驶证图片接口
...
...
@@ -84,12 +86,15 @@ public class DrivingLicenseController {
}
@GetMapping
(
"/image"
)
public
void
image
(
@RequestParam
(
"userId"
)
String
userId
,
@RequestParam
(
"idCard"
)
String
idCard
,
HttpServletResponse
response
)
{
public
void
image
(
@RequestParam
(
"userId"
)
String
userId
,
@RequestParam
(
"idCard"
)
String
idCard
,
@RequestParam
(
"type"
)
Integer
type
,
HttpServletResponse
response
)
{
// 验证是否有查看权限
if
(!
drivingLicenseService
.
checkValid
(
userId
,
idCard
)
&&
!
iBindService
.
checkValid
(
userId
,
idCard
))
{
throw
new
BusinessException
(
StatusCode
.
PARAM_ERROR
);
}
DrivingLicenseMicRes
drivingLicenseMicRes
=
drivingLicenseFeign
.
getByIdCard
(
new
CreditIdCardMicReq
().
setIdCard
(
idCard
)).
fallback
().
getData
();
ByteArrayOutputStream
outputStream
;
if
(
type
==
null
||
Objects
.
equals
(
type
,
1
))
{
DlImageDO
dlImageDO
=
new
DlImageDO
();
dlImageDO
.
setAddress
(
drivingLicenseMicRes
.
getAddress
());
dlImageDO
.
setBelowLicenseNumber
(
drivingLicenseMicRes
.
getIdCard
());
...
...
@@ -105,8 +110,13 @@ public class DrivingLicenseController {
dlImageDO
.
setValidityPeriod
(
drivingLicenseMicRes
.
getEffectiveDate
()
+
"至"
+
drivingLicenseMicRes
.
getExpiryDate
());
dlImageDO
.
setRecord
(
""
);
dlImageDO
.
setFileNumber
(
drivingLicenseMicRes
.
getFileNum
());
ByteArrayOutputStream
outputStream
=
(
ByteArrayOutputStream
)
credentialsImageService
.
genDlImage
(
dlImageDO
);
outputStream
=
(
ByteArrayOutputStream
)
credentialsImageService
.
genDlImage
(
dlImageDO
);
}
else
{
DlBackImageDO
dlBackImageDO
=
new
DlBackImageDO
();
dlBackImageDO
.
setRecordContents
(
""
);
dlBackImageDO
.
setSerialNum
(
""
);
outputStream
=
(
ByteArrayOutputStream
)
credentialsImageService
.
genDlBackImage
(
dlBackImageDO
);
}
try
{
setHeader
(
response
,
drivingLicenseMicRes
.
getIdCard
()
+
".jpg"
);
response
.
getOutputStream
().
write
(
outputStream
.
toByteArray
());
...
...
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/CredentialsImageService.java
View file @
55e3e63b
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
domain
;
import
com.hikcreate.edl.common.image.builder.domain.DlBackImageDO
;
import
com.hikcreate.edl.common.image.builder.domain.DlImageDO
;
import
java.io.OutputStream
;
...
...
@@ -17,4 +18,13 @@ public interface CredentialsImageService {
* @return
*/
OutputStream
genDlImage
(
DlImageDO
params
);
/**
* 生成驾驶证背面图片
*
* @param params 参数
* @return
*/
OutputStream
genDlBackImage
(
DlBackImageDO
params
);
}
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/CredentialsImageServiceImpl.java
View file @
55e3e63b
...
...
@@ -2,6 +2,7 @@ package com.hikcreate.edl.pub.web.mobile.domain.impl;
import
com.alibaba.fastjson.JSONObject
;
import
com.hikcreate.common.sdk.exception.BusinessException
;
import
com.hikcreate.edl.common.image.builder.domain.DlBackImageDO
;
import
com.hikcreate.edl.common.image.builder.domain.DlImageDO
;
import
com.hikcreate.edl.common.image.builder.refactor.DrawDispatcher
;
import
com.hikcreate.edl.pub.web.mobile.domain.CredentialsImageService
;
...
...
@@ -18,6 +19,7 @@ import java.io.OutputStream;
@Slf4j
@Service
public
class
CredentialsImageServiceImpl
implements
CredentialsImageService
{
@Autowired
private
DrawDispatcher
drawDispatcher
;
...
...
@@ -32,4 +34,23 @@ public class CredentialsImageServiceImpl implements CredentialsImageService {
}
return
outputStream
;
}
/**
* 生成驾驶证背面图片
*
* @param params 参数
* @return
*/
@Override
public
OutputStream
genDlBackImage
(
DlBackImageDO
params
)
{
OutputStream
outputStream
;
try
{
outputStream
=
drawDispatcher
.
drawDlBack
(
params
);
}
catch
(
Exception
e
)
{
log
.
error
(
"Gen DrivingLicense back Image Error, param={}, msg={}"
,
JSONObject
.
toJSONString
(
params
),
e
);
throw
new
BusinessException
(
"获取驾驶证图片失败"
);
}
return
outputStream
;
}
}
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