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 {
* @date: 2020/6/19 10:27
*/
@PostMapping( "bind" )
// @BodyDecryptAnnotation
// @ResponseEncryptAnnotation
@BodyDecryptAnnotation
@ResponseEncryptAnnotation
public Result bindInfo( @RequestBody @Validated BindInfoReq req ) {
Result response = null;
try {
......@@ -65,11 +65,13 @@ public class BindInfoControlller extends BaseController {
}
/**
* 车辆绑定短信验证几节课
* 车辆绑定短信验证
* @param req
* @return
*/
@PostMapping("bind/smsValid")
@BodyDecryptAnnotation
@ResponseEncryptAnnotation
public Result<BindInfoRes> bindSmsValid(@RequestBody @Validated BindSmsValidReq req) {
return service.bindSmsValid(req);
}
......@@ -105,6 +107,8 @@ public class BindInfoControlller extends BaseController {
* @return
*/
@PostMapping( "admin/unbind" )
@BodyDecryptAnnotation
@ResponseEncryptAnnotation
public Result adminUnbind(@RequestBody @Validated AdminUnbindReq req ) {
Result result = null;
try {
......@@ -124,6 +128,8 @@ public class BindInfoControlller extends BaseController {
* @return
*/
@PostMapping( "admin/unbind/smsValid" )
@BodyDecryptAnnotation
@ResponseEncryptAnnotation
public Result adminUnbindSmsValid(@RequestBody @Validated AdminUnbindSmsValidReq req) {
Result result = null;
try {
......
......@@ -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,29 +86,37 @@ 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();
DlImageDO dlImageDO = new DlImageDO();
dlImageDO.setAddress(drivingLicenseMicRes.getAddress());
dlImageDO.setBelowLicenseNumber(drivingLicenseMicRes.getIdCard());
dlImageDO.setAvatarFullUrl(fastDfsConfigBean.genBigDataInnerUrl(drivingLicenseMicRes.getAvatar()));
dlImageDO.setBirthday(drivingLicenseMicRes.getBirthday());
dlImageDO.setLicenseNumber(drivingLicenseMicRes.getIdCard());
dlImageDO.setInitLicenseDate(drivingLicenseMicRes.getIssueDate());
dlImageDO.setName(drivingLicenseMicRes.getRealName());
dlImageDO.setBelowName(drivingLicenseMicRes.getRealName());
dlImageDO.setModel(drivingLicenseMicRes.getLicenseType());
dlImageDO.setNationality(drivingLicenseMicRes.getNationality());
dlImageDO.setSex(drivingLicenseMicRes.getGender());
dlImageDO.setValidityPeriod(drivingLicenseMicRes.getEffectiveDate() + "至" + drivingLicenseMicRes.getExpiryDate());
dlImageDO.setRecord("");
dlImageDO.setFileNumber(drivingLicenseMicRes.getFileNum());
ByteArrayOutputStream outputStream = (ByteArrayOutputStream) credentialsImageService.genDlImage(dlImageDO);
ByteArrayOutputStream outputStream;
if(type == null || Objects.equals(type, 1)) {
DlImageDO dlImageDO = new DlImageDO();
dlImageDO.setAddress(drivingLicenseMicRes.getAddress());
dlImageDO.setBelowLicenseNumber(drivingLicenseMicRes.getIdCard());
dlImageDO.setAvatarFullUrl(fastDfsConfigBean.genBigDataInnerUrl(drivingLicenseMicRes.getAvatar()));
dlImageDO.setBirthday(drivingLicenseMicRes.getBirthday());
dlImageDO.setLicenseNumber(drivingLicenseMicRes.getIdCard());
dlImageDO.setInitLicenseDate(drivingLicenseMicRes.getIssueDate());
dlImageDO.setName(drivingLicenseMicRes.getRealName());
dlImageDO.setBelowName(drivingLicenseMicRes.getRealName());
dlImageDO.setModel(drivingLicenseMicRes.getLicenseType());
dlImageDO.setNationality(drivingLicenseMicRes.getNationality());
dlImageDO.setSex(drivingLicenseMicRes.getGender());
dlImageDO.setValidityPeriod(drivingLicenseMicRes.getEffectiveDate() + "至" + drivingLicenseMicRes.getExpiryDate());
dlImageDO.setRecord("");
dlImageDO.setFileNumber(drivingLicenseMicRes.getFileNum());
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());
......
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);
}
......@@ -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;
}
}
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