|
@@ -1,16 +1,24 @@
|
|
|
-package com.zhongshu.card.server.core.service.openAPI;
|
|
|
|
|
|
|
+package com.zhongshu.card.server.core.service.openAPI.org;
|
|
|
|
|
|
|
|
import com.github.microservice.components.data.base.util.PageEntityUtil;
|
|
import com.github.microservice.components.data.base.util.PageEntityUtil;
|
|
|
import com.github.microservice.net.ResultContent;
|
|
import com.github.microservice.net.ResultContent;
|
|
|
|
|
+import com.zhongshu.card.client.model.base.ProjectOidParam;
|
|
|
import com.zhongshu.card.client.model.org.orgUser.OrganizationUserSearch;
|
|
import com.zhongshu.card.client.model.org.orgUser.OrganizationUserSearch;
|
|
|
-import com.zhongshu.card.client.openApi.model.OrganizationUserOpenApiModel;
|
|
|
|
|
-import com.zhongshu.card.client.openApi.params.OrganizationUserOpenApiSearch;
|
|
|
|
|
|
|
+import com.zhongshu.card.client.model.school.ImportResultModel;
|
|
|
|
|
+import com.zhongshu.card.client.openApi.base.PhoneParam;
|
|
|
|
|
+import com.zhongshu.card.client.openApi.base.ProjectCodeParam;
|
|
|
|
|
+import com.zhongshu.card.client.openApi.model.orgUser.OrganizationUserOpenApiModel;
|
|
|
|
|
+import com.zhongshu.card.client.openApi.model.orgUser.OrganizationUserOpenApiSearch;
|
|
|
import com.zhongshu.card.server.core.dao.org.OrganizationUserDao;
|
|
import com.zhongshu.card.server.core.dao.org.OrganizationUserDao;
|
|
|
import com.zhongshu.card.server.core.domain.org.Organization;
|
|
import com.zhongshu.card.server.core.domain.org.Organization;
|
|
|
import com.zhongshu.card.server.core.domain.org.OrganizationUser;
|
|
import com.zhongshu.card.server.core.domain.org.OrganizationUser;
|
|
|
import com.zhongshu.card.server.core.domain.org.UserAccount;
|
|
import com.zhongshu.card.server.core.domain.org.UserAccount;
|
|
|
|
|
+import com.zhongshu.card.server.core.service.base.CommonService;
|
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
|
|
|
+import com.zhongshu.card.server.core.service.org.OrganizationUserServiceImpl;
|
|
|
import com.zhongshu.card.server.core.util.BeanUtils;
|
|
import com.zhongshu.card.server.core.util.BeanUtils;
|
|
|
|
|
+import jakarta.servlet.http.HttpServletRequest;
|
|
|
|
|
+import jakarta.servlet.http.HttpServletResponse;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -19,6 +27,7 @@ import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 机构相关的 openAPI
|
|
* 机构相关的 openAPI
|
|
@@ -33,6 +42,35 @@ public class OrganizationUserOpenApiService extends SuperService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private OrganizationUserDao organizationUserDao;
|
|
private OrganizationUserDao organizationUserDao;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private CommonService commonService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private OrganizationUserServiceImpl organizationUserServiceImpl;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param request
|
|
|
|
|
+ * @param response
|
|
|
|
|
+ * @param file
|
|
|
|
|
+ * @param param
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public ResultContent<ImportResultModel> importProjectUsers(HttpServletRequest request, HttpServletResponse response, MultipartFile file, ProjectCodeParam param) {
|
|
|
|
|
+ if (StringUtils.isEmpty(param.getProjectCode())) {
|
|
|
|
|
+ return ResultContent.buildFail("projectCode不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ String projectCode = param.getProjectCode();
|
|
|
|
|
+ ResultContent<String> resultContent = commonService.checkProjectCanUserByCode(projectCode);
|
|
|
|
|
+ if (resultContent.isFailed()) {
|
|
|
|
|
+ return ResultContent.buildFail(resultContent.getMsg());
|
|
|
|
|
+ }
|
|
|
|
|
+ String projectOid = resultContent.getContent();
|
|
|
|
|
+ ProjectOidParam oidParam = new ProjectOidParam();
|
|
|
|
|
+ oidParam.setProjectOid(projectOid);
|
|
|
|
|
+ return organizationUserServiceImpl.importProjectUsers(request, response, file, oidParam);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 项目用户列表
|
|
* 项目用户列表
|
|
|
*
|
|
*
|
|
@@ -41,13 +79,12 @@ public class OrganizationUserOpenApiService extends SuperService {
|
|
|
*/
|
|
*/
|
|
|
public ResultContent<Page<OrganizationUserOpenApiModel>> projectUserPage(OrganizationUserOpenApiSearch apiSearch) {
|
|
public ResultContent<Page<OrganizationUserOpenApiModel>> projectUserPage(OrganizationUserOpenApiSearch apiSearch) {
|
|
|
OrganizationUserSearch param = new OrganizationUserSearch();
|
|
OrganizationUserSearch param = new OrganizationUserSearch();
|
|
|
- if (StringUtils.isEmpty(apiSearch.getProjectCode())) {
|
|
|
|
|
- return ResultContent.buildFail("projectCode不能为空");
|
|
|
|
|
- }
|
|
|
|
|
- String projectOid = getOidByCode(apiSearch.getProjectCode());
|
|
|
|
|
- if (StringUtils.isEmpty(projectOid)) {
|
|
|
|
|
- projectOid = "unKnow";
|
|
|
|
|
|
|
+ String projectCode = apiSearch.getProjectCode();
|
|
|
|
|
+ ResultContent<String> resultContent = commonService.checkProjectCanUserByCode(projectCode);
|
|
|
|
|
+ if (resultContent.isFailed()) {
|
|
|
|
|
+ return ResultContent.buildFail(resultContent.getMsg());
|
|
|
}
|
|
}
|
|
|
|
|
+ String projectOid = resultContent.getContent();
|
|
|
BeanUtils.copyProperties(apiSearch, param);
|
|
BeanUtils.copyProperties(apiSearch, param);
|
|
|
param.setProjectOid(projectOid);
|
|
param.setProjectOid(projectOid);
|
|
|
|
|
|
|
@@ -70,6 +107,23 @@ public class OrganizationUserOpenApiService extends SuperService {
|
|
|
return ResultContent.buildSuccess(toModel(organizationUser));
|
|
return ResultContent.buildSuccess(toModel(organizationUser));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public ResultContent<OrganizationUserOpenApiModel> getUserDetailByPhone(PhoneParam param) {
|
|
|
|
|
+ if (StringUtils.isNotEmpty(param.getPhone())) {
|
|
|
|
|
+ return ResultContent.buildFail("phone不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ String projectCode = param.getProjectCode();
|
|
|
|
|
+ ResultContent<String> resultContent = commonService.checkProjectCanUserByCode(projectCode);
|
|
|
|
|
+ if (resultContent.isFailed()) {
|
|
|
|
|
+ return ResultContent.buildFail(resultContent.getMsg());
|
|
|
|
|
+ }
|
|
|
|
|
+ String projectOid = resultContent.getContent();
|
|
|
|
|
+ OrganizationUser organizationUser = organizationUserDao.findTopByPhoneAndProjectOid(param.getPhone(), projectOid);
|
|
|
|
|
+ if (ObjectUtils.isEmpty(organizationUser)) {
|
|
|
|
|
+ return ResultContent.buildFail("用户存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ return ResultContent.buildSuccess(toModel(organizationUser));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public OrganizationUserOpenApiModel toModel(OrganizationUser entity) {
|
|
public OrganizationUserOpenApiModel toModel(OrganizationUser entity) {
|
|
|
OrganizationUserOpenApiModel model = new OrganizationUserOpenApiModel();
|
|
OrganizationUserOpenApiModel model = new OrganizationUserOpenApiModel();
|
|
|
if (ObjectUtils.isNotEmpty(entity.getId())) {
|
|
if (ObjectUtils.isNotEmpty(entity.getId())) {
|