|
@@ -29,6 +29,7 @@ import com.diagbot.enums.AuthStatusEnum;
|
|
|
import com.diagbot.enums.ConstantEnum;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.enums.OrganizationTypeEnum;
|
|
|
+import com.diagbot.enums.RejectEnum;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.exception.ServiceErrorCode;
|
|
@@ -45,21 +46,16 @@ import com.diagbot.util.UserUtils;
|
|
|
import com.diagbot.vo.BaseIdVO;
|
|
|
import com.diagbot.vo.ImgVerVerVO;
|
|
|
import com.diagbot.vo.OrganizationVO;
|
|
|
-import com.diagbot.vo.UserAndOrgPageVO;
|
|
|
import com.diagbot.vo.UserAndOrganizationVO;
|
|
|
import com.diagbot.vo.UserExportVO;
|
|
|
import com.diagbot.vo.UserInfoAuditVO;
|
|
|
import com.diagbot.vo.UserInfoOrganizationsVO;
|
|
|
-import com.diagbot.vo.UserInfoPagVO;
|
|
|
import com.diagbot.vo.UserSaveVO;
|
|
|
-import com.diagbot.vo.UsernameVO;
|
|
|
-
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.crypto.factory.PasswordEncoderFactories;
|
|
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
|
|
import org.springframework.security.oauth2.common.OAuth2AccessToken;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
import java.io.Serializable;
|
|
|
import java.util.ArrayList;
|
|
@@ -676,8 +672,8 @@ public class UserFacade extends UserServiceImpl {
|
|
|
|
|
|
String organizationName = organizationVO.getOrganizationName();
|
|
|
List<Organization> organizationList = organizationFacade.findOrganization(organizationName);
|
|
|
- if (organizationList.size() > 0) {
|
|
|
- return RespDTO.onSuc("该机构存在");
|
|
|
+ if (ListUtil.isNotEmpty(organizationList)) {
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "该机构存在");
|
|
|
}
|
|
|
Organization organization = new Organization();
|
|
|
organization.setName(organizationVO.getOrganizationName());
|
|
@@ -687,7 +683,6 @@ public class UserFacade extends UserServiceImpl {
|
|
|
organization.setAddress(organizationVO.getAddress());
|
|
|
organization.setGmtCreate(DateUtil.now());
|
|
|
organization.setModifier(UserUtils.getCurrentPrincipleID());
|
|
|
- // organization.setCreator("5");
|
|
|
|
|
|
boolean res = organizationFacade.save(organization);
|
|
|
|
|
@@ -710,15 +705,15 @@ public class UserFacade extends UserServiceImpl {
|
|
|
User userData = getUserInfo(username);
|
|
|
// System.out.println(user);
|
|
|
if (userData != null) {
|
|
|
- return RespDTO.onSuc("该用户存在");
|
|
|
+ throw new CommonException(CommonErrorCode.IS_EXISTS, "该用户已存在");
|
|
|
}
|
|
|
// 验证机构是否被绑定
|
|
|
UserOrganization userORG = new UserOrganization();
|
|
|
userORG.setOrganizationId(userAndOrganizationVO.getOrganizationid());
|
|
|
|
|
|
List<UserOrganization> userOrganizationData = userOrganizationFacade.getAgencyPersonnel(userORG);
|
|
|
- if (userOrganizationData.size() > 0) {
|
|
|
- return RespDTO.onSuc("该机构绑定了用户!");
|
|
|
+ if (ListUtil.isNotEmpty(userOrganizationData)) {
|
|
|
+ throw new CommonException(CommonErrorCode.IS_EXISTS, "该机构绑定了用户");
|
|
|
}
|
|
|
|
|
|
User user = new User();
|
|
@@ -740,8 +735,8 @@ public class UserFacade extends UserServiceImpl {
|
|
|
userAuthentication.setGmtCreate(DateUtil.now());// 记录创建时间
|
|
|
userAuthentication.setPosition(userAndOrganizationVO.getPosition());// 岗位信息
|
|
|
userAuthentication.setUserId(userId);// 用户id
|
|
|
- userAuthentication.setIsReject(1);// 是否通过认证 0:未通过,1:已通过
|
|
|
- userAuthentication.setStatus(1);// 认证状态(0:未认证,1:已认证,2:认证中)
|
|
|
+ userAuthentication.setIsReject(RejectEnum.PASS.getKey());// 是否通过认证 0:未通过,1:已通过
|
|
|
+ userAuthentication.setStatus(AuthStatusEnum.Authorized.getKey());// 认证状态(0:未认证,1:已认证,2:认证中)
|
|
|
userAuthenticationFacade.save(userAuthentication);
|
|
|
|
|
|
// 用户信息和机构信息的绑定
|
|
@@ -753,9 +748,11 @@ public class UserFacade extends UserServiceImpl {
|
|
|
userOrganization.setUserId(userId);// 用户id
|
|
|
|
|
|
userOrganizationFacade.save(userOrganization);
|
|
|
+ } else {
|
|
|
+ throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED);
|
|
|
}
|
|
|
|
|
|
- return RespDTO.onSuc("绑定成功");
|
|
|
+ return RespDTO.onSuc(userAndOrganizationVO);
|
|
|
}
|
|
|
|
|
|
|