diff --git a/op-auth/src/main/resources/bootstrap.yml b/op-auth/src/main/resources/bootstrap.yml
index f67ac2c1..b2c96afa 100644
--- a/op-auth/src/main/resources/bootstrap.yml
+++ b/op-auth/src/main/resources/bootstrap.yml
@@ -16,12 +16,13 @@ spring:
# password: sfnacos2023
# 服务注册地址
#--spring.cloud.nacos.discovery.namespace=zxl --spring.cloud.nacos.config.namespace=zxl
- namespace: zxl
+ namespace: lanju-op
+ group: zxl
server-addr: 140.249.53.142:8848
config:
#命名空间
- namespace: zxl
-# group: zxl
+ namespace: lanju-op
+ group: zxl
# 配置中心地址
server-addr: 140.249.53.142:8848
# 配置文件格式
diff --git a/op-gateway/src/main/resources/bootstrap.yml b/op-gateway/src/main/resources/bootstrap.yml
index 31445b35..71e49015 100644
--- a/op-gateway/src/main/resources/bootstrap.yml
+++ b/op-gateway/src/main/resources/bootstrap.yml
@@ -15,13 +15,14 @@ spring:
discovery:
# username: nacos
# password: sfnacos2023
- namespace: zxl
+ namespace: lanju-op
+ group: zxl
# 服务注册地址
server-addr: 140.249.53.142:8848
config:
#命名空间
- # group: local
- namespace: zxl
+ namespace: lanju-op
+ group: zxl
# 配置中心地址
server-addr: 140.249.53.142:8848
# 配置文件格式
diff --git a/op-modules/op-gen/src/main/resources/bootstrap.yml b/op-modules/op-gen/src/main/resources/bootstrap.yml
index be5f35c6..1eaccce2 100644
--- a/op-modules/op-gen/src/main/resources/bootstrap.yml
+++ b/op-modules/op-gen/src/main/resources/bootstrap.yml
@@ -13,13 +13,14 @@ spring:
cloud:
nacos:
discovery:
- namespace: zxl
+ namespace: lanju-op
+ group: zxl
# 服务注册地址
server-addr: 140.249.53.142:8848
config:
#命名空间
- # group: local
- namespace: zxl
+ namespace: lanju-op
+ group: zxl
# 配置中心地址
server-addr: 140.249.53.142:8848
# 配置文件格式
diff --git a/op-modules/op-job/src/main/resources/bootstrap.yml b/op-modules/op-job/src/main/resources/bootstrap.yml
index 5ed7962b..108a2081 100644
--- a/op-modules/op-job/src/main/resources/bootstrap.yml
+++ b/op-modules/op-job/src/main/resources/bootstrap.yml
@@ -3,7 +3,7 @@ server:
port: 9203
# Spring
-spring:
+spring:
application:
# 应用名称
name: op-job
@@ -13,11 +13,15 @@ spring:
cloud:
nacos:
discovery:
+ namespace: zxl
# 服务注册地址
- server-addr: localhost:8848
+ server-addr: 140.249.53.142:8848
config:
+ namespace: zxl
+ #命名空间
+ #group: local
# 配置中心地址
- server-addr: localhost:8848
+ server-addr: 140.249.53.142:8848
# 配置文件格式
file-extension: yml
# 共享配置
diff --git a/op-modules/op-mes/op-modules-mes.iml b/op-modules/op-mes/op-modules-mes.iml
new file mode 100644
index 00000000..98be0bca
--- /dev/null
+++ b/op-modules/op-mes/op-modules-mes.iml
@@ -0,0 +1,198 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/op-modules/op-mes/pom.xml b/op-modules/op-mes/pom.xml
new file mode 100644
index 00000000..0bf2860f
--- /dev/null
+++ b/op-modules/op-mes/pom.xml
@@ -0,0 +1,100 @@
+
+
+
+ com.op
+ op-modules
+ 0.0.1
+
+ 4.0.0
+
+ op-modules-mes
+
+
+ op-modules-mes系统模块
+
+
+
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-discovery
+
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-config
+
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-sentinel
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+
+
+ io.springfox
+ springfox-swagger-ui
+ ${swagger.fox.version}
+
+
+
+
+ mysql
+ mysql-connector-java
+
+
+
+
+ com.op
+ op-common-datasource
+
+
+
+
+ com.op
+ op-common-datascope
+
+
+
+
+ com.op
+ op-common-log
+
+
+
+
+ com.op
+ op-common-swagger
+
+
+
+
+
+ ${project.artifactId}
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+
+
+
+
+
+
diff --git a/op-modules/op-mes/src/main/java/com/op/mes/MesApplication.java b/op-modules/op-mes/src/main/java/com/op/mes/MesApplication.java
new file mode 100644
index 00000000..9c22430a
--- /dev/null
+++ b/op-modules/op-mes/src/main/java/com/op/mes/MesApplication.java
@@ -0,0 +1,30 @@
+package com.op.mes;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import com.op.common.security.annotation.EnableCustomConfig;
+import com.op.common.security.annotation.EnableRyFeignClients;
+import com.op.common.swagger.annotation.EnableCustomSwagger2;
+
+/**
+ * 系统模块
+ *
+ * @author OP
+ */
+@EnableCustomConfig
+@EnableCustomSwagger2
+@EnableRyFeignClients
+@SpringBootApplication
+public class MesApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(MesApplication.class, args);
+ System.err.println("MES服务启动成功\n"
+ + " | | \r\n"
+ + " ___ _ __ ______ ___ _ _ ___| |_ ___ _ __ ___ \r\n"
+ + " / _ \\| '_ \\______/ __| | | / __| __/ _ \\ '_ ` _ \\ \r\n"
+ + "| (_) | |_) | \\__ \\ |_| \\__ \\ || __/ | | | | |\r\n"
+ + " \\___/| .__/ |___/\\__, |___/\\__\\___|_| |_| |_|\r\n"
+ + " | | __/ | \r\n"
+ + " |_| |___/ \r\n");
+ }
+}
diff --git a/op-modules/op-mes/src/main/java/com/op/mes/controller/SysUserController.java b/op-modules/op-mes/src/main/java/com/op/mes/controller/SysUserController.java
new file mode 100644
index 00000000..6389a944
--- /dev/null
+++ b/op-modules/op-mes/src/main/java/com/op/mes/controller/SysUserController.java
@@ -0,0 +1,127 @@
+package com.op.mes.controller;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.lang3.ArrayUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import com.op.common.core.domain.R;
+import com.op.common.core.utils.StringUtils;
+import com.op.common.core.utils.poi.ExcelUtil;
+import com.op.common.core.web.controller.BaseController;
+import com.op.common.core.web.domain.AjaxResult;
+import com.op.common.core.web.page.TableDataInfo;
+import com.op.common.log.annotation.Log;
+import com.op.common.log.enums.BusinessType;
+import com.op.common.security.annotation.InnerAuth;
+import com.op.common.security.annotation.RequiresPermissions;
+import com.op.common.security.utils.SecurityUtils;
+import com.op.system.api.domain.SysDept;
+import com.op.system.api.domain.SysRole;
+import com.op.system.api.domain.SysUser;
+import com.op.system.api.model.LoginUser;
+import com.op.mes.service.ISysUserService;
+
+/**
+ * 用户信息
+ *
+ * @author OP
+ */
+@RestController
+@RequestMapping("/user")
+public class SysUserController extends BaseController {
+ @Autowired
+ private ISysUserService userService;
+
+
+ /**
+ * 获取用户列表
+ */
+ @RequiresPermissions("system:user:list")
+ @GetMapping("/list")
+ public TableDataInfo list(SysUser user) {
+ startPage();
+ List list = userService.selectUserList(user);
+ return getDataTable(list);
+ }
+
+ @Log(title = "用户管理", businessType = BusinessType.EXPORT)
+ @RequiresPermissions("system:user:export")
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysUser user) {
+ List list = userService.selectUserList(user);
+ ExcelUtil util = new ExcelUtil(SysUser.class);
+ util.exportExcel(response, list, "用户数据");
+ }
+
+
+
+ @PostMapping("/importTemplate")
+ public void importTemplate(HttpServletResponse response) throws IOException {
+ ExcelUtil util = new ExcelUtil(SysUser.class);
+ util.importTemplateExcel(response, "用户数据");
+ }
+
+
+
+ /**
+ * 新增用户
+ */
+ @RequiresPermissions("system:user:add")
+ @Log(title = "用户管理", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@Validated @RequestBody SysUser user) {
+ if (!userService.checkUserNameUnique(user)) {
+ return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
+ } else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
+ return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
+ } else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
+ return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
+ }
+ user.setCreateBy(SecurityUtils.getUsername());
+ user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
+ return toAjax(userService.insertUser(user));
+ }
+
+
+
+ /**
+ * 重置密码
+ */
+ @RequiresPermissions("system:user:edit")
+ @Log(title = "用户管理", businessType = BusinessType.UPDATE)
+ @PutMapping("/resetPwd")
+ public AjaxResult resetPwd(@RequestBody SysUser user) {
+ userService.checkUserAllowed(user);
+ userService.checkUserDataScope(user.getUserId());
+ user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
+ user.setUpdateBy(SecurityUtils.getUsername());
+ return toAjax(userService.resetPwd(user));
+ }
+
+ /**
+ * 状态修改
+ */
+ @RequiresPermissions("system:user:edit")
+ @Log(title = "用户管理", businessType = BusinessType.UPDATE)
+ @PutMapping("/changeStatus")
+ public AjaxResult changeStatus(@RequestBody SysUser user) {
+ userService.checkUserAllowed(user);
+ userService.checkUserDataScope(user.getUserId());
+ user.setUpdateBy(SecurityUtils.getUsername());
+ return toAjax(userService.updateUserStatus(user));
+ }
+
+}
diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/SysUserRole.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/SysUserRole.java
new file mode 100644
index 00000000..9d6e6a35
--- /dev/null
+++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/SysUserRole.java
@@ -0,0 +1,39 @@
+package com.op.mes.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 用户和角色关联 sys_user_role
+ *
+ * @author OP
+ */
+public class SysUserRole {
+ /** 用户ID */
+ private Long userId;
+
+ /** 角色ID */
+ private Long roleId;
+
+ public Long getUserId() {
+ return userId;
+ }
+
+ public void setUserId(Long userId) {
+ this.userId = userId;
+ }
+
+ public Long getRoleId() {
+ return roleId;
+ }
+
+ public void setRoleId(Long roleId) {
+ this.roleId = roleId;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("userId", getUserId())
+ .append("roleId", getRoleId()).toString();
+ }
+}
diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/vo/MetaVo.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/vo/MetaVo.java
new file mode 100644
index 00000000..c03b76c8
--- /dev/null
+++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/vo/MetaVo.java
@@ -0,0 +1,91 @@
+package com.op.mes.domain.vo;
+
+import com.op.common.core.utils.StringUtils;
+
+/**
+ * 路由显示信息
+ *
+ * @author OP
+ */
+public class MetaVo {
+ /**
+ * 设置该路由在侧边栏和面包屑中展示的名字
+ */
+ private String title;
+
+ /**
+ * 设置该路由的图标,对应路径src/assets/icons/svg
+ */
+ private String icon;
+
+ /**
+ * 设置为true,则不会被 缓存
+ */
+ private boolean noCache;
+
+ /**
+ * 内链地址(http(s)://开头)
+ */
+ private String link;
+
+ public MetaVo() {
+ }
+
+ public MetaVo(String title, String icon) {
+ this.title = title;
+ this.icon = icon;
+ }
+
+ public MetaVo(String title, String icon, boolean noCache) {
+ this.title = title;
+ this.icon = icon;
+ this.noCache = noCache;
+ }
+
+ public MetaVo(String title, String icon, String link) {
+ this.title = title;
+ this.icon = icon;
+ this.link = link;
+ }
+
+ public MetaVo(String title, String icon, boolean noCache, String link) {
+ this.title = title;
+ this.icon = icon;
+ this.noCache = noCache;
+ if (StringUtils.ishttp(link)) {
+ this.link = link;
+ }
+ }
+
+ public boolean isNoCache() {
+ return noCache;
+ }
+
+ public void setNoCache(boolean noCache) {
+ this.noCache = noCache;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getIcon() {
+ return icon;
+ }
+
+ public void setIcon(String icon) {
+ this.icon = icon;
+ }
+
+ public String getLink() {
+ return link;
+ }
+
+ public void setLink(String link) {
+ this.link = link;
+ }
+}
diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/vo/RouterVo.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/vo/RouterVo.java
new file mode 100644
index 00000000..6f87be3c
--- /dev/null
+++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/vo/RouterVo.java
@@ -0,0 +1,129 @@
+package com.op.mes.domain.vo;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import java.util.List;
+
+/**
+ * 路由配置信息
+ *
+ * @author OP
+ */
+@JsonInclude(JsonInclude.Include.NON_EMPTY)
+public class RouterVo {
+ /**
+ * 路由名字
+ */
+ private String name;
+
+ /**
+ * 路由地址
+ */
+ private String path;
+
+ /**
+ * 是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现
+ */
+ private boolean hidden;
+
+ /**
+ * 重定向地址,当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
+ */
+ private String redirect;
+
+ /**
+ * 组件地址
+ */
+ private String component;
+
+ /**
+ * 路由参数:如 {"id": 1, "name": "ry"}
+ */
+ private String query;
+
+ /**
+ * 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
+ */
+ private Boolean alwaysShow;
+
+ /**
+ * 其他元素
+ */
+ private MetaVo meta;
+
+ /**
+ * 子路由
+ */
+ private List children;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public boolean getHidden() {
+ return hidden;
+ }
+
+ public void setHidden(boolean hidden) {
+ this.hidden = hidden;
+ }
+
+ public String getRedirect() {
+ return redirect;
+ }
+
+ public void setRedirect(String redirect) {
+ this.redirect = redirect;
+ }
+
+ public String getComponent() {
+ return component;
+ }
+
+ public void setComponent(String component) {
+ this.component = component;
+ }
+
+ public String getQuery() {
+ return query;
+ }
+
+ public void setQuery(String query) {
+ this.query = query;
+ }
+
+ public Boolean getAlwaysShow() {
+ return alwaysShow;
+ }
+
+ public void setAlwaysShow(Boolean alwaysShow) {
+ this.alwaysShow = alwaysShow;
+ }
+
+ public MetaVo getMeta() {
+ return meta;
+ }
+
+ public void setMeta(MetaVo meta) {
+ this.meta = meta;
+ }
+
+ public List getChildren() {
+ return children;
+ }
+
+ public void setChildren(List children) {
+ this.children = children;
+ }
+}
diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/SysUserMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/SysUserMapper.java
new file mode 100644
index 00000000..6998e34c
--- /dev/null
+++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/SysUserMapper.java
@@ -0,0 +1,126 @@
+package com.op.mes.mapper;
+
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+import com.op.system.api.domain.SysUser;
+
+/**
+ * 用户表 数据层
+ *
+ * @author OP
+ */
+public interface SysUserMapper {
+ /**
+ * 根据条件分页查询用户列表
+ *
+ * @param sysUser 用户信息
+ * @return 用户信息集合信息
+ */
+ public List selectUserList(SysUser sysUser);
+
+ /**
+ * 根据条件分页查询已配用户角色列表
+ *
+ * @param user 用户信息
+ * @return 用户信息集合信息
+ */
+ public List selectAllocatedList(SysUser user);
+
+ /**
+ * 根据条件分页查询未分配用户角色列表
+ *
+ * @param user 用户信息
+ * @return 用户信息集合信息
+ */
+ public List selectUnallocatedList(SysUser user);
+
+ /**
+ * 通过用户名查询用户
+ *
+ * @param userName 用户名
+ * @return 用户对象信息
+ */
+ public SysUser selectUserByUserName(String userName);
+
+ /**
+ * 通过用户ID查询用户
+ *
+ * @param userId 用户ID
+ * @return 用户对象信息
+ */
+ public SysUser selectUserById(Long userId);
+
+ /**
+ * 新增用户信息
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ public int insertUser(SysUser user);
+
+ /**
+ * 修改用户信息
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ public int updateUser(SysUser user);
+
+ /**
+ * 修改用户头像
+ *
+ * @param userName 用户名
+ * @param avatar 头像地址
+ * @return 结果
+ */
+ public int updateUserAvatar(@Param("userName") String userName, @Param("avatar") String avatar);
+
+ /**
+ * 重置用户密码
+ *
+ * @param userName 用户名
+ * @param password 密码
+ * @return 结果
+ */
+ public int resetUserPwd(@Param("userName") String userName, @Param("password") String password);
+
+ /**
+ * 通过用户ID删除用户
+ *
+ * @param userId 用户ID
+ * @return 结果
+ */
+ public int deleteUserById(Long userId);
+
+ /**
+ * 批量删除用户信息
+ *
+ * @param userIds 需要删除的用户ID
+ * @return 结果
+ */
+ public int deleteUserByIds(Long[] userIds);
+
+ /**
+ * 校验用户名称是否唯一
+ *
+ * @param userName 用户名称
+ * @return 结果
+ */
+ public SysUser checkUserNameUnique(String userName);
+
+ /**
+ * 校验手机号码是否唯一
+ *
+ * @param phonenumber 手机号码
+ * @return 结果
+ */
+ public SysUser checkPhoneUnique(String phonenumber);
+
+ /**
+ * 校验email是否唯一
+ *
+ * @param email 用户邮箱
+ * @return 结果
+ */
+ public SysUser checkEmailUnique(String email);
+}
diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/ISysUserService.java b/op-modules/op-mes/src/main/java/com/op/mes/service/ISysUserService.java
new file mode 100644
index 00000000..03e39a0f
--- /dev/null
+++ b/op-modules/op-mes/src/main/java/com/op/mes/service/ISysUserService.java
@@ -0,0 +1,149 @@
+package com.op.mes.service;
+
+import java.util.List;
+import com.op.system.api.domain.SysUser;
+
+/**
+ * 用户 业务层
+ *
+ * @author OP
+ */
+public interface ISysUserService {
+ /**
+ * 根据条件分页查询用户列表
+ *
+ * @param user 用户信息
+ * @return 用户信息集合信息
+ */
+ public List selectUserList(SysUser user);
+
+ /**
+ * 根据条件分页查询已分配用户角色列表
+ *
+ * @param user 用户信息
+ * @return 用户信息集合信息
+ */
+ public List selectAllocatedList(SysUser user);
+
+ /**
+ * 根据条件分页查询未分配用户角色列表
+ *
+ * @param user 用户信息
+ * @return 用户信息集合信息
+ */
+ public List selectUnallocatedList(SysUser user);
+
+ /**
+ * 通过用户名查询用户
+ *
+ * @param userName 用户名
+ * @return 用户对象信息
+ */
+ public SysUser selectUserByUserName(String userName);
+
+ /**
+ * 通过用户ID查询用户
+ *
+ * @param userId 用户ID
+ * @return 用户对象信息
+ */
+ public SysUser selectUserById(Long userId);
+
+ /**
+ * 校验用户名称是否唯一
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ public boolean checkUserNameUnique(SysUser user);
+
+ /**
+ * 校验手机号码是否唯一
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ public boolean checkPhoneUnique(SysUser user);
+
+ /**
+ * 校验email是否唯一
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ public boolean checkEmailUnique(SysUser user);
+
+ /**
+ * 校验用户是否允许操作
+ *
+ * @param user 用户信息
+ */
+ public void checkUserAllowed(SysUser user);
+
+ /**
+ * 校验用户是否有数据权限
+ *
+ * @param userId 用户id
+ */
+ public void checkUserDataScope(Long userId);
+
+ /**
+ * 新增用户信息
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ public int insertUser(SysUser user);
+
+ /**
+ * 注册用户信息
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ public boolean registerUser(SysUser user);
+
+
+ /**
+ * 修改用户状态
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ public int updateUserStatus(SysUser user);
+
+ /**
+ * 修改用户基本信息
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ public int updateUserProfile(SysUser user);
+
+ /**
+ * 修改用户头像
+ *
+ * @param userName 用户名
+ * @param avatar 头像地址
+ * @return 结果
+ */
+ public boolean updateUserAvatar(String userName, String avatar);
+
+ /**
+ * 重置用户密码
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ public int resetPwd(SysUser user);
+
+ /**
+ * 重置用户密码
+ *
+ * @param userName 用户名
+ * @param password 密码
+ * @return 结果
+ */
+ public int resetUserPwd(String userName, String password);
+
+}
diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/SysUserServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/SysUserServiceImpl.java
new file mode 100644
index 00000000..e06bfd21
--- /dev/null
+++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/SysUserServiceImpl.java
@@ -0,0 +1,262 @@
+package com.op.mes.service.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import javax.validation.Validator;
+
+import com.op.mes.service.ISysUserService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+import com.op.common.core.constant.UserConstants;
+import com.op.common.core.exception.ServiceException;
+import com.op.common.core.utils.SpringUtils;
+import com.op.common.core.utils.StringUtils;
+import com.op.common.core.utils.bean.BeanValidators;
+import com.op.common.datascope.annotation.DataScope;
+import com.op.common.security.utils.SecurityUtils;
+import com.op.system.api.domain.SysRole;
+import com.op.system.api.domain.SysUser;
+import com.op.mes.mapper.SysUserMapper;
+
+/**
+ * 用户 业务层处理
+ *
+ * @author OP
+ */
+@Service
+public class SysUserServiceImpl implements ISysUserService {
+ private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
+
+ @Autowired
+ private SysUserMapper userMapper;
+
+
+ @Autowired
+ protected Validator validator;
+
+ /**
+ * 根据条件分页查询用户列表
+ *
+ * @param user 用户信息
+ * @return 用户信息集合信息
+ */
+ @Override
+ @DataScope(deptAlias = "d", userAlias = "u")
+ public List selectUserList(SysUser user) {
+ return userMapper.selectUserList(user);
+ }
+
+ /**
+ * 根据条件分页查询已分配用户角色列表
+ *
+ * @param user 用户信息
+ * @return 用户信息集合信息
+ */
+ @Override
+ @DataScope(deptAlias = "d", userAlias = "u")
+ public List selectAllocatedList(SysUser user) {
+ return userMapper.selectAllocatedList(user);
+ }
+
+ /**
+ * 根据条件分页查询未分配用户角色列表
+ *
+ * @param user 用户信息
+ * @return 用户信息集合信息
+ */
+ @Override
+ @DataScope(deptAlias = "d", userAlias = "u")
+ public List selectUnallocatedList(SysUser user) {
+ return userMapper.selectUnallocatedList(user);
+ }
+
+ /**
+ * 通过用户名查询用户
+ *
+ * @param userName 用户名
+ * @return 用户对象信息
+ */
+ @Override
+ public SysUser selectUserByUserName(String userName) {
+ return userMapper.selectUserByUserName(userName);
+ }
+
+ /**
+ * 通过用户ID查询用户
+ *
+ * @param userId 用户ID
+ * @return 用户对象信息
+ */
+ @Override
+ public SysUser selectUserById(Long userId) {
+ return userMapper.selectUserById(userId);
+ }
+
+
+ /**
+ * 校验用户名称是否唯一
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ @Override
+ public boolean checkUserNameUnique(SysUser user) {
+ Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
+ SysUser info = userMapper.checkUserNameUnique(user.getUserName());
+ if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
+ return UserConstants.NOT_UNIQUE;
+ }
+ return UserConstants.UNIQUE;
+ }
+
+ /**
+ * 校验手机号码是否唯一
+ *
+ * @param user 用户信息
+ * @return
+ */
+ @Override
+ public boolean checkPhoneUnique(SysUser user) {
+ Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
+ SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
+ if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
+ return UserConstants.NOT_UNIQUE;
+ }
+ return UserConstants.UNIQUE;
+ }
+
+ /**
+ * 校验email是否唯一
+ *
+ * @param user 用户信息
+ * @return
+ */
+ @Override
+ public boolean checkEmailUnique(SysUser user) {
+ Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
+ SysUser info = userMapper.checkEmailUnique(user.getEmail());
+ if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
+ return UserConstants.NOT_UNIQUE;
+ }
+ return UserConstants.UNIQUE;
+ }
+
+ /**
+ * 校验用户是否允许操作
+ *
+ * @param user 用户信息
+ */
+ @Override
+ public void checkUserAllowed(SysUser user) {
+ if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) {
+ throw new ServiceException("不允许操作超级管理员用户");
+ }
+ }
+
+ /**
+ * 校验用户是否有数据权限
+ *
+ * @param userId 用户id
+ */
+ @Override
+ public void checkUserDataScope(Long userId) {
+ if (!SysUser.isAdmin(SecurityUtils.getUserId())) {
+ SysUser user = new SysUser();
+ user.setUserId(userId);
+ List users = SpringUtils.getAopProxy(this).selectUserList(user);
+ if (StringUtils.isEmpty(users)) {
+ throw new ServiceException("没有权限访问用户数据!");
+ }
+ }
+ }
+
+ /**
+ * 新增保存用户信息
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int insertUser(SysUser user) {
+ // 新增用户信息
+ int rows = userMapper.insertUser(user);
+
+ return rows;
+ }
+
+ /**
+ * 注册用户信息
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ @Override
+ public boolean registerUser(SysUser user) {
+ return userMapper.insertUser(user) > 0;
+ }
+
+
+ /**
+ * 修改用户状态
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ @Override
+ public int updateUserStatus(SysUser user) {
+ return userMapper.updateUser(user);
+ }
+
+ /**
+ * 修改用户基本信息
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ @Override
+ public int updateUserProfile(SysUser user) {
+ return userMapper.updateUser(user);
+ }
+
+ /**
+ * 修改用户头像
+ *
+ * @param userName 用户名
+ * @param avatar 头像地址
+ * @return 结果
+ */
+ @Override
+ public boolean updateUserAvatar(String userName, String avatar) {
+ return userMapper.updateUserAvatar(userName, avatar) > 0;
+ }
+
+ /**
+ * 重置用户密码
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ @Override
+ public int resetPwd(SysUser user) {
+ return userMapper.updateUser(user);
+ }
+
+ /**
+ * 重置用户密码
+ *
+ * @param userName 用户名
+ * @param password 密码
+ * @return 结果
+ */
+ @Override
+ public int resetUserPwd(String userName, String password) {
+ return userMapper.resetUserPwd(userName, password);
+ }
+
+}
diff --git a/op-modules/op-mes/src/main/resources/banner.txt b/op-modules/op-mes/src/main/resources/banner.txt
new file mode 100644
index 00000000..e8a75ab1
--- /dev/null
+++ b/op-modules/op-mes/src/main/resources/banner.txt
@@ -0,0 +1,10 @@
+Spring Boot Version: ${spring-boot.version}
+Spring Application Name: ${spring.application.name}
+ _
+ | |
+ ___ _ __ ______ ___ _ _ ___| |_ ___ _ __ ___
+ / _ \| '_ \______/ __| | | / __| __/ _ \ '_ ` _ \
+| (_) | |_) | \__ \ |_| \__ \ || __/ | | | | |
+ \___/| .__/ |___/\__, |___/\__\___|_| |_| |_|
+ | | __/ |
+ |_| |___/
diff --git a/op-modules/op-mes/src/main/resources/bootstrap.yml b/op-modules/op-mes/src/main/resources/bootstrap.yml
new file mode 100644
index 00000000..44e0b278
--- /dev/null
+++ b/op-modules/op-mes/src/main/resources/bootstrap.yml
@@ -0,0 +1,31 @@
+# Tomcat
+server:
+ port: 9204
+
+# Spring
+spring:
+ application:
+ # 应用名称
+ name: op-mes
+ profiles:
+ # 环境配置
+ active: dev
+ cloud:
+ nacos:
+ discovery:
+ namespace: lanju-op
+ group: zxl
+ # 服务注册地址
+ server-addr: 140.249.53.142:8848
+ config:
+ namespace: lanju-op
+ group: zxl
+ #命名空间
+ #group: local
+ # 配置中心地址
+ server-addr: 140.249.53.142:8848
+ # 配置文件格式
+ file-extension: yml
+ # 共享配置
+ shared-configs:
+ - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
diff --git a/op-modules/op-mes/src/main/resources/logback.xml b/op-modules/op-mes/src/main/resources/logback.xml
new file mode 100644
index 00000000..1b5726ff
--- /dev/null
+++ b/op-modules/op-mes/src/main/resources/logback.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+ ${log.pattern}
+
+
+
+
+
+ ${log.path}/info.log
+
+
+
+ ${log.path}/info.%d{yyyy-MM-dd}.log
+
+ 60
+
+
+ ${log.pattern}
+
+
+
+ INFO
+
+ ACCEPT
+
+ DENY
+
+
+
+
+ ${log.path}/error.log
+
+
+
+ ${log.path}/error.%d{yyyy-MM-dd}.log
+
+ 60
+
+
+ ${log.pattern}
+
+
+
+ ERROR
+
+ ACCEPT
+
+ DENY
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/SysUserMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/SysUserMapper.xml
new file mode 100644
index 00000000..629940f5
--- /dev/null
+++ b/op-modules/op-mes/src/main/resources/mapper/mes/SysUserMapper.xml
@@ -0,0 +1,221 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
+ d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
+ r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
+ from sys_user u
+ left join sys_dept d on u.dept_id = d.dept_id
+ left join sys_user_role ur on u.user_id = ur.user_id
+ left join sys_role r on r.role_id = ur.role_id
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ insert into sys_user(
+ user_id,
+ dept_id,
+ user_name,
+ nick_name,
+ email,
+ avatar,
+ phonenumber,
+ sex,
+ password,
+ status,
+ create_by,
+ remark,
+ create_time
+ )values(
+ #{userId},
+ #{deptId},
+ #{userName},
+ #{nickName},
+ #{email},
+ #{avatar},
+ #{phonenumber},
+ #{sex},
+ #{password},
+ #{status},
+ #{createBy},
+ #{remark},
+ sysdate()
+ )
+
+
+
+ update sys_user
+
+ dept_id = #{deptId},
+ user_name = #{userName},
+ nick_name = #{nickName},
+ email = #{email},
+ phonenumber = #{phonenumber},
+ sex = #{sex},
+ avatar = #{avatar},
+ password = #{password},
+ status = #{status},
+ login_ip = #{loginIp},
+ login_date = #{loginDate},
+ update_by = #{updateBy},
+ remark = #{remark},
+ update_time = sysdate()
+
+ where user_id = #{userId}
+
+
+
+ update sys_user set status = #{status} where user_id = #{userId}
+
+
+
+ update sys_user set avatar = #{avatar} where user_name = #{userName}
+
+
+
+ update sys_user set password = #{password} where user_name = #{userName}
+
+
+
+ update sys_user set del_flag = '2' where user_id = #{userId}
+
+
+
+ update sys_user set del_flag = '2' where user_id in
+
+ #{userId}
+
+
+
+
diff --git a/op-modules/op-system/src/main/resources/bootstrap.yml b/op-modules/op-system/src/main/resources/bootstrap.yml
index 90ded63a..18669e66 100644
--- a/op-modules/op-system/src/main/resources/bootstrap.yml
+++ b/op-modules/op-system/src/main/resources/bootstrap.yml
@@ -13,13 +13,15 @@ spring:
cloud:
nacos:
discovery:
- namespace: zxl
+ namespace: lanju-op
+ group: zxl
# 服务注册地址
server-addr: 140.249.53.142:8848
config:
- namespace: zxl
+ namespace: lanju-op
+ group: zxl
#命名空间
- # group: local
+ #group: local
# 配置中心地址
server-addr: 140.249.53.142:8848
# 配置文件格式
diff --git a/op-modules/pom.xml b/op-modules/pom.xml
index ab24cd37..c3661a63 100644
--- a/op-modules/pom.xml
+++ b/op-modules/pom.xml
@@ -13,6 +13,7 @@
op-gen
op-job
op-file
+ op-mes
op-modules