Antiloveg 8 anos atrás
pai
commit
c026f1824a

+ 32 - 19
src/main/java/com/goafanti/admin/controller/AdminApiController.java

@@ -399,12 +399,18 @@ public class AdminApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.USER_ALREADY_EXIST, "当前用户已注册!"));
 			return res;
 		}
-		
-		if (UserType.ORGANIZATION.getCode().equals(inputUser.getType()) && StringUtils.isBlank(inputUser.getUnitName())){
+
+		if (UserType.ORGANIZATION.getCode().equals(inputUser.getType())
+				&& StringUtils.isBlank(inputUser.getUnitName())) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "公司名称", "公司名称"));
 			return res;
 		}
 
+		if (UserType.PERSONAL.getCode().equals(inputUser.getType()) && StringUtils.isBlank(inputUser.getUsername())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "用户名称", "用户名称"));
+			return res;
+		}
+
 		User u = new User();
 		u.setId(UUID.randomUUID().toString());
 		u.setMobile(inputUser.getMobile().trim());
@@ -416,7 +422,7 @@ public class AdminApiController extends CertifyApiController {
 		u.setPassword(passwordUtil.getEncryptPwd(u));
 		u.setLvl(UserLevel.GENERAL.getCode());
 		u.setAid(TokenManager.getAdminId());
-		userService.insertRegister(u, "", inputUser.getUnitName());
+		userService.insertRegister(u, "", inputUser.getUnitName(), inputUser.getUsername());
 		return res;
 	}
 
@@ -468,10 +474,10 @@ public class AdminApiController extends CertifyApiController {
 					UserIdentityFields.getFieldDesc(bindingResult.getFieldError().getField())));
 			return res;
 		}
-        boolean insertFlag = Boolean.FALSE;
+
 		if (StringUtils.isBlank(userIdentity.getId())) {
-			userIdentity.setId(UUID.randomUUID().toString());
-			insertFlag = Boolean.TRUE;
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到认证ID", "认证ID"));
+			return res;
 		}
 
 		if (StringUtils.isBlank(userIdentity.getUid())) {
@@ -483,11 +489,11 @@ public class AdminApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到保存提交方式", "保存提交方式"));
 			return res;
 		}
-		
+
 		Integer level = userIdentity.getLevel();
 		if (!UserLevel.GENERAL.getCode().equals(level)) {
 			User u = userService.selectByPrimaryKey(userIdentity.getUid());
-			if (UserLevel.GENERAL.getCode().equals(u.getLvl())){
+			if (UserLevel.GENERAL.getCode().equals(u.getLvl())) {
 				res.getError().add(buildError(ErrorConstants.NON_CERTIFIED, "未通过实名认证,无法操作!"));
 				return res;
 			}
@@ -505,21 +511,20 @@ public class AdminApiController extends CertifyApiController {
 			} catch (ParseException e) {
 			}
 		}
-		
 
 		UserIdentity ui = new UserIdentity();
 		BeanUtils.copyProperties(userIdentity, ui);
 
 		if (CertifySubmitType.SUBMIT.getCode().equals(saveSign)) {
 			User u = userService.selectByPrimaryKey(userIdentity.getUid());
-			if (!UserLevel.GENERAL.getCode().equals(u.getLvl())){
+			if (!UserLevel.GENERAL.getCode().equals(u.getLvl())) {
 				res.getError().add(buildError("", "已通过实名认证,无法操作!"));
 				return res;
 			}
 			ui.setProcess(IdentityProcess.COMMITTED.getCode());
 			ui.setAuditStatus(IdentityAuditStatus.COMMITTED.getCode());
 		}
-		res.setData(userIdentityService.updateUserDetail(ui, saveSign, level, insertFlag));
+		res.setData(userIdentityService.updateUserDetail(ui, saveSign, level));
 		return res;
 	}
 
@@ -590,7 +595,7 @@ public class AdminApiController extends CertifyApiController {
 		Integer level = orgIdentity.getLevel();
 		if (!UserLevel.GENERAL.getCode().equals(level)) {
 			User u = userService.selectByPrimaryKey(orgIdentity.getUid());
-			if (UserLevel.GENERAL.getCode().equals(u.getLvl())){
+			if (UserLevel.GENERAL.getCode().equals(u.getLvl())) {
 				res.getError().add(buildError(ErrorConstants.NON_CERTIFIED, "未通过实名认证,无法操作!"));
 				return res;
 			}
@@ -605,7 +610,15 @@ public class AdminApiController extends CertifyApiController {
 
 		OrganizationIdentity oi = new OrganizationIdentity();
 		BeanUtils.copyProperties(orgIdentity, oi);
-
+		if (CertifySubmitType.SUBMIT.getCode().equals(saveSign)) {
+			User u = userService.selectByPrimaryKey(oi.getUid());
+			if (!UserLevel.GENERAL.getCode().equals(u.getLvl())) {
+				res.getError().add(buildError("", "已通过实名认证,无法操作!"));
+				return res;
+			}
+			oi.setProcess(IdentityProcess.COMMITTED.getCode());
+			oi.setAuditStatus(IdentityAuditStatus.COMMITTED.getCode());
+		}
 		res.setData(organizationIdentityService.updateOrgDetail(oi, saveSign, level));
 		return res;
 	}
@@ -762,7 +775,7 @@ public class AdminApiController extends CertifyApiController {
 		}
 		return res;
 	}
-	
+
 	/**
 	 * 删除团体人力资源
 	 * 
@@ -778,8 +791,7 @@ public class AdminApiController extends CertifyApiController {
 		}
 		return res;
 	}
-	
-	
+
 	/**
 	 * 企业参与国家标准或行业标准制定情况明细列表
 	 */
@@ -1185,7 +1197,7 @@ public class AdminApiController extends CertifyApiController {
 		if (StringUtils.isBlank(otp.getId())) {
 			OrgTechProduct product = orgTechProductService.findBySerialNumberAndUid(otp.getSerialNumber(),
 					otp.getUid());
-			if (null != product){
+			if (null != product) {
 				res.getError().add(buildError("", "产品编号重复,无法保存!"));
 				return res;
 			}
@@ -2232,7 +2244,7 @@ public class AdminApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
 			return res;
 		}
-		
+
 		if (!checkCertify(res, orgTechCenter.getUid()).getError().isEmpty()) {
 			return res;
 		}
@@ -2872,7 +2884,8 @@ public class AdminApiController extends CertifyApiController {
 	 * 高企培育列表
 	 */
 	@RequestMapping(value = "/cultivate", method = RequestMethod.POST)
-	public Result cultivationList(String uid, Integer locationProvince, String unitName, String pageNo, String pageSize) {
+	public Result cultivationList(String uid, Integer locationProvince, String unitName, String pageNo,
+			String pageSize) {
 		Result res = new Result();
 		Integer pNo = 1;
 		Integer pSize = 10;

+ 1 - 1
src/main/java/com/goafanti/cognizance/controller/CognizanceApiController.java

@@ -1614,7 +1614,7 @@ public class CognizanceApiController extends CertifyApiController {
 		if (!StringUtils.isBlank(authorizationDateFormattedDate)) {
 			try {
 				orgIntellectualProperty.setAuthorizationDate(
-						DateUtils.parseDate(authorizationDateFormattedDate, AFTConstants.YYYYMMDDHHMMSS));
+						DateUtils.parseDate(authorizationDateFormattedDate, AFTConstants.YYYYMMDD));
 			} catch (ParseException e) {
 			}
 		}

+ 18 - 12
src/main/java/com/goafanti/user/bo/InputUser.java

@@ -7,19 +7,22 @@ import javax.validation.constraints.Size;
 import com.goafanti.common.constant.ErrorConstants;
 
 public class InputUser {
-	
+
 	@Size(min = 0, max = 11, message = "{" + ErrorConstants.MOBILE_SIZE_ERROR + "}")
-	private String mobile;
-	
+	private String	mobile;
+
 	@Max(value = 1, message = "{" + ErrorConstants.PARAM_ERROR + "}")
 	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
-	private Integer type;
-	
+	private Integer	type;
+
 	@Size(min = 0, max = 45, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
-	private String unitName;
-	
+	private String	unitName;
+
 	@Size(min = 0, max = 45, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
-	private String password;
+	private String	password;
+
+	@Size(min = 0, max = 16, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String	username;
 
 	public String getMobile() {
 		return mobile;
@@ -53,9 +56,12 @@ public class InputUser {
 		this.password = password;
 	}
 
-	
-	
-	
-	
+	public String getUsername() {
+		return username;
+	}
+
+	public void setUsername(String username) {
+		this.username = username;
+	}
 
 }

+ 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);
+			userService.insertRegister(us, contacts, companyName, null);
 		}
 
 		return res;

+ 1 - 1
src/main/java/com/goafanti/user/service/UserIdentityService.java

@@ -21,7 +21,7 @@ public interface UserIdentityService {
 
 	int saveUserIdentityProcess(Result res, UserIdentity u, String uid);
 
-	int updateUserDetail(UserIdentity userIdentity, String saveSign, Integer level, Boolean insertFlag);
+	int updateUserDetail(UserIdentity userIdentity, String saveSign, Integer level);
 
 	UserIdentity insertByAdmin(UserIdentity ui, String saveSign);
 

+ 1 - 1
src/main/java/com/goafanti/user/service/UserService.java

@@ -26,7 +26,7 @@ public interface UserService {
 
 	User selectByMobieAndType(String mobile, Integer type);
 
-	User insertRegister(User user, String companyName, String contacts);
+	User insertRegister(User user, String companyName, String contacts, String username);
 
 	UserPageHomeBo selectUserPageHomeBoByUserId(String userId);
 

+ 3 - 12
src/main/java/com/goafanti/user/service/impl/UserIdentityServiceImpl.java

@@ -19,7 +19,6 @@ import com.goafanti.common.dao.UserMapper;
 import com.goafanti.common.dao.UserRoleMapper;
 import com.goafanti.common.enums.CertifySubmitType;
 import com.goafanti.common.enums.IdentityAuditStatus;
-import com.goafanti.common.enums.IdentityProcess;
 import com.goafanti.common.enums.NoticeReadStatus;
 import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.enums.UserLevel;
@@ -93,7 +92,7 @@ public class UserIdentityServiceImpl extends BaseMybatisDao<UserIdentityMapper>
 	}
 
 	@Override
-	public int updateUserDetail(UserIdentity u, String saveSign, Integer level, Boolean insertFlag) {
+	public int updateUserDetail(UserIdentity u, String saveSign, Integer level) {
 		User user = userMapper.selectByPrimaryKey(u.getUid());
 		if (!UserLevel.GENERAL.getCode().equals(user.getLvl())
 				&& !CertifySubmitType.SUBMIT.getCode().equals(saveSign)) {
@@ -103,16 +102,8 @@ public class UserIdentityServiceImpl extends BaseMybatisDao<UserIdentityMapper>
 		if (CertifySubmitType.SUBMIT.getCode().equals(saveSign)) {
 			createAuditorNotice(user);
 		}
-		if (insertFlag) {
-			if (!CertifySubmitType.SUBMIT.getCode().equals(saveSign)) {
-				u.setProcess(IdentityProcess.UNCOMMITTED.getCode());
-				u.setAuditStatus(IdentityAuditStatus.UNCOMMITTED.getCode());
-			}
-			userIdentityMapper.insert(u);
-		} else {
-			userIdentityMapper.updateByPrimaryKeySelective(u);
-		}
-		return 1;
+			
+		return userIdentityMapper.updateByPrimaryKeySelective(u);
 
 	}
 

+ 14 - 1
src/main/java/com/goafanti/user/service/impl/UserServiceImpl.java

@@ -23,6 +23,7 @@ import com.goafanti.common.dao.UserMapper;
 import com.goafanti.common.enums.UserType;
 import com.goafanti.common.model.OrganizationIdentity;
 import com.goafanti.common.model.User;
+import com.goafanti.common.model.UserIdentity;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
@@ -57,7 +58,7 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 	private OrgIntellectualPropertyMapper	orgIntellectualPropertyMapper;
 
 	@Override
-	public User insertRegister(User user, String contacts, String unitName) {
+	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)) {
@@ -75,6 +76,18 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 				organizationIdentityMapper.insert(organizationIdentity);
 			}
 		}
+
+		if (null != user.getType() && UserType.PERSONAL.getCode().equals(user.getType())
+				&& StringUtils.isNotBlank(username)) {
+			UserIdentity ui = new UserIdentity();
+			ui.setId(UUID.randomUUID().toString());
+			ui.setUid(user.getId());
+			ui.setAuditStatus(0);
+			ui.setProcess(0);
+			ui.setWrongCount(0);
+			userIdentityMapper.insert(ui);
+		}
+
 		return user;
 	}