Procházet zdrojové kódy

Merge branch 'master' of https://git.coding.net/aft/AFT.git

wanghui před 8 roky
rodič
revize
d40902cfdb

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

@@ -145,13 +145,6 @@ public class PublicController extends BaseController {
 			res.getError().add(buildError(ErrorConstants.MCODE_FREQUENCY_ERROR, "", "手机验证码发送频繁!"));
 		}
 
-		// resetCode
-		if (res.getError().isEmpty() && sign) {
-			String resetCode = UUID.randomUUID().toString();
-			TokenManager.setVal2Session(VerifyCodeUtils.RESET_CODE, resetCode);
-			TokenManager.setVal2Session(VerifyCodeUtils.RESET_CODE_TIME, System.currentTimeMillis());
-			res.setData(resetCode);
-		}
 		return res;
 	}
 
@@ -396,6 +389,13 @@ public class PublicController extends BaseController {
 			res.getError().add(buildError(ErrorConstants.MCODE_ERROR, "", "手机验证码错误"));
 			return res;
 		}
+		// resetCode
+		if (res.getError().isEmpty()) {
+			String resetCode = UUID.randomUUID().toString();
+			TokenManager.setVal2Session(VerifyCodeUtils.RESET_CODE, resetCode);
+			TokenManager.setVal2Session(VerifyCodeUtils.RESET_CODE_TIME, System.currentTimeMillis());
+			res.setData(resetCode);
+		}
 		return res;
 
 	}

+ 1 - 1
src/main/java/com/goafanti/user/controller/UserRegisterController.java

@@ -98,7 +98,7 @@ public class UserRegisterController extends BaseController {
 			}
 			*/
 			us.setAid("2");//ID为"2"的管理员
-			userService.insertRegister(us, contacts, companyName, null);
+			userService.insertRegister(us, contacts, companyName, user.getUsername());
 		}
 
 		return res;

+ 13 - 10
src/main/java/com/goafanti/user/service/impl/UserIdentityServiceImpl.java

@@ -52,8 +52,8 @@ public class UserIdentityServiceImpl extends BaseMybatisDao<UserIdentityMapper>
 	@Autowired
 	private NoticeMapper		noticeMapper;
 
-	private static final Logger logger = LoggerFactory.getLogger(UserIdentityServiceImpl.class);
-			
+	private static final Logger	logger	= LoggerFactory.getLogger(UserIdentityServiceImpl.class);
+
 	@Override
 	public UserIdentity selectUserIdentityByUserId(String uid) {
 		return userIdentityMapper.selectUserIdentityByUserId(uid);
@@ -112,7 +112,7 @@ public class UserIdentityServiceImpl extends BaseMybatisDao<UserIdentityMapper>
 		if (CertifySubmitType.SUBMIT.getCode().equals(saveSign)) {
 			createAuditorNotice(user);
 		}
-			
+
 		return userIdentityMapper.updateByPrimaryKeySelective(u);
 
 	}
@@ -127,9 +127,10 @@ public class UserIdentityServiceImpl extends BaseMybatisDao<UserIdentityMapper>
 			createNotice(user, ui.getAuditStatus());
 		}
 		if (IdentityAuditStatus.PASSED.getCode().equals(ui.getAuditStatus())) {
-			/*if (UserLevel.GENERAL.getCode().equals(level)) {
-				user.setLvl(UserLevel.CERTIFIED.getCode());
-			}*/
+			/*
+			 * if (UserLevel.GENERAL.getCode().equals(level)) {
+			 * user.setLvl(UserLevel.CERTIFIED.getCode()); }
+			 */
 			user.setLvl(UserLevel.CERTIFIED.getCode());
 			user.setAid(aid);
 			user.setMid(mid);
@@ -273,10 +274,12 @@ public class UserIdentityServiceImpl extends BaseMybatisDao<UserIdentityMapper>
 
 	@Override
 	public UserIdentityDetailAdminBo selectUserIdentityByUserIdAdmin(String uid) {
-		UserIdentity ui =  userIdentityMapper.selectUserIdentityByUserId(uid);
+		UserIdentity ui = userIdentityMapper.selectUserIdentityByUserId(uid);
 		User u = userMapper.selectByPrimaryKey(uid);
 		UserIdentityDetailAdminBo bo = new UserIdentityDetailAdminBo();
-		BeanUtils.copyProperties(ui, bo);
+		if (ui != null) {
+			BeanUtils.copyProperties(ui, bo);
+		}
 		bo.setLevel(u.getLvl().toString());
 		return bo;
 	}
@@ -286,9 +289,9 @@ public class UserIdentityServiceImpl extends BaseMybatisDao<UserIdentityMapper>
 	public List<InternationalListBo> selectInternationalUser(Integer internationalUserCacheKey) {
 		return userIdentityMapper.selectInternationalUser();
 	}
-	
+
 	@CacheEvict(value = "internationalUserList", allEntries = true)
-	public void cleanInternationalUser(){
+	public void cleanInternationalUser() {
 		LoggerUtils.debug(logger, "清除国际专家列表");
 	}
 

+ 18 - 20
src/main/java/com/goafanti/user/service/impl/UserServiceImpl.java

@@ -63,31 +63,28 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 	public User insertRegister(User user, String contacts, String unitName, String username) {
 		userMapper.insert(user);
 		if (null != user.getType() && UserType.ORGANIZATION.getCode().equals(user.getType())) {
-			if (!StringUtils.isBlank(unitName) || !StringUtils.isBlank(contacts)) {
-				OrganizationIdentity organizationIdentity = new OrganizationIdentity();
-				organizationIdentity.setUid(user.getId());
-				organizationIdentity.setUnitName(StringUtils.isBlank(unitName) ? "" : unitName);
-				organizationIdentity.setContacts(StringUtils.isBlank(contacts) ? "" : contacts);
-				organizationIdentity.setId(UUID.randomUUID().toString());
-				organizationIdentity.setIdentityType(0);
-				organizationIdentity.setAuditStatus(0);
-				organizationIdentity.setProcess(0);
-				organizationIdentity.setWrongCount(0);
-				organizationIdentity.setListed(0);
-				organizationIdentity.setListedType(0);
-				organizationIdentityMapper.insert(organizationIdentity);
-			}
-		}
-
-		if (null != user.getType() && UserType.PERSONAL.getCode().equals(user.getType())
-				&& StringUtils.isNotBlank(username)) {
+			OrganizationIdentity organizationIdentity = new OrganizationIdentity();
+			organizationIdentity.setUid(user.getId());
+			organizationIdentity.setUnitName(StringUtils.isBlank(unitName) ? "" : unitName);
+			organizationIdentity.setContacts(StringUtils.isBlank(contacts) ? "" : contacts);
+			organizationIdentity.setId(UUID.randomUUID().toString());
+			organizationIdentity.setIdentityType(0);
+			organizationIdentity.setAuditStatus(0);
+			organizationIdentity.setProcess(0);
+			organizationIdentity.setWrongCount(0);
+			organizationIdentity.setListed(0);
+			organizationIdentity.setListedType(0);
+			organizationIdentityMapper.insert(organizationIdentity);
+		}
+
+		if (null != user.getType() && UserType.PERSONAL.getCode().equals(user.getType())) {
 			UserIdentity ui = new UserIdentity();
 			ui.setId(UUID.randomUUID().toString());
 			ui.setUid(user.getId());
 			ui.setAuditStatus(0);
 			ui.setProcess(0);
 			ui.setWrongCount(0);
-			ui.setUsername(username);
+			ui.setUsername(StringUtils.isBlank(username) ? "" : username);
 			userIdentityMapper.insert(ui);
 		}
 
@@ -503,7 +500,8 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 		if (pSize == null || pSize < 0 || pSize > 10) {
 			pSize = 10;
 		}
-		return (Pagination<StarAndExpertListBo>) findPage("findStarAndExpertListByPage", "findStarAndExpertCount", params, pNo, pSize);
+		return (Pagination<StarAndExpertListBo>) findPage("findStarAndExpertListByPage", "findStarAndExpertCount",
+				params, pNo, pSize);
 	}
 
 }