parent
9f1ac0a5dc
commit
b78fee1dd0
|
@ -47,8 +47,13 @@ public interface RemoteUserService {
|
|||
@GetMapping("/user/authRole/{userId}")
|
||||
public Result authRole (@PathVariable("userId") Long userId);
|
||||
|
||||
@GetMapping("/user/userById/{userId}")
|
||||
public SysUser userById(@PathVariable("userId") Long UserType);
|
||||
|
||||
@GetMapping("/user/selectByUserId/{userId}")
|
||||
public SysUser selectByUserId (@PathVariable("userId") Long userId);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,9 +3,12 @@ package com.muyu.business.service.impl;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.business.domain.Business;
|
||||
import com.muyu.business.domain.Entinfo;
|
||||
import com.muyu.business.mapper.BusinessMapper;
|
||||
import com.muyu.business.service.BusinessService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.common.redis.service.RedisService;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
|
@ -40,8 +43,9 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business> i
|
|||
@Autowired
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate<String,String> redisTemplate;
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -73,17 +77,17 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business> i
|
|||
int i = businessMapper.insertBusiness(business);
|
||||
System.out.println(business);
|
||||
|
||||
SysUser sysUser = SysUser.builder()
|
||||
.userName(business.getName() + business.getId())
|
||||
.password("admin123")
|
||||
.nickName(business.getName())
|
||||
.email(business.getBusinessEmail())
|
||||
.phonenumber(business.getBusinessPhone())
|
||||
.loginIp("175.24.138.82")
|
||||
.userType(String.valueOf(business.getId()))
|
||||
.build();
|
||||
|
||||
remoteUserService.add(sysUser);
|
||||
SysUser sysUser = SysUser.builder()
|
||||
.userName(business.getName())
|
||||
.password("admin123")
|
||||
.nickName(business.getName())
|
||||
.email(business.getBusinessEmail())
|
||||
.phonenumber(business.getBusinessPhone())
|
||||
.loginIp("111.229.102.61")
|
||||
.roleId(Long.valueOf(101))
|
||||
.userType(String.valueOf(business.getId()))
|
||||
.build();
|
||||
Result add = remoteUserService.add(sysUser);
|
||||
return i;
|
||||
|
||||
}
|
||||
|
@ -97,16 +101,29 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business> i
|
|||
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
private EntinfoServiceImpl entinfoService;
|
||||
/**
|
||||
*
|
||||
* @ 判断redis是否存在端口号
|
||||
* @return
|
||||
*/
|
||||
public void httpConnectMysql(Business business){
|
||||
if (business.getBusinessStates().equals(2) ) {
|
||||
if (!redisTemplate.hasKey(business.getId()+business.getName())){
|
||||
redisTemplate.opsForValue().set(business.getId()+ business.getName(),String.valueOf(3306+business.getId()));
|
||||
redisService.deleteObject("entinfo");
|
||||
List<Entinfo> list = entinfoService.list();
|
||||
if (list.size()!=0){
|
||||
redisService.setCacheList("entinfo",list);
|
||||
}
|
||||
if (business.getBusinessStates().equals("2")){
|
||||
SysUser sysUser = remoteUserService.userById(business.getId());
|
||||
sysUser.setRoleId(Long.valueOf(2));
|
||||
remoteUserService.updateById(sysUser);
|
||||
Entinfo build = Entinfo.builder()
|
||||
.entCode("test_" + business.getId())
|
||||
.ip("192.168.120.128")
|
||||
.port(Integer.valueOf(3306 + Integer.valueOf(String.valueOf(business.getId())))).build();
|
||||
Entinfo entinfo =entinfoService.selectEntinfo(build);
|
||||
if (entinfo == null){
|
||||
extracted(business);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue