|
|
@@ -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;
|
|
|
+
|
|
|
/**
|
|
|
* 修改密码
|
|
|
*
|
|
|
@@ -144,86 +158,6 @@ public class UserApiController extends BaseApiController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 重置密码
|
|
|
- *
|
|
|
- * @param resetCode
|
|
|
- * @param mobile
|
|
|
- * @param type
|
|
|
- * @param newPwd
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/resetPwd", method = RequestMethod.POST)
|
|
|
- public Result resetPwd(String resetCode, String mobile, Integer type, String newPwd) {
|
|
|
- Result res = new Result();
|
|
|
- if (TimeUtils.checkOverTime("resetCode")) {
|
|
|
- res.getError().add(buildError(ErrorConstants.RESET_CODE_OVERTIME, "页面超时失效,请重新获取验证码!"));
|
|
|
- this.cleanCodeSession();
|
|
|
- return res;
|
|
|
- }
|
|
|
- if (!TokenManager.getSession().getAttribute(VerifyCodeUtils.RESET_CODE).equals(resetCode)) {
|
|
|
- res.getError().add(buildError(ErrorConstants.RESET_CODE_ERROR, "页面失效,请重新获取验证码!"));
|
|
|
- this.cleanCodeSession();
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
- if (StringUtils.isBlank(newPwd)) {
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "新密码"));
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
- if (StringUtils.isBlank(mobile)) {
|
|
|
- res.getError().add(buildError(ErrorConstants.MOBILE_EMPTY_ERROR, "", "mobile"));
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
- if (1 != type || 0 != type) {
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_PATTERN_ERROR, "", "type"));
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
- User user = userService.selectByMobieAndType(mobile, type);
|
|
|
- if (null == user) {
|
|
|
- res.getError().add(buildError(ErrorConstants.MOBILE_EMPTY_ERROR, "", "mobile"));
|
|
|
- return res;
|
|
|
- }
|
|
|
- user.setPassword(newPwd);
|
|
|
- user.setPassword(passwordUtil.getEncryptPwd(user));
|
|
|
- userService.updateByPrimaryKey(user);
|
|
|
- TokenManager.getSession().removeAttribute(VerifyCodeUtils.RESET_CODE);
|
|
|
- TokenManager.getSession().removeAttribute(VerifyCodeUtils.RESET_CODE_TIME);
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- *
|
|
|
- * @param mobileCode
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/checkMCode", method = RequestMethod.POST)
|
|
|
- public Result checkMCode(String mobileCode) {
|
|
|
- Result res = new Result();
|
|
|
-
|
|
|
- if (StringUtils.isBlank(mobileCode)) {
|
|
|
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "手机验证码"));
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
- if (TimeUtils.checkOverTime("register")) {
|
|
|
- res.getError().add(buildError(ErrorConstants.MCODE_OVERTIME_ERROR, "手机验证码超时失效"));
|
|
|
- TokenManager.getSession().removeAttribute(VerifyCodeUtils.M_CODE);
|
|
|
- TokenManager.getSession().removeAttribute(VerifyCodeUtils.M_CODE_TIME);
|
|
|
- return res;
|
|
|
- }
|
|
|
- System.out.println(TokenManager.getSession().getAttribute(VerifyCodeUtils.M_CODE));
|
|
|
- if (!TokenManager.getSession().getAttribute(VerifyCodeUtils.M_CODE).equals(mobileCode)) {
|
|
|
- res.getError().add(buildError(ErrorConstants.MCODE_ERROR, "手机验证码错误"));
|
|
|
- return res;
|
|
|
- }
|
|
|
- return res;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
* 更换手机
|
|
|
*
|
|
|
* @param mobile
|
|
|
@@ -749,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
|
|
|
@@ -772,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);
|
|
|
@@ -820,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
|
|
|
@@ -844,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);
|
|
|
@@ -900,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));
|
|
|
@@ -910,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));
|
|
|
@@ -930,13 +874,6 @@ public class UserApiController extends BaseApiController {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
- private void cleanCodeSession() {
|
|
|
- TokenManager.getSession().removeAttribute(VerifyCodeUtils.RESET_CODE);
|
|
|
- TokenManager.getSession().removeAttribute(VerifyCodeUtils.RESET_CODE_TIME);
|
|
|
- TokenManager.getSession().removeAttribute(VerifyCodeUtils.M_CODE);
|
|
|
- TokenManager.getSession().removeAttribute(VerifyCodeUtils.M_CODE_TIME);
|
|
|
- }
|
|
|
-
|
|
|
private UidAndTypeBo basicInfo(UserService userService) {
|
|
|
User u = userService.selectByPrimaryKey(TokenManager.getUserId());
|
|
|
UidAndTypeBo ub = new UidAndTypeBo();
|
|
|
@@ -950,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;
|
|
|
}
|
|
|
|