|
|
@@ -1,8 +1,11 @@
|
|
|
package com.zhongshu.card.server.core.service.org;
|
|
|
|
|
|
+import com.github.microservice.auth.client.content.ResultState;
|
|
|
+import com.github.microservice.auth.client.service.UserService;
|
|
|
import com.github.microservice.auth.security.type.AuthType;
|
|
|
import com.github.microservice.components.data.base.util.PageEntityUtil;
|
|
|
import com.zhongshu.card.client.model.base.AuthTypeParam;
|
|
|
+import com.zhongshu.card.client.model.base.UserIdModel;
|
|
|
import com.zhongshu.card.client.model.org.*;
|
|
|
import com.zhongshu.card.client.ret.ResultContent;
|
|
|
import com.zhongshu.card.client.ret.ResultMessage;
|
|
|
@@ -11,6 +14,7 @@ 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.dataConfig.CardDefault;
|
|
|
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;
|
|
|
@@ -23,6 +27,7 @@ import org.springframework.context.annotation.Primary;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.Assert;
|
|
|
|
|
|
import java.io.Serializable;
|
|
|
import java.util.List;
|
|
|
@@ -42,6 +47,9 @@ public class UserAccountServiceImpl extends SuperService implements UserAccountS
|
|
|
@Autowired
|
|
|
OrganizationService organizationService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ UserService userService;
|
|
|
+
|
|
|
@Override
|
|
|
public ResultContent update(UserCountAddParam param) {
|
|
|
UserAccount userCount = new UserAccount();
|
|
|
@@ -51,9 +59,51 @@ public class UserAccountServiceImpl extends SuperService implements UserAccountS
|
|
|
return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, param.getUserId()));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
// 在授权中心添加用户
|
|
|
+ return ResultContent.buildSuccess();
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 当前用户修改密码
|
|
|
+ *
|
|
|
+ * @param param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResultContent updatePassWord(PassWordModel param) {
|
|
|
+ Assert.hasText(param.getOldPass(), "密码不能为空");
|
|
|
+ Assert.hasText(param.getPassWord(), "新密码不能为空");
|
|
|
+ Assert.hasText(param.getConfirmPass(), "验证密码不能为空");
|
|
|
+ if (!param.getPassWord().equals(param.getConfirmPass())) {
|
|
|
+ return ResultContent.buildFail(String.format("密码和验证密码不一致"));
|
|
|
+ }
|
|
|
+ com.github.microservice.auth.client.content.ResultContent<Void> resultContent = userService.checkLoginPassword(param.getUserId(), param.getOldPass());
|
|
|
+ if (resultContent.getState() == ResultState.Success) {
|
|
|
+ com.github.microservice.auth.client.content.ResultContent<Void> resultContent1 = userService.updateLoginPassword(param.getUserId(), param.getPassWord());
|
|
|
+ if (resultContent1.getState() != ResultState.Success) {
|
|
|
+ return ResultContent.buildFail(resultContent1.getMsg());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return ResultContent.buildFail(resultContent.getMsg());
|
|
|
+ }
|
|
|
+ return ResultContent.buildSuccess();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 重置密码
|
|
|
+ * @param param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResultContent resetPassWord(UserIdModel param) {
|
|
|
+ UserAccount userCount = userCountDao.findTopByUserId(param.getUserId());
|
|
|
+ if (ObjectUtils.isEmpty(userCount)) {
|
|
|
+ return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, param.getUserId()));
|
|
|
+ }
|
|
|
+ com.github.microservice.auth.client.content.ResultContent<Void> resultContent = userService.updateLoginPassword(param.getUserId(), CardDefault.DEFAULT_PASSWORD);
|
|
|
+ if (resultContent.getState() != ResultState.Success) {
|
|
|
+ return ResultContent.buildFail(resultContent.getMsg());
|
|
|
+ }
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@@ -85,6 +135,7 @@ public class UserAccountServiceImpl extends SuperService implements UserAccountS
|
|
|
|
|
|
/**
|
|
|
* 得到当前的用户信息 (包含机构信息)
|
|
|
+ *
|
|
|
* @param param
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -109,6 +160,7 @@ public class UserAccountServiceImpl extends SuperService implements UserAccountS
|
|
|
|
|
|
/**
|
|
|
* 得到用户信息
|
|
|
+ *
|
|
|
* @param userId
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -121,6 +173,13 @@ public class UserAccountServiceImpl extends SuperService implements UserAccountS
|
|
|
return ResultContent.buildSuccess(model);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 分页查询所有用户
|
|
|
+ *
|
|
|
+ * @param param
|
|
|
+ * @param pageable
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@Override
|
|
|
public ResultContent<Page<UserCountModel>> list(UserCountSearchParam param, Pageable pageable) {
|
|
|
Page<UserAccount> page = userCountDao.page(pageable, param);
|