|
|
@@ -1,6 +1,7 @@
|
|
|
package com.goafanti.user.controller;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
import java.util.UUID;
|
|
|
|
|
|
@@ -8,6 +9,7 @@ import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.junit.Test;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
@@ -443,16 +445,7 @@ public class UserApiController extends BaseApiController {
|
|
|
organizationIdentity.setQq(orgIdentityBo.getQq());
|
|
|
organizationIdentity.setPostalAddress(orgIdentityBo.getPostalAddress());
|
|
|
organizationIdentity.setPostcode(orgIdentityBo.getPostcode());
|
|
|
- OrganizationInfo info = organizationInfoService.selectOrgInfoByUserId(TokenManager.getUserId());
|
|
|
- if (null == info){
|
|
|
- OrganizationInfo i = new OrganizationInfo();
|
|
|
- i.setId(UUID.randomUUID().toString());
|
|
|
- i.setUid(TokenManager.getUserId());
|
|
|
- organizationInfoService.insert(i);
|
|
|
- } else {
|
|
|
- info.setLegalPerson(orgIdentityBo.getLegalPerson());
|
|
|
- organizationInfoService.updateByPrimaryKeySelective(info);
|
|
|
- }
|
|
|
+ organizationIdentity.setLegalPerson(orgIdentityBo.getLegalPerson());
|
|
|
if (identity == null) {
|
|
|
organizationIdentity.setId(UUID.randomUUID().toString());
|
|
|
organizationIdentity.setUid(TokenManager.getUserId());
|
|
|
@@ -673,6 +666,39 @@ public class UserApiController extends BaseApiController {
|
|
|
return res;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if (3 == userIdentity.getProcess()){
|
|
|
+ UserIdentity u = userIdentityService.selectUserIdentityByUserId(TokenManager.getUserId());
|
|
|
+ u.setAuditStatus(1);
|
|
|
+ userIdentityService.updateByPrimaryKeySelective(u);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (5 == userIdentity.getProcess()){
|
|
|
+ UserIdentity u = userIdentityService.selectUserIdentityByUserId(TokenManager.getUserId());
|
|
|
+ System.out.println((System.currentTimeMillis() - u.getPaymentDate().getTime()) > 432000000);
|
|
|
+ if ((System.currentTimeMillis() - u.getPaymentDate().getTime()) > 432000000){
|
|
|
+ System.out.println(111);
|
|
|
+ res.getError().add(buildError("","超过打款日期5日,无法提交确认"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (3 == u.getWrongCount()){
|
|
|
+ res.getError().add(buildError("","输入错误金额次数过多"));
|
|
|
+ return res;
|
|
|
+ } else {
|
|
|
+ if (u.getAmountMoney() != userIdentity.getAmountMoney()){
|
|
|
+ int t = 3 - u.getWrongCount() - 1;
|
|
|
+ u.setWrongCount(u.getWrongCount()+1);
|
|
|
+ userIdentityService.updateByPrimaryKeySelective(u);
|
|
|
+ if (0 == t){
|
|
|
+ res.getError().add(buildError("","输入错误金额次数过多"));
|
|
|
+ } else {
|
|
|
+ res.getError().add(buildError("","输入打款金额错误,您还有" + t + "次机会"));
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
return dealUserProcess(res,userIdentity,TokenManager.getUserId());
|
|
|
}
|
|
|
|
|
|
@@ -700,23 +726,93 @@ public class UserApiController extends BaseApiController {
|
|
|
return res;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ if (3 == o.getProcess()){
|
|
|
+ OrganizationIdentity orgIdentity = organizationIdentityService.selectOrgIdentityByUserId(TokenManager.getUserId());
|
|
|
+ orgIdentity.setAuditStatus(1);
|
|
|
+ organizationIdentityService.updateByPrimaryKeySelective(orgIdentity);
|
|
|
+ }
|
|
|
if (5 == o.getProcess()){
|
|
|
OrganizationIdentity orgIdentity = organizationIdentityService.selectOrgIdentityByUserId(TokenManager.getUserId());
|
|
|
- if (3 == orgIdentity.getWrongCount()){
|
|
|
- res.getError().add(buildError("","输入错误金额次数过多"));
|
|
|
+ if (System.currentTimeMillis() - orgIdentity.getPaymentDate().getTime() > 43200000000L){
|
|
|
+ res.getError().add(buildError("超过打款日期5日,无法提交确认"));
|
|
|
return res;
|
|
|
- } else {
|
|
|
-
|
|
|
}
|
|
|
+ if (3 == orgIdentity.getWrongCount()){
|
|
|
+ res.getError().add(buildError("输入错误金额次数过多"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (o.getValidationAmount() != orgIdentity.getValidationAmount()){
|
|
|
+ int t = 3 - o.getWrongCount() - 1;
|
|
|
+ o.setWrongCount(o.getWrongCount() + 1);
|
|
|
+ organizationIdentityService.updateByPrimaryKeySelective(o);
|
|
|
+ if (0 == t){
|
|
|
+ res.getError().add(buildError("输入错误金额次数过多"));
|
|
|
+ } else {
|
|
|
+ res.getError().add(buildError("输入打款金额错误,您还有" + t + "次机会"));
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
return dealOrgProcess(res, o ,TokenManager.getUserId());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 认证失败
|
|
|
+ */
|
|
|
+ @RequestMapping(value="/identFailed", method = RequestMethod.GET)
|
|
|
+ public Result authenticationFailed(){
|
|
|
+ Result res = new Result();
|
|
|
+ return dealFaild(res);
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 管理端确认用户认证
|
|
|
+ * @param auditStatus
|
|
|
+ * @param money
|
|
|
+ * @param uid
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value="/adminConfirmIdent", method = RequestMethod.POST)
|
|
|
+ public Result adminConfirmIdent(Integer auditStatus, BigDecimal money, String uid){
|
|
|
+ Result res = new Result();
|
|
|
+ if (0 == userService.selectByPrimaryKey(uid).getType()){
|
|
|
+ UserIdentity u = userIdentityService.selectUserIdentityByUserId(uid);
|
|
|
+ u.setAuditStatus(auditStatus);
|
|
|
+ u.setAmountMoney(money);
|
|
|
+ res.setData(userIdentityService.updateByPrimaryKeySelective(u));
|
|
|
+ }else{
|
|
|
+ OrganizationIdentity o = organizationIdentityService.selectOrgIdentityByUserId(uid);
|
|
|
+ o.setAuditStatus(auditStatus);
|
|
|
+ o.setValidationAmount(money);
|
|
|
+ res.setData(organizationIdentityService.updateByPrimaryKeySelective(o));
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
|
|
|
+ //认证失败清除相关认证信息
|
|
|
+ private Result dealFaild(Result res){
|
|
|
+ if (0 == userService.selectByPrimaryKey(TokenManager.getUserId()).getType()){
|
|
|
+ UserIdentity u = userIdentityService.selectUserIdentityByUserId(TokenManager.getUserId());
|
|
|
+ UserIdentity user = new UserIdentity();
|
|
|
+ user.setId(u.getId());
|
|
|
+ user.setUid(u.getUid());
|
|
|
+ user.setProcess(0);
|
|
|
+ user.setAmountMoney(new BigDecimal(0));
|
|
|
+ res.setData(userIdentityService.updateByPrimaryKey(user));
|
|
|
+ } else {
|
|
|
+ OrganizationIdentity o = organizationIdentityService.selectOrgIdentityByUserId(TokenManager.getUserId());
|
|
|
+ OrganizationIdentity org = new OrganizationIdentity();
|
|
|
+ org.setId(o.getId());
|
|
|
+ org.setUid(o.getUid());
|
|
|
+ org.setProcess(0);
|
|
|
+ org.setValidationAmount(new BigDecimal(0));
|
|
|
+ res.setData(organizationIdentityService.updateByPrimaryKey(org));
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
+ //orgProcess
|
|
|
private Result dealOrgProcess(Result res, OrganizationIdentity o ,String uid){
|
|
|
OrganizationIdentity org = organizationIdentityService.selectOrgIdentityByUserId(uid);
|
|
|
if (null == org){
|
|
|
@@ -730,6 +826,7 @@ public class UserApiController extends BaseApiController {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ //userProcess
|
|
|
private Result dealUserProcess(Result res,UserIdentity userIdentity,String uid){
|
|
|
UserIdentity identity = userIdentityService.selectUserIdentityByUserId(uid);
|
|
|
if (null == identity){
|
|
|
@@ -743,6 +840,9 @@ public class UserApiController extends BaseApiController {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
private void cleanCodeSession(){
|
|
|
TokenManager.getSession().removeAttribute(VerifyCodeUtils.RESET_CODE);
|
|
|
TokenManager.getSession().removeAttribute(VerifyCodeUtils.RESET_CODE_TIME);
|
|
|
@@ -757,5 +857,6 @@ public class UserApiController extends BaseApiController {
|
|
|
ub.setUid(u.getId());
|
|
|
return ub;
|
|
|
}
|
|
|
+
|
|
|
|
|
|
}
|