Compare commits
No commits in common. "bonus-jyy-canteen" and "main" have entirely different histories.
bonus-jyy-
...
main
|
|
@ -3,7 +3,10 @@ package com.bonus.system.api;
|
|||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.bonus.common.core.constant.ServiceNameConstants;
|
||||
import com.bonus.common.core.domain.R;
|
||||
|
|
@ -42,7 +45,4 @@ public interface RemoteFileService
|
|||
*/
|
||||
@PostMapping("/deleteFile")
|
||||
public AjaxResult deleteFile(@RequestParam("objectKey") String objectKey);
|
||||
|
||||
@GetMapping("/getFullFileUrl")
|
||||
public String getFullFileUrl(@RequestParam("fileUrl") String fileUrl);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,11 +39,6 @@ public class SysDept extends BaseEntity {
|
|||
*/
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 部门名称(全称)
|
||||
*/
|
||||
private String deptFullName;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
|
|
@ -313,14 +308,6 @@ public class SysDept extends BaseEntity {
|
|||
this.deptName = deptName;
|
||||
}
|
||||
|
||||
public String getDeptFullName() {
|
||||
return deptFullName;
|
||||
}
|
||||
|
||||
public void setDeptFullName(String deptFullName) {
|
||||
this.deptFullName = deptFullName;
|
||||
}
|
||||
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
public Integer getOrderNum() {
|
||||
return orderNum;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import com.bonus.common.core.annotation.Excel.Type;
|
|||
import com.bonus.common.core.annotation.Excels;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import com.bonus.common.core.xss.Xss;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
|
|
@ -46,11 +45,6 @@ public class SysUser extends BaseEntity {
|
|||
@Excel(name = "公司编号", type = Type.IMPORT)
|
||||
private Long companyId;
|
||||
|
||||
/**
|
||||
* 用户类型 (00系统用户)
|
||||
*/
|
||||
private String userType;
|
||||
|
||||
/**
|
||||
* 用户账号
|
||||
*/
|
||||
|
|
@ -86,16 +80,6 @@ public class SysUser extends BaseEntity {
|
|||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 人脸照片地址
|
||||
*/
|
||||
private String photoUrl;
|
||||
|
||||
/** 生日 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private String birthday;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
|
|
@ -220,14 +204,6 @@ public class SysUser extends BaseEntity {
|
|||
this.nickName = nickName;
|
||||
}
|
||||
|
||||
public String getUserType() {
|
||||
return userType;
|
||||
}
|
||||
|
||||
public void setUserType(String userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
|
||||
@Xss(message = "用户账号不能包含脚本字符")
|
||||
@NotBlank(message = "用户账号不能为空")
|
||||
@Size(min = 0, max = 20, message = "用户账号长度不能超过20个字符")
|
||||
|
|
@ -274,23 +250,6 @@ public class SysUser extends BaseEntity {
|
|||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getPhotoUrl() {
|
||||
return photoUrl;
|
||||
}
|
||||
|
||||
public void setPhotoUrl(String photoUrl) {
|
||||
this.photoUrl = photoUrl;
|
||||
}
|
||||
|
||||
|
||||
public String getBirthday() {
|
||||
return birthday;
|
||||
}
|
||||
|
||||
public void setBirthday(String birthday) {
|
||||
this.birthday = birthday;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
package com.bonus.system.api.domain;
|
||||
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class SysUserFace extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 人员id */
|
||||
@ApiModelProperty(value = "人员id")
|
||||
//@NotBlank(message = "人员id必填")
|
||||
private Long userId;
|
||||
|
||||
/** 照片地址 */
|
||||
@ApiModelProperty(value = "照片地址")
|
||||
//@NotBlank(message = "照片地址必填")
|
||||
private String photoUrl;
|
||||
|
||||
}
|
||||
|
|
@ -41,11 +41,6 @@ public class RemoteFileFallbackFactory implements FallbackFactory<RemoteFileServ
|
|||
public AjaxResult deleteFile(String objectKey) {
|
||||
return AjaxResult.error("删除文件失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullFileUrl(String fileUrl) {
|
||||
return "获取文件完整路径失败";
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import com.bonus.common.core.domain.R;
|
|||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.JwtUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.redis.service.RedisService;
|
||||
import com.bonus.common.security.auth.AuthUtil;
|
||||
|
|
@ -153,11 +152,8 @@ public class TokenController {
|
|||
return R.fail("当前系统用户并发数超过系统配置,请稍后再试");
|
||||
}
|
||||
|
||||
String username = Sm4Utils.decrypt(form.getUsername());
|
||||
String password = Sm4Utils.decrypt(form.getPassword());
|
||||
|
||||
LoginUser login = strategy.login(username, password);
|
||||
logService.saveLogin(username, "登录", "登录成功", null, "成功");
|
||||
LoginUser login = strategy.login(form.getUsername(), form.getPassword());
|
||||
logService.saveLogin(form.getUsername(), "登录", "登录成功", null, "成功");
|
||||
return R.ok(tokenService.createToken(login));
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 48381
|
||||
port: 58081
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ spring:
|
|||
name: bonus-auth
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: jyy_canteen_local
|
||||
active: dev
|
||||
|
||||
#加密组件
|
||||
jasypt:
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class Sm4Utils {
|
|||
|
||||
// 测试方法,演示加密和解密过程
|
||||
public static void main(String[] args) {
|
||||
String plainText = "admin";
|
||||
String plainText = "15398187429";
|
||||
System.out.println("原文: " + plainText);
|
||||
|
||||
// 加密明文
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public class TokenService {
|
|||
*/
|
||||
public Map<String, Object> createToken(LoginUser loginUser) {
|
||||
// 检查并删除已有的token
|
||||
//delExistingToken(loginUser.getSysUser().getUserId());
|
||||
delExistingToken(loginUser.getSysUser().getUserId());
|
||||
String token = IdUtils.fastUUID();
|
||||
Long userId = loginUser.getSysUser().getUserId();
|
||||
String userName = loginUser.getSysUser().getUserName();
|
||||
|
|
@ -206,12 +206,8 @@ public class TokenService {
|
|||
private Long getTokenTime(){
|
||||
long tokenTime = 20L;
|
||||
String redisResult = redisService.getCacheObject("sys_config:"+ "sys.visit.tokentime");
|
||||
if(StringUtils.isNotEmpty(redisResult)) {
|
||||
try {
|
||||
tokenTime = Long.parseLong(redisResult);
|
||||
} catch (Exception e) {
|
||||
tokenTime = 43200L; //MINUTES
|
||||
}
|
||||
if(!redisResult.isEmpty()) {
|
||||
tokenTime = Long.parseLong(redisResult);
|
||||
}else {
|
||||
Long result = systemConfig.getTokenTime();
|
||||
if (!ObjectUtil.isEmpty(result)){
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
package com.bonus.gateway.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.reactive.CorsWebFilter;
|
||||
import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.util.pattern.PathPatternParser;
|
||||
|
||||
/**
|
||||
* Description: 全局跨域配置
|
||||
*/
|
||||
@Configuration
|
||||
public class GlobalCorsConfig {
|
||||
@Bean
|
||||
public CorsWebFilter corsFilter() {
|
||||
// 创建一个新的CorsConfiguration对象,用于配置跨域请求
|
||||
CorsConfiguration config = new CorsConfiguration();
|
||||
// 允许所有的HTTP请求方法(GET, POST, PUT, DELETE等)
|
||||
config.addAllowedMethod("*");
|
||||
// 允许所有的域名发起的请求 比如http://localhost:8080、
|
||||
config.addAllowedOrigin("*");
|
||||
// 允许所有的域名发起的请求(支持正则表达式) 比如http://localhost:8080
|
||||
config.addAllowedOriginPattern("*");
|
||||
// 允许所有的请求头部信息 比如token、Content-Type
|
||||
config.addAllowedHeader("*");
|
||||
// 创建一个UrlBasedCorsConfigurationSource对象,并使用PathPatternParser进行路径匹配
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(new PathPatternParser());
|
||||
// 注册跨域配置,应用于所有的URL路径
|
||||
source.registerCorsConfiguration("/**", config);
|
||||
return new CorsWebFilter(source);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 48380
|
||||
port: 58080
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ spring:
|
|||
name: bonus-gateway
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: jyy_canteen_local
|
||||
active: dev
|
||||
|
||||
#加密组件
|
||||
jasypt:
|
||||
|
|
|
|||
|
|
@ -102,11 +102,6 @@ public class SysFileController
|
|||
}
|
||||
}
|
||||
|
||||
@GetMapping("/getFullFileUrl")
|
||||
public String getFullFileUrl(@RequestParam String fileUrl) throws Exception {
|
||||
return sysFileService.getFullFileUrl(fileUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件删除
|
||||
* 从各个存储平台删除文件
|
||||
|
|
|
|||
|
|
@ -42,8 +42,6 @@ public interface ISysFileService
|
|||
*/
|
||||
public void downloadFile(HttpServletResponse response, String urlStr) throws Exception;
|
||||
|
||||
public String getFullFileUrl(String urlStr) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* 从给定的URL下载文件并将其保存到指定的目标位置。
|
||||
|
|
|
|||
|
|
@ -104,11 +104,6 @@ public class FastDfsSysFileServiceImpl implements ISysFileService
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullFileUrl(String urlStr) throws Exception {
|
||||
return urlStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从给定的URL下载文件并将其保存到指定的目标位置。
|
||||
*
|
||||
|
|
|
|||
|
|
@ -78,11 +78,6 @@ public class LocalSysFileServiceImpl implements ISysFileService
|
|||
FileDownloadUtils.downloadFile(response, urlStr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullFileUrl(String urlStr) throws Exception {
|
||||
return urlStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从给定的URL下载文件并将其保存到指定的目标位置。
|
||||
*
|
||||
|
|
|
|||
|
|
@ -116,11 +116,6 @@ public class MinioServiceImpl implements ISysFileService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullFileUrl(String urlStr) throws Exception {
|
||||
return minioUtil.getFullFileUrl(urlStr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从给定的URL下载文件并将其保存到指定的目标位置。
|
||||
*
|
||||
|
|
|
|||
|
|
@ -113,11 +113,6 @@ public class MongodbServiceImpl implements ISysFileService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullFileUrl(String urlStr) throws Exception {
|
||||
return urlStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从给定的URL下载文件并将其保存到指定的目标位置。
|
||||
*
|
||||
|
|
|
|||
|
|
@ -102,11 +102,6 @@ public class ObsServiceImpl implements ISysFileService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullFileUrl(String urlStr) throws Exception {
|
||||
return urlStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从给定的URL下载文件并将其保存到指定的目标位置。
|
||||
*
|
||||
|
|
|
|||
|
|
@ -115,11 +115,6 @@ public class OssServiceImpl implements ISysFileService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullFileUrl(String urlStr) throws Exception {
|
||||
return urlStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从给定的URL下载文件并将其保存到指定的目标位置。
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.bonus.file.utils;
|
||||
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.file.config.MinioConfig;
|
||||
import com.bonus.file.entity.FileDetails;
|
||||
import com.bonus.system.api.domain.SysFile;
|
||||
|
|
@ -299,18 +298,6 @@ public class MinioUtil {
|
|||
return getFileUrl(bucketName, objectName, 604800);
|
||||
}
|
||||
|
||||
public String getFullFileUrl(String fileUrl) throws Exception {
|
||||
if (StringUtils.isNotEmpty(fileUrl)){
|
||||
if (fileUrl.startsWith("http://")) {
|
||||
return fileUrl;
|
||||
} else {
|
||||
return minioConfig.getEndpoint() + "/" + minioConfig.getBucketName() + "/" + fileUrl;
|
||||
}
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除指定的对象
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 48383
|
||||
port: 59300
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ spring:
|
|||
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: jyy_canteen_local
|
||||
active: dev
|
||||
|
||||
#加密组件
|
||||
jasypt:
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class SysNoticeController extends BaseController
|
|||
/**
|
||||
* 获取通知公告列表
|
||||
*/
|
||||
//@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:notice:list"))
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:notice:list"))
|
||||
@GetMapping("/list")
|
||||
@SysLog(title = "通知公告", businessType = OperaType.QUERY,logType = 0,module = "系统管理->通知公告")
|
||||
public TableDataInfo list(SysNotice notice) {
|
||||
|
|
@ -59,7 +59,7 @@ public class SysNoticeController extends BaseController
|
|||
/**
|
||||
* 根据通知公告编号获取详细信息
|
||||
*/
|
||||
//@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:notice:query"))
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:notice:query"))
|
||||
@GetMapping(value = "/{noticeId}")
|
||||
public AjaxResult getInfo(@PathVariable Long noticeId) {
|
||||
try{
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ public class SysProfileController extends BaseController {
|
|||
try {
|
||||
String username = SecurityUtils.getUsername();
|
||||
SysUser user = userService.selectUserByUserName(username);
|
||||
user.setAvatar(remoteFileService.getFullFileUrl(user.getAvatar()));
|
||||
AjaxResult ajax = AjaxResult.success(user);
|
||||
ajax.put("roleGroup", userService.selectUserRoleGroup(username));
|
||||
ajax.put("postGroup", userService.selectUserPostGroup(username));
|
||||
|
|
@ -153,9 +152,9 @@ public class SysProfileController extends BaseController {
|
|||
String url = fileResult.getDataAs(SysFile.class).getUrl();
|
||||
if (userService.updateUserAvatar(loginUser.getUsername(), url)) {
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("imgUrl", remoteFileService.getFullFileUrl(url));
|
||||
ajax.put("imgUrl", url);
|
||||
// 更新缓存用户头像
|
||||
loginUser.getSysUser().setAvatar(remoteFileService.getFullFileUrl(url));
|
||||
loginUser.getSysUser().setAvatar(url);
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return ajax;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import com.bonus.common.security.annotation.PreventRepeatSubmit;
|
|||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.common.security.annotation.RequiresPermissionsOrInnerAuth;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.system.api.RemoteFileService;
|
||||
import com.bonus.system.api.domain.SysDept;
|
||||
import com.bonus.system.api.domain.SysRole;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
|
|
@ -74,9 +73,6 @@ public class SysUserController extends BaseController {
|
|||
@Autowired
|
||||
private ISysLogService sysLogService;
|
||||
|
||||
@Autowired
|
||||
RemoteFileService remoteFileService;
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
*/
|
||||
|
|
@ -238,8 +234,6 @@ public class SysUserController extends BaseController {
|
|||
public AjaxResult getInfo() {
|
||||
try {
|
||||
SysUser user = userService.selectUserById(SecurityUtils.getUserId());
|
||||
user.setAvatar(remoteFileService.getFullFileUrl(user.getAvatar()));
|
||||
user.setPhotoUrl(remoteFileService.getFullFileUrl(user.getPhotoUrl()));
|
||||
user.setPassword(null);
|
||||
// 角色集合
|
||||
Set<String> roles = permissionService.getRolePermission(user);
|
||||
|
|
@ -271,7 +265,6 @@ public class SysUserController extends BaseController {
|
|||
if (StringUtils.isNotNull(userId)) {
|
||||
SysUser sysUser = userService.selectUserById(userId);
|
||||
sysUser.setPassword(null);
|
||||
sysUser.setPhotoUrl(remoteFileService.getFullFileUrl(sysUser.getPhotoUrl()));
|
||||
ajax.put(AjaxResult.DATA_TAG, sysUser);
|
||||
ajax.put("postIds", postService.selectPostListByUserId(userId));
|
||||
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
||||
|
|
@ -341,8 +334,8 @@ public class SysUserController extends BaseController {
|
|||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
//@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:user:edit"))
|
||||
@PostMapping("/edit")
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:user:edit"))
|
||||
@PostMapping("/edit")
|
||||
@SysLog(title = "用户管理", businessType = OperaType.UPDATE, logType = 0, module = "系统管理->用户管理", details = "修改用户信息")
|
||||
public AjaxResult edit(@Validated @RequestBody SysUser user) {
|
||||
try {
|
||||
|
|
@ -366,7 +359,6 @@ public class SysUserController extends BaseController {
|
|||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
package com.bonus.system.feign;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import com.bonus.system.api.domain.SysUserFace;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(value="bonus-smart-canteen")
|
||||
@Service
|
||||
@Component
|
||||
public interface SmartCanteenClient {
|
||||
|
||||
@ApiOperation(value = "新增账户")
|
||||
@RequestMapping(value = "/acc_info/sync",method = RequestMethod.POST)
|
||||
AjaxResult syncAccInfo(SysUser sysUser);
|
||||
|
||||
@ApiOperation(value = "删除账户")
|
||||
@RequestMapping(value = "/acc_info/deleteAccInfoByUserIds",method = RequestMethod.POST)
|
||||
AjaxResult deleteAccInfoByUserIds(List<SysUser> users);
|
||||
|
||||
@ApiOperation(value = "上传人脸特征")
|
||||
@RequestMapping(value = "/userFace/uploadUserFace",method = RequestMethod.POST)
|
||||
AjaxResult uploadUserFace(SysUserFace sysUserFace);
|
||||
}
|
||||
|
|
@ -135,8 +135,6 @@ public interface SysDeptMapper
|
|||
*/
|
||||
public int updateDeptChildren(@Param("depts") List<SysDept> depts);
|
||||
|
||||
public int updateDeptChildrenFullName(@Param("depts") List<SysDept> depts);
|
||||
|
||||
/**
|
||||
* 删除部门管理信息
|
||||
*
|
||||
|
|
|
|||
|
|
@ -310,7 +310,6 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
if (dept.getParentId() == null){
|
||||
dept.setParentId(0L);
|
||||
dept.setAncestors("0");
|
||||
dept.setDeptFullName(dept.getDeptName());
|
||||
dept.setStatus("0");//默认启用
|
||||
int result = deptMapper.insertDept(dept);
|
||||
if (SecurityUtils.isAdmin(SecurityUtils.getUserId()) && systemConfig.isAddRootCompany() && result > 0) {
|
||||
|
|
@ -328,7 +327,6 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
throw new ServiceException("部门停用,不允许新增");
|
||||
}
|
||||
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
||||
dept.setDeptFullName(info.getDeptFullName() + "/" + dept.getDeptName());
|
||||
return deptMapper.insertDept(dept);
|
||||
}
|
||||
}
|
||||
|
|
@ -352,7 +350,6 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
dept.setAncestors(newAncestors);
|
||||
updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
|
||||
}
|
||||
updateDeptChildrenFullName(dept, newParentDept);
|
||||
int result = deptMapper.updateDept(dept);
|
||||
if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors())
|
||||
&& !StringUtils.equals("0", dept.getAncestors()))
|
||||
|
|
@ -363,7 +360,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
//判断是否需要修改公司管理员用户信息
|
||||
if (SecurityUtils.isAdmin(SecurityUtils.getUserId()) && systemConfig.isAddRootCompany() && Objects.nonNull(dept.getParentId()) && dept.getParentId().equals(0L)){
|
||||
SysUser companyAdminUser = dept.getSysUser();
|
||||
if (Objects.nonNull(companyAdminUser) && Objects.nonNull(companyAdminUser.getRoleId())) {
|
||||
if (Objects.nonNull(companyAdminUser.getRoleId())) {
|
||||
companyAdminUser.setUpdateBy(SecurityUtils.getUsername());
|
||||
companyAdminUser.setUpdateTime(DateUtils.getNowDate());
|
||||
roleMenuMapper.deleteRoleMenuByRoleId(companyAdminUser.getRoleId());
|
||||
|
|
@ -374,38 +371,6 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
return result;
|
||||
}
|
||||
|
||||
public void updateDeptChildrenFullName(SysDept dept, SysDept newParentDept)
|
||||
{
|
||||
if (Objects.isNull(newParentDept)) {
|
||||
dept.setDeptFullName(dept.getDeptName());
|
||||
} else {
|
||||
dept.setDeptFullName(newParentDept.getDeptFullName() + "/" + dept.getDeptName());
|
||||
}
|
||||
List<SysDept> children = deptMapper.selectChildrenDeptById(dept.getDeptId());
|
||||
List<SysDept> fullDeptList = deptMapper.selectDeptList(new SysDept());
|
||||
for (SysDept innerDept : fullDeptList) {
|
||||
if (innerDept.getDeptId().equals(dept.getDeptId())) {
|
||||
innerDept.setDeptName(dept.getDeptName());
|
||||
}
|
||||
}
|
||||
for (SysDept child : children) {
|
||||
if (child.getDeptId().equals(dept.getDeptId())) {
|
||||
child.setDeptName(dept.getDeptName());
|
||||
}
|
||||
}
|
||||
for (SysDept child : children) {
|
||||
String deptAncestors = child.getAncestors();
|
||||
deptAncestors = deptAncestors.replaceFirst("0,", "").replaceAll(",", "/");
|
||||
for (SysDept innerDept : fullDeptList) {
|
||||
deptAncestors = deptAncestors.replace(String.valueOf(innerDept.getDeptId()), innerDept.getDeptName());
|
||||
}
|
||||
child.setDeptFullName(deptAncestors + "/" + child.getDeptName());
|
||||
}
|
||||
if (children.size() > 0) {
|
||||
deptMapper.updateDeptChildrenFullName(children);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改该部门的父级部门状态
|
||||
*
|
||||
|
|
|
|||
|
|
@ -15,9 +15,11 @@ import com.bonus.common.datascope.annotation.DataScope;
|
|||
import com.bonus.common.datascope.utils.CommonDataPermissionInfo;
|
||||
import com.bonus.common.security.config.VerificationCodeConfig;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.system.api.domain.*;
|
||||
import com.bonus.system.api.domain.SysPost;
|
||||
import com.bonus.system.api.domain.SysRole;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import com.bonus.system.api.domain.SysUserRole;
|
||||
import com.bonus.system.domain.SysUserPost;
|
||||
import com.bonus.system.feign.SmartCanteenClient;
|
||||
import com.bonus.system.mapper.*;
|
||||
import com.bonus.system.service.ISysConfigService;
|
||||
import com.bonus.system.service.ISysDeptService;
|
||||
|
|
@ -78,9 +80,6 @@ public class SysUserServiceImpl implements ISysUserService {
|
|||
@Autowired
|
||||
private JavaMailSender mailSender; // 自动注入JavaMailSender,用于发送邮件
|
||||
|
||||
@Resource
|
||||
private SmartCanteenClient smartCanteenClient;
|
||||
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
*
|
||||
|
|
@ -333,10 +332,6 @@ public class SysUserServiceImpl implements ISysUserService {
|
|||
insertUserPost(user);
|
||||
// 新增用户与角色管理
|
||||
insertUserRole(user);
|
||||
// 同步创建账户数据
|
||||
smartCanteenClient.syncAccInfo(user);
|
||||
// 同步更新user face数据
|
||||
uploadUserFace(user);
|
||||
return rows;
|
||||
}
|
||||
|
||||
|
|
@ -369,23 +364,9 @@ public class SysUserServiceImpl implements ISysUserService {
|
|||
userPostMapper.deleteUserPostByUserId(userId);
|
||||
// 新增用户与岗位管理
|
||||
insertUserPost(user);
|
||||
// 同步更新user face数据
|
||||
uploadUserFace(user);
|
||||
// 更新用户
|
||||
return userMapper.updateUser(user);
|
||||
}
|
||||
|
||||
private void uploadUserFace(SysUser user) {
|
||||
try {
|
||||
SysUserFace sysUserFace = new SysUserFace();
|
||||
sysUserFace.setUserId(user.getUserId());
|
||||
sysUserFace.setPhotoUrl(user.getPhotoUrl());
|
||||
smartCanteenClient.uploadUserFace(sysUserFace);
|
||||
} catch (Exception e) {
|
||||
log.error("上传人脸失败, ", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权角色
|
||||
*
|
||||
|
|
@ -538,15 +519,6 @@ public class SysUserServiceImpl implements ISysUserService {
|
|||
userRoleMapper.deleteUserRole(userIds);
|
||||
// 删除用户与岗位关联
|
||||
userPostMapper.deleteUserPost(userIds);
|
||||
// 同步删除账户信息
|
||||
List<SysUser> users = new ArrayList<>();
|
||||
for (int i = 0; i < userIds.length; i++) {
|
||||
SysUser user = new SysUser();
|
||||
user.setUserId(userIds[i]);
|
||||
users.add(user);
|
||||
}
|
||||
smartCanteenClient.deleteAccInfoByUserIds(users);
|
||||
|
||||
return userMapper.deleteUserByIds(userIds);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 48382
|
||||
port: 58082
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ spring:
|
|||
name: bonus-system
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: jyy_canteen_local
|
||||
active: dev
|
||||
task:
|
||||
scheduling:
|
||||
pool:
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="parentId" column="parent_id" />
|
||||
<result property="ancestors" column="ancestors" />
|
||||
<result property="deptName" column="dept_name" />
|
||||
<result property="deptFullName" column="dept_full_name" />
|
||||
<result property="orderNum" column="order_num" />
|
||||
<result property="leader" column="leader" />
|
||||
<result property="phone" column="phone" />
|
||||
|
|
@ -38,7 +37,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
d.parent_id,
|
||||
d.ancestors,
|
||||
d.dept_name,
|
||||
d.dept_full_name,
|
||||
d.order_num,
|
||||
d.leader,
|
||||
d.phone,
|
||||
|
|
@ -55,7 +53,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
d.parent_id,
|
||||
d.ancestors,
|
||||
d.dept_name,
|
||||
d.dept_full_name,
|
||||
d.order_num,
|
||||
d.leader,
|
||||
d.phone,
|
||||
|
|
@ -195,7 +192,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||
<if test="parentId != null and parentId != 0">parent_id,</if>
|
||||
<if test="deptName != null and deptName != ''">dept_name,</if>
|
||||
<if test="deptFullName != null and deptFullName != ''">dept_full_name,</if>
|
||||
<if test="ancestors != null and ancestors != ''">ancestors,</if>
|
||||
<if test="orderNum != null">order_num,</if>
|
||||
<if test="leader != null and leader != ''">leader,</if>
|
||||
|
|
@ -217,7 +213,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="deptId != null and deptId != 0">#{deptId},</if>
|
||||
<if test="parentId != null and parentId != 0">#{parentId},</if>
|
||||
<if test="deptName != null and deptName != ''">#{deptName},</if>
|
||||
<if test="deptFullName != null and deptFullName != ''">#{deptFullName},</if>
|
||||
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
|
||||
<if test="orderNum != null">#{orderNum},</if>
|
||||
<if test="leader != null and leader != ''">#{leader},</if>
|
||||
|
|
@ -243,7 +238,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<set>
|
||||
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
|
||||
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
|
||||
<if test="deptFullName != null and deptFullName != ''">dept_full_name = #{deptFullName},</if>
|
||||
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
|
||||
<if test="orderNum != null">order_num = #{orderNum},</if>
|
||||
<if test="leader != null">leader = #{leader},</if>
|
||||
|
|
@ -279,19 +273,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateDeptChildrenFullName" parameterType="java.util.List">
|
||||
update sys_dept set dept_full_name =
|
||||
<foreach collection="depts" item="item" index="index"
|
||||
separator=" " open="case dept_id" close="end">
|
||||
when #{item.deptId} then #{item.deptFullName}
|
||||
</foreach>
|
||||
where dept_id in
|
||||
<foreach collection="depts" item="item" index="index"
|
||||
separator="," open="(" close=")">
|
||||
#{item.deptId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateDeptStatusNormal" parameterType="Long">
|
||||
update sys_dept set status = '0' where dept_id in
|
||||
<foreach collection="array" item="deptId" open="(" separator="," close=")">
|
||||
|
|
|
|||
|
|
@ -8,15 +8,12 @@
|
|||
<id property="userId" column="user_id"/>
|
||||
<result property="deptId" column="dept_id"/>
|
||||
<result property="companyId" column="company_id"/>
|
||||
<result property="userType" column="user_type"/>
|
||||
<result property="userName" column="user_name"/>
|
||||
<result property="nickName" column="nick_name"/>
|
||||
<result property="email" column="email"/>
|
||||
<result property="phonenumber" column="phonenumber"/>
|
||||
<result property="sex" column="sex"/>
|
||||
<result property="avatar" column="avatar"/>
|
||||
<result property="photoUrl" column="photo_url"/>
|
||||
<result property="birthday" column="birthday"/>
|
||||
<result property="password" column="password"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
|
|
@ -64,13 +61,10 @@
|
|||
ELSE
|
||||
SUBSTRING_INDEX(SUBSTRING_INDEX(d.ancestors, ',', 2), ',', -1)
|
||||
END as company_id,
|
||||
u.user_type,
|
||||
u.user_name,
|
||||
u.nick_name,
|
||||
u.email,
|
||||
u.avatar,
|
||||
u.photo_url,
|
||||
u.birthday,
|
||||
u.phonenumber,
|
||||
u.password,
|
||||
u.sex,
|
||||
|
|
@ -106,7 +100,7 @@
|
|||
</sql>
|
||||
|
||||
<select id="selectUserList" parameterType="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, u.birthday,
|
||||
select u.user_id, u.dept_id, u.nick_name, 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,u.approval_status,u.is_permanent,u.is_built_in, d.dept_name,
|
||||
d.leader,r.role_id,
|
||||
r.role_name,
|
||||
|
|
@ -268,12 +262,10 @@
|
|||
insert into sys_user(
|
||||
<if test="userId != null and userId != 0">user_id,</if>
|
||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||
<if test="userType != null and userType != ''">user_type,</if>
|
||||
<if test="userName != null and userName != ''">user_name,</if>
|
||||
<if test="nickName != null and nickName != ''">nick_name,</if>
|
||||
<if test="email != null and email != ''">email,</if>
|
||||
<if test="avatar != null and avatar != ''">avatar,</if>
|
||||
<if test="birthday != null and birthday != ''">birthday,</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
|
||||
<if test="sex != null and sex != ''">sex,</if>
|
||||
<if test="password != null and password != ''">password,</if>
|
||||
|
|
@ -284,16 +276,14 @@
|
|||
<if test="approvalStatus != null and approvalStatus!=''">approval_status,</if>
|
||||
<if test="isPermanent != null and isPermanent!=''">is_permanent,</if>
|
||||
<if test="isBuiltIn != null and isBuiltIn!=''">is_built_in,</if>
|
||||
create_time, update_time
|
||||
create_time
|
||||
)values(
|
||||
<if test="userId != null and userId != ''">#{userId},</if>
|
||||
<if test="deptId != null and deptId != ''">#{deptId},</if>
|
||||
<if test="userType != null and userType != ''">#{userType},</if>
|
||||
<if test="userName != null and userName != ''">#{userName},</if>
|
||||
<if test="nickName != null and nickName != ''">#{nickName},</if>
|
||||
<if test="email != null and email != ''">#{email},</if>
|
||||
<if test="avatar != null and avatar != ''">#{avatar},</if>
|
||||
<if test="birthday != null and birthday != ''">#{birthday},</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
|
||||
<if test="sex != null and sex != ''">#{sex},</if>
|
||||
<if test="password != null and password != ''">#{password},</if>
|
||||
|
|
@ -304,7 +294,7 @@
|
|||
<if test="approvalStatus != null and approvalStatus!=''">#{approvalStatus},</if>
|
||||
<if test="isPermanent != null and isPermanent!=''">#{isPermanent},</if>
|
||||
<if test="isBuiltIn != null and isBuiltIn!=''">#{isBuiltIn},</if>
|
||||
sysdate(), sysdate()
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
|
@ -312,15 +302,12 @@
|
|||
update sys_user
|
||||
<set>
|
||||
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
|
||||
<if test="userType != null and userType != ''">user_type = #{userType},</if>
|
||||
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
||||
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
|
||||
<if test="email != null ">email = #{email},</if>
|
||||
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
|
||||
<if test="sex != null and sex != ''">sex = #{sex},</if>
|
||||
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
|
||||
<if test="photoUrl != null and photoUrl != ''">photo_url = #{photoUrl},</if>
|
||||
<if test="birthday != null and birthday != ''">birthday = #{birthday},</if>
|
||||
<if test="password != null and password != ''">password = #{password},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
-- 照片地址
|
||||
alter table sys_user
|
||||
add photo_url varchar(255) null comment '照片地址';
|
||||
|
||||
-- 生日
|
||||
alter table sys_user
|
||||
add birthday date null comment '生日';
|
||||
|
||||
-- 组织全称
|
||||
alter table sys_dept
|
||||
add dept_full_name varchar(1000) null comment '组织全称';
|
||||
Loading…
Reference in New Issue