Explorar el Código

认证流程 接口测试更改

Antiloveg hace 9 años
padre
commit
0425eb66f5

+ 1 - 2
src/main/java/com/goafanti/common/controller/BaseController.java

@@ -38,7 +38,7 @@ public class BaseController {
 	private String uploadPrivatePath = null;
 	
 	@Value(value = "${accessKey}")
-	private String accessKey=null;
+	private String accessKey = null;
 	
 	@Value(value = "${accessSecret}")
 	private String accessSecret = null;
@@ -91,7 +91,6 @@ public class BaseController {
 		model.addAttribute("uploadPath",uploadPath);
 		model.addAttribute("uploadPrivatePath",uploadPrivatePath);
 		if(SecurityUtils.getSubject().getPrincipal()  instanceof User){
-			System.out.println(TokenManager.getToken().getId());
 			model.addAttribute("userData", TokenManager.getToken() );
 		}
 		

+ 1 - 0
src/main/java/com/goafanti/common/controller/PublicController.java

@@ -73,6 +73,7 @@ public class PublicController extends BaseController {
 
 			// 生成随机字串
 			String verifyCode = VerifyCodeUtils.generateVerifyCode(4);
+			System.out.println(verifyCode);
 			// 存入Shiro会话session
 			TokenManager.setVal2Session(VerifyCodeUtils.V_CODE, verifyCode.toLowerCase());
 			// 生成图片

+ 50 - 36
src/main/java/com/goafanti/user/controller/UserApiController.java

@@ -2,14 +2,15 @@ package com.goafanti.user.controller;
 
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.UUID;
 
 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;
@@ -675,29 +676,34 @@ public class UserApiController extends BaseApiController {
 		
 		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日,无法提交确认"));
+				u.setAuditStatus(4);
+				userIdentityService.updateByPrimaryKeySelective(u);
+				res.getError().add(buildError("","1"));//超过打款日期5日,无法提交确认
 				return res;
 			}
 			if (3 == u.getWrongCount()){
-				res.getError().add(buildError("","输入错误金额次数过多"));
+				u.setAuditStatus(4);
+				u.setProcess(5);
+				userIdentityService.updateByPrimaryKeySelective(u);
+				res.getError().add(buildError("","2"));//输入错误金额次数过多
 				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 + "次机会"));
-					}
+			} 
+			if (0 != (u.getAmountMoney().compareTo(userIdentity.getAmountMoney()))){
+				int t = 3 - u.getWrongCount() - 1;
+				u.setWrongCount(u.getWrongCount()+1);
+				userIdentityService.updateByPrimaryKeySelective(u);	
+				if (0 == t){
+					u.setAuditStatus(4);
+					u.setProcess(5);
+					userIdentityService.updateByPrimaryKeySelective(u);
+					res.getError().add(buildError("","2"));//输入错误金额次数过多
+				} else {
+					res.getError().add(buildError("","输入打款金额错误,您还有" + t + "次机会"));
+				}
 				return res;
-			    }
 			}
-			
+			userIdentity.setAuditStatus(5);
 		}
 		return dealUserProcess(res,userIdentity,TokenManager.getUserId());
 	}
@@ -718,43 +724,51 @@ public class UserApiController extends BaseApiController {
 	 * 团体实名认证流程下一步
 	 */
 	@RequestMapping(value="/orgNextPro",method = RequestMethod.POST)
-	public Result orgNextProcess(OrganizationIdentity o, String verificationCode){
+	public Result orgNextProcess(OrganizationIdentity orgIdentity, String verificationCode){
 		Result res = new Result();
-		if (1 == o.getProcess()){
+		if (1 == orgIdentity.getProcess()){
 			if (!TokenManager.getSession().getAttribute(VerifyCodeUtils.V_CODE).equals(verificationCode)){
 				res.getError().add(buildError(ErrorConstants.VCODE_ERROR,"验证码错误"));
 				return res;
 			}
 		}
-		if (3 == o.getProcess()){
-			OrganizationIdentity orgIdentity =	organizationIdentityService.selectOrgIdentityByUserId(TokenManager.getUserId());
-			orgIdentity.setAuditStatus(1);
-			organizationIdentityService.updateByPrimaryKeySelective(orgIdentity);
+		if (3 == orgIdentity.getProcess()){
+			OrganizationIdentity  o = organizationIdentityService.selectOrgIdentityByUserId(TokenManager.getUserId());
+			o.setAuditStatus(1);
+			organizationIdentityService.updateByPrimaryKeySelective(o);
 		}
-		if (5 == o.getProcess()){
-			OrganizationIdentity orgIdentity =	organizationIdentityService.selectOrgIdentityByUserId(TokenManager.getUserId());
-			if (System.currentTimeMillis() - orgIdentity.getPaymentDate().getTime() > 43200000000L){
-				res.getError().add(buildError("超过打款日期5日,无法提交确认"));
+		if (5 == orgIdentity.getProcess()){
+			OrganizationIdentity o = organizationIdentityService.selectOrgIdentityByUserId(TokenManager.getUserId());
+			if (System.currentTimeMillis() - o.getPaymentDate().getTime() > 432000000){
+				o.setAuditStatus(4);
+				organizationIdentityService.updateByPrimaryKeySelective(o);
+				res.getError().add(buildError("", "1"));//超过打款日期5日,无法提交确认
 				return res;
 			}
-			if (3 == orgIdentity.getWrongCount()){
-				res.getError().add(buildError("输入错误金额次数过多"));
+			if (3 == o.getWrongCount()){
+				o.setAuditStatus(4);
+				o.setProcess(5);
+				organizationIdentityService.updateByPrimaryKeySelective(o);
+				res.getError().add(buildError("", "2"));//输入错误金额次数过多
 				return res;
 			} 
-			if (o.getValidationAmount() != orgIdentity.getValidationAmount()){
+			if (0 != (o.getValidationAmount().compareTo(orgIdentity.getValidationAmount()))){
 				int t = 3 - o.getWrongCount() - 1;
 				o.setWrongCount(o.getWrongCount() + 1);
 				organizationIdentityService.updateByPrimaryKeySelective(o);	
 				if (0 == t){
-					res.getError().add(buildError("输入错误金额次数过多"));
+					o.setAuditStatus(4);
+					o.setProcess(5);
+					organizationIdentityService.updateByPrimaryKeySelective(o);
+					res.getError().add(buildError("","2"));//输入错误金额次数过多
 				} else {
-					res.getError().add(buildError("输入打款金额错误,您还有" + t + "次机会"));
-				}
-					return res;
+					res.getError().add(buildError("", "输入打款金额错误,您还有" + t + "次机会"));
 				}
-			
+				  return res;
+			}
+			orgIdentity.setAuditStatus(5);
 		}
-		return dealOrgProcess(res, o ,TokenManager.getUserId());
+		return dealOrgProcess(res, orgIdentity ,TokenManager.getUserId());
 	}
 	
 	/**

+ 1 - 1
src/main/webapp/WEB-INF/html/test.html

@@ -75,7 +75,7 @@
 	{
 	"mobile": "13600000000",
 	"password": "123456",
-	"type"    :0,
+	"type"    :0 ,
 	"remember":false
 }
       </textarea>