Commit 06453fa3 authored by hezhen's avatar hezhen

123

parent 7722e325
...@@ -21,6 +21,8 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -21,6 +21,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.github.wxiaoqi.security.admin.mapper.AppUserRelationMapper; import com.github.wxiaoqi.security.admin.mapper.AppUserRelationMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import java.util.*; import java.util.*;
...@@ -76,8 +78,11 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper, AppUserRe ...@@ -76,8 +78,11 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper, AppUserRe
return false; return false;
} }
private boolean parentLock(Integer userId) { private boolean parentLock(Integer userId) {
log.info("---进锁前---parentId===="+userId);
synchronized (parentObj) { synchronized (parentObj) {
log.info("---进锁---parentId===="+userId);
if (parentMap.get(userId) == null) { if (parentMap.get(userId) == null) {
log.info("---进锁处理---parentId===="+userId);
parentMap.put(userId, true); parentMap.put(userId, true);
return true; return true;
} }
...@@ -86,6 +91,7 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper, AppUserRe ...@@ -86,6 +91,7 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper, AppUserRe
} }
private void unParentLock(Integer userId) { private void unParentLock(Integer userId) {
log.info("---解锁处理---parentId===="+userId);
synchronized (parentObj) { synchronized (parentObj) {
parentMap.remove(userId); parentMap.remove(userId);
} }
...@@ -104,6 +110,7 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper, AppUserRe ...@@ -104,6 +110,7 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper, AppUserRe
* @param userId * @param userId
* @param parentId * @param parentId
*/ */
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public void bindRelation(Integer userId,Integer parentId,Integer type){ public void bindRelation(Integer userId,Integer parentId,Integer type){
try { try {
if (userId.equals(parentId)){ if (userId.equals(parentId)){
......
...@@ -393,16 +393,50 @@ public class AppPermissionService { ...@@ -393,16 +393,50 @@ public class AppPermissionService {
} }
/*public void test(){ public void test(){
Example example=new Example(AppUserLogin.class); Example example=new Example(AppUserLogin.class);
example.createCriteria().andEqualTo("imUserid",0); example.createCriteria().andEqualTo("imUserid",0);
List<AppUserLogin> list=appUserLoginBiz.selectByExample(example); List<AppUserLogin> list=appUserLoginBiz.selectByExample(example);
for (AppUserLogin userLogin:list){ for (AppUserLogin userLogin:list) {
Long now = System.currentTimeMillis() / 1000;
Integer userId = userLogin.getId();
String username = userLogin.getUsername();
String ip = getIp();
String nickname = SystemConfig.USER_NIKENAME_DEFAULT + (int) ((Math.random() * 9 + 1) * 100000);
AppUserDetail rsUserDetail = new AppUserDetail();
rsUserDetail.setUserid(userId);
rsUserDetail = appUserDetailBiz.selectOne(rsUserDetail);
if (rsUserDetail == null) {
rsUserDetail.setUserid(userId);
rsUserDetail.setNickname(nickname);
rsUserDetail.setHeadimgurl(SystemConfig.USER_HEADER_URL_DEFAULT); // 默认路径,待写
rsUserDetail.setCreatetime(now);
rsUserDetail.setUpdatetime(now);
rsUserDetail.setIsdel(0);
rsUserDetail.setCrtHost(ip);
//生成邀请码 长度改为8 不然重复率太高
rsUserDetail.setCode(ReferralCodeUtil.encode(userId));
appUserDetailBiz.insertSelective(rsUserDetail);
} else {
nickname=rsUserDetail.getNickname();
}
Map<String, Object> map = registerIm(userLogin.getUsername(), userLogin.getPassword(), nickname);
if (map != null) {
Integer imUserId = Integer.parseInt(map.get("userId").toString());
String imPassword = map.get("password").toString();
if (imUserId != null && imUserId > 0 && StringUtils.isNotBlank(imPassword)) {
AppUserLogin userLogin1 = new AppUserLogin();
userLogin1.setId(userId);
userLogin1.setImPassword(imPassword);
userLogin1.setImUserid(imUserId);
userLogin1.setUsername(username);
appUserLoginBiz.updateSelectiveById(userLogin1);
log.info(username + "----userLogin updateSelectiveById---username=====" + username + "----imPassword====" + imPassword);
}
}
} }
}
}*/
private void sendQueue(String username, String password, String headimgurl, String nickname, String mobilecode, String openId, String unionid, Integer type, String code, String activityCode, Integer userid,Integer sign) { private void sendQueue(String username, String password, String headimgurl, String nickname, String mobilecode, String openId, String unionid, Integer type, String code, String activityCode, Integer userid,Integer sign) {
try { try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment