|
@@ -10,6 +10,7 @@ import com.bosshand.virgo.core.model.MgrUser;
|
|
import com.bosshand.virgo.core.model.MgrUserRole;
|
|
import com.bosshand.virgo.core.model.MgrUserRole;
|
|
import com.bosshand.virgo.core.utils.CodeCache;
|
|
import com.bosshand.virgo.core.utils.CodeCache;
|
|
import com.bosshand.virgo.core.utils.WeChatUtil;
|
|
import com.bosshand.virgo.core.utils.WeChatUtil;
|
|
|
|
+import com.bosshand.virgo.util.MD5Utils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -41,7 +42,28 @@ public class UserService {
|
|
}
|
|
}
|
|
|
|
|
|
public int update(MgrUser user) {
|
|
public int update(MgrUser user) {
|
|
- return mgrUserDao.update(user);
|
|
|
|
|
|
+ int update = mgrUserDao.update(user);
|
|
|
|
+ //修改聊天用户信息
|
|
|
|
+ JSONObject js = new JSONObject();
|
|
|
|
+ js.put("nickname", user.getName());
|
|
|
|
+ js.put("avatarUrl", user.getPortrait());
|
|
|
|
+ WeChatUtil.httpPost("http://git.waywish.com:9120/user/update", js, this.getYelToken(String.valueOf(user.getId())));
|
|
|
|
+ return update;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取Yel-Token
|
|
|
|
+ */
|
|
|
|
+ public String getYelToken(String userId) {
|
|
|
|
+ JSONObject js = new JSONObject();
|
|
|
|
+ js.put("userId", userId);
|
|
|
|
+ long timestamp = System.currentTimeMillis() + 30 * 1000;
|
|
|
|
+ js.put("timestamp", timestamp);
|
|
|
|
+ String sign = MD5Utils.code(userId + timestamp + "50abd47112ebe8c5a73f4694c96a49ce");
|
|
|
|
+ js.put("sign", sign);
|
|
|
|
+ String str = WeChatUtil.httpPost("http://git.waywish.com:9120/user/token/get", js, null);
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(str);
|
|
|
|
+ return jsonObject.getJSONObject("data").getString("token");
|
|
}
|
|
}
|
|
|
|
|
|
public void updateResources(MgrUserRole userRole) {
|
|
public void updateResources(MgrUserRole userRole) {
|
|
@@ -99,8 +121,8 @@ public class UserService {
|
|
JSONObject js = new JSONObject();
|
|
JSONObject js = new JSONObject();
|
|
js.put("userId", userId);
|
|
js.put("userId", userId);
|
|
js.put("nickname", user.getName());
|
|
js.put("nickname", user.getName());
|
|
- js.put("avatarUrl", "https://api.multiavatar.com/Starcrasher.png");
|
|
|
|
- WeChatUtil.httpPost("http://git.waywish.com:9120/user/register", js);
|
|
|
|
|
|
+ js.put("avatarUrl", CodeCache.DefaultPortrait);
|
|
|
|
+ WeChatUtil.httpPost("http://git.waywish.com:9120/user/register", js, null);
|
|
}
|
|
}
|
|
MgrUserRole mur = mgrUserRoleDao.getUser(userId, organizationId);
|
|
MgrUserRole mur = mgrUserRoleDao.getUser(userId, organizationId);
|
|
if (mur != null) {
|
|
if (mur != null) {
|