|
|
@@ -14,6 +14,7 @@ import com.zhongshu.card.client.model.org.*;
|
|
|
import com.zhongshu.card.client.model.org.register.UserCountRegisterParam;
|
|
|
import com.zhongshu.card.client.model.orgModel.OrgBindUserAllParam;
|
|
|
import com.zhongshu.card.client.model.paySetting.paySetting.OrgPayShowSettingModel;
|
|
|
+import com.zhongshu.card.client.model.projectAbout.projectCommon.ProjectCommonConfigModel;
|
|
|
import com.zhongshu.card.client.model.school.ExcelUserParam;
|
|
|
import com.zhongshu.card.client.model.school.ImportResultModel;
|
|
|
import com.zhongshu.card.client.model.school.RegisterBindSchoolParam;
|
|
|
@@ -30,6 +31,7 @@ import com.zhongshu.card.server.core.service.base.SuperService;
|
|
|
import com.zhongshu.card.server.core.service.devices.permiss.DevicePermissEventService;
|
|
|
import com.zhongshu.card.server.core.service.orgManager.OrganizationManagerServiceImpl;
|
|
|
import com.zhongshu.card.server.core.service.paySetting.ProjectPaySettingServiceImpl;
|
|
|
+import com.zhongshu.card.server.core.service.projectAbout.ProjectCommonConfigService;
|
|
|
import com.zhongshu.card.server.core.service.school.DictInfoServiceImpl;
|
|
|
import com.zhongshu.card.server.core.service.user.DepartmentServiceImpl;
|
|
|
import com.zhongshu.card.server.core.service.user.RoleServiceImpl;
|
|
|
@@ -124,6 +126,9 @@ public class OrganizationUserServiceImpl extends SuperService {
|
|
|
@Autowired
|
|
|
private UserInfoSyncService userInfoSyncService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ProjectCommonConfigService projectCommonConfigService;
|
|
|
+
|
|
|
/**
|
|
|
* 添加编辑用户 添加机构用户 (包括角色 部门 职位等信息)
|
|
|
* 用户可能不存在
|
|
|
@@ -221,7 +226,58 @@ public class OrganizationUserServiceImpl extends SuperService {
|
|
|
return ResultContent.buildSuccess(organizationUser);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 注册用户
|
|
|
+ *
|
|
|
+ * @param param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public ResultContent registerProjectUser(UserCountRegisterParam param) {
|
|
|
+ String projectOid = param.getProjectOid();
|
|
|
+ if (StringUtils.isEmpty(projectOid)) {
|
|
|
+ projectOid = getCurrentProjectOid();
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(projectOid)) {
|
|
|
+ return ResultContent.buildFail("projectOid 信息为空");
|
|
|
+ }
|
|
|
+ ProjectCommonConfigModel projectCommonConfig = projectCommonConfigService.getInfoByOid(projectOid);
|
|
|
+ if (ObjectUtils.isEmpty(projectCommonConfig)) {
|
|
|
+ return ResultContent.buildFail("项目的通用配置未配置");
|
|
|
+ }
|
|
|
+ if (projectCommonConfig.getIsAllowRegister() == null || !projectCommonConfig.getIsAllowRegister()) {
|
|
|
+ return ResultContent.buildFail("项目部允许注册用户");
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isEmpty(param.getRoleIds())) {
|
|
|
+ return ResultContent.buildFail("roleIds 不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ String phone = param.getPhone();
|
|
|
+ String loginName = phone;
|
|
|
+ UserAccount userAccount = userCountDao.findTopByLoginName(loginName);
|
|
|
+
|
|
|
+ if (ObjectUtils.isEmpty(userAccount)) {
|
|
|
+ String password = param.getPassWord();
|
|
|
+ String name = "游客";
|
|
|
+ if (phone != null && phone.length() == 11) {
|
|
|
+ name = "游客" + loginName.substring(8, 11);
|
|
|
+ }
|
|
|
+ // 用户基本信息维护 电话号码为登录名
|
|
|
+ RegisterUserAccountParam userAccountParam = new RegisterUserAccountParam();
|
|
|
+ userAccountParam.setLoginName(loginName);
|
|
|
+ userAccountParam.setPassword(password);
|
|
|
+ userAccountParam.setPhone(param.getPhone());
|
|
|
+ userAccountParam.setName(name);
|
|
|
+ userAccountParam.setCardNumber(param.getCardNumber());
|
|
|
+ userAccountParam.setSex(param.getSex());
|
|
|
+ userAccountParam.setProfilePic(param.getProfilePic());
|
|
|
+ ResultContent<String> userAccountContent = userAccountService.registerUserAccount(userAccountParam);
|
|
|
+ if (userAccountContent.isFailed()) {
|
|
|
+ return ResultContent.buildFail(userAccountContent.getMsg());
|
|
|
+ }
|
|
|
+ String userId = userAccountContent.getContent();
|
|
|
+ userAccount = userCountDao.findTopByUserId(userId);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
return ResultContent.buildSuccess();
|