Compare commits
No commits in common. "dev" and "master" have entirely different histories.
|
@ -34,8 +34,7 @@ public class TokenController {
|
||||||
@PostMapping("login")
|
@PostMapping("login")
|
||||||
public Result<?> login (@RequestBody LoginBody form) {
|
public Result<?> login (@RequestBody LoginBody form) {
|
||||||
// 用户登录
|
// 用户登录
|
||||||
// LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword());
|
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword());
|
||||||
LoginUser userInfo = sysLoginService.login(form.getEmail(), form.getPassword());
|
|
||||||
// 获取登录token
|
// 获取登录token
|
||||||
return Result.success(tokenService.createToken(userInfo));
|
return Result.success(tokenService.createToken(userInfo));
|
||||||
}
|
}
|
||||||
|
@ -67,7 +66,7 @@ public class TokenController {
|
||||||
@PostMapping("register")
|
@PostMapping("register")
|
||||||
public Result<?> register (@RequestBody RegisterBody registerBody) {
|
public Result<?> register (@RequestBody RegisterBody registerBody) {
|
||||||
// 用户注册
|
// 用户注册
|
||||||
sysLoginService.register(registerBody.getEmail(), registerBody.getPassword());
|
sysLoginService.register(registerBody.getUsername(), registerBody.getPassword());
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,51 +1,34 @@
|
||||||
package com.muyu.auth.form;
|
package com.muyu.auth.form;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户登录对象
|
* 用户登录对象
|
||||||
*
|
*
|
||||||
* @author muyu
|
* @author muyu
|
||||||
*/
|
*/
|
||||||
@Data
|
|
||||||
public class LoginBody {
|
public class LoginBody {
|
||||||
/**
|
/**
|
||||||
* 用户名
|
* 用户名
|
||||||
*/
|
*/
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 邮箱
|
|
||||||
*/
|
|
||||||
private String email;
|
|
||||||
|
|
||||||
// public LoginBody() {
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public LoginBody(String email) {
|
|
||||||
// this.email = email;
|
|
||||||
// }
|
|
||||||
// -----------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户密码
|
* 用户密码
|
||||||
*/
|
*/
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
// public String getUsername () {
|
public String getUsername () {
|
||||||
// return username;
|
return username;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// public void setUsername (String username) {
|
public void setUsername (String username) {
|
||||||
// this.username = username;
|
this.username = username;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// public String getPassword () {
|
public String getPassword () {
|
||||||
// return password;
|
return password;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// public void setPassword (String password) {
|
public void setPassword (String password) {
|
||||||
// this.password = password;
|
this.password = password;
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,43 +40,36 @@ public class SysLoginService {
|
||||||
/**
|
/**
|
||||||
* 登录
|
* 登录
|
||||||
*/
|
*/
|
||||||
public LoginUser login (String email, String password) {
|
public LoginUser login (String username, String password) {
|
||||||
// public LoginUser login (String username, String password) {
|
|
||||||
// 用户名或密码为空 错误
|
// 用户名或密码为空 错误
|
||||||
// if (StringUtils.isAnyBlank(username, password)) {
|
if (StringUtils.isAnyBlank(username, password)) {
|
||||||
if (StringUtils.isAnyBlank(email, password)) {
|
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户/密码必须填写");
|
||||||
// recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户/密码必须填写");
|
throw new ServiceException("用户/密码必须填写");
|
||||||
recordLogService.recordLogininfor(email, Constants.LOGIN_FAIL, "用户/密码必须填写");
|
|
||||||
throw new ServiceException("用户/邮箱 密码必须填写");
|
|
||||||
}
|
}
|
||||||
// 密码如果不在指定范围内 错误
|
// 密码如果不在指定范围内 错误
|
||||||
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|
||||||
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH) {
|
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH) {
|
||||||
// recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户密码不在指定范围");
|
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户密码不在指定范围");
|
||||||
recordLogService.recordLogininfor(email, Constants.LOGIN_FAIL, "用户密码不在指定范围");
|
|
||||||
throw new ServiceException("用户密码不在指定范围");
|
throw new ServiceException("用户密码不在指定范围");
|
||||||
}
|
}
|
||||||
// 用户名不在指定范围内 错误
|
// 用户名不在指定范围内 错误
|
||||||
if (email.length() < UserConstants.USERNAME_MIN_LENGTH
|
if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|
||||||
|| email.length() > UserConstants.USERNAME_MAX_LENGTH) {
|
|| username.length() > UserConstants.USERNAME_MAX_LENGTH) {
|
||||||
recordLogService.recordLogininfor(email, Constants.LOGIN_FAIL, "用户名不在指定范围");
|
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户名不在指定范围");
|
||||||
throw new ServiceException("用户名不在指定范围");
|
throw new ServiceException("用户名不在指定范围");
|
||||||
}
|
}
|
||||||
// IP黑名单校验
|
// IP黑名单校验
|
||||||
String blackStr = Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST));
|
String blackStr = Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST));
|
||||||
if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) {
|
if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) {
|
||||||
recordLogService.recordLogininfor(email, Constants.LOGIN_FAIL, "很遗憾,访问IP已被列入系统黑名单");
|
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "很遗憾,访问IP已被列入系统黑名单");
|
||||||
throw new ServiceException("很遗憾,访问IP已被列入系统黑名单");
|
throw new ServiceException("很遗憾,访问IP已被列入系统黑名单");
|
||||||
}
|
}
|
||||||
// 查询用户信息
|
// 查询用户信息
|
||||||
// Result<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
|
Result<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
|
||||||
Result<LoginUser> userResult = remoteUserService.getUserInfo(email, SecurityConstants.INNER);
|
|
||||||
|
|
||||||
if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) {
|
if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) {
|
||||||
// recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
|
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
|
||||||
recordLogService.recordLogininfor(email, Constants.LOGIN_FAIL, "登录用户不存在");
|
throw new ServiceException("登录用户:" + username + " 不存在");
|
||||||
// throw new ServiceException("登录用户:" + username + " 不存在");
|
|
||||||
throw new ServiceException("登录用户:" + email + " 不存在");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Result.FAIL == userResult.getCode()) {
|
if (Result.FAIL == userResult.getCode()) {
|
||||||
|
@ -86,19 +79,15 @@ public class SysLoginService {
|
||||||
LoginUser userInfo = userResult.getData();
|
LoginUser userInfo = userResult.getData();
|
||||||
SysUser user = userResult.getData().getSysUser();
|
SysUser user = userResult.getData().getSysUser();
|
||||||
if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
|
if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
|
||||||
// recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
|
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
|
||||||
recordLogService.recordLogininfor(email, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
|
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
|
||||||
// throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
|
|
||||||
throw new ServiceException("对不起,您的账号:" + email + " 已被删除");
|
|
||||||
}
|
}
|
||||||
if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
|
if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
|
||||||
// recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
|
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
|
||||||
recordLogService.recordLogininfor(email, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
|
throw new ServiceException("对不起,您的账号:" + username + " 已停用");
|
||||||
throw new ServiceException("对不起,您的账号:" + email + " 已停用");
|
|
||||||
}
|
}
|
||||||
passwordService.validate(user, password);
|
passwordService.validate(user, password);
|
||||||
// recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
|
recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
|
||||||
recordLogService.recordLogininfor(email, Constants.LOGIN_SUCCESS, "登录成功");
|
|
||||||
return userInfo;
|
return userInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,15 +98,13 @@ public class SysLoginService {
|
||||||
/**
|
/**
|
||||||
* 注册
|
* 注册
|
||||||
*/
|
*/
|
||||||
// public void register (String username, String password) {
|
public void register (String username, String password) {
|
||||||
public void register (String email, String password) {
|
|
||||||
// 用户名或密码为空 错误
|
// 用户名或密码为空 错误
|
||||||
// if (StringUtils.isAnyBlank(username, password)) {
|
if (StringUtils.isAnyBlank(username, password)) {
|
||||||
if (StringUtils.isAnyBlank(email, password)) {
|
|
||||||
throw new ServiceException("用户/密码必须填写");
|
throw new ServiceException("用户/密码必须填写");
|
||||||
}
|
}
|
||||||
if (email.length() < UserConstants.USERNAME_MIN_LENGTH
|
if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|
||||||
|| email.length() > UserConstants.USERNAME_MAX_LENGTH) {
|
|| username.length() > UserConstants.USERNAME_MAX_LENGTH) {
|
||||||
throw new ServiceException("账户长度必须在2到20个字符之间");
|
throw new ServiceException("账户长度必须在2到20个字符之间");
|
||||||
}
|
}
|
||||||
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|
||||||
|
@ -127,15 +114,14 @@ public class SysLoginService {
|
||||||
|
|
||||||
// 注册用户信息
|
// 注册用户信息
|
||||||
SysUser sysUser = new SysUser();
|
SysUser sysUser = new SysUser();
|
||||||
sysUser.setUserName(email);
|
sysUser.setUserName(username);
|
||||||
sysUser.setNickName(email);
|
sysUser.setNickName(username);
|
||||||
sysUser.setPassword(SecurityUtils.encryptPassword(password));
|
sysUser.setPassword(SecurityUtils.encryptPassword(password));
|
||||||
Result<?> registerResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER);
|
Result<?> registerResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER);
|
||||||
|
|
||||||
if (Result.FAIL == registerResult.getCode()) {
|
if (Result.FAIL == registerResult.getCode()) {
|
||||||
throw new ServiceException(registerResult.getMsg());
|
throw new ServiceException(registerResult.getMsg());
|
||||||
}
|
}
|
||||||
// recordLogService.recordLogininfor(username, Constants.REGISTER, "注册成功");
|
recordLogService.recordLogininfor(username, Constants.REGISTER, "注册成功");
|
||||||
recordLogService.recordLogininfor(email, Constants.REGISTER, "注册成功");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,11 +28,9 @@ public class SysRecordLogService {
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
// public void recordLogininfor (String username, String status, String message) {
|
public void recordLogininfor (String username, String status, String message) {
|
||||||
public void recordLogininfor (String email, String status, String message) {
|
|
||||||
SysLogininfor logininfor = new SysLogininfor();
|
SysLogininfor logininfor = new SysLogininfor();
|
||||||
// logininfor.setUserName(username);
|
logininfor.setUserName(username);
|
||||||
logininfor.setUserName(email);
|
|
||||||
logininfor.setIpaddr(IpUtils.getIpAddr());
|
logininfor.setIpaddr(IpUtils.getIpAddr());
|
||||||
logininfor.setMsg(message);
|
logininfor.setMsg(message);
|
||||||
// 日志状态
|
// 日志状态
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
package com.muyu.common.system.domain;
|
package com.muyu.common.system.domain;
|
||||||
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -14,10 +9,6 @@ import java.util.Set;
|
||||||
*
|
*
|
||||||
* @author muyu
|
* @author muyu
|
||||||
*/
|
*/
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Builder
|
|
||||||
public class LoginUser implements Serializable {
|
public class LoginUser implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ -35,12 +26,6 @@ public class LoginUser implements Serializable {
|
||||||
* 用户名
|
* 用户名
|
||||||
*/
|
*/
|
||||||
private String username;
|
private String username;
|
||||||
//----------------------
|
|
||||||
/**
|
|
||||||
* 邮箱
|
|
||||||
*/
|
|
||||||
private String email;
|
|
||||||
// ------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录时间
|
* 登录时间
|
||||||
|
|
|
@ -37,8 +37,6 @@ public class SysLogininfor extends BaseEntity {
|
||||||
@Excel(name = "用户账号")
|
@Excel(name = "用户账号")
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态 0成功 1失败
|
* 状态 0成功 1失败
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -16,19 +16,16 @@ import org.springframework.web.bind.annotation.*;
|
||||||
*/
|
*/
|
||||||
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
|
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
|
||||||
public interface RemoteUserService {
|
public interface RemoteUserService {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过用户名查询用户信息
|
* 通过用户名查询用户信息
|
||||||
*
|
*
|
||||||
* @param email 用户名
|
* @param username 用户名
|
||||||
* @param source 请求来源
|
* @param source 请求来源
|
||||||
*
|
*
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
// @GetMapping("/user/info/{username}")
|
@GetMapping("/user/info/{username}")
|
||||||
@GetMapping("/user/info/{email}")
|
public Result<LoginUser> getUserInfo (@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
public Result<LoginUser> getUserInfo (@PathVariable("email") String email, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册用户信息
|
* 注册用户信息
|
||||||
|
|
|
@ -23,8 +23,7 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
||||||
log.error("用户服务调用失败:{}", throwable.getMessage());
|
log.error("用户服务调用失败:{}", throwable.getMessage());
|
||||||
return new RemoteUserService() {
|
return new RemoteUserService() {
|
||||||
@Override
|
@Override
|
||||||
// public Result<LoginUser> getUserInfo (String username, String source) {
|
public Result<LoginUser> getUserInfo (String username, String source) {
|
||||||
public Result<LoginUser> getUserInfo (String email, String source) {
|
|
||||||
return Result.error("获取用户失败:" + throwable.getMessage());
|
return Result.error("获取用户失败:" + throwable.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
port: 9206
|
port: 9203
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
|
@ -1,114 +0,0 @@
|
||||||
package com.muyu.system.controller;
|
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
|
||||||
import com.muyu.common.log.annotation.Log;
|
|
||||||
import com.muyu.common.log.enums.BusinessType;
|
|
||||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
|
||||||
import com.muyu.system.domain.AsUserDept;
|
|
||||||
import com.muyu.system.domain.resp.AsUserDeptNumResponse;
|
|
||||||
import com.muyu.system.service.AsUserDeptService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*@Author:ShenJiaFeng
|
|
||||||
*@Package:com.muyu.system.controller
|
|
||||||
*@Project:zg6_cloud
|
|
||||||
*@name:AsUserController
|
|
||||||
*@Date:2024/4/14 10:14
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/userDept")
|
|
||||||
public class AsUserDeptController extends BaseController
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private AsUserDeptService asUserDeptService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询【请填写功能名称】列表
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("system:dept:list")
|
|
||||||
@GetMapping("/list")
|
|
||||||
public Result<TableDataInfo<AsUserDept>> list(AsUserDept asUserDept)
|
|
||||||
{
|
|
||||||
startPage();
|
|
||||||
List<AsUserDept> list = asUserDeptService.selectAsUserDeptList(asUserDept);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/UpdateAsUserDept")
|
|
||||||
public Result list(@RequestParam("id") Long id)
|
|
||||||
{
|
|
||||||
return asUserDeptService.updateAsUserDeptRead(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/GetNum")
|
|
||||||
public Result<AsUserDeptNumResponse> getNum(@RequestParam("noticeId") Long noticeId)
|
|
||||||
{
|
|
||||||
return asUserDeptService.getNum(noticeId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出【请填写功能名称】列表
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("system:dept:export")
|
|
||||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
|
|
||||||
@PostMapping("/export")
|
|
||||||
public void export(HttpServletResponse response, AsUserDept asUserDept)
|
|
||||||
{
|
|
||||||
List<AsUserDept> list = asUserDeptService.selectAsUserDeptList(asUserDept);
|
|
||||||
ExcelUtil<AsUserDept> util = new ExcelUtil<AsUserDept>(AsUserDept.class);
|
|
||||||
util.exportExcel(response, list, "【请填写功能名称】数据");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取【请填写功能名称】详细信息
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("system:dept:query")
|
|
||||||
@GetMapping(value = "/{id}")
|
|
||||||
public Result getInfo(@PathVariable("id") Long id)
|
|
||||||
{
|
|
||||||
return success(asUserDeptService.selectAsUserDeptById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增【请填写功能名称】
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("system:dept:add")
|
|
||||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping
|
|
||||||
public Result add(@RequestBody AsUserDept asUserDept)
|
|
||||||
{
|
|
||||||
return toAjax(asUserDeptService.insertAsUserDept(asUserDept));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改【请填写功能名称】
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("system:dept:edit")
|
|
||||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
|
|
||||||
@PutMapping
|
|
||||||
public Result edit(@RequestBody AsUserDept asUserDept)
|
|
||||||
{
|
|
||||||
return toAjax(asUserDeptService.updateAsUserDept(asUserDept));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除【请填写功能名称】
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("system:dept:remove")
|
|
||||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
|
|
||||||
@DeleteMapping("/{ids}")
|
|
||||||
public Result remove(@PathVariable Long[] ids)
|
|
||||||
{
|
|
||||||
return toAjax(asUserDeptService.deleteAsUserDeptByIds(ids));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -8,8 +8,6 @@ import com.muyu.common.log.enums.BusinessType;
|
||||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.system.domain.SysNotice;
|
import com.muyu.system.domain.SysNotice;
|
||||||
import com.muyu.system.domain.req.SysNoticeRequest;
|
|
||||||
import com.muyu.system.domain.resp.SysNoticeResponse;
|
|
||||||
import com.muyu.system.service.SysNoticeService;
|
import com.muyu.system.service.SysNoticeService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
@ -39,15 +37,6 @@ public class SysNoticeController extends BaseController {
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* ---
|
|
||||||
* @param sysNoticeRequest
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/GetNoticeList")
|
|
||||||
public Result<List<SysNoticeResponse>> getNoticeList (@RequestBody SysNoticeRequest sysNoticeRequest){
|
|
||||||
return noticeService.getNoticeList(sysNoticeRequest);
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* 根据通知公告编号获取详细信息
|
* 根据通知公告编号获取详细信息
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -9,10 +9,10 @@ import com.muyu.common.log.annotation.Log;
|
||||||
import com.muyu.common.log.enums.BusinessType;
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
import com.muyu.common.security.service.TokenService;
|
import com.muyu.common.security.service.TokenService;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.remote.RemoteFileService;
|
||||||
import com.muyu.common.system.domain.SysFile;
|
import com.muyu.common.system.domain.SysFile;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.common.system.remote.RemoteFileService;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
import com.muyu.system.domain.resp.ProfileResp;
|
import com.muyu.system.domain.resp.ProfileResp;
|
||||||
import com.muyu.system.service.SysUserService;
|
import com.muyu.system.service.SysUserService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -44,8 +44,7 @@ public class SysProfileController extends BaseController {
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public Result profile () {
|
public Result profile () {
|
||||||
String username = SecurityUtils.getUsername();
|
String username = SecurityUtils.getUsername();
|
||||||
// SysUser user = userService.selectUserByUserName(username);
|
SysUser user = userService.selectUserByUserName(username);
|
||||||
SysUser user = userService.selectUserByUserEmail(username);
|
|
||||||
return Result.success(
|
return Result.success(
|
||||||
ProfileResp.builder()
|
ProfileResp.builder()
|
||||||
.roleGroup( userService.selectUserRoleGroup(username) )
|
.roleGroup( userService.selectUserRoleGroup(username) )
|
||||||
|
@ -88,8 +87,7 @@ public class SysProfileController extends BaseController {
|
||||||
@PutMapping("/updatePwd")
|
@PutMapping("/updatePwd")
|
||||||
public Result updatePwd (String oldPassword, String newPassword) {
|
public Result updatePwd (String oldPassword, String newPassword) {
|
||||||
String username = SecurityUtils.getUsername();
|
String username = SecurityUtils.getUsername();
|
||||||
// SysUser user = userService.selectUserByUserName(username);
|
SysUser user = userService.selectUserByUserName(username);
|
||||||
SysUser user = userService.selectUserByUserEmail(username);
|
|
||||||
String password = user.getPassword();
|
String password = user.getPassword();
|
||||||
if (!SecurityUtils.matchesPassword(oldPassword, password)) {
|
if (!SecurityUtils.matchesPassword(oldPassword, password)) {
|
||||||
return error("修改密码失败,旧密码错误");
|
return error("修改密码失败,旧密码错误");
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.muyu.system.controller;
|
package com.muyu.system.controller;
|
||||||
|
|
||||||
import com.muyu.common.core.constant.CacheConstants;
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
@ -8,7 +7,6 @@ import com.muyu.common.core.web.controller.BaseController;
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
import com.muyu.common.log.annotation.Log;
|
import com.muyu.common.log.annotation.Log;
|
||||||
import com.muyu.common.log.enums.BusinessType;
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
import com.muyu.common.redis.service.RedisService;
|
|
||||||
import com.muyu.common.security.annotation.InnerAuth;
|
import com.muyu.common.security.annotation.InnerAuth;
|
||||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
@ -99,12 +97,9 @@ public class SysUserController extends BaseController {
|
||||||
* 获取当前用户信息
|
* 获取当前用户信息
|
||||||
*/
|
*/
|
||||||
@InnerAuth
|
@InnerAuth
|
||||||
// @GetMapping("/info/{username}")
|
@GetMapping("/info/{username}")
|
||||||
@GetMapping("/info/{email}")
|
public Result<LoginUser> info (@PathVariable("username") String username) {
|
||||||
// public Result<LoginUser> info (@PathVariable("username") String username) {
|
SysUser sysUser = userService.selectUserByUserName(username);
|
||||||
public Result<LoginUser> info (@PathVariable("email") String email) {
|
|
||||||
// SysUser sysUser = userService.selectUserByUserName(username);
|
|
||||||
SysUser sysUser = userService.selectUserByUserEmail(email);
|
|
||||||
if (StringUtils.isNull(sysUser)) {
|
if (StringUtils.isNull(sysUser)) {
|
||||||
return Result.error("用户名或密码错误");
|
return Result.error("用户名或密码错误");
|
||||||
}
|
}
|
||||||
|
@ -125,14 +120,12 @@ public class SysUserController extends BaseController {
|
||||||
@InnerAuth
|
@InnerAuth
|
||||||
@PostMapping("/register")
|
@PostMapping("/register")
|
||||||
public Result<Boolean> register (@RequestBody SysUser sysUser) {
|
public Result<Boolean> register (@RequestBody SysUser sysUser) {
|
||||||
// String username = sysUser.getUserName();
|
String username = sysUser.getUserName();
|
||||||
String email = sysUser.getUserName();
|
|
||||||
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) {
|
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) {
|
||||||
return Result.error("当前系统没有开启注册功能!");
|
return Result.error("当前系统没有开启注册功能!");
|
||||||
}
|
}
|
||||||
if (!userService.checkUserNameUnique(sysUser)) {
|
if (!userService.checkUserNameUnique(sysUser)) {
|
||||||
// return Result.error("保存用户'" + username + "'失败,注册账号已存在");
|
return Result.error("保存用户'" + username + "'失败,注册账号已存在");
|
||||||
return Result.error("保存用户'" + email + "'失败,注册账号已存在");
|
|
||||||
}
|
}
|
||||||
return Result.success(userService.registerUser(sysUser));
|
return Result.success(userService.registerUser(sysUser));
|
||||||
}
|
}
|
||||||
|
@ -245,13 +238,9 @@ public class SysUserController extends BaseController {
|
||||||
userService.checkUserDataScope(user.getUserId());
|
userService.checkUserDataScope(user.getUserId());
|
||||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||||
user.setUpdateBy(SecurityUtils.getUsername());
|
user.setUpdateBy(SecurityUtils.getUsername());
|
||||||
|
|
||||||
// redisService.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + user.getUserId());
|
|
||||||
|
|
||||||
return toAjax(userService.resetPwd(user));
|
return toAjax(userService.resetPwd(user));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态修改
|
* 状态修改
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
package com.muyu.system.domain;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ShenJiaFeng
|
|
||||||
* @Package:com.muyu.system.domain
|
|
||||||
* @Project:zg6_cloud
|
|
||||||
* @name:AsUserD俄pt
|
|
||||||
* @Date:2024/4/14 9:53
|
|
||||||
*/
|
|
||||||
|
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户部门中间表
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
public class AsUserDept extends BaseEntity {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* id
|
|
||||||
*/
|
|
||||||
private Long id;
|
|
||||||
/**
|
|
||||||
* 用户id
|
|
||||||
*/
|
|
||||||
private Long userId;
|
|
||||||
/**
|
|
||||||
* 公告id
|
|
||||||
*/
|
|
||||||
private Long noticeId;
|
|
||||||
/**
|
|
||||||
* 是否已读
|
|
||||||
*/
|
|
||||||
private String isRead;
|
|
||||||
}
|
|
|
@ -12,7 +12,6 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知公告表 sys_notice
|
* 通知公告表 sys_notice
|
||||||
|
@ -52,18 +51,6 @@ public class SysNotice extends BaseEntity {
|
||||||
*/
|
*/
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/**
|
|
||||||
* 部门id集合--
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private List<List<Long>> sectionList;
|
|
||||||
|
|
||||||
/**--
|
|
||||||
* 用户id集合
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private List<Long> persomelList;
|
|
||||||
|
|
||||||
public Long getNoticeId () {
|
public Long getNoticeId () {
|
||||||
return noticeId;
|
return noticeId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
package com.muyu.system.domain.req;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ShenJiaFeng
|
|
||||||
* @Package:com.muyu.system.domain.req
|
|
||||||
* @Project:zg6_cloud
|
|
||||||
* @name:SysNoticeRequest
|
|
||||||
* @Date:2024/4/14 9:59
|
|
||||||
*/
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SysNoticeRequest
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class SysNoticeRequest {
|
|
||||||
private Long noticeId;
|
|
||||||
private Long userId;
|
|
||||||
private String noticeType;
|
|
||||||
private String isRead;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package com.muyu.system.domain.resp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ShenJiaFeng
|
|
||||||
* @Package:com.muyu.system.domain.resp
|
|
||||||
* @Project:zg6_cloud
|
|
||||||
* @name:AsUserDeptNumResponse
|
|
||||||
* @Date:2024/4/14 10:02
|
|
||||||
*/
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.experimental.SuperBuilder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 部门中间响应
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@SuperBuilder
|
|
||||||
public class AsUserDeptNumResponse {
|
|
||||||
private Long num;
|
|
||||||
private Long redNum;
|
|
||||||
private Long noReadNum;
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
package com.muyu.system.domain.resp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ShenJiaFeng
|
|
||||||
* @Package:com.muyu.system.domain.resp
|
|
||||||
* @Project:zg6_cloud
|
|
||||||
* @name:SysNoticeResponse
|
|
||||||
* @Date:2024/4/14 10:03
|
|
||||||
*/
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.experimental.SuperBuilder;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SysNoticeResponse
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@SuperBuilder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class SysNoticeResponse {
|
|
||||||
private Date createTime;
|
|
||||||
private String createBy;
|
|
||||||
private String noticeType;
|
|
||||||
private String isRead;
|
|
||||||
private String noticeTitle;
|
|
||||||
private String noticeContent;
|
|
||||||
private Long noticeId;
|
|
||||||
private Long id;
|
|
||||||
}
|
|
|
@ -1,68 +0,0 @@
|
||||||
package com.muyu.system.mapper;
|
|
||||||
|
|
||||||
import com.muyu.system.domain.AsUserDept;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ShenJiaFeng
|
|
||||||
* @Package:com.muyu.system.mapper
|
|
||||||
* @Project:zg6_cloud
|
|
||||||
* @name:AsUserDeptMapper
|
|
||||||
* @Date:2024/4/14 10:08
|
|
||||||
*/
|
|
||||||
public interface AsUserDeptMapper {
|
|
||||||
/**
|
|
||||||
* 查询【请填写功能名称】
|
|
||||||
*
|
|
||||||
* @param id 【请填写功能名称】主键
|
|
||||||
* @return 【请填写功能名称】
|
|
||||||
*/
|
|
||||||
public AsUserDept selectAsUserDeptById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询【请填写功能名称】列表
|
|
||||||
*
|
|
||||||
* @param asUserDept 【请填写功能名称】
|
|
||||||
* @return 【请填写功能名称】集合
|
|
||||||
*/
|
|
||||||
public List<AsUserDept> selectAsUserDeptList(AsUserDept asUserDept);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增【请填写功能名称】
|
|
||||||
*
|
|
||||||
* @param asUserDept 【请填写功能名称】
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertAsUserDept(AsUserDept asUserDept);
|
|
||||||
public int insertBachAsUserDept(@Param("asUserDepts") List<AsUserDept> asUserDepts);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改【请填写功能名称】
|
|
||||||
*
|
|
||||||
* @param asUserDept 【请填写功能名称】
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateAsUserDept(AsUserDept asUserDept);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除【请填写功能名称】
|
|
||||||
*
|
|
||||||
* @param id 【请填写功能名称】主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteAsUserDeptById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除【请填写功能名称】
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的数据主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteAsUserDeptByIds(Long[] ids);
|
|
||||||
|
|
||||||
void updateAsUserDeptRead(@Param("id") Long id);
|
|
||||||
Long selectAsUserDeptNum(@Param("noticeId") Long noticeId);
|
|
||||||
Long selectAsUserDeptReadNum(@Param("noticeId") Long noticeId);
|
|
||||||
}
|
|
|
@ -21,19 +21,6 @@ public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
||||||
*/
|
*/
|
||||||
public List<SysMenu> selectMenuList (SysMenu menu);
|
public List<SysMenu> selectMenuList (SysMenu menu);
|
||||||
|
|
||||||
/**
|
|
||||||
* 搜索系统
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public List<SysMenu> selectSysMenList(@Param("longs") List<Long> longs);
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param longs
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public List<SysMenu> selectSysChdMenuList(@Param("longs") List<Long> longs);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户所有权限
|
* 根据用户所有权限
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,8 +2,6 @@ package com.muyu.system.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.muyu.system.domain.SysNotice;
|
import com.muyu.system.domain.SysNotice;
|
||||||
import com.muyu.system.domain.req.SysNoticeRequest;
|
|
||||||
import com.muyu.system.domain.resp.SysNoticeResponse;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -66,13 +64,4 @@ public interface SysNoticeMapper extends BaseMapper<SysNotice> {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteNoticeByIds (Long[] noticeIds);
|
public int deleteNoticeByIds (Long[] noticeIds);
|
||||||
|
|
||||||
/**
|
|
||||||
* --
|
|
||||||
* @param sysNoticeRequest
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<SysNoticeResponse> getNoticeList(SysNoticeRequest sysNoticeRequest);
|
|
||||||
|
|
||||||
List<Long> selectUser();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||||
*
|
*
|
||||||
* @return 用户对象信息
|
* @return 用户对象信息
|
||||||
*/
|
*/
|
||||||
// public SysUser selectUserByUserName (String userName);
|
public SysUser selectUserByUserName (String userName);
|
||||||
public SysUser selectUserByUserEmail (String email);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过用户ID查询用户
|
* 通过用户ID查询用户
|
||||||
|
@ -140,6 +139,4 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public SysUser checkEmailUnique (String email);
|
public SysUser checkEmailUnique (String email);
|
||||||
|
|
||||||
List<Long> selectDeptUser(@Param("sectionIds") List<Long> sectionIds);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,72 +0,0 @@
|
||||||
package com.muyu.system.service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ShenJiaFeng
|
|
||||||
* @Package:com.muyu.system.service
|
|
||||||
* @Project:zg6_cloud
|
|
||||||
* @name:AsUserDeptService
|
|
||||||
* @Date:2024/4/14 10:12
|
|
||||||
*/
|
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.system.domain.AsUserDept;
|
|
||||||
import com.muyu.system.domain.resp.AsUserDeptNumResponse;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 中间service
|
|
||||||
*/
|
|
||||||
public interface AsUserDeptService {
|
|
||||||
/**
|
|
||||||
* 查询【请填写功能名称】
|
|
||||||
*
|
|
||||||
* @param id 【请填写功能名称】主键
|
|
||||||
* @return 【请填写功能名称】
|
|
||||||
*/
|
|
||||||
public AsUserDept selectAsUserDeptById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询【请填写功能名称】列表
|
|
||||||
*
|
|
||||||
* @param asUserDept 【请填写功能名称】
|
|
||||||
* @return 【请填写功能名称】集合
|
|
||||||
*/
|
|
||||||
public List<AsUserDept> selectAsUserDeptList(AsUserDept asUserDept);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增【请填写功能名称】
|
|
||||||
*
|
|
||||||
* @param asUserDept 【请填写功能名称】
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertAsUserDept(AsUserDept asUserDept);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改【请填写功能名称】
|
|
||||||
*
|
|
||||||
* @param asUserDept 【请填写功能名称】
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateAsUserDept(AsUserDept asUserDept);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除【请填写功能名称】
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的【请填写功能名称】主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteAsUserDeptByIds(Long[] ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除【请填写功能名称】信息
|
|
||||||
*
|
|
||||||
* @param id 【请填写功能名称】主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteAsUserDeptById(Long id);
|
|
||||||
|
|
||||||
Result updateAsUserDeptRead(Long id);
|
|
||||||
|
|
||||||
Result<AsUserDeptNumResponse> getNum(Long noticeId);
|
|
||||||
}
|
|
|
@ -1,10 +1,7 @@
|
||||||
package com.muyu.system.service;
|
package com.muyu.system.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.system.domain.SysNotice;
|
import com.muyu.system.domain.SysNotice;
|
||||||
import com.muyu.system.domain.req.SysNoticeRequest;
|
|
||||||
import com.muyu.system.domain.resp.SysNoticeResponse;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -67,9 +64,4 @@ public interface SysNoticeService extends IService<SysNotice> {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteNoticeByIds (Long[] noticeIds);
|
public int deleteNoticeByIds (Long[] noticeIds);
|
||||||
|
|
||||||
|
|
||||||
Result<List<SysNoticeResponse> > getNoticeList(SysNoticeRequest sysNoticeRequest);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,12 +41,11 @@ public interface SysUserService extends IService<SysUser> {
|
||||||
/**
|
/**
|
||||||
* 通过用户名查询用户
|
* 通过用户名查询用户
|
||||||
*
|
*
|
||||||
* @param email 用户名
|
* @param userName 用户名
|
||||||
*
|
*
|
||||||
* @return 用户对象信息
|
* @return 用户对象信息
|
||||||
*/
|
*/
|
||||||
// public SysUser selectUserByUserName (String userName);
|
public SysUser selectUserByUserName (String userName);
|
||||||
public SysUser selectUserByUserEmail (String email);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过用户ID查询用户
|
* 通过用户ID查询用户
|
||||||
|
|
|
@ -1,119 +0,0 @@
|
||||||
package com.muyu.system.service.impl;
|
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.common.core.utils.DateUtils;
|
|
||||||
import com.muyu.system.domain.AsUserDept;
|
|
||||||
import com.muyu.system.domain.resp.AsUserDeptNumResponse;
|
|
||||||
import com.muyu.system.mapper.AsUserDeptMapper;
|
|
||||||
import com.muyu.system.service.AsUserDeptService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ShenJiaFeng
|
|
||||||
* @Package:com.muyu.system.service.impl
|
|
||||||
* @Project:zg6_cloud
|
|
||||||
* @name:AsUserDeptServiceImpl
|
|
||||||
* @Date:2024/4/14 10:13
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class AsUserDeptServiceImpl implements AsUserDeptService {
|
|
||||||
@Autowired
|
|
||||||
private AsUserDeptMapper asUserDeptMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询【请填写功能名称】
|
|
||||||
*
|
|
||||||
* @param id 【请填写功能名称】主键
|
|
||||||
* @return 【请填写功能名称】
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public AsUserDept selectAsUserDeptById(Long id)
|
|
||||||
{
|
|
||||||
return asUserDeptMapper.selectAsUserDeptById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询【请填写功能名称】列表
|
|
||||||
*
|
|
||||||
* @param asUserDept 【请填写功能名称】
|
|
||||||
* @return 【请填写功能名称】
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<AsUserDept> selectAsUserDeptList(AsUserDept asUserDept)
|
|
||||||
{
|
|
||||||
return asUserDeptMapper.selectAsUserDeptList(asUserDept);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增【请填写功能名称】
|
|
||||||
*
|
|
||||||
* @param asUserDept 【请填写功能名称】
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int insertAsUserDept(AsUserDept asUserDept)
|
|
||||||
{
|
|
||||||
asUserDept.setCreateTime(DateUtils.getNowDate());
|
|
||||||
return asUserDeptMapper.insertAsUserDept(asUserDept);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改【请填写功能名称】
|
|
||||||
*
|
|
||||||
* @param asUserDept 【请填写功能名称】
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateAsUserDept(AsUserDept asUserDept)
|
|
||||||
{
|
|
||||||
asUserDept.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
return asUserDeptMapper.updateAsUserDept(asUserDept);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除【请填写功能名称】
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的【请填写功能名称】主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteAsUserDeptByIds(Long[] ids)
|
|
||||||
{
|
|
||||||
return asUserDeptMapper.deleteAsUserDeptByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除【请填写功能名称】信息
|
|
||||||
*
|
|
||||||
* @param id 【请填写功能名称】主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteAsUserDeptById(Long id)
|
|
||||||
{
|
|
||||||
return asUserDeptMapper.deleteAsUserDeptById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public Result updateAsUserDeptRead(Long id) {
|
|
||||||
asUserDeptMapper.updateAsUserDeptRead(id);
|
|
||||||
return Result.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result<AsUserDeptNumResponse> getNum(Long noticeId) {
|
|
||||||
Long num = asUserDeptMapper.selectAsUserDeptNum(noticeId);
|
|
||||||
Long readNum = asUserDeptMapper.selectAsUserDeptReadNum(noticeId);
|
|
||||||
long noReadNum = num-readNum;
|
|
||||||
return Result.success(AsUserDeptNumResponse.builder()
|
|
||||||
.num(num)
|
|
||||||
.redNum(readNum)
|
|
||||||
.noReadNum(noReadNum)
|
|
||||||
.build());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -43,6 +43,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
* 根据用户查询系统菜单列表
|
* 根据用户查询系统菜单列表
|
||||||
*
|
*
|
||||||
* @param userId 用户ID
|
* @param userId 用户ID
|
||||||
|
*
|
||||||
* @return 菜单列表
|
* @return 菜单列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -50,60 +51,11 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
return selectMenuList(new SysMenu(), userId);
|
return selectMenuList(new SysMenu(), userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 系统搜索 递归调用 向上查找每个采单对应父级
|
|
||||||
*
|
|
||||||
* @param menuList
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public List<SysMenu> selectSysMenList(List<SysMenu> menuList) {
|
|
||||||
// 获取父级ID 返回 流 id去重
|
|
||||||
List<Long> longs = menuList.stream()
|
|
||||||
.map(SysMenu::getParentId)
|
|
||||||
.filter(parentId -> parentId != 0)
|
|
||||||
.distinct()
|
|
||||||
.toList();
|
|
||||||
// 没有找到直接返回null
|
|
||||||
if (longs.size() == 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
// 递归调用自身
|
|
||||||
List<SysMenu> sysMenus = menuMapper.selectSysMenList(longs);
|
|
||||||
// 自己调自己
|
|
||||||
List<SysMenu> sysMenus1 = selectSysMenList(sysMenus);
|
|
||||||
if (sysMenus1 != null) {
|
|
||||||
sysMenus.addAll(sysMenus1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return sysMenus;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public List<SysMenu> selectSysChdMenuList(List<SysMenu> menuList) {
|
|
||||||
// stream流 获取id
|
|
||||||
List<Long> longs = menuList.stream()
|
|
||||||
.map(SysMenu::getMenuId)
|
|
||||||
.toList();
|
|
||||||
// 跟进parentId 值查询数据库终结对应的子菜单信息
|
|
||||||
List<SysMenu> sysMenus = menuMapper.selectSysChdMenuList(longs);
|
|
||||||
if (sysMenus != null && sysMenus.size() != 0) {
|
|
||||||
// 如果有 调用selectSysMenList 继续递归查询 子菜单
|
|
||||||
List<SysMenu> sysMenus1 = selectSysChdMenuList(sysMenus);
|
|
||||||
if (sysMenus1 != null) {
|
|
||||||
// 不为空 添加原始数据
|
|
||||||
sysMenus.addAll(sysMenus1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 没有查到任何条件的信息
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return sysMenus;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询系统菜单列表
|
* 查询系统菜单列表
|
||||||
*
|
*
|
||||||
* @param menu 菜单信息
|
* @param menu 菜单信息
|
||||||
|
*
|
||||||
* @return 菜单列表
|
* @return 菜单列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -112,27 +64,10 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
// 管理员显示所有菜单信息
|
// 管理员显示所有菜单信息
|
||||||
if (SysUser.isAdmin(userId)) {
|
if (SysUser.isAdmin(userId)) {
|
||||||
menuList = menuMapper.selectMenuList(menu);
|
menuList = menuMapper.selectMenuList(menu);
|
||||||
// 调用秭归
|
|
||||||
List<SysMenu> sysMenus1 = selectSysMenList(menuList);
|
|
||||||
if (sysMenus1 != null && sysMenus1.size() != 0) {
|
|
||||||
menuList.addAll(sysMenus1);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<SysMenu> sysMenus = selectSysChdMenuList(menuMapper.selectMenuList(menu));
|
|
||||||
// --------------
|
|
||||||
if (sysMenus != null && sysMenus.size() != 0) {
|
|
||||||
menuList.addAll(sysMenus);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
menu.getParams().put("userId", userId);
|
menu.getParams().put("userId", userId);
|
||||||
menuList = menuMapper.selectMenuListByUserId(menu);
|
menuList = menuMapper.selectMenuListByUserId(menu);
|
||||||
}
|
}
|
||||||
// -----
|
|
||||||
menuList = menuList.stream()
|
|
||||||
.distinct()
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
return menuList;
|
return menuList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,6 +75,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
* 根据用户ID查询权限
|
* 根据用户ID查询权限
|
||||||
*
|
*
|
||||||
* @param userId 用户ID
|
* @param userId 用户ID
|
||||||
|
*
|
||||||
* @return 权限列表
|
* @return 权限列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -158,6 +94,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
* 根据角色ID查询权限
|
* 根据角色ID查询权限
|
||||||
*
|
*
|
||||||
* @param roleId 角色ID
|
* @param roleId 角色ID
|
||||||
|
*
|
||||||
* @return 权限列表
|
* @return 权限列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -176,6 +113,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
* 根据用户ID查询菜单
|
* 根据用户ID查询菜单
|
||||||
*
|
*
|
||||||
* @param userId 用户名称
|
* @param userId 用户名称
|
||||||
|
*
|
||||||
* @return 菜单列表
|
* @return 菜单列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -193,6 +131,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
* 根据角色ID查询菜单树信息
|
* 根据角色ID查询菜单树信息
|
||||||
*
|
*
|
||||||
* @param roleId 角色ID
|
* @param roleId 角色ID
|
||||||
|
*
|
||||||
* @return 选中菜单列表
|
* @return 选中菜单列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -205,6 +144,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
* 构建前端路由所需要的菜单
|
* 构建前端路由所需要的菜单
|
||||||
*
|
*
|
||||||
* @param menus 菜单列表
|
* @param menus 菜单列表
|
||||||
|
*
|
||||||
* @return 路由列表
|
* @return 路由列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -256,6 +196,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
* 构建前端所需要树结构
|
* 构建前端所需要树结构
|
||||||
*
|
*
|
||||||
* @param menus 菜单列表
|
* @param menus 菜单列表
|
||||||
|
*
|
||||||
* @return 树结构列表
|
* @return 树结构列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -280,6 +221,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
* 构建前端所需要下拉树结构
|
* 构建前端所需要下拉树结构
|
||||||
*
|
*
|
||||||
* @param menus 菜单列表
|
* @param menus 菜单列表
|
||||||
|
*
|
||||||
* @return 下拉树结构列表
|
* @return 下拉树结构列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -292,6 +234,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
* 根据菜单ID查询信息
|
* 根据菜单ID查询信息
|
||||||
*
|
*
|
||||||
* @param menuId 菜单ID
|
* @param menuId 菜单ID
|
||||||
|
*
|
||||||
* @return 菜单信息
|
* @return 菜单信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -303,6 +246,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
* 是否存在菜单子节点
|
* 是否存在菜单子节点
|
||||||
*
|
*
|
||||||
* @param menuId 菜单ID
|
* @param menuId 菜单ID
|
||||||
|
*
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -315,6 +259,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
* 查询菜单使用数量
|
* 查询菜单使用数量
|
||||||
*
|
*
|
||||||
* @param menuId 菜单ID
|
* @param menuId 菜单ID
|
||||||
|
*
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -327,6 +272,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
* 新增保存菜单信息
|
* 新增保存菜单信息
|
||||||
*
|
*
|
||||||
* @param menu 菜单信息
|
* @param menu 菜单信息
|
||||||
|
*
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -338,6 +284,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
* 修改保存菜单信息
|
* 修改保存菜单信息
|
||||||
*
|
*
|
||||||
* @param menu 菜单信息
|
* @param menu 菜单信息
|
||||||
|
*
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -349,6 +296,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
* 删除菜单管理信息
|
* 删除菜单管理信息
|
||||||
*
|
*
|
||||||
* @param menuId 菜单ID
|
* @param menuId 菜单ID
|
||||||
|
*
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -360,6 +308,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
* 校验菜单名称是否唯一
|
* 校验菜单名称是否唯一
|
||||||
*
|
*
|
||||||
* @param menu 菜单信息
|
* @param menu 菜单信息
|
||||||
|
*
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -376,6 +325,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
* 获取路由名称
|
* 获取路由名称
|
||||||
*
|
*
|
||||||
* @param menu 菜单信息
|
* @param menu 菜单信息
|
||||||
|
*
|
||||||
* @return 路由名称
|
* @return 路由名称
|
||||||
*/
|
*/
|
||||||
public String getRouteName (SysMenu menu) {
|
public String getRouteName (SysMenu menu) {
|
||||||
|
@ -391,6 +341,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
* 获取路由地址
|
* 获取路由地址
|
||||||
*
|
*
|
||||||
* @param menu 菜单信息
|
* @param menu 菜单信息
|
||||||
|
*
|
||||||
* @return 路由地址
|
* @return 路由地址
|
||||||
*/
|
*/
|
||||||
public String getRouterPath (SysMenu menu) {
|
public String getRouterPath (SysMenu menu) {
|
||||||
|
@ -415,6 +366,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
* 获取组件信息
|
* 获取组件信息
|
||||||
*
|
*
|
||||||
* @param menu 菜单信息
|
* @param menu 菜单信息
|
||||||
|
*
|
||||||
* @return 组件信息
|
* @return 组件信息
|
||||||
*/
|
*/
|
||||||
public String getComponent (SysMenu menu) {
|
public String getComponent (SysMenu menu) {
|
||||||
|
@ -433,6 +385,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
* 是否为菜单内部跳转
|
* 是否为菜单内部跳转
|
||||||
*
|
*
|
||||||
* @param menu 菜单信息
|
* @param menu 菜单信息
|
||||||
|
*
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public boolean isMenuFrame (SysMenu menu) {
|
public boolean isMenuFrame (SysMenu menu) {
|
||||||
|
@ -444,6 +397,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
* 是否为内链组件
|
* 是否为内链组件
|
||||||
*
|
*
|
||||||
* @param menu 菜单信息
|
* @param menu 菜单信息
|
||||||
|
*
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public boolean isInnerLink (SysMenu menu) {
|
public boolean isInnerLink (SysMenu menu) {
|
||||||
|
@ -454,6 +408,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
* 是否为parent_view组件
|
* 是否为parent_view组件
|
||||||
*
|
*
|
||||||
* @param menu 菜单信息
|
* @param menu 菜单信息
|
||||||
|
*
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public boolean isParentView (SysMenu menu) {
|
public boolean isParentView (SysMenu menu) {
|
||||||
|
@ -465,6 +420,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
*
|
*
|
||||||
* @param list 分类表
|
* @param list 分类表
|
||||||
* @param parentId 传入的父节点ID
|
* @param parentId 传入的父节点ID
|
||||||
|
*
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public List<SysMenu> getChildPerms (List<SysMenu> list, int parentId) {
|
public List<SysMenu> getChildPerms (List<SysMenu> list, int parentId) {
|
||||||
|
|
|
@ -1,24 +1,13 @@
|
||||||
package com.muyu.system.service.impl;
|
package com.muyu.system.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
|
||||||
import com.muyu.system.domain.AsUserDept;
|
|
||||||
import com.muyu.system.domain.SysNotice;
|
import com.muyu.system.domain.SysNotice;
|
||||||
import com.muyu.system.domain.req.SysNoticeRequest;
|
|
||||||
import com.muyu.system.domain.resp.SysNoticeResponse;
|
|
||||||
import com.muyu.system.mapper.AsUserDeptMapper;
|
|
||||||
import com.muyu.system.mapper.SysNoticeMapper;
|
import com.muyu.system.mapper.SysNoticeMapper;
|
||||||
import com.muyu.system.mapper.SysUserMapper;
|
|
||||||
import com.muyu.system.service.SysNoticeService;
|
import com.muyu.system.service.SysNoticeService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公告 服务层实现
|
* 公告 服务层实现
|
||||||
|
@ -30,11 +19,6 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysNoticeMapper noticeMapper;
|
private SysNoticeMapper noticeMapper;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SysUserMapper sysUserMapper;
|
|
||||||
@Autowired
|
|
||||||
private AsUserDeptMapper asUserDeptMapper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询公告信息
|
* 查询公告信息
|
||||||
*
|
*
|
||||||
|
@ -59,37 +43,6 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
||||||
return noticeMapper.selectNoticeList(notice);
|
return noticeMapper.selectNoticeList(notice);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AsUserDept> handleList(List<Long> personnelList,List<List<Long>> sectionList,Long noticeId){
|
|
||||||
List<Long> lons = new ArrayList<>();
|
|
||||||
if (sectionList!=null && sectionList.size()!=0){
|
|
||||||
sectionList.stream()
|
|
||||||
.map(section -> {
|
|
||||||
for (Long aLong : section) {
|
|
||||||
lons.add(aLong);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}).collect(Collectors.toList());
|
|
||||||
List<Long> sectionIds = lons.stream().distinct().toList();
|
|
||||||
List<Long> userIds=sysUserMapper.selectDeptUser(sectionIds);
|
|
||||||
if (userIds!=null){
|
|
||||||
personnelList.addAll(userIds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
personnelList = personnelList.stream().distinct().toList();
|
|
||||||
System.out.println(personnelList);
|
|
||||||
List<AsUserDept> asUserDepts = personnelList.stream()
|
|
||||||
.map(personne1 -> {
|
|
||||||
AsUserDept asUserDept = new AsUserDept();
|
|
||||||
asUserDept.setUserId(personne1);
|
|
||||||
asUserDept.setNoticeId(noticeId);
|
|
||||||
asUserDept.setCreateBy(SecurityUtils.getUsername());
|
|
||||||
asUserDept.setCreateTime(new Date());
|
|
||||||
return asUserDept;
|
|
||||||
}).toList();
|
|
||||||
return asUserDepts;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增公告
|
* 新增公告
|
||||||
*
|
*
|
||||||
|
@ -98,31 +51,8 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
|
||||||
public int insertNotice (SysNotice notice) {
|
public int insertNotice (SysNotice notice) {
|
||||||
// return noticeMapper.insertNotice(notice);
|
return noticeMapper.insertNotice(notice);
|
||||||
int i = noticeMapper.insertNotice(notice);
|
|
||||||
|
|
||||||
if (notice.getNoticeType() .equals("1")){
|
|
||||||
Long noticeId = notice.getNoticeId();
|
|
||||||
List<Long> personnelList = notice.getPersomelList();
|
|
||||||
List<List<Long>> sectionList = notice.getSectionList();
|
|
||||||
List<AsUserDept> asUserDepts = handleList(personnelList, sectionList, noticeId);
|
|
||||||
asUserDeptMapper.insertBachAsUserDept(asUserDepts);
|
|
||||||
}else {
|
|
||||||
List<Long> userIds = noticeMapper.selectUser();
|
|
||||||
List<AsUserDept> asUserDepts = userIds.stream()
|
|
||||||
.map(id -> {
|
|
||||||
AsUserDept asUserDept = new AsUserDept();
|
|
||||||
asUserDept.setNoticeId(notice.getNoticeId());
|
|
||||||
asUserDept.setCreateTime(new Date());
|
|
||||||
asUserDept.setUserId(id);
|
|
||||||
asUserDept.setCreateBy(SecurityUtils.getUsername());
|
|
||||||
return asUserDept;
|
|
||||||
}).toList();
|
|
||||||
asUserDeptMapper.insertBachAsUserDept(asUserDepts);
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -160,12 +90,4 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
||||||
public int deleteNoticeByIds (Long[] noticeIds) {
|
public int deleteNoticeByIds (Long[] noticeIds) {
|
||||||
return noticeMapper.deleteNoticeByIds(noticeIds);
|
return noticeMapper.deleteNoticeByIds(noticeIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result<List<SysNoticeResponse>> getNoticeList(SysNoticeRequest sysNoticeRequest) {
|
|
||||||
sysNoticeRequest.setUserId(SecurityUtils.getUserId());
|
|
||||||
List<SysNoticeResponse> noticeList = noticeMapper.getNoticeList(sysNoticeRequest);
|
|
||||||
return Result.success(noticeList);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,15 +97,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
*
|
*
|
||||||
* @return 用户对象信息
|
* @return 用户对象信息
|
||||||
*/
|
*/
|
||||||
// @Override
|
|
||||||
// public SysUser selectUserByUserName (String userName) {
|
|
||||||
// return userMapper.selectUserByUserName(userName);
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SysUser selectUserByUserEmail (String email) {
|
public SysUser selectUserByUserName (String userName) {
|
||||||
// public SysUser selectUserByUserEmail (String userName) {
|
return userMapper.selectUserByUserName(userName);
|
||||||
return userMapper.selectUserByUserEmail(email);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -469,8 +463,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
for (SysUser user : userList) {
|
for (SysUser user : userList) {
|
||||||
try {
|
try {
|
||||||
// 验证是否存在这个用户
|
// 验证是否存在这个用户
|
||||||
// SysUser u = userMapper.selectUserByUserName(user.getUserName());
|
SysUser u = userMapper.selectUserByUserName(user.getUserName());
|
||||||
SysUser u = userMapper.selectUserByUserEmail(user.getUserName());
|
|
||||||
if (StringUtils.isNull(u)) {
|
if (StringUtils.isNull(u)) {
|
||||||
BeanValidators.validateWithException(validator, user);
|
BeanValidators.validateWithException(validator, user);
|
||||||
user.setPassword(SecurityUtils.encryptPassword(password));
|
user.setPassword(SecurityUtils.encryptPassword(password));
|
||||||
|
|
|
@ -1,110 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<!--
|
|
||||||
1.在mybats的开发中namespace有特殊的意思,一定要是对应接口的全限定名
|
|
||||||
通过namespace可以简历mapper.xml和接口之间的关系(名字不重要,位置不重要)
|
|
||||||
-->
|
|
||||||
<mapper namespace="com.muyu.system.mapper.AsUserDeptMapper">
|
|
||||||
<!-- 添加 -->
|
|
||||||
<resultMap type="com.muyu.system.domain.AsUserDept" id="AsUserDeptResult">
|
|
||||||
<result property="id" column="id" />
|
|
||||||
<result property="userId" column="user_id" />
|
|
||||||
<result property="noticeId" column="notice_id" />
|
|
||||||
<result property="isRead" column="is_read" />
|
|
||||||
<result property="createBy" column="create_by" />
|
|
||||||
<result property="createTime" column="create_time" />
|
|
||||||
<result property="updateBy" column="update_by" />
|
|
||||||
<result property="updateTime" column="update_time" />
|
|
||||||
<result property="remark" column="remark" />
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="selectAsUserDeptVo">
|
|
||||||
select id, user_id, notice_id, is_read, create_by, create_time, update_by, update_time, remark from as_user_dept
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="selectAsUserDeptList" parameterType="com.muyu.system.domain.AsUserDept" resultMap="AsUserDeptResult">
|
|
||||||
<include refid="selectAsUserDeptVo"/>
|
|
||||||
<where>
|
|
||||||
<if test="userId != null "> and user_id = #{userId}</if>
|
|
||||||
<if test="noticeId != null "> and notice_id = #{noticeId}</if>
|
|
||||||
<if test="isRead != null and isRead != ''"> and is_read = #{isRead}</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectAsUserDeptById" parameterType="Long" resultMap="AsUserDeptResult">
|
|
||||||
<include refid="selectAsUserDeptVo"/>
|
|
||||||
where id = #{id}
|
|
||||||
</select>
|
|
||||||
<select id="selectAsUserDeptNum" resultType="java.lang.Long">
|
|
||||||
select count(*) from as_user_dept where notice_id=#{noticeId}
|
|
||||||
</select>
|
|
||||||
<select id="selectAsUserDeptReadNum" resultType="java.lang.Long">
|
|
||||||
select count(*) from as_user_dept where notice_id=#{noticeId} and is_read = '0'
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<insert id="insertAsUserDept" parameterType="com.muyu.system.domain.AsUserDept" useGeneratedKeys="true" keyProperty="id">
|
|
||||||
insert into as_user_dept
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="userId != null">user_id,</if>
|
|
||||||
<if test="noticeId != null">notice_id,</if>
|
|
||||||
<if test="isRead != null">is_read,</if>
|
|
||||||
<if test="createBy != null">create_by,</if>
|
|
||||||
<if test="createTime != null">create_time,</if>
|
|
||||||
<if test="updateBy != null">update_by,</if>
|
|
||||||
<if test="updateTime != null">update_time,</if>
|
|
||||||
<if test="remark != null">remark,</if>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="userId != null">#{userId},</if>
|
|
||||||
<if test="noticeId != null">#{noticeId},</if>
|
|
||||||
<if test="isRead != null">#{isRead},</if>
|
|
||||||
<if test="createBy != null">#{createBy},</if>
|
|
||||||
<if test="createTime != null">#{createTime},</if>
|
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
|
||||||
<if test="updateTime != null">#{updateTime},</if>
|
|
||||||
<if test="remark != null">#{remark},</if>
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
<insert id="insertBachAsUserDept">
|
|
||||||
INSERT INTO `as_user_dept` (`user_id`, `notice_id`, `create_by`, `create_time`)
|
|
||||||
VALUES
|
|
||||||
<foreach collection="asUserDepts" separator="," item="asUserDept">
|
|
||||||
(#{asUserDept.userId}, #{asUserDept.noticeId}, #{asUserDept.createBy}, #{asUserDept.createTime})
|
|
||||||
</foreach>
|
|
||||||
|
|
||||||
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<update id="updateAsUserDept" parameterType="com.muyu.system.domain.AsUserDept">
|
|
||||||
update as_user_dept
|
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
|
||||||
<if test="userId != null">user_id = #{userId},</if>
|
|
||||||
<if test="noticeId != null">notice_id = #{noticeId},</if>
|
|
||||||
<if test="isRead != null">is_read = #{isRead},</if>
|
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
|
||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
||||||
<if test="remark != null">remark = #{remark},</if>
|
|
||||||
</trim>
|
|
||||||
where id = #{id}
|
|
||||||
</update>
|
|
||||||
<update id="updateAsUserDeptRead">
|
|
||||||
update as_user_dept set is_read = 0 where id=#{id}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<delete id="deleteAsUserDeptById" parameterType="Long">
|
|
||||||
delete from as_user_dept where id = #{id}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<delete id="deleteAsUserDeptByIds" parameterType="String">
|
|
||||||
delete from as_user_dept where id in
|
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -186,30 +186,6 @@
|
||||||
where menu_name=#{menuName} and parent_id = #{parentId} limit 1
|
where menu_name=#{menuName} and parent_id = #{parentId} limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectSysMenList" resultType="com.muyu.system.domain.SysMenu">
|
|
||||||
<include refid="selectMenuVo"/>
|
|
||||||
<where>
|
|
||||||
menu_id in(
|
|
||||||
<foreach collection="longs" separator="," item="id">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
)
|
|
||||||
</where>
|
|
||||||
order by parent_id,order_num
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectSysChdMenuList" resultType="com.muyu.system.domain.SysMenu">
|
|
||||||
<include refid="selectMenuVo"/>
|
|
||||||
<where>
|
|
||||||
parent_id in(
|
|
||||||
<foreach collection="longs" separator="," item="id">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
)
|
|
||||||
</where>
|
|
||||||
order by parent_id,order_num
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<update id="updateMenu" parameterType="com.muyu.system.domain.SysMenu">
|
<update id="updateMenu" parameterType="com.muyu.system.domain.SysMenu">
|
||||||
update sys_menu
|
update sys_menu
|
||||||
<set>
|
<set>
|
||||||
|
|
|
@ -50,23 +50,6 @@
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
<select id="getNoticeList" resultType="com.muyu.system.domain.resp.SysNoticeResponse">
|
|
||||||
select id,a.notice_id,is_read,a.create_by,a.create_time,notice_title,notice_content,notice_type
|
|
||||||
from as_user_dept a join sys_notice n on a.notice_id=n.notice_id\
|
|
||||||
where a.user_id=#{userId}
|
|
||||||
<if test="isRead !=null and isRead!=''">
|
|
||||||
and is_read = #{isRead}
|
|
||||||
</if>
|
|
||||||
<if test="noticeType !=null and noticeType!=''">
|
|
||||||
and n.notice_type = #{noticeType}
|
|
||||||
</if>
|
|
||||||
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectUser" resultType="java.lang.Long">
|
|
||||||
select user_id from sys_user
|
|
||||||
</select>
|
|
||||||
|
|
||||||
|
|
||||||
<insert id="insertNotice" parameterType="com.muyu.system.domain.SysNotice">
|
<insert id="insertNotice" parameterType="com.muyu.system.domain.SysNotice">
|
||||||
insert into sys_notice (
|
insert into sys_notice (
|
||||||
|
|
|
@ -149,11 +149,10 @@
|
||||||
<!-- 数据范围过滤 -->
|
<!-- 数据范围过滤 -->
|
||||||
${params.dataScope}
|
${params.dataScope}
|
||||||
</select>
|
</select>
|
||||||
<!-- where u.user_name = #{userName} and u.del_flag = '0'-->
|
|
||||||
|
|
||||||
<select id="selectUserByUserEmail" parameterType="String" resultMap="SysUserResult">
|
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
|
||||||
<include refid="selectUserVo"/>
|
<include refid="selectUserVo"/>
|
||||||
where u.user_name = #{email} or u.email =#{email} and u.del_flag = '0'
|
where u.user_name = #{userName} and u.del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
||||||
|
@ -184,13 +183,6 @@
|
||||||
and del_flag = '0'
|
and del_flag = '0'
|
||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
<select id="selectDeptUser" resultType="java.lang.Long">
|
|
||||||
select user_id from sys_user where dept_id in (
|
|
||||||
<foreach collection="sectionIds" separator="," item="id">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
)
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<insert id="insertUser" parameterType="com.muyu.common.system.domain.SysUser" useGeneratedKeys="true" keyProperty="userId">
|
<insert id="insertUser" parameterType="com.muyu.common.system.domain.SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||||
insert into sys_user(
|
insert into sys_user(
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
port: 9105
|
port: 9100
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
Loading…
Reference in New Issue