|
|
@@ -110,6 +110,20 @@ public class UserApiController extends BaseApiController {
|
|
|
@Resource
|
|
|
private OrgRatepayService orgRatepayService;
|
|
|
|
|
|
+ private static final Integer STEP_ONE = 1;
|
|
|
+
|
|
|
+ // private static final Integer STEP_TWO = 2;
|
|
|
+
|
|
|
+ private static final Integer STEP_THREE = 3;
|
|
|
+
|
|
|
+ // private static final Integer STEP_FOUR = 4;
|
|
|
+
|
|
|
+ private static final Integer STEP_FIVE = 5;
|
|
|
+
|
|
|
+ private static final Integer MAX_WRONG_COUNT = 3;
|
|
|
+
|
|
|
+ private static final Integer INIT_WRONG_COUNT = 0;
|
|
|
+
|
|
|
/**
|
|
|
* 修改密码
|
|
|
*
|
|
|
@@ -143,10 +157,6 @@ public class UserApiController extends BaseApiController {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 更换手机
|
|
|
*
|
|
|
@@ -673,22 +683,26 @@ public class UserApiController extends BaseApiController {
|
|
|
@RequestMapping(value = "/userNextPro", method = RequestMethod.POST)
|
|
|
public Result userNextProcess(UserIdentity userIdentity, String verificationCode) {
|
|
|
Result res = new Result();
|
|
|
- if ((IdentityProcess.UNCOMMITTED.getCode() + 1) == userIdentity.getProcess()) {
|
|
|
+ if (null == userIdentity.getProcess()) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "process"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(verificationCode)) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.VCODE_EMPTY_ERROR));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (STEP_ONE.equals(userIdentity.getProcess())) {
|
|
|
if (!TokenManager.getSession().getAttribute(VerifyCodeUtils.V_CODE).equals(verificationCode)) {
|
|
|
- res.getError().add(buildError(ErrorConstants.VCODE_ERROR, "验证码错误"));
|
|
|
+ res.getError().add(buildError(ErrorConstants.VCODE_ERROR));
|
|
|
return res;
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- if (IdentityProcess.COMMITTED.getCode() == userIdentity.getProcess()) {// 3
|
|
|
+ } else if (STEP_THREE.equals(userIdentity.getProcess())) {
|
|
|
UserIdentity u = userIdentityService.selectUserIdentityByUserId(TokenManager.getUserId());
|
|
|
u.setProcess(IdentityProcess.COMMITTED.getCode());
|
|
|
u.setAuditStatus(IdentityAuditStatus.COMMITTED.getCode());
|
|
|
userIdentityService.updateByPrimaryKeySelective(u);
|
|
|
return res;
|
|
|
- }
|
|
|
-
|
|
|
- if (IdentityProcess.RESULTS.getCode() == userIdentity.getProcess()) {
|
|
|
+ } else if (STEP_FIVE.equals(userIdentity.getProcess())) {
|
|
|
UserIdentity u = userIdentityService.selectUserIdentityByUserId(TokenManager.getUserId());
|
|
|
if ((System.currentTimeMillis() - u.getPaymentDate().getTime()) > 432000000) {
|
|
|
u.setAuditStatus(IdentityAuditStatus.NOTPASSED.getCode());// 4
|
|
|
@@ -696,7 +710,7 @@ public class UserApiController extends BaseApiController {
|
|
|
res.getError().add(buildError("", "1"));// 超过打款日期5日,无法提交确认
|
|
|
return res;
|
|
|
}
|
|
|
- if (3 == u.getWrongCount()) {
|
|
|
+ if (MAX_WRONG_COUNT.equals(u.getWrongCount())) {
|
|
|
u.setAuditStatus(IdentityAuditStatus.NOTPASSED.getCode());// 4
|
|
|
u.setProcess(IdentityProcess.RESULTS.getCode());// 5
|
|
|
userIdentityService.updateByPrimaryKeySelective(u);
|
|
|
@@ -744,23 +758,29 @@ public class UserApiController extends BaseApiController {
|
|
|
public Result orgNextProcess(OrganizationIdentity orgIdentity, String listedDateFormattedDate,
|
|
|
String verificationCode) throws ParseException {
|
|
|
Result res = new Result();
|
|
|
- if ((IdentityProcess.UNCOMMITTED.getCode() + 1) == orgIdentity.getProcess()) {
|
|
|
+ if (null == orgIdentity.getProcess()) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "process"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(verificationCode)) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.VCODE_EMPTY_ERROR));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (STEP_ONE.equals(orgIdentity.getProcess())) {
|
|
|
if (!TokenManager.getSession().getAttribute(VerifyCodeUtils.V_CODE).equals(verificationCode)) {
|
|
|
- res.getError().add(buildError(ErrorConstants.VCODE_ERROR, "验证码错误"));
|
|
|
+ res.getError().add(buildError(ErrorConstants.VCODE_ERROR));
|
|
|
return res;
|
|
|
}
|
|
|
if (!StringUtils.isBlank(listedDateFormattedDate)) {
|
|
|
orgIdentity.setListedDate(DateUtils.parseDate(listedDateFormattedDate, AFTConstants.YYYYMMDD));
|
|
|
}
|
|
|
- }
|
|
|
- if (IdentityProcess.COMMITTED.getCode() == orgIdentity.getProcess()) {
|
|
|
+ } else if (STEP_THREE.equals(orgIdentity.getProcess())) {
|
|
|
OrganizationIdentity o = organizationIdentityService.selectOrgIdentityByUserId(TokenManager.getUserId());
|
|
|
o.setAuditStatus(IdentityAuditStatus.COMMITTED.getCode());
|
|
|
o.setProcess(IdentityProcess.COMMITTED.getCode());
|
|
|
organizationIdentityService.updateByPrimaryKeySelective(o);
|
|
|
return res;
|
|
|
- }
|
|
|
- if (5 == orgIdentity.getProcess()) {
|
|
|
+ } else if (STEP_FIVE.equals(orgIdentity.getProcess())) {
|
|
|
OrganizationIdentity o = organizationIdentityService.selectOrgIdentityByUserId(TokenManager.getUserId());
|
|
|
if (System.currentTimeMillis() - o.getPaymentDate().getTime() > 432000000) {
|
|
|
o.setAuditStatus(IdentityAuditStatus.NOTPASSED.getCode());// 4
|
|
|
@@ -768,7 +788,7 @@ public class UserApiController extends BaseApiController {
|
|
|
res.getError().add(buildError("", "1"));// 超过打款日期5日,无法提交确认
|
|
|
return res;
|
|
|
}
|
|
|
- if (3 == o.getWrongCount()) {
|
|
|
+ if (MAX_WRONG_COUNT.equals(o.getWrongCount())) {
|
|
|
o.setAuditStatus(IdentityAuditStatus.NOTPASSED.getCode());// 4
|
|
|
o.setProcess(IdentityProcess.RESULTS.getCode());// 5
|
|
|
organizationIdentityService.updateByPrimaryKeySelective(o);
|
|
|
@@ -824,7 +844,7 @@ public class UserApiController extends BaseApiController {
|
|
|
user.setId(u.getId());
|
|
|
user.setUid(u.getUid());
|
|
|
user.setProcess(IdentityProcess.UNCOMMITTED.getCode());
|
|
|
- user.setWrongCount(0);
|
|
|
+ user.setWrongCount(INIT_WRONG_COUNT);
|
|
|
user.setAmountMoney(new BigDecimal(0));
|
|
|
user.setAuditStatus(IdentityAuditStatus.UNCOMMITTED.getCode());
|
|
|
res.setData(userIdentityService.updateByPrimaryKey(user));
|
|
|
@@ -834,7 +854,7 @@ public class UserApiController extends BaseApiController {
|
|
|
org.setId(o.getId());
|
|
|
org.setUid(o.getUid());
|
|
|
org.setProcess(IdentityProcess.UNCOMMITTED.getCode());
|
|
|
- org.setWrongCount(0);
|
|
|
+ org.setWrongCount(INIT_WRONG_COUNT);
|
|
|
org.setAuditStatus(IdentityAuditStatus.UNCOMMITTED.getCode());
|
|
|
org.setValidationAmount(new BigDecimal(0));
|
|
|
res.setData(organizationIdentityService.updateByPrimaryKey(org));
|
|
|
@@ -854,8 +874,6 @@ public class UserApiController extends BaseApiController {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
private UidAndTypeBo basicInfo(UserService userService) {
|
|
|
User u = userService.selectByPrimaryKey(TokenManager.getUserId());
|
|
|
UidAndTypeBo ub = new UidAndTypeBo();
|
|
|
@@ -869,10 +887,9 @@ public class UserApiController extends BaseApiController {
|
|
|
// 判断用户是否通过认证
|
|
|
private Result checkCertify(Result res) {
|
|
|
OrganizationIdentity o = organizationIdentityService.selectOrgIdentityByUserId(TokenManager.getUserId());
|
|
|
- if (null == o || 5 != o.getAuditStatus()) {
|
|
|
+ if (null == o || !IdentityAuditStatus.PASSED.getCode().equals(o.getAuditStatus())) {
|
|
|
res.getError().add(buildError(ErrorConstants.NON_CERTIFIED, "未通过实名认证,无法操作!"));
|
|
|
}
|
|
|
-
|
|
|
return res;
|
|
|
}
|
|
|
|