|
|
@@ -1,17 +1,19 @@
|
|
|
package com.zhongshu.card.server.core.service.org;
|
|
|
|
|
|
+import com.github.microservice.auth.security.type.AuthType;
|
|
|
import com.github.microservice.components.data.base.util.PageEntityUtil;
|
|
|
-import com.zhongshu.card.client.model.org.UserCountAddParam;
|
|
|
-import com.zhongshu.card.client.model.org.UserCountModel;
|
|
|
-import com.zhongshu.card.client.model.org.UserCountSearchParam;
|
|
|
+import com.zhongshu.card.client.model.base.AuthTypeParam;
|
|
|
+import com.zhongshu.card.client.model.org.*;
|
|
|
import com.zhongshu.card.client.ret.ResultContent;
|
|
|
import com.zhongshu.card.client.ret.ResultMessage;
|
|
|
+import com.zhongshu.card.client.service.org.OrganizationService;
|
|
|
import com.zhongshu.card.client.service.org.UserAccountService;
|
|
|
import com.zhongshu.card.client.utils.type.Sex;
|
|
|
import com.zhongshu.card.client.utils.type.UserState;
|
|
|
import com.zhongshu.card.server.core.dao.org.UserCountDao;
|
|
|
import com.zhongshu.card.server.core.domain.org.Organization;
|
|
|
import com.zhongshu.card.server.core.domain.org.UserAccount;
|
|
|
+import com.zhongshu.card.server.core.service.base.SuperService;
|
|
|
import com.zhongshu.card.server.core.util.BeanUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
@@ -23,6 +25,7 @@ import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.Serializable;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* @author TRX
|
|
|
@@ -31,11 +34,14 @@ import java.io.Serializable;
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
@Primary
|
|
|
-public class UserAccountServiceImpl implements UserAccountService, Serializable {
|
|
|
+public class UserAccountServiceImpl extends SuperService implements UserAccountService, Serializable {
|
|
|
|
|
|
@Autowired
|
|
|
UserCountDao userCountDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ OrganizationService organizationService;
|
|
|
+
|
|
|
@Override
|
|
|
public ResultContent update(UserCountAddParam param) {
|
|
|
UserAccount userCount = new UserAccount();
|
|
|
@@ -77,6 +83,44 @@ public class UserAccountServiceImpl implements UserAccountService, Serializable
|
|
|
return userAccount;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 得到当前的用户信息 (包含机构信息)
|
|
|
+ * @param param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public ResultContent<UserCountDetailsModel> getCurrentDetail(AuthTypeParam param) {
|
|
|
+ UserCountDetailsModel model = new UserCountDetailsModel();
|
|
|
+ UserAccount userAccount = userCountDao.findTopByUserId(getCurrentUserId());
|
|
|
+ if (ObjectUtils.isNotEmpty(userAccount)) {
|
|
|
+ UserCountModel model1 = toModel(userAccount);
|
|
|
+ BeanUtils.copyProperties(model1, model);
|
|
|
+ // 查询机构列表
|
|
|
+ OrganizationUserSearch search = new OrganizationUserSearch();
|
|
|
+ search.setState(UserState.Normal);
|
|
|
+ search.setAuthType(param.getAuthType());
|
|
|
+ search.setUserId(getCurrentUserId());
|
|
|
+ ResultContent<List<OrganizationModel>> resultContent = organizationService.getUserOrgList(search);
|
|
|
+ if (resultContent.isSuccess()) {
|
|
|
+ model.setList(resultContent.getContent());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResultContent.buildSuccess(model);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 得到用户信息
|
|
|
+ * @param userId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public ResultContent<UserCountModel> getUserDetail(String userId) {
|
|
|
+ UserCountModel model = new UserCountModel();
|
|
|
+ UserAccount userAccount = userCountDao.findTopByUserId(userId);
|
|
|
+ if (ObjectUtils.isNotEmpty(userAccount)) {
|
|
|
+ model = toModel(userAccount);
|
|
|
+ }
|
|
|
+ return ResultContent.buildSuccess(model);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public ResultContent<Page<UserCountModel>> list(UserCountSearchParam param, Pageable pageable) {
|
|
|
Page<UserAccount> page = userCountDao.page(pageable, param);
|