Commit 6e512373 authored by hezhen's avatar hezhen

修改实名认证

parent aaaee09f
...@@ -38,6 +38,7 @@ public interface UserFeign { ...@@ -38,6 +38,7 @@ public interface UserFeign {
*/ */
@RequestMapping(value = "/api/app/user/authentication", method = RequestMethod.POST) @RequestMapping(value = "/api/app/user/authentication", method = RequestMethod.POST)
public ObjectRestResponse authentication( @RequestParam(value="userId")Integer userId, public ObjectRestResponse authentication( @RequestParam(value="userId")Integer userId,
@RequestParam(value="name")String name,
@RequestParam(value="idNumber")String idNumber, @RequestParam(value="idNumber")String idNumber,
@RequestParam(value="status")Integer status); @RequestParam(value="status")Integer status);
......
...@@ -42,12 +42,12 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> { ...@@ -42,12 +42,12 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
} }
@Override @Override
@CacheClear(pre="user{1.username}") @CacheClear(pre="user{1.id}")
public void updateSelectiveById(AppUserLogin entity) { public void updateSelectiveById(AppUserLogin entity) {
super.updateSelectiveById(entity); super.updateSelectiveById(entity);
} }
@CacheClear(pre="user{1.username}") @CacheClear(pre="user{1.id}")
public void updatePasswordById(AppUserLogin entity) { public void updatePasswordById(AppUserLogin entity) {
String password = new BCryptPasswordEncoder(UserConstant.PW_ENCORDER_SALT).encode(entity.getPassword()); String password = new BCryptPasswordEncoder(UserConstant.PW_ENCORDER_SALT).encode(entity.getPassword());
entity.setPassword(password); entity.setPassword(password);
......
...@@ -164,10 +164,11 @@ public class AppUserRest { ...@@ -164,10 +164,11 @@ public class AppUserRest {
@RequestMapping(value = "/user/authentication", method = RequestMethod.POST) @RequestMapping(value = "/user/authentication", method = RequestMethod.POST)
public @ResponseBody ObjectRestResponse authentication( public @ResponseBody ObjectRestResponse authentication(
@RequestParam(value="userId",defaultValue="0")Integer userId, @RequestParam(value="userId",defaultValue="0")Integer userId,
@RequestParam(value="name",defaultValue="")String name,
@RequestParam(value="idNumber",defaultValue="")String idNumber, @RequestParam(value="idNumber",defaultValue="")String idNumber,
@RequestParam(value="status",defaultValue="0")Integer status @RequestParam(value="status",defaultValue="0")Integer status
){ ){
return appPermissionService.upAuthentication(userId,idNumber,status); return appPermissionService.upAuthentication(userId,name,idNumber,status);
} }
......
...@@ -543,26 +543,28 @@ public class AppPermissionService { ...@@ -543,26 +543,28 @@ public class AppPermissionService {
//实名认证 //实名认证
@Transactional @Transactional
public ObjectRestResponse upAuthentication(Integer userid, String idNumber, Integer status) { public ObjectRestResponse upAuthentication(Integer userid, String name,String idNumber, Integer status) {
if (userid == null || userid == 0 || (status == 1 && StringUtils.isBlank(idNumber))) { if (userid == null || userid == 0 || (status == 1 && StringUtils.isBlank(idNumber)&& StringUtils.isBlank(name))) {
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数为空"); return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数为空");
} }
try { try {
AppUserLogin user = appUserLoginBiz.getUserById(userid); AppUserVo userVo = appUserDetailBiz.getUserInfoById(userid);
if (user == null) { if (userVo == null) {
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, "用户不存在"); return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, "用户不存在");
} }
if (user.getCertificationStatus() == 1) { if (userVo.getCertificationStatus() == 1) {
return ObjectRestResponse.createFailedResultWithObj(ResultCode.EXIST_CODE, "用户已认证", user.getIdNumber()); return ObjectRestResponse.createFailedResultWithObj(ResultCode.EXIST_CODE, "用户已认证", userVo.getIdNumber());
} }
if (status == 1) { if (status == 1) {
String username = user.getUsername(); AppUserLogin user = new AppUserLogin();
user = new AppUserLogin();
user.setId(userid); user.setId(userid);
user.setUsername(username);
user.setIdNumber(idNumber); user.setIdNumber(idNumber);
user.setCertificationStatus(1); user.setCertificationStatus(1);
appUserLoginBiz.updateSelectiveById(user); appUserLoginBiz.updateSelectiveById(user);
userVo=new AppUserVo();
userVo.setId(userVo.getId());
userVo.setRealname(name);
appUserDetailBiz.updUuserInfoById(userVo);
} }
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} catch (Exception e) { } catch (Exception e) {
......
...@@ -19,7 +19,7 @@ import java.util.Date; ...@@ -19,7 +19,7 @@ import java.util.Date;
/** /**
* 证件信息表 * 证件信息表
*/ */
@Table(name = "app_user_login") @Table(name = "id_information")
@Data @Data
public class IdInformation implements Serializable { public class IdInformation implements Serializable {
......
...@@ -68,7 +68,7 @@ public class CertificationController { ...@@ -68,7 +68,7 @@ public class CertificationController {
//获取用户认证信息 //获取用户认证信息
ObjectRestResponse orr = userFeign.authentication(idInformation.getUserLonginId(), null, 0); ObjectRestResponse orr = userFeign.authentication(idInformation.getUserLonginId(), null,null, 0);
if (orr==null) { if (orr==null) {
return ObjectRestResponse.createFailedResult(ResultCode.GET_AUTH_INFO_FAILED_CODE,"获取用户认证信息失败"); return ObjectRestResponse.createFailedResult(ResultCode.GET_AUTH_INFO_FAILED_CODE,"获取用户认证信息失败");
......
...@@ -474,7 +474,7 @@ public class CertificationService { ...@@ -474,7 +474,7 @@ public class CertificationService {
//认证成功后修改用户,用户认证状态 //认证成功后修改用户,用户认证状态
ObjectRestResponse authentication = userFeign.authentication(idInformation.getUserLonginId(), idInformation.getIdNumber(), 1); ObjectRestResponse authentication = userFeign.authentication(idInformation.getUserLonginId(), idInformation.getName(),idInformation.getIdNumber(), 1);
return authentication.getRel(); return authentication.getRel();
} }
......
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