Commit 3c96bedb by lixian7

Merge branch 'feature-20200720' into 'test'

Feature 20200720

See merge request !26
parents 9e28c5d3 7a416196
...@@ -48,8 +48,8 @@ public class BindInfoControlller extends BaseController { ...@@ -48,8 +48,8 @@ public class BindInfoControlller extends BaseController {
* @date: 2020/6/19 10:27 * @date: 2020/6/19 10:27
*/ */
@PostMapping( "bind" ) @PostMapping( "bind" )
// @BodyDecryptAnnotation @BodyDecryptAnnotation
// @ResponseEncryptAnnotation @ResponseEncryptAnnotation
public Result bindInfo( @RequestBody @Validated BindInfoReq req ) { public Result bindInfo( @RequestBody @Validated BindInfoReq req ) {
Result response = null; Result response = null;
try { try {
...@@ -65,11 +65,13 @@ public class BindInfoControlller extends BaseController { ...@@ -65,11 +65,13 @@ public class BindInfoControlller extends BaseController {
} }
/** /**
* 车辆绑定短信验证几节课 * 车辆绑定短信验证
* @param req * @param req
* @return * @return
*/ */
@PostMapping("bind/smsValid") @PostMapping("bind/smsValid")
@BodyDecryptAnnotation
@ResponseEncryptAnnotation
public Result<BindInfoRes> bindSmsValid(@RequestBody @Validated BindSmsValidReq req) { public Result<BindInfoRes> bindSmsValid(@RequestBody @Validated BindSmsValidReq req) {
return service.bindSmsValid(req); return service.bindSmsValid(req);
} }
...@@ -105,6 +107,8 @@ public class BindInfoControlller extends BaseController { ...@@ -105,6 +107,8 @@ public class BindInfoControlller extends BaseController {
* @return * @return
*/ */
@PostMapping( "admin/unbind" ) @PostMapping( "admin/unbind" )
@BodyDecryptAnnotation
@ResponseEncryptAnnotation
public Result adminUnbind(@RequestBody @Validated AdminUnbindReq req ) { public Result adminUnbind(@RequestBody @Validated AdminUnbindReq req ) {
Result result = null; Result result = null;
try { try {
...@@ -124,6 +128,8 @@ public class BindInfoControlller extends BaseController { ...@@ -124,6 +128,8 @@ public class BindInfoControlller extends BaseController {
* @return * @return
*/ */
@PostMapping( "admin/unbind/smsValid" ) @PostMapping( "admin/unbind/smsValid" )
@BodyDecryptAnnotation
@ResponseEncryptAnnotation
public Result adminUnbindSmsValid(@RequestBody @Validated AdminUnbindSmsValidReq req) { public Result adminUnbindSmsValid(@RequestBody @Validated AdminUnbindSmsValidReq req) {
Result result = null; Result result = null;
try { try {
......
...@@ -5,6 +5,7 @@ import com.hikcreate.common.sdk.exception.BusinessException; ...@@ -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.Response;
import com.hikcreate.common.sdk.response.apiparam.ResponseGenerator; import com.hikcreate.common.sdk.response.apiparam.ResponseGenerator;
import com.hikcreate.common.sdk.response.statuscode.StatusCode; 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.common.image.builder.domain.DlImageDO;
import com.hikcreate.edl.pub.web.mobile.domain.CredentialsImageService; import com.hikcreate.edl.pub.web.mobile.domain.CredentialsImageService;
import com.hikcreate.edl.pub.web.mobile.domain.DrivingLicenseService; import com.hikcreate.edl.pub.web.mobile.domain.DrivingLicenseService;
...@@ -34,6 +35,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -34,6 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.Objects;
/** /**
* 驾驶证图片接口 * 驾驶证图片接口
...@@ -84,12 +86,15 @@ public class DrivingLicenseController { ...@@ -84,12 +86,15 @@ public class DrivingLicenseController {
} }
@GetMapping("/image") @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)) { if (!drivingLicenseService.checkValid(userId, idCard) && !iBindService.checkValid(userId,idCard)) {
throw new BusinessException(StatusCode.PARAM_ERROR); throw new BusinessException(StatusCode.PARAM_ERROR);
} }
DrivingLicenseMicRes drivingLicenseMicRes = drivingLicenseFeign.getByIdCard(new CreditIdCardMicReq().setIdCard(idCard)).fallback().getData(); DrivingLicenseMicRes drivingLicenseMicRes = drivingLicenseFeign.getByIdCard(new CreditIdCardMicReq().setIdCard(idCard)).fallback().getData();
ByteArrayOutputStream outputStream;
if(type == null || Objects.equals(type, 1)) {
DlImageDO dlImageDO = new DlImageDO(); DlImageDO dlImageDO = new DlImageDO();
dlImageDO.setAddress(drivingLicenseMicRes.getAddress()); dlImageDO.setAddress(drivingLicenseMicRes.getAddress());
dlImageDO.setBelowLicenseNumber(drivingLicenseMicRes.getIdCard()); dlImageDO.setBelowLicenseNumber(drivingLicenseMicRes.getIdCard());
...@@ -105,8 +110,13 @@ public class DrivingLicenseController { ...@@ -105,8 +110,13 @@ public class DrivingLicenseController {
dlImageDO.setValidityPeriod(drivingLicenseMicRes.getEffectiveDate() + "至" + drivingLicenseMicRes.getExpiryDate()); dlImageDO.setValidityPeriod(drivingLicenseMicRes.getEffectiveDate() + "至" + drivingLicenseMicRes.getExpiryDate());
dlImageDO.setRecord(""); dlImageDO.setRecord("");
dlImageDO.setFileNumber(drivingLicenseMicRes.getFileNum()); 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 { try {
setHeader(response, drivingLicenseMicRes.getIdCard() + ".jpg"); setHeader(response, drivingLicenseMicRes.getIdCard() + ".jpg");
response.getOutputStream().write(outputStream.toByteArray()); response.getOutputStream().write(outputStream.toByteArray());
......
package com.hikcreate.edl.pub.web.mobile.domain; 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 com.hikcreate.edl.common.image.builder.domain.DlImageDO;
import java.io.OutputStream; import java.io.OutputStream;
...@@ -17,4 +18,13 @@ public interface CredentialsImageService { ...@@ -17,4 +18,13 @@ public interface CredentialsImageService {
* @return * @return
*/ */
OutputStream genDlImage(DlImageDO params); OutputStream genDlImage(DlImageDO params);
/**
* 生成驾驶证背面图片
*
* @param params 参数
* @return
*/
OutputStream genDlBackImage(DlBackImageDO params);
} }
...@@ -2,6 +2,7 @@ package com.hikcreate.edl.pub.web.mobile.domain.impl; ...@@ -2,6 +2,7 @@ package com.hikcreate.edl.pub.web.mobile.domain.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hikcreate.common.sdk.exception.BusinessException; 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.domain.DlImageDO;
import com.hikcreate.edl.common.image.builder.refactor.DrawDispatcher; import com.hikcreate.edl.common.image.builder.refactor.DrawDispatcher;
import com.hikcreate.edl.pub.web.mobile.domain.CredentialsImageService; import com.hikcreate.edl.pub.web.mobile.domain.CredentialsImageService;
...@@ -18,6 +19,7 @@ import java.io.OutputStream; ...@@ -18,6 +19,7 @@ import java.io.OutputStream;
@Slf4j @Slf4j
@Service @Service
public class CredentialsImageServiceImpl implements CredentialsImageService { public class CredentialsImageServiceImpl implements CredentialsImageService {
@Autowired @Autowired
private DrawDispatcher drawDispatcher; private DrawDispatcher drawDispatcher;
...@@ -32,4 +34,23 @@ public class CredentialsImageServiceImpl implements CredentialsImageService { ...@@ -32,4 +34,23 @@ public class CredentialsImageServiceImpl implements CredentialsImageService {
} }
return outputStream; 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;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment