fast()用户重写
parent
36c0439773
commit
71dbd303d6
|
@ -1,6 +1,8 @@
|
||||||
package com.muyu.common.system.domain;
|
package com.muyu.common.system.domain;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -9,6 +11,7 @@ import java.util.Set;
|
||||||
*
|
*
|
||||||
* @author muyu
|
* @author muyu
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class LoginUser implements Serializable {
|
public class LoginUser implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ -57,6 +60,8 @@ public class LoginUser implements Serializable {
|
||||||
*/
|
*/
|
||||||
private SysUser sysUser;
|
private SysUser sysUser;
|
||||||
|
|
||||||
|
private Long firm;
|
||||||
|
|
||||||
public String getToken () {
|
public String getToken () {
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package muyu.goods.enterprise.client.config;
|
package muyu.goods.enterprise.client.config;
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.goods.domain.Enterprise;
|
import com.muyu.goods.domain.Enterprise;
|
||||||
import com.muyu.system.remote.RemoteSystemManageService;
|
import com.muyu.system.remote.RemoteSystemManageService;
|
||||||
|
@ -11,7 +13,10 @@ import org.springframework.context.annotation.ComponentScan;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@ComponentScan
|
@ComponentScan
|
||||||
|
@ -20,10 +25,11 @@ public class EnterpriseConfig {
|
||||||
@Autowired
|
@Autowired
|
||||||
private RemoteSystemManageService remoteSystemManageService;
|
private RemoteSystemManageService remoteSystemManageService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加新用户
|
||||||
|
* @param enterprise
|
||||||
|
*/
|
||||||
public void index(Enterprise enterprise) {
|
public void index(Enterprise enterprise) {
|
||||||
Result<List<SysUser>> lists = remoteSystemManageService.lists();
|
|
||||||
List<SysUser> data = lists.getData();
|
|
||||||
SysUser sysUser = new SysUser();
|
SysUser sysUser = new SysUser();
|
||||||
//用户昵称
|
//用户昵称
|
||||||
sysUser.setNickName(enterprise.getEnterpriseName());
|
sysUser.setNickName(enterprise.getEnterpriseName());
|
||||||
|
@ -51,4 +57,15 @@ public class EnterpriseConfig {
|
||||||
sysUser.setFirm(enterprise.getId());
|
sysUser.setFirm(enterprise.getId());
|
||||||
remoteSystemManageService.add(sysUser);
|
remoteSystemManageService.add(sysUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 展示和企业绑定的用户
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<SysUser> sysUsers() {
|
||||||
|
Result<List<SysUser>> lists = remoteSystemManageService.lists();
|
||||||
|
List<SysUser> sysUserList = lists.getData();
|
||||||
|
List<SysUser> collect = sysUserList.stream().filter(user -> user.getFirm()!=null).collect(Collectors.toList());
|
||||||
|
return collect;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.goods.controller;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.goods.domain.Enterprise;
|
import com.muyu.goods.domain.Enterprise;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
@ -38,7 +39,7 @@ public class EnterpriseController extends BaseController
|
||||||
/**
|
/**
|
||||||
* 查询企业列表
|
* 查询企业列表
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("goods:enterprise:list")
|
// @RequiresPermissions("goods:enterprise:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public Result<TableDataInfo<Enterprise>> list(Enterprise enterprise)
|
public Result<TableDataInfo<Enterprise>> list(Enterprise enterprise)
|
||||||
{
|
{
|
||||||
|
@ -47,10 +48,19 @@ public class EnterpriseController extends BaseController
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业详情
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("lists")
|
||||||
|
public Result<List<Enterprise>> lists(){
|
||||||
|
return success(enterpriseService.lists());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出企业列表
|
* 导出企业列表
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("goods:enterprise:export")
|
// @RequiresPermissions("goods:enterprise:export")
|
||||||
@Log(title = "企业", businessType = BusinessType.EXPORT)
|
@Log(title = "企业", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, Enterprise enterprise)
|
public void export(HttpServletResponse response, Enterprise enterprise)
|
||||||
|
@ -63,7 +73,7 @@ public class EnterpriseController extends BaseController
|
||||||
/**
|
/**
|
||||||
* 获取企业详细信息
|
* 获取企业详细信息
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("goods:enterprise:query")
|
// @RequiresPermissions("goods:enterprise:query")
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public Result<Enterprise> getInfo(@PathVariable("id") Long id)
|
public Result<Enterprise> getInfo(@PathVariable("id") Long id)
|
||||||
{
|
{
|
||||||
|
@ -89,7 +99,7 @@ public class EnterpriseController extends BaseController
|
||||||
/**
|
/**
|
||||||
* 修改企业
|
* 修改企业
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("goods:enterprise:edit")
|
// @RequiresPermissions("goods:enterprise:edit")
|
||||||
@Log(title = "企业", businessType = BusinessType.UPDATE)
|
@Log(title = "企业", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public Result edit(@RequestBody Enterprise enterprise)
|
public Result edit(@RequestBody Enterprise enterprise)
|
||||||
|
@ -110,11 +120,20 @@ public class EnterpriseController extends BaseController
|
||||||
/**
|
/**
|
||||||
* 删除企业
|
* 删除企业
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("goods:enterprise:remove")
|
// @RequiresPermissions("goods:enterprise:remove")
|
||||||
@Log(title = "企业", businessType = BusinessType.DELETE)
|
@Log(title = "企业", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public Result remove(@PathVariable Long[] ids)
|
public Result remove(@PathVariable Long[] ids)
|
||||||
{
|
{
|
||||||
return toAjax(enterpriseService.deleteEnterpriseByIds(ids));
|
return toAjax(enterpriseService.deleteEnterpriseByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取企业管理账户
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("sysUsers")
|
||||||
|
public Result<List<SysUser>> sysUsers() {
|
||||||
|
return success(enterpriseService.sysUsers());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,4 +63,6 @@ public interface EnterpriseMapper
|
||||||
int authentication(Enterprise enterprise);
|
int authentication(Enterprise enterprise);
|
||||||
|
|
||||||
Enterprise getEnterpriseById(@Param("id") Long id);
|
Enterprise getEnterpriseById(@Param("id") Long id);
|
||||||
|
|
||||||
|
Enterprise queryDateEnterprise();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.muyu.goods.service;
|
package com.muyu.goods.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.goods.domain.Enterprise;
|
import com.muyu.goods.domain.Enterprise;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,4 +70,8 @@ public interface IEnterpriseService
|
||||||
|
|
||||||
|
|
||||||
Enterprise getEnterpriseById(Long id);
|
Enterprise getEnterpriseById(Long id);
|
||||||
|
|
||||||
|
List<SysUser> sysUsers();
|
||||||
|
|
||||||
|
List<Enterprise> lists();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.goods.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.utils.DateUtils;
|
import com.muyu.common.core.utils.DateUtils;
|
||||||
|
@ -54,7 +55,8 @@ public class EnterpriseServiceImpl implements IEnterpriseService
|
||||||
@Override
|
@Override
|
||||||
public List<Enterprise> selectEnterpriseList(Enterprise enterprise)
|
public List<Enterprise> selectEnterpriseList(Enterprise enterprise)
|
||||||
{
|
{
|
||||||
return enterpriseMapper.selectEnterpriseList(enterprise);
|
List<Enterprise> enterprises = enterpriseMapper.selectEnterpriseList(enterprise);
|
||||||
|
return enterprises;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,7 +73,12 @@ public class EnterpriseServiceImpl implements IEnterpriseService
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
enterprise.setCreateBy(loginUser.getUsername());
|
enterprise.setCreateBy(loginUser.getUsername());
|
||||||
enterprise.setBusinessLincenseNumber(UUID.randomUUID().toString());
|
enterprise.setBusinessLincenseNumber(UUID.randomUUID().toString());
|
||||||
return enterpriseMapper.insertEnterprise(enterprise);
|
int i = enterpriseMapper.insertEnterprise(enterprise);
|
||||||
|
if (i>0){
|
||||||
|
Enterprise enterprise1 = enterpriseMapper.queryDateEnterprise();
|
||||||
|
enterpriseConfig.index(enterprise1);
|
||||||
|
}
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -99,8 +106,7 @@ public class EnterpriseServiceImpl implements IEnterpriseService
|
||||||
Enterprise enterprise = new Enterprise();
|
Enterprise enterprise = new Enterprise();
|
||||||
enterprise.setId(id);
|
enterprise.setId(id);
|
||||||
enterprise.setAuthenticationDate(DateUtils.getNowDate());
|
enterprise.setAuthenticationDate(DateUtils.getNowDate());
|
||||||
Enterprise enterprise1 = getEnterpriseById(id);
|
|
||||||
enterpriseConfig.index(enterprise1);
|
|
||||||
return enterpriseMapper.authentication(enterprise);
|
return enterpriseMapper.authentication(enterprise);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,8 +134,31 @@ public class EnterpriseServiceImpl implements IEnterpriseService
|
||||||
return enterpriseMapper.deleteEnterpriseById(id);
|
return enterpriseMapper.deleteEnterpriseById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取企业详情
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Enterprise getEnterpriseById(Long id) {
|
public Enterprise getEnterpriseById(Long id) {
|
||||||
return enterpriseMapper.getEnterpriseById(id);
|
return enterpriseMapper.getEnterpriseById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取和企业绑定的用户
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysUser> sysUsers() {
|
||||||
|
return enterpriseConfig.sysUsers();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取全部企业详情
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Enterprise> lists() {
|
||||||
|
return selectEnterpriseList(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
from enterprise
|
from enterprise
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="queryDateEnterprise" resultType="com.muyu.goods.domain.Enterprise">
|
||||||
|
<include refid="selectEnterpriseVo"/>
|
||||||
|
ORDER BY id DESC LIMIT 1;
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertEnterprise" parameterType="com.muyu.goods.domain.Enterprise" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertEnterprise" parameterType="com.muyu.goods.domain.Enterprise" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into enterprise
|
insert into enterprise
|
||||||
|
@ -65,7 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="remark != null">remark,</if>
|
<if test="remark != null">remark,</if>
|
||||||
<if test="createBy != null">create_by,</if>
|
<if test="createBy != null">create_by,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
<if test="authentication != null">authentication,</if>
|
authentication,
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="enterpriseName != null">#{enterpriseName},</if>
|
<if test="enterpriseName != null">#{enterpriseName},</if>
|
||||||
|
@ -83,7 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
<if test="updateTime != null">#{updateTime},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
<if test="authentication != null">0,</if>
|
0,
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|
|
@ -117,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_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time, u.firm
|
||||||
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
|
||||||
|
@ -134,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.nick_name, u.email, u.phonenumber, u.status, u.create_time, u.firm
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue