|
@@ -276,7 +276,7 @@ public class MyController {
|
|
|
return ResponseHelp.success(true);
|
|
|
}
|
|
|
|
|
|
- @RequestMapping(value = "/real/front", produces = MediaType.IMAGE_JPEG_VALUE, method = RequestMethod.POST)
|
|
|
+ @RequestMapping(value = "/real/front", method = RequestMethod.POST)
|
|
|
@ApiOperation(value = "实名认证", notes = "保存用户实名信息", httpMethod = "POST")
|
|
|
public Response<UserRealDto> realFront(@RequestParam("file") MultipartFile file) throws IOException {
|
|
|
if (file.isEmpty()) {
|
|
@@ -291,14 +291,17 @@ public class MyController {
|
|
|
dto.setIdentity(map.get("identity"));
|
|
|
|
|
|
User in = usersService.getByIdentity(map.get("identity"));
|
|
|
- if (in != null){
|
|
|
+ if (in != null && !in.getId().equals(user.getId())){
|
|
|
throw new ParameterException("该身份证已被其他账号认证");
|
|
|
}
|
|
|
|
|
|
- String frontName = UUID.randomUUID().toString();
|
|
|
+ String filename = file.getOriginalFilename();
|
|
|
+ String suffix = filename.substring(filename.lastIndexOf(".")+1);
|
|
|
+ String frontName = UUID.randomUUID().toString()+"."+suffix;
|
|
|
try {
|
|
|
- File frontDest = new File(localPath + File.separator+frontName);
|
|
|
- file.transferTo(frontDest);
|
|
|
+ File dir = new File(localPath);
|
|
|
+ File dest = new File(dir.getAbsolutePath() + File.separator+frontName);
|
|
|
+ file.transferTo(dest);
|
|
|
dto.setPhotoFront(webUrl+frontName);
|
|
|
usersService.edit(User.builder()
|
|
|
.id(user.getId())
|
|
@@ -314,7 +317,7 @@ public class MyController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @RequestMapping(value = "/real/back", produces = MediaType.IMAGE_JPEG_VALUE, method = RequestMethod.POST)
|
|
|
+ @RequestMapping(value = "/real/back", method = RequestMethod.POST)
|
|
|
@ApiOperation(value = "实名认证", notes = "保存用户实名信息", httpMethod = "POST")
|
|
|
public Response<UserRealDto> realBack(@RequestParam("file") MultipartFile file) throws IOException {
|
|
|
if (file.isEmpty()) {
|
|
@@ -324,10 +327,13 @@ public class MyController {
|
|
|
UserRealDto dto = new UserRealDto();
|
|
|
|
|
|
aiHelp.orcIdcardBack(file.getBytes());
|
|
|
- String backName = UUID.randomUUID().toString();
|
|
|
+ String filename = file.getOriginalFilename();
|
|
|
+ String suffix = filename.substring(filename.lastIndexOf(".")+1);
|
|
|
+ String backName = UUID.randomUUID().toString()+"."+suffix;
|
|
|
try {
|
|
|
- File backDest = new File(localPath + File.separator+backName);
|
|
|
- file.transferTo(backDest);
|
|
|
+ File dir = new File(localPath);
|
|
|
+ File dest = new File(dir.getAbsolutePath() + File.separator+backName);
|
|
|
+ file.transferTo(dest);
|
|
|
dto.setPhotoBack(webUrl+backName);
|
|
|
usersService.edit(User.builder()
|
|
|
.id(user.getId())
|
|
@@ -340,26 +346,26 @@ public class MyController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @RequestMapping(value = "/real/finish", produces = MediaType.IMAGE_JPEG_VALUE, method = RequestMethod.POST)
|
|
|
+ @RequestMapping(value = "/real/finish", method = RequestMethod.POST)
|
|
|
@ApiOperation(value = "实名认证", notes = "保存用户实名信息", httpMethod = "POST")
|
|
|
public Response<UserRealDto> realFinish() {
|
|
|
User user = (User) shiroHelp.getLoginUser();
|
|
|
UserRealDto dto = new UserRealDto();
|
|
|
|
|
|
User in = usersService.get(user.getId());
|
|
|
- if (in.getRealAddress() == null || !in.getRealAddress().equals("")){
|
|
|
+ if (in.getRealAddress() == null || in.getRealAddress().equals("")){
|
|
|
throw new ParameterException("实名认证流程错误");
|
|
|
}
|
|
|
- if (in.getRealIdentity() == null || !in.getRealIdentity().equals("")){
|
|
|
+ if (in.getRealIdentity() == null || in.getRealIdentity().equals("")){
|
|
|
throw new ParameterException("实名认证流程错误");
|
|
|
}
|
|
|
- if (in.getRealName() == null || !in.getRealName().equals("")){
|
|
|
+ if (in.getRealName() == null || in.getRealName().equals("")){
|
|
|
throw new ParameterException("实名认证流程错误");
|
|
|
}
|
|
|
- if (in.getRealPhotoFront() == null || !in.getRealPhotoFront().equals("")){
|
|
|
+ if (in.getRealPhotoFront() == null || in.getRealPhotoFront().equals("")){
|
|
|
throw new ParameterException("实名认证流程错误");
|
|
|
}
|
|
|
- if (in.getRealPhotoBack() == null || !in.getRealPhotoBack().equals("")){
|
|
|
+ if (in.getRealPhotoBack() == null || in.getRealPhotoBack().equals("")){
|
|
|
throw new ParameterException("实名认证流程错误");
|
|
|
}
|
|
|
|
|
@@ -368,7 +374,8 @@ public class MyController {
|
|
|
.realStatus(1)
|
|
|
.realTime(new Date())
|
|
|
.build());
|
|
|
- orderFlowService.giveReal(in);
|
|
|
+ UserOrderRecord record = orderFlowService.giveReal(in);
|
|
|
+ dto.setRecord(Transform.convert(record, UserOrderRecordExtendDto.class));
|
|
|
return ResponseHelp.success(dto);
|
|
|
}
|
|
|
|