From 7c92a9851eb6bf90e3bb9e2a5059b83f12564b85 Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期五, 22 四月 2022 19:27:21 +0800
Subject: [PATCH] fix
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/ClientService.java | 66 +++++++++++++++++++++++++++-----
1 files changed, 55 insertions(+), 11 deletions(-)
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/ClientService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/ClientService.java
index 376c204..a3ff485 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/ClientService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/ClientService.java
@@ -7,6 +7,7 @@
import com.sandu.common.object.BaseConditionVO;
import com.sandu.common.service.impl.BaseServiceImpl;
import com.sandu.ximon.admin.param.AddClientPrarm;
+import com.sandu.ximon.admin.param.PwdParam;
import com.sandu.ximon.admin.param.ResetClientPasswordPrarm;
import com.sandu.ximon.admin.param.UpdateClientPrarm;
import com.sandu.ximon.admin.security.SecurityUtils;
@@ -114,23 +115,19 @@
return updateById(client);
}
- public boolean resetPassword(ResetClientPasswordPrarm resetClientPasswordPrarm) {
- Client client = getOne(Wrappers.lambdaQuery(Client.class).eq(Client::getId, resetClientPasswordPrarm.getId()));
+ public boolean resetPassword(PwdParam param) {
+
+ Client client = getOne(Wrappers.lambdaQuery(Client.class).eq(Client::getId, SecurityUtils.getUserDetails().getUserId()));
if (client == null) {
throw new BusinessException("璇ョ敤鎴蜂笉瀛樺湪锛�");
}
PasswordEncoder pw = new BCryptPasswordEncoder();
- //鍒ゆ柇鏃у瘑鐮佷笌鏁版嵁搴撴槸鍚︿竴鑷�
- if (pw.matches(resetClientPasswordPrarm.getOldPassword(), client.getPassword())) {
- //鍔犲瘑鏂板瘑鐮�
- String encode = pw.encode(resetClientPasswordPrarm.getNewPassword());
- client.setPassword(encode);
- return updateById(client);
- } else {
- throw new BusinessException("鏃у瘑鐮佷笉姝g‘锛岃閲嶆柊纭瀵嗙爜锛�");
- }
+ //鍔犲瘑鏂板瘑鐮�
+ String encode = pw.encode(param.getNewPass());
+ client.setPassword(encode);
+ return updateById(client);
}
public boolean deleteClient(Long id) {
@@ -177,6 +174,23 @@
}
/**
+ * \
+ * 鍏朵粬绫荤敤鏉ユ煡鎵惧鎴穒d浣跨敤 濡傛灉娌℃湁涓婄骇瀹㈡埛 杩欒繑鍥炵敤鎴稩D
+ *
+ * @param
+ * @return
+ */
+ public Long getClientId(Long userId) {
+ Client one = getOne(Wrappers.lambdaQuery(Client.class).eq(Client::getId, userId));
+ if (one != null && one.getSuperiorId() != null) {
+ return one.getSuperiorId();
+ } else {
+ return userId;
+ }
+
+ }
+
+ /**
* 涓�绾у鎴疯繑鍥瀎alse 浜岀骇瀹㈡埛杩斿洖true
*
* @return
@@ -191,4 +205,34 @@
}
}
+
+ /**
+ * 涓�绾у鎴疯繑鍥瀎alse 浜岀骇瀹㈡埛杩斿洖true
+ *
+ * @return
+ */
+ public boolean findClientId(Long userId) {
+ Client one = getOne(Wrappers.lambdaQuery(Client.class).eq(Client::getId, userId));
+ if (one != null && one.getSuperiorId() != null) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * 淇敼鏅�氱敤鎴峰ご鍍�
+ *
+ * @param userId
+ * @param IconUrl
+ * @return
+ */
+ public boolean updateIcon(Long userId, String IconUrl) {
+ Client one = getOne(Wrappers.lambdaQuery(Client.class).eq(Client::getId, userId));
+ if (one == null) {
+ throw new BusinessException("鐢ㄦ埛涓嶅瓨鍦�");
+ }
+ one.setIcon(IconUrl);
+ return updateById(one);
+ }
}
--
Gitblit v1.9.3