重构企业项目,并可以添加数据
parent
3477a3921d
commit
3dbcd574cc
|
@ -89,6 +89,7 @@ public class SysUser extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 用户类型(00 系统用户)
|
* 用户类型(00 系统用户)
|
||||||
*/
|
*/
|
||||||
|
@Excel(name = "企业ID")
|
||||||
private String userType;
|
private String userType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.common.system.remote.factory.RemoteUserFallbackFactory;
|
import com.muyu.common.system.remote.factory.RemoteUserFallbackFactory;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,7 +27,6 @@ public interface RemoteUserService {
|
||||||
*/
|
*/
|
||||||
@GetMapping("/user/info/{username}")
|
@GetMapping("/user/info/{username}")
|
||||||
public Result<LoginUser> getUserInfo (@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
public Result<LoginUser> getUserInfo (@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册用户信息
|
* 注册用户信息
|
||||||
*
|
*
|
||||||
|
@ -37,4 +37,18 @@ public interface RemoteUserService {
|
||||||
*/
|
*/
|
||||||
@PostMapping("/user/register")
|
@PostMapping("/user/register")
|
||||||
public Result<Boolean> registerUserInfo (@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
public Result<Boolean> registerUserInfo (@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
|
@PostMapping("/user")
|
||||||
|
public Result add (@Validated @RequestBody SysUser user);
|
||||||
|
|
||||||
|
@GetMapping("/user/info/{username}")
|
||||||
|
public Result<LoginUser> info (@PathVariable("username") String username);
|
||||||
|
|
||||||
|
@GetMapping("/user/authRole/{userId}")
|
||||||
|
public Result authRole (@PathVariable("userId") Long userId);
|
||||||
|
|
||||||
|
@GetMapping("/user/selectByUserId/{userId}")
|
||||||
|
public SysUser selectByUserId (@PathVariable("userId") Long userId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,26 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
||||||
public Result<Boolean> registerUserInfo (SysUser sysUser, String source) {
|
public Result<Boolean> registerUserInfo (SysUser sysUser, String source) {
|
||||||
return Result.error("注册用户失败:" + throwable.getMessage());
|
return Result.error("注册用户失败:" + throwable.getMessage());
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public Result add(SysUser user) {
|
||||||
|
return Result.error("注册用户失败:" + throwable.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<LoginUser> info(String username) {
|
||||||
|
return Result.error("注册用户失败:" + throwable.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result authRole(Long userId) {
|
||||||
|
return Result.error("注册用户失败:" + throwable.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysUser selectByUserId(Long userId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,8 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business> i
|
||||||
public int updateBusiness(Business business) {
|
public int updateBusiness(Business business) {
|
||||||
|
|
||||||
business.setUpdateTime(DateUtils.getNowDate());
|
business.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
httpConnectMysql(business);
|
||||||
|
return businessMapper.updateBusiness(business);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,10 +107,7 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business> i
|
||||||
public void httpConnectMysql(Business business){
|
public void httpConnectMysql(Business business){
|
||||||
if (business.getBusinessStates().equals(2) ) {
|
if (business.getBusinessStates().equals(2) ) {
|
||||||
if (!redisTemplate.hasKey(business.getId()+business.getName())){
|
if (!redisTemplate.hasKey(business.getId()+business.getName())){
|
||||||
redisTemplate.opsForValue()
|
redisTemplate.opsForValue().set(business.getId()+ business.getName(),String.valueOf(3306+business.getId()));
|
||||||
.set(business.getId()+
|
|
||||||
business.getName()
|
|
||||||
,String.valueOf(3306+business.getId()));
|
|
||||||
extracted(business);
|
extracted(business);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,7 +117,7 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business> i
|
||||||
|
|
||||||
|
|
||||||
private static void extracted(Business business) {
|
private static void extracted(Business business) {
|
||||||
String postUrl="http://122.51.111.225:10006/webhook/%E6%96%B0%E5%BB%BA%E4%BC%81%E4%B8%9A%E6%95%B0%E6%8D%AE%E6%BA%90";
|
String postUrl="http://175.24.138.82:10006/webhook/%E6%9C%AA%E5%91%BD%E5%90%8D%E9%A1%B9%E7%9B%AE";
|
||||||
HashMap<String, String> hashMap = new HashMap<>();
|
HashMap<String, String> hashMap = new HashMap<>();
|
||||||
hashMap.put("businessId", business.getId()+ business.getName());
|
hashMap.put("businessId", business.getId()+ business.getName());
|
||||||
hashMap.put("mysqlPort",String.valueOf(3306+ business.getId()));
|
hashMap.put("mysqlPort",String.valueOf(3306+ business.getId()));
|
||||||
|
|
|
@ -66,6 +66,11 @@ public class SysUserController extends BaseController {
|
||||||
List<SysUser> list = userService.selectUserList(user);
|
List<SysUser> list = userService.selectUserList(user);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
@GetMapping("/selectByUserId/{userId}")
|
||||||
|
public SysUser selectByUserId (@PathVariable("userId") Long userId) {
|
||||||
|
SysUser user = userService.selectUserById(userId);
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
||||||
@RequiresPermissions("system:user:export")
|
@RequiresPermissions("system:user:export")
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<result property="deptId" column="dept_id"/>
|
<result property="deptId" column="dept_id"/>
|
||||||
<result property="userName" column="user_name"/>
|
<result property="userName" column="user_name"/>
|
||||||
<result property="nickName" column="nick_name"/>
|
<result property="nickName" column="nick_name"/>
|
||||||
|
<result property="userType" column="user_type"/>
|
||||||
<result property="email" column="email"/>
|
<result property="email" column="email"/>
|
||||||
<result property="phonenumber" column="phonenumber"/>
|
<result property="phonenumber" column="phonenumber"/>
|
||||||
<result property="sex" column="sex"/>
|
<result property="sex" column="sex"/>
|
||||||
|
@ -56,6 +57,7 @@
|
||||||
u.phonenumber,
|
u.phonenumber,
|
||||||
u.password,
|
u.password,
|
||||||
u.sex,
|
u.sex,
|
||||||
|
u.user_type,
|
||||||
u.status,
|
u.status,
|
||||||
u.del_flag,
|
u.del_flag,
|
||||||
u.login_ip,
|
u.login_ip,
|
||||||
|
@ -83,7 +85,7 @@
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectUserList" parameterType="com.muyu.common.system.domain.SysUser" resultMap="SysUserResult">
|
<select id="selectUserList" parameterType="com.muyu.common.system.domain.SysUser" resultMap="SysUserResult">
|
||||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status,
|
select u.user_id, u.dept_id, u.nick_name, u.user_type,u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status,
|
||||||
u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user
|
u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user
|
||||||
u
|
u
|
||||||
left join sys_dept d on u.dept_id = d.dept_id
|
left join sys_dept d on u.dept_id = d.dept_id
|
||||||
|
@ -115,7 +117,7 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectAllocatedList" parameterType="com.muyu.common.system.domain.SysUser" resultMap="SysUserResult">
|
<select id="selectAllocatedList" parameterType="com.muyu.common.system.domain.SysUser" resultMap="SysUserResult">
|
||||||
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
select distinct u.user_id, u.dept_id,u.user_type, u.user_name,u.user_type, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
||||||
from sys_user u
|
from sys_user u
|
||||||
left join sys_dept d on u.dept_id = d.dept_id
|
left join sys_dept d on u.dept_id = d.dept_id
|
||||||
left join sys_user_role ur on u.user_id = ur.user_id
|
left join sys_user_role ur on u.user_id = ur.user_id
|
||||||
|
@ -132,7 +134,7 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUnallocatedList" parameterType="com.muyu.common.system.domain.SysUser" resultMap="SysUserResult">
|
<select id="selectUnallocatedList" parameterType="com.muyu.common.system.domain.SysUser" resultMap="SysUserResult">
|
||||||
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
select distinct u.user_id, u.dept_id, u.user_name,u.user_type, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
||||||
from sys_user u
|
from sys_user u
|
||||||
left join sys_dept d on u.dept_id = d.dept_id
|
left join sys_dept d on u.dept_id = d.dept_id
|
||||||
left join sys_user_role ur on u.user_id = ur.user_id
|
left join sys_user_role ur on u.user_id = ur.user_id
|
||||||
|
@ -188,6 +190,7 @@
|
||||||
insert into sys_user(
|
insert into sys_user(
|
||||||
<if test="userId != null and userId != 0">user_id,</if>
|
<if test="userId != null and userId != 0">user_id,</if>
|
||||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||||
|
<if test="userType != null and userType != 0">user_type,</if>
|
||||||
<if test="userName != null and userName != ''">user_name,</if>
|
<if test="userName != null and userName != ''">user_name,</if>
|
||||||
<if test="nickName != null and nickName != ''">nick_name,</if>
|
<if test="nickName != null and nickName != ''">nick_name,</if>
|
||||||
<if test="email != null and email != ''">email,</if>
|
<if test="email != null and email != ''">email,</if>
|
||||||
|
@ -203,6 +206,7 @@
|
||||||
<if test="userId != null and userId != ''">#{userId},</if>
|
<if test="userId != null and userId != ''">#{userId},</if>
|
||||||
<if test="deptId != null and deptId != ''">#{deptId},</if>
|
<if test="deptId != null and deptId != ''">#{deptId},</if>
|
||||||
<if test="userName != null and userName != ''">#{userName},</if>
|
<if test="userName != null and userName != ''">#{userName},</if>
|
||||||
|
<if test="userType != null and userType != ''">#{userType},</if>
|
||||||
<if test="nickName != null and nickName != ''">#{nickName},</if>
|
<if test="nickName != null and nickName != ''">#{nickName},</if>
|
||||||
<if test="email != null and email != ''">#{email},</if>
|
<if test="email != null and email != ''">#{email},</if>
|
||||||
<if test="avatar != null and avatar != ''">#{avatar},</if>
|
<if test="avatar != null and avatar != ''">#{avatar},</if>
|
||||||
|
@ -221,6 +225,7 @@
|
||||||
<set>
|
<set>
|
||||||
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
|
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
|
||||||
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
||||||
|
<if test="userType != null and userType != ''">user_type =#{userType},</if>
|
||||||
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
|
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
|
||||||
<if test="email != null ">email = #{email},</if>
|
<if test="email != null ">email = #{email},</if>
|
||||||
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
|
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
|
||||||
|
|
Loading…
Reference in New Issue