1
This commit is contained in:
23
klp-oa/klp-admin/Dockerfile
Normal file
23
klp-oa/klp-admin/Dockerfile
Normal file
@@ -0,0 +1,23 @@
|
||||
FROM anapsix/alpine-java:8_server-jre_unlimited
|
||||
|
||||
MAINTAINER Lion Li
|
||||
|
||||
RUN mkdir -p /klp/server/logs \
|
||||
/klp/server/temp \
|
||||
/klp/skywalking/agent
|
||||
|
||||
WORKDIR /klp/server
|
||||
|
||||
ENV SERVER_PORT=8080
|
||||
|
||||
EXPOSE ${SERVER_PORT}
|
||||
|
||||
ADD ./target/klp-admin.jar ./app.jar
|
||||
|
||||
ENTRYPOINT ["java", \
|
||||
"-Djava.security.egd=file:/dev/./urandom", \
|
||||
"-Dserver.port=${SERVER_PORT}", \
|
||||
# 应用名称 如果想区分集群节点监控 改成不同的名称即可
|
||||
# "-Dskywalking.agent.service_name=klp-server", \
|
||||
# "-javaagent:/klp/skywalking/agent/skywalking-agent.jar", \
|
||||
"-jar", "app.jar"]
|
||||
25
klp-oa/klp-admin/src/main/java/com/klp/KLPApplication.java
Normal file
25
klp-oa/klp-admin/src/main/java/com/klp/KLPApplication.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.klp;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author klp
|
||||
*/
|
||||
|
||||
//@SpringBootApplication
|
||||
@SpringBootApplication(exclude = org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration.class)
|
||||
public class KLPApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.setProperty("spring.devtools.restart.enabled", "false");
|
||||
SpringApplication application = new SpringApplication(KLPApplication.class);
|
||||
application.setApplicationStartup(new BufferingApplicationStartup(2048));
|
||||
application.run(args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ RuoYi-Flowable-Plus启动成功 ლ(´ڡ`ლ)゙");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.klp.web.controller.monitor;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.constant.CacheConstants;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.common.utils.redis.RedisUtils;
|
||||
import com.klp.system.domain.SysLogininfor;
|
||||
import com.klp.system.service.ISysLogininforService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统访问记录
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/monitor/logininfor")
|
||||
public class SysLogininforController extends BaseController {
|
||||
|
||||
private final ISysLogininforService logininforService;
|
||||
|
||||
/**
|
||||
* 获取系统访问记录列表
|
||||
*/
|
||||
@SaCheckPermission("monitor:logininfor:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<SysLogininfor> list(SysLogininfor logininfor, PageQuery pageQuery) {
|
||||
return logininforService.selectPageLogininforList(logininfor, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出系统访问记录列表
|
||||
*/
|
||||
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
|
||||
@SaCheckPermission("monitor:logininfor:export")
|
||||
@PostMapping("/export")
|
||||
public void export(SysLogininfor logininfor, HttpServletResponse response) {
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
ExcelUtil.exportExcel(list, "登录日志", SysLogininfor.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除登录日志
|
||||
* @param infoIds 日志ids
|
||||
*/
|
||||
@SaCheckPermission("monitor:logininfor:remove")
|
||||
@Log(title = "登录日志", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{infoIds}")
|
||||
public R<Void> remove(@PathVariable Long[] infoIds) {
|
||||
return toAjax(logininforService.deleteLogininforByIds(infoIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理系统访问记录
|
||||
*/
|
||||
@SaCheckPermission("monitor:logininfor:remove")
|
||||
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/clean")
|
||||
public R<Void> clean() {
|
||||
logininforService.cleanLogininfor();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@SaCheckPermission("monitor:logininfor:unlock")
|
||||
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/unlock/{userName}")
|
||||
public R<Void> unlock(@PathVariable("userName") String userName) {
|
||||
String loginName = CacheConstants.PWD_ERR_CNT_KEY + userName;
|
||||
if (RedisUtils.hasKey(loginName)) {
|
||||
RedisUtils.deleteObject(loginName);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.klp.web.controller.system;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.constant.UserConstants;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.domain.entity.SysDept;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import com.klp.system.service.ISysDeptService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门信息
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/system/dept")
|
||||
public class SysDeptController extends BaseController {
|
||||
|
||||
private final ISysDeptService deptService;
|
||||
|
||||
/**
|
||||
* 获取部门列表
|
||||
*/
|
||||
@SaCheckPermission("system:dept:list")
|
||||
@GetMapping("/list")
|
||||
public R<List<SysDept>> list(SysDept dept) {
|
||||
List<SysDept> depts = deptService.selectDeptList(dept);
|
||||
return R.ok(depts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询部门列表(排除节点)
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
*/
|
||||
@SaCheckPermission("system:dept:list")
|
||||
@GetMapping("/list/exclude/{deptId}")
|
||||
public R<List<SysDept>> excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) {
|
||||
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
||||
depts.removeIf(d -> d.getDeptId().equals(deptId)
|
||||
|| StringUtils.splitList(d.getAncestors()).contains(Convert.toStr(deptId)));
|
||||
return R.ok(depts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据部门编号获取详细信息
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
*/
|
||||
@SaCheckPermission("system:dept:query")
|
||||
@GetMapping(value = "/{deptId}")
|
||||
public R<SysDept> getInfo(@PathVariable Long deptId) {
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
return R.ok(deptService.selectDeptById(deptId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增部门
|
||||
*/
|
||||
@SaCheckPermission("system:dept:add")
|
||||
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody SysDept dept) {
|
||||
if (!deptService.checkDeptNameUnique(dept)) {
|
||||
return R.fail("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
}
|
||||
return toAjax(deptService.insertDept(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改部门
|
||||
*/
|
||||
@SaCheckPermission("system:dept:edit")
|
||||
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody SysDept dept) {
|
||||
Long deptId = dept.getDeptId();
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
if (!deptService.checkDeptNameUnique(dept)) {
|
||||
return R.fail("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
} else if (dept.getParentId().equals(deptId)) {
|
||||
return R.fail("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
|
||||
&& deptService.selectNormalChildrenDeptById(deptId) > 0) {
|
||||
return R.fail("该部门包含未停用的子部门!");
|
||||
}
|
||||
return toAjax(deptService.updateDept(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除部门
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
*/
|
||||
@SaCheckPermission("system:dept:remove")
|
||||
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{deptId}")
|
||||
public R<Void> remove(@PathVariable Long deptId) {
|
||||
if (deptService.hasChildByDeptId(deptId)) {
|
||||
return R.warn("存在下级部门,不允许删除");
|
||||
}
|
||||
if (deptService.checkDeptExistUser(deptId)) {
|
||||
return R.warn("部门存在用户,不允许删除");
|
||||
}
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
return toAjax(deptService.deleteDeptById(deptId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.klp.web.controller.system;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.domain.entity.SysDictType;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.system.service.ISysDictTypeService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/system/dict/type")
|
||||
public class SysDictTypeController extends BaseController {
|
||||
|
||||
private final ISysDictTypeService dictTypeService;
|
||||
|
||||
/**
|
||||
* 查询字典类型列表
|
||||
*/
|
||||
@SaCheckPermission("system:dict:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<SysDictType> list(SysDictType dictType, PageQuery pageQuery) {
|
||||
return dictTypeService.selectPageDictTypeList(dictType, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出字典类型列表
|
||||
*/
|
||||
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||
@SaCheckPermission("system:dict:export")
|
||||
@PostMapping("/export")
|
||||
public void export(SysDictType dictType, HttpServletResponse response) {
|
||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
ExcelUtil.exportExcel(list, "字典类型", SysDictType.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典类型详细
|
||||
*
|
||||
* @param dictId 字典ID
|
||||
*/
|
||||
@SaCheckPermission("system:dict:query")
|
||||
@GetMapping(value = "/{dictId}")
|
||||
public R<SysDictType> getInfo(@PathVariable Long dictId) {
|
||||
return R.ok(dictTypeService.selectDictTypeById(dictId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@SaCheckPermission("system:dict:add")
|
||||
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody SysDictType dict) {
|
||||
if (!dictTypeService.checkDictTypeUnique(dict)) {
|
||||
return R.fail("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dictTypeService.insertDictType(dict);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典类型
|
||||
*/
|
||||
@SaCheckPermission("system:dict:edit")
|
||||
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody SysDictType dict) {
|
||||
if (!dictTypeService.checkDictTypeUnique(dict)) {
|
||||
return R.fail("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dictTypeService.updateDictType(dict);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
*
|
||||
* @param dictIds 字典ID串
|
||||
*/
|
||||
@SaCheckPermission("system:dict:remove")
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictIds}")
|
||||
public R<Void> remove(@PathVariable Long[] dictIds) {
|
||||
dictTypeService.deleteDictTypeByIds(dictIds);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新字典缓存
|
||||
*/
|
||||
@SaCheckPermission("system:dict:remove")
|
||||
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/refreshCache")
|
||||
public R<Void> refreshCache() {
|
||||
dictTypeService.resetDictCache();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典选择框列表
|
||||
*/
|
||||
@GetMapping("/optionselect")
|
||||
public R<List<SysDictType>> optionselect() {
|
||||
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
||||
return R.ok(dictTypes);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.klp.web.controller.system;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.klp.common.config.KLPConfig;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 首页
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
public class SysIndexController {
|
||||
|
||||
/**
|
||||
* 系统基础配置
|
||||
*/
|
||||
private final KLPConfig ruoyiConfig;
|
||||
|
||||
/**
|
||||
* 访问首页,提示语
|
||||
*/
|
||||
@SaIgnore
|
||||
@GetMapping("/")
|
||||
public String index() {
|
||||
return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package com.klp.web.controller.system;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.klp.common.constant.Constants;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.domain.entity.SysMenu;
|
||||
import com.klp.common.core.domain.entity.SysUser;
|
||||
import com.klp.common.core.domain.model.EmailLoginBody;
|
||||
import com.klp.common.core.domain.model.LoginBody;
|
||||
import com.klp.common.core.domain.model.LoginUser;
|
||||
import com.klp.common.core.domain.model.SmsLoginBody;
|
||||
import com.klp.common.helper.LoginHelper;
|
||||
import com.klp.system.domain.vo.RouterVo;
|
||||
import com.klp.system.service.ISysMenuService;
|
||||
import com.klp.system.service.ISysUserService;
|
||||
import com.klp.system.service.SysLoginService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
public class SysLoginController {
|
||||
|
||||
private final SysLoginService loginService;
|
||||
private final ISysMenuService menuService;
|
||||
private final ISysUserService userService;
|
||||
|
||||
/**
|
||||
* 登录方法
|
||||
*
|
||||
* @param loginBody 登录信息
|
||||
* @return 结果
|
||||
*/
|
||||
@SaIgnore
|
||||
@PostMapping("/login")
|
||||
public R<Map<String, Object>> login(@Validated @RequestBody LoginBody loginBody) {
|
||||
Map<String, Object> ajax = new HashMap<>();
|
||||
// 生成令牌
|
||||
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
|
||||
loginBody.getUuid());
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return R.ok(ajax);
|
||||
}
|
||||
|
||||
/**
|
||||
* 短信登录
|
||||
*
|
||||
* @param smsLoginBody 登录信息
|
||||
* @return 结果
|
||||
*/
|
||||
@SaIgnore
|
||||
@PostMapping("/smsLogin")
|
||||
public R<Map<String, Object>> smsLogin(@Validated @RequestBody SmsLoginBody smsLoginBody) {
|
||||
Map<String, Object> ajax = new HashMap<>();
|
||||
// 生成令牌
|
||||
String token = loginService.smsLogin(smsLoginBody.getPhonenumber(), smsLoginBody.getSmsCode());
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return R.ok(ajax);
|
||||
}
|
||||
|
||||
/**
|
||||
* 邮件登录
|
||||
*
|
||||
* @param body 登录信息
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/emailLogin")
|
||||
public R<Map<String, Object>> emailLogin(@Validated @RequestBody EmailLoginBody body) {
|
||||
Map<String, Object> ajax = new HashMap<>();
|
||||
// 生成令牌
|
||||
String token = loginService.emailLogin(body.getEmail(), body.getEmailCode());
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return R.ok(ajax);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序登录(示例)
|
||||
*
|
||||
* @param xcxCode 小程序code
|
||||
* @return 结果
|
||||
*/
|
||||
@SaIgnore
|
||||
@PostMapping("/xcxLogin")
|
||||
public R<Map<String, Object>> xcxLogin(@NotBlank(message = "{xcx.code.not.blank}") String xcxCode) {
|
||||
Map<String, Object> ajax = new HashMap<>();
|
||||
// 生成令牌
|
||||
String token = loginService.xcxLogin(xcxCode);
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return R.ok(ajax);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出登录
|
||||
*/
|
||||
@SaIgnore
|
||||
@PostMapping("/logout")
|
||||
public R<Void> logout() {
|
||||
loginService.logout();
|
||||
return R.ok("退出成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping("getInfo")
|
||||
public R<Map<String, Object>> getInfo() {
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
SysUser user = userService.selectUserById(loginUser.getUserId());
|
||||
Map<String, Object> ajax = new HashMap<>();
|
||||
ajax.put("user", user);
|
||||
ajax.put("roles", loginUser.getRolePermission());
|
||||
ajax.put("permissions", loginUser.getMenuPermission());
|
||||
return R.ok(ajax);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取路由信息
|
||||
*
|
||||
* @return 路由信息
|
||||
*/
|
||||
@GetMapping("getRouters")
|
||||
public R<List<RouterVo>> getRouters() {
|
||||
Long userId = LoginHelper.getUserId();
|
||||
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
|
||||
return R.ok(menuService.buildMenus(menus));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.klp.web.controller.system;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.constant.UserConstants;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.domain.entity.SysMenu;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import com.klp.system.service.ISysMenuService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 菜单信息
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/system/menu")
|
||||
public class SysMenuController extends BaseController {
|
||||
|
||||
private final ISysMenuService menuService;
|
||||
|
||||
/**
|
||||
* 获取菜单列表
|
||||
*/
|
||||
@SaCheckPermission("system:menu:list")
|
||||
@GetMapping("/list")
|
||||
public R<List<SysMenu>> list(SysMenu menu) {
|
||||
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
||||
return R.ok(menus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据菜单编号获取详细信息
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
*/
|
||||
@SaCheckPermission("system:menu:query")
|
||||
@GetMapping(value = "/{menuId}")
|
||||
public R<SysMenu> getInfo(@PathVariable Long menuId) {
|
||||
return R.ok(menuService.selectMenuById(menuId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单下拉树列表
|
||||
*/
|
||||
@GetMapping("/treeselect")
|
||||
public R<List<Tree<Long>>> treeselect(SysMenu menu) {
|
||||
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
||||
return R.ok(menuService.buildMenuTreeSelect(menus));
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载对应角色菜单列表树
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
*/
|
||||
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
|
||||
public R<Map<String, Object>> roleMenuTreeselect(@PathVariable("roleId") Long roleId) {
|
||||
List<SysMenu> menus = menuService.selectMenuList(getUserId());
|
||||
Map<String, Object> ajax = new HashMap<>();
|
||||
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
|
||||
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
|
||||
return R.ok(ajax);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增菜单
|
||||
*/
|
||||
@SaCheckPermission("system:menu:add")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody SysMenu menu) {
|
||||
if (!menuService.checkMenuNameUnique(menu)) {
|
||||
return R.fail("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
} else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
|
||||
return R.fail("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
}
|
||||
return toAjax(menuService.insertMenu(menu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜单
|
||||
*/
|
||||
@SaCheckPermission("system:menu:edit")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody SysMenu menu) {
|
||||
if (!menuService.checkMenuNameUnique(menu)) {
|
||||
return R.fail("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
} else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
|
||||
return R.fail("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
} else if (menu.getMenuId().equals(menu.getParentId())) {
|
||||
return R.fail("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
||||
}
|
||||
return toAjax(menuService.updateMenu(menu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
*/
|
||||
@SaCheckPermission("system:menu:remove")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{menuId}")
|
||||
public R<Void> remove(@PathVariable("menuId") Long menuId) {
|
||||
if (menuService.hasChildByMenuId(menuId)) {
|
||||
return R.warn("存在子菜单,不允许删除");
|
||||
}
|
||||
if (menuService.checkMenuExistRole(menuId)) {
|
||||
return R.warn("菜单已分配,不允许删除");
|
||||
}
|
||||
return toAjax(menuService.deleteMenuById(menuId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.klp.web.controller.system;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.validate.QueryGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.system.domain.bo.SysOssBo;
|
||||
import com.klp.system.domain.vo.SysOssVo;
|
||||
import com.klp.system.service.ISysOssService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 文件上传 控制层
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/system/oss")
|
||||
public class SysOssController extends BaseController {
|
||||
|
||||
private final ISysOssService iSysOssService;
|
||||
|
||||
/**
|
||||
* 查询OSS对象存储列表
|
||||
*/
|
||||
@SaCheckPermission("system:oss:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<SysOssVo> list(@Validated(QueryGroup.class) SysOssBo bo, PageQuery pageQuery) {
|
||||
return iSysOssService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询OSS对象基于id串
|
||||
*
|
||||
* @param ossIds OSS对象ID串
|
||||
*/
|
||||
@SaCheckPermission("system:oss:list")
|
||||
@GetMapping("/listByIds/{ossIds}")
|
||||
public R<List<SysOssVo>> listByIds(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ossIds) {
|
||||
List<SysOssVo> list = iSysOssService.listByIds(Arrays.asList(ossIds));
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传OSS对象存储
|
||||
*
|
||||
* @param file 文件
|
||||
*/
|
||||
@SaCheckPermission("system:oss:upload")
|
||||
@Log(title = "OSS对象存储", businessType = BusinessType.INSERT)
|
||||
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public R<Map<String, String>> upload(@RequestPart("file") MultipartFile file) {
|
||||
if (ObjectUtil.isNull(file)) {
|
||||
return R.fail("上传文件不能为空");
|
||||
}
|
||||
SysOssVo oss = iSysOssService.upload(file);
|
||||
Map<String, String> map = new HashMap<>(2);
|
||||
map.put("url", oss.getUrl());
|
||||
map.put("fileName", oss.getOriginalName());
|
||||
map.put("ossId", oss.getOssId().toString());
|
||||
return R.ok(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载OSS对象
|
||||
*
|
||||
* @param ossId OSS对象ID
|
||||
*/
|
||||
@SaCheckPermission("system:oss:download")
|
||||
@GetMapping("/download/{ossId}")
|
||||
public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException {
|
||||
iSysOssService.download(ossId,response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除OSS对象存储
|
||||
*
|
||||
* @param ossIds OSS对象ID串
|
||||
*/
|
||||
@SaCheckPermission("system:oss:remove")
|
||||
@Log(title = "OSS对象存储", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ossIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ossIds) {
|
||||
return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.klp.web.controller.system;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.system.domain.SysPost;
|
||||
import com.klp.system.service.ISysPostService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 岗位信息操作处理
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/system/post")
|
||||
public class SysPostController extends BaseController {
|
||||
|
||||
private final ISysPostService postService;
|
||||
|
||||
/**
|
||||
* 获取岗位列表
|
||||
*/
|
||||
@SaCheckPermission("system:post:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<SysPost> list(SysPost post, PageQuery pageQuery) {
|
||||
return postService.selectPagePostList(post, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出岗位列表
|
||||
*/
|
||||
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
||||
@SaCheckPermission("system:post:export")
|
||||
@PostMapping("/export")
|
||||
public void export(SysPost post, HttpServletResponse response) {
|
||||
List<SysPost> list = postService.selectPostList(post);
|
||||
ExcelUtil.exportExcel(list, "岗位数据", SysPost.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据岗位编号获取详细信息
|
||||
*
|
||||
* @param postId 岗位ID
|
||||
*/
|
||||
@SaCheckPermission("system:post:query")
|
||||
@GetMapping(value = "/{postId}")
|
||||
public R<SysPost> getInfo(@PathVariable Long postId) {
|
||||
return R.ok(postService.selectPostById(postId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增岗位
|
||||
*/
|
||||
@SaCheckPermission("system:post:add")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody SysPost post) {
|
||||
if (!postService.checkPostNameUnique(post)) {
|
||||
return R.fail("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
} else if (!postService.checkPostCodeUnique(post)) {
|
||||
return R.fail("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
return toAjax(postService.insertPost(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改岗位
|
||||
*/
|
||||
@SaCheckPermission("system:post:edit")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody SysPost post) {
|
||||
if (!postService.checkPostNameUnique(post)) {
|
||||
return R.fail("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
} else if (!postService.checkPostCodeUnique(post)) {
|
||||
return R.fail("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
return toAjax(postService.updatePost(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除岗位
|
||||
*
|
||||
* @param postIds 岗位ID串
|
||||
*/
|
||||
@SaCheckPermission("system:post:remove")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{postIds}")
|
||||
public R<Void> remove(@PathVariable Long[] postIds) {
|
||||
return toAjax(postService.deletePostByIds(postIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取岗位选择框列表
|
||||
*/
|
||||
@GetMapping("/optionselect")
|
||||
public R<List<SysPost>> optionselect() {
|
||||
List<SysPost> posts = postService.selectPostAll();
|
||||
return R.ok(posts);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.klp.web.controller.system;
|
||||
|
||||
import cn.dev33.satoken.secure.BCrypt;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.domain.entity.SysUser;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.helper.LoginHelper;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import com.klp.common.utils.file.MimeTypeUtils;
|
||||
import com.klp.system.domain.vo.SysOssVo;
|
||||
import com.klp.system.service.ISysOssService;
|
||||
import com.klp.system.service.ISysUserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 个人信息 业务处理
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/system/user/profile")
|
||||
public class SysProfileController extends BaseController {
|
||||
|
||||
private final ISysUserService userService;
|
||||
private final ISysOssService iSysOssService;
|
||||
|
||||
/**
|
||||
* 个人信息
|
||||
*/
|
||||
@GetMapping
|
||||
public R<Map<String, Object>> profile() {
|
||||
SysUser user = userService.selectUserById(getUserId());
|
||||
Map<String, Object> ajax = new HashMap<>();
|
||||
ajax.put("user", user);
|
||||
ajax.put("roleGroup", userService.selectUserRoleGroup(user.getUserName()));
|
||||
ajax.put("postGroup", userService.selectUserPostGroup(user.getUserName()));
|
||||
return R.ok(ajax);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> updateProfile(@RequestBody SysUser user) {
|
||||
if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
|
||||
return R.fail("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
|
||||
return R.fail("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setUserId(getUserId());
|
||||
user.setUserName(null);
|
||||
user.setPassword(null);
|
||||
user.setAvatar(null);
|
||||
user.setDeptId(null);
|
||||
if (userService.updateUserProfile(user) > 0) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.fail("修改个人信息异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*
|
||||
* @param newPassword 旧密码
|
||||
* @param oldPassword 新密码
|
||||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/updatePwd")
|
||||
public R<Void> updatePwd(String oldPassword, String newPassword) {
|
||||
SysUser user = userService.selectUserById(LoginHelper.getUserId());
|
||||
String userName = user.getUserName();
|
||||
String password = user.getPassword();
|
||||
if (!BCrypt.checkpw(oldPassword, password)) {
|
||||
return R.fail("修改密码失败,旧密码错误");
|
||||
}
|
||||
if (BCrypt.checkpw(newPassword, password)) {
|
||||
return R.fail("新密码不能与旧密码相同");
|
||||
}
|
||||
|
||||
if (userService.resetUserPwd(userName, BCrypt.hashpw(newPassword)) > 0) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.fail("修改密码异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 头像上传
|
||||
*
|
||||
* @param avatarfile 用户头像
|
||||
*/
|
||||
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/avatar", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public R<Map<String, Object>> avatar(@RequestPart("avatarfile") MultipartFile avatarfile) {
|
||||
Map<String, Object> ajax = new HashMap<>();
|
||||
if (!avatarfile.isEmpty()) {
|
||||
String extension = FileUtil.extName(avatarfile.getOriginalFilename());
|
||||
if (!StringUtils.equalsAnyIgnoreCase(extension, MimeTypeUtils.IMAGE_EXTENSION)) {
|
||||
return R.fail("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtils.IMAGE_EXTENSION) + "格式");
|
||||
}
|
||||
SysOssVo oss = iSysOssService.upload(avatarfile);
|
||||
String avatar = oss.getUrl();
|
||||
if (userService.updateUserAvatar(getUsername(), avatar)) {
|
||||
ajax.put("imgUrl", avatar);
|
||||
return R.ok(ajax);
|
||||
}
|
||||
}
|
||||
return R.fail("上传图片异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.klp.web.controller.system;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.domain.model.RegisterBody;
|
||||
import com.klp.system.service.ISysConfigService;
|
||||
import com.klp.system.service.SysRegisterService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 注册验证
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
public class SysRegisterController extends BaseController {
|
||||
|
||||
private final SysRegisterService registerService;
|
||||
private final ISysConfigService configService;
|
||||
|
||||
/**
|
||||
* 用户注册
|
||||
*/
|
||||
@SaIgnore
|
||||
@PostMapping("/register")
|
||||
public R<Void> register(@Validated @RequestBody RegisterBody user) {
|
||||
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) {
|
||||
return R.fail("当前系统没有开启注册功能!");
|
||||
}
|
||||
registerService.register(user);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.klp.web.controller.workflow;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.validate.QueryGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.workflow.domain.WfDeployForm;
|
||||
import com.klp.workflow.domain.bo.WfFormBo;
|
||||
import com.klp.workflow.domain.vo.WfFormVo;
|
||||
import com.klp.workflow.service.IWfDeployFormService;
|
||||
import com.klp.workflow.service.IWfFormService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程表单Controller
|
||||
*
|
||||
* @author KonBAI
|
||||
* @createTime 2022/3/7 22:07
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/workflow/form")
|
||||
public class WfFormController extends BaseController {
|
||||
|
||||
private final IWfFormService formService;
|
||||
|
||||
private final IWfDeployFormService deployFormService;
|
||||
|
||||
/**
|
||||
* 查询流程表单列表
|
||||
*/
|
||||
@SaCheckPermission("workflow:form:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WfFormVo> list(@Validated(QueryGroup.class) WfFormBo bo, PageQuery pageQuery) {
|
||||
return formService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出流程表单列表
|
||||
*/
|
||||
@SaCheckPermission("workflow:form:export")
|
||||
@Log(title = "流程表单", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(@Validated WfFormBo bo, HttpServletResponse response) {
|
||||
List<WfFormVo> list = formService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "流程表单", WfFormVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流程表单详细信息
|
||||
* @param formId 主键
|
||||
*/
|
||||
@SaCheckPermission("workflow:form:query")
|
||||
@GetMapping(value = "/{formId}")
|
||||
public R<WfFormVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable("formId") Long formId) {
|
||||
return R.ok(formService.queryById(formId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增流程表单
|
||||
*/
|
||||
@SaCheckPermission("workflow:form:add")
|
||||
@Log(title = "流程表单", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@RequestBody WfFormBo bo) {
|
||||
return toAjax(formService.insertForm(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改流程表单
|
||||
*/
|
||||
@SaCheckPermission("workflow:form:edit")
|
||||
@Log(title = "流程表单", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@RequestBody WfFormBo bo) {
|
||||
return toAjax(formService.updateForm(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除流程表单
|
||||
* @param formIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("workflow:form:remove")
|
||||
@Log(title = "流程表单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{formIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] formIds) {
|
||||
return toAjax(formService.deleteWithValidByIds(Arrays.asList(formIds)) ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 挂载流程表单
|
||||
*/
|
||||
@Log(title = "流程表单", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/addDeployForm")
|
||||
public R<Void> addDeployForm(@RequestBody WfDeployForm deployForm) {
|
||||
return toAjax(deployFormService.insertWfDeployForm(deployForm));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.klp.web.controller.workflow;
|
||||
|
||||
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.workflow.domain.bo.WfTaskBo;
|
||||
import com.klp.workflow.service.IWfInstanceService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 工作流流程实例管理
|
||||
*
|
||||
* @author KonBAI
|
||||
* @createTime 2022/3/10 00:12
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/workflow/instance")
|
||||
public class WfInstanceController {
|
||||
|
||||
private final IWfInstanceService instanceService;
|
||||
|
||||
/**
|
||||
* 激活或挂起流程实例
|
||||
*
|
||||
* @param state 1:激活,2:挂起
|
||||
* @param instanceId 流程实例ID
|
||||
*/
|
||||
@PostMapping(value = "/updateState")
|
||||
public R updateState(@RequestParam Integer state, @RequestParam String instanceId) {
|
||||
instanceService.updateState(state, instanceId);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束流程实例
|
||||
*
|
||||
* @param bo 流程任务业务对象
|
||||
*/
|
||||
@PostMapping(value = "/stopProcessInstance")
|
||||
public R stopProcessInstance(@RequestBody WfTaskBo bo) {
|
||||
instanceService.stopProcessInstance(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除流程实例
|
||||
*
|
||||
* @param instanceId 流程实例ID
|
||||
* @param deleteReason 删除原因
|
||||
*/
|
||||
@Deprecated
|
||||
@DeleteMapping(value = "/delete")
|
||||
public R delete(@RequestParam String instanceId, String deleteReason) {
|
||||
instanceService.delete(instanceId, deleteReason);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询流程实例详情信息
|
||||
*
|
||||
* @param procInsId 流程实例ID
|
||||
* @param deployId 流程部署ID
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
public R detail(String procInsId, String deployId) {
|
||||
return R.ok(instanceService.queryDetailProcess(procInsId, deployId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
package com.klp.web.controller.workflow;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.workflow.domain.WfCategory;
|
||||
import com.klp.workflow.domain.bo.WfModelBo;
|
||||
import com.klp.workflow.domain.vo.WfCategoryVo;
|
||||
import com.klp.workflow.domain.vo.WfModelExportVo;
|
||||
import com.klp.workflow.domain.vo.WfModelVo;
|
||||
import com.klp.workflow.service.IWfCategoryService;
|
||||
import com.klp.workflow.service.IWfModelService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 工作流流程模型管理
|
||||
*
|
||||
* @author KonBAI
|
||||
* @createTime 2022/6/21 9:09
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/workflow/model")
|
||||
public class WfModelController extends BaseController {
|
||||
|
||||
private final IWfModelService modelService;
|
||||
private final IWfCategoryService categoryService;
|
||||
|
||||
/**
|
||||
* 查询流程模型列表
|
||||
*
|
||||
* @param modelBo 流程模型对象
|
||||
* @param pageQuery 分页参数
|
||||
*/
|
||||
@SaCheckPermission("workflow:model:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WfModelVo> list(WfModelBo modelBo, PageQuery pageQuery) {
|
||||
return modelService.list(modelBo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询流程模型列表
|
||||
*
|
||||
* @param modelBo 流程模型对象
|
||||
* @param pageQuery 分页参数
|
||||
*/
|
||||
@SaCheckPermission("workflow:model:list")
|
||||
@GetMapping("/historyList")
|
||||
public TableDataInfo<WfModelVo> historyList(WfModelBo modelBo, PageQuery pageQuery) {
|
||||
return modelService.historyList(modelBo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流程模型详细信息
|
||||
*
|
||||
* @param modelId 模型主键
|
||||
*/
|
||||
@SaCheckPermission("workflow:model:query")
|
||||
@GetMapping(value = "/{modelId}")
|
||||
public R<WfModelVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable("modelId") String modelId) {
|
||||
return R.ok(modelService.getModel(modelId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流程表单详细信息
|
||||
*
|
||||
* @param modelId 模型主键
|
||||
*/
|
||||
@SaCheckPermission("workflow:model:query")
|
||||
@GetMapping(value = "/bpmnXml/{modelId}")
|
||||
public R<String> getBpmnXml(@NotNull(message = "主键不能为空") @PathVariable("modelId") String modelId) {
|
||||
return R.ok("操作成功", modelService.queryBpmnXmlById(modelId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增流程模型
|
||||
*/
|
||||
@SaCheckPermission("workflow:model:add")
|
||||
@Log(title = "流程模型", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WfModelBo modelBo) {
|
||||
modelService.insertModel(modelBo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改流程模型
|
||||
*/
|
||||
@SaCheckPermission("workflow:model:edit")
|
||||
@Log(title = "流程模型", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WfModelBo modelBo) {
|
||||
modelService.updateModel(modelBo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存流程模型
|
||||
*/
|
||||
@SaCheckPermission("workflow:model:save")
|
||||
@Log(title = "保存流程模型", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/save")
|
||||
public R<String> save(@RequestBody WfModelBo modelBo) {
|
||||
modelService.saveModel(modelBo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设为最新流程模型
|
||||
* @param modelId
|
||||
* @return
|
||||
*/
|
||||
@SaCheckPermission("workflow:model:save")
|
||||
@Log(title = "设为最新流程模型", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/latest")
|
||||
public R<?> latest(@RequestParam String modelId) {
|
||||
modelService.latestModel(modelId);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除流程模型
|
||||
*
|
||||
* @param modelIds 流程模型主键串
|
||||
*/
|
||||
@SaCheckPermission("workflow:model:remove")
|
||||
@Log(title = "删除流程模型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{modelIds}")
|
||||
public R<String> remove(@NotEmpty(message = "主键不能为空") @PathVariable String[] modelIds) {
|
||||
modelService.deleteByIds(Arrays.asList(modelIds));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 部署流程模型
|
||||
*
|
||||
* @param modelId 流程模型主键
|
||||
*/
|
||||
@SaCheckPermission("workflow:model:deploy")
|
||||
@Log(title = "部署流程模型", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/deploy")
|
||||
public R<Void> deployModel(@RequestParam String modelId) {
|
||||
return toAjax(modelService.deployModel(modelId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出流程模型数据
|
||||
*/
|
||||
@Log(title = "导出流程模型数据", businessType = BusinessType.EXPORT)
|
||||
@SaCheckPermission("workflow:model:export")
|
||||
@PostMapping("/export")
|
||||
public void export(WfModelBo modelBo, HttpServletResponse response) {
|
||||
List<WfModelVo> list = modelService.list(modelBo);
|
||||
List<WfModelExportVo> listVo = BeanUtil.copyToList(list, WfModelExportVo.class);
|
||||
List<WfCategoryVo> categoryVos = categoryService.queryList(new WfCategory());
|
||||
Map<String, String> categoryMap = categoryVos.stream()
|
||||
.collect(Collectors.toMap(WfCategoryVo::getCode, WfCategoryVo::getCategoryName));
|
||||
for (WfModelExportVo exportVo : listVo) {
|
||||
exportVo.setCategoryName(categoryMap.get(exportVo.getCategory()));
|
||||
}
|
||||
ExcelUtil.exportExcel(listVo, "流程模型数据", WfModelExportVo.class, response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
package com.klp.web.controller.workflow;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.workflow.domain.bo.WfTaskBo;
|
||||
import com.klp.workflow.service.IWfTaskService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* 工作流任务管理
|
||||
*
|
||||
* @author KonBAI
|
||||
* @createTime 2022/3/10 00:12
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/workflow/task")
|
||||
public class WfTaskController {
|
||||
|
||||
private final IWfTaskService flowTaskService;
|
||||
|
||||
/**
|
||||
* 取消流程
|
||||
*/
|
||||
@PostMapping(value = "/stopProcess")
|
||||
@SaCheckPermission("workflow:process:cancel")
|
||||
public R stopProcess(@RequestBody WfTaskBo bo) {
|
||||
flowTaskService.stopProcess(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤回流程
|
||||
*/
|
||||
@PostMapping(value = "/revokeProcess")
|
||||
@SaCheckPermission("workflow:process:revoke")
|
||||
public R revokeProcess(@RequestBody WfTaskBo bo) {
|
||||
flowTaskService.revokeProcess(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流程变量
|
||||
* @param taskId 流程任务Id
|
||||
*/
|
||||
@GetMapping(value = "/processVariables/{taskId}")
|
||||
@SaCheckPermission("workflow:process:query")
|
||||
public R processVariables(@PathVariable(value = "taskId") String taskId) {
|
||||
return R.ok(flowTaskService.getProcessVariables(taskId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批任务
|
||||
*/
|
||||
@PostMapping(value = "/complete")
|
||||
@SaCheckPermission("workflow:process:approval")
|
||||
public R complete(@RequestBody WfTaskBo bo) {
|
||||
flowTaskService.complete(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 拒绝任务
|
||||
*/
|
||||
@PostMapping(value = "/reject")
|
||||
@SaCheckPermission("workflow:process:approval")
|
||||
public R taskReject(@RequestBody WfTaskBo taskBo) {
|
||||
flowTaskService.taskReject(taskBo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 退回任务
|
||||
*/
|
||||
@PostMapping(value = "/return")
|
||||
@SaCheckPermission("workflow:process:approval")
|
||||
public R taskReturn(@RequestBody WfTaskBo bo) {
|
||||
flowTaskService.taskReturn(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有可回退的节点
|
||||
*/
|
||||
@PostMapping(value = "/returnList")
|
||||
@SaCheckPermission("workflow:process:query")
|
||||
public R findReturnTaskList(@RequestBody WfTaskBo bo) {
|
||||
return R.ok(flowTaskService.findReturnTaskList(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除任务
|
||||
*/
|
||||
@DeleteMapping(value = "/delete")
|
||||
@SaCheckPermission("workflow:process:approval")
|
||||
public R delete(@RequestBody WfTaskBo bo) {
|
||||
flowTaskService.deleteTask(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 认领/签收任务
|
||||
*/
|
||||
@PostMapping(value = "/claim")
|
||||
@SaCheckPermission("workflow:process:claim")
|
||||
public R claim(@RequestBody WfTaskBo bo) {
|
||||
flowTaskService.claim(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消认领/签收任务
|
||||
*/
|
||||
@PostMapping(value = "/unClaim")
|
||||
@SaCheckPermission("workflow:process:claim")
|
||||
public R unClaim(@RequestBody WfTaskBo bo) {
|
||||
flowTaskService.unClaim(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 委派任务
|
||||
*/
|
||||
@PostMapping(value = "/delegate")
|
||||
@SaCheckPermission("workflow:process:approval")
|
||||
public R delegate(@RequestBody WfTaskBo bo) {
|
||||
if (ObjectUtil.hasNull(bo.getTaskId(), bo.getUserId())) {
|
||||
return R.fail("参数错误!");
|
||||
}
|
||||
flowTaskService.delegateTask(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 转办任务
|
||||
*/
|
||||
@PostMapping(value = "/transfer")
|
||||
@SaCheckPermission("workflow:process:approval")
|
||||
public R transfer(@RequestBody WfTaskBo bo) {
|
||||
if (ObjectUtil.hasNull(bo.getTaskId(), bo.getUserId())) {
|
||||
return R.fail("参数错误!");
|
||||
}
|
||||
flowTaskService.transferTask(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成流程图
|
||||
*
|
||||
* @param processId 任务ID
|
||||
*/
|
||||
@RequestMapping("/diagram/{processId}")
|
||||
public void genProcessDiagram(HttpServletResponse response,
|
||||
@PathVariable("processId") String processId) {
|
||||
InputStream inputStream = flowTaskService.diagram(processId);
|
||||
OutputStream os = null;
|
||||
BufferedImage image = null;
|
||||
try {
|
||||
image = ImageIO.read(inputStream);
|
||||
response.setContentType("image/png");
|
||||
os = response.getOutputStream();
|
||||
if (image != null) {
|
||||
ImageIO.write(image, "png", os);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (os != null) {
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
184
klp-oa/klp-admin/src/main/resources/application-prod.yml
Normal file
184
klp-oa/klp-admin/src/main/resources/application-prod.yml
Normal file
@@ -0,0 +1,184 @@
|
||||
--- # 临时文件存储位置 避免临时文件被系统清理报错
|
||||
spring.servlet.multipart.location: /klp/server/temp
|
||||
|
||||
--- # WMS文件管理配置
|
||||
klp:
|
||||
file:
|
||||
# 生产环境文件存储目录
|
||||
directory-path: /home/ubuntu/oa/folder
|
||||
|
||||
--- # 监控中心配置
|
||||
spring.boot.admin.client:
|
||||
# 增加客户端开关
|
||||
enabled: true
|
||||
url: http://localhost:9090/admin
|
||||
instance:
|
||||
service-host-type: IP
|
||||
username: klp
|
||||
password: 123456
|
||||
|
||||
--- # xxl-job 配置
|
||||
xxl.job:
|
||||
# 执行器开关
|
||||
enabled: false
|
||||
# 调度中心地址:如调度中心集群部署存在多个地址则用逗号分隔。
|
||||
admin-addresses: http://localhost:9100/xxl-job-admin
|
||||
# 执行器通讯TOKEN:非空时启用
|
||||
access-token: xxl-job
|
||||
executor:
|
||||
# 执行器AppName:执行器心跳注册分组依据;为空则关闭自动注册
|
||||
appname: xxl-job-executor
|
||||
# 执行器端口号 执行器从9101开始往后写
|
||||
port: 9101
|
||||
# 执行器注册:默认IP:PORT
|
||||
address:
|
||||
# 执行器IP:默认自动获取IP
|
||||
ip:
|
||||
# 执行器运行日志文件存储磁盘路径
|
||||
logpath: ./logs/xxl-job
|
||||
# 执行器日志文件保存天数:大于3生效
|
||||
logretentiondays: 30
|
||||
|
||||
--- # 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
# 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content
|
||||
dynamic:
|
||||
# 性能分析插件(有性能损耗 不建议生产环境使用)
|
||||
p6spy: false
|
||||
# 设置默认的数据源或者数据源组,默认值即为 master
|
||||
primary: master
|
||||
# 严格模式 匹配不到数据源则报错
|
||||
strict: true
|
||||
datasource:
|
||||
# 主库数据源
|
||||
master:
|
||||
type: ${spring.datasource.type}
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
||||
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
||||
url: jdbc:mysql://140.143.206.120:13306/klp-oa?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
|
||||
username: klp
|
||||
password: KeLunPu@123
|
||||
# 从库数据源
|
||||
slave:
|
||||
lazy: true
|
||||
type: ${spring.datasource.type}
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://140.143.206.120:13306/klp_pocketfactory?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
|
||||
username: klp
|
||||
password: KeLunPu@123
|
||||
# oracle:
|
||||
# type: ${spring.datasource.type}
|
||||
# driverClassName: oracle.jdbc.OracleDriver
|
||||
# url: jdbc:oracle:thin:@//localhost:1521/XE
|
||||
# username: ROOT
|
||||
# password: root
|
||||
# hikari:
|
||||
# connectionTestQuery: SELECT 1 FROM DUAL
|
||||
# postgres:
|
||||
# type: ${spring.datasource.type}
|
||||
# driverClassName: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
|
||||
# username: root
|
||||
# password: root
|
||||
# sqlserver:
|
||||
# type: ${spring.datasource.type}
|
||||
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
# url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true
|
||||
# username: SA
|
||||
# password: root
|
||||
hikari:
|
||||
# 最大连接池数量
|
||||
maxPoolSize: 20
|
||||
# 最小空闲线程数量
|
||||
minIdle: 10
|
||||
# 配置获取连接等待超时的时间
|
||||
connectionTimeout: 30000
|
||||
# 校验超时时间
|
||||
validationTimeout: 5000
|
||||
# 空闲连接存活最大时间,默认10分钟
|
||||
idleTimeout: 600000
|
||||
# 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认30分钟
|
||||
maxLifetime: 1800000
|
||||
# 连接测试query(配置检测连接是否有效)
|
||||
connectionTestQuery: SELECT 1
|
||||
# 多久检查一次连接的活性
|
||||
keepaliveTime: 30000
|
||||
|
||||
flyway:
|
||||
baseline-on-migrate: true # 第一次运行时建立记录,不执行历史脚本
|
||||
clean-disabled: true # 禁止清空库
|
||||
|
||||
--- # redis 单机配置(单机与集群只能开启一个另一个需要注释掉)
|
||||
spring:
|
||||
redis:
|
||||
# 地址
|
||||
host: 140.143.206.120
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码(如没有密码请注释掉)
|
||||
password: KeLunPu123!
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
# 是否开启ssl
|
||||
ssl: false
|
||||
|
||||
redisson:
|
||||
# redis key前缀
|
||||
keyPrefix:
|
||||
# 线程池数量
|
||||
threads: 16
|
||||
# Netty线程池数量
|
||||
nettyThreads: 32
|
||||
# 单节点配置
|
||||
singleServerConfig:
|
||||
# 客户端名称
|
||||
clientName: ${klp.name}
|
||||
# 最小空闲连接数
|
||||
connectionMinimumIdleSize: 32
|
||||
# 连接池大小
|
||||
connectionPoolSize: 64
|
||||
# 连接空闲超时,单位:毫秒
|
||||
idleConnectionTimeout: 10000
|
||||
# 命令等待超时,单位:毫秒
|
||||
timeout: 3000
|
||||
# 发布和订阅连接池大小
|
||||
subscriptionConnectionPoolSize: 50
|
||||
|
||||
--- # mail 邮件发送
|
||||
mail:
|
||||
enabled: false
|
||||
host: smtp.163.com
|
||||
port: 465
|
||||
# 是否需要用户名密码验证
|
||||
auth: true
|
||||
# 发送方,遵循RFC-822标准
|
||||
from: xxx@163.com
|
||||
# 用户名(注意:如果使用foxmail邮箱,此处user为qq号)
|
||||
user: xxx@163.com
|
||||
# 密码(注意,某些邮箱需要为SMTP服务单独设置密码,详情查看相关帮助)
|
||||
pass: xxxxxxxxxx
|
||||
# 使用 STARTTLS安全连接,STARTTLS是对纯文本通信协议的扩展。
|
||||
starttlsEnable: true
|
||||
# 使用SSL安全连接
|
||||
sslEnable: true
|
||||
# SMTP超时时长,单位毫秒,缺省值不超时
|
||||
timeout: 0
|
||||
# Socket连接超时值,单位毫秒,缺省值不超时
|
||||
connectionTimeout: 0
|
||||
|
||||
--- # sms 短信
|
||||
sms:
|
||||
enabled: false
|
||||
# 阿里云 dysmsapi.aliyuncs.com
|
||||
# 腾讯云 sms.tencentcloudapi.com
|
||||
endpoint: "dysmsapi.aliyuncs.com"
|
||||
accessKeyId: xxxxxxx
|
||||
accessKeySecret: xxxxxx
|
||||
signName: 测试
|
||||
# 腾讯专用
|
||||
sdkAppId:
|
||||
349
klp-oa/klp-admin/src/main/resources/application.yml
Normal file
349
klp-oa/klp-admin/src/main/resources/application.yml
Normal file
@@ -0,0 +1,349 @@
|
||||
# 项目相关配置
|
||||
klp:
|
||||
# 名称
|
||||
name: fad-oa
|
||||
# 版本
|
||||
version: ${klp-flowable-plus.version}
|
||||
# 版权年份
|
||||
copyrightYear: 2025
|
||||
# 实例演示开关
|
||||
demoEnabled: true
|
||||
# 获取ip地址开关
|
||||
addressEnabled: true
|
||||
# 缓存懒加载
|
||||
cacheLazy: false
|
||||
# 文件管理配置
|
||||
file:
|
||||
# 文件存储目录路径
|
||||
directory-path: ${klp.file.directory-path:testDirectory}
|
||||
|
||||
captcha:
|
||||
# 页面 <参数设置> 可开启关闭 验证码校验
|
||||
# 验证码类型 math 数组计算 char 字符验证
|
||||
type: MATH
|
||||
# line 线段干扰 circle 圆圈干扰 shear 扭曲干扰
|
||||
category: CIRCLE
|
||||
# 数字验证码位数
|
||||
numberLength: 1
|
||||
# 字符验证码长度
|
||||
charLength: 4
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 8080
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /
|
||||
# undertow 配置
|
||||
undertow:
|
||||
# HTTP post内容的最大大小。当值为-1时,默认值为大小是无限的
|
||||
max-http-post-size: -1
|
||||
# 以下的配置会影响buffer,这些buffer会用于服务器连接的IO操作,有点类似netty的池化内存管理
|
||||
# 每块buffer的空间大小,越小的空间被利用越充分
|
||||
buffer-size: 512
|
||||
# 是否分配的直接内存
|
||||
direct-buffers: true
|
||||
threads:
|
||||
# 设置IO线程数, 它主要执行非阻塞的任务,它们会负责多个连接, 默认设置每个CPU核心一个线程
|
||||
io: 8
|
||||
# 阻塞任务线程池, 当执行类似servlet请求阻塞操作, undertow会从这个线程池中取得线程,它的值设置取决于系统的负载
|
||||
worker: 256
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.klp: @logging.level@
|
||||
org.springframework: warn
|
||||
config: classpath:logback-plus.xml
|
||||
|
||||
# 用户配置
|
||||
user:
|
||||
password:
|
||||
# 密码最大错误次数
|
||||
maxRetryCount: 5
|
||||
# 密码锁定时间(默认10分钟)
|
||||
lockTime: 10
|
||||
|
||||
# Spring配置
|
||||
spring:
|
||||
application:
|
||||
name: ${klp.name}
|
||||
# 资源信息
|
||||
messages:
|
||||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
profiles:
|
||||
active: @profiles.active@
|
||||
# 文件上传
|
||||
servlet:
|
||||
multipart:
|
||||
# 单个文件大小
|
||||
max-file-size: 10MB
|
||||
# 设置总上传的文件大小
|
||||
max-request-size: 20MB
|
||||
# 服务模块
|
||||
devtools:
|
||||
restart:
|
||||
# 热部署开关
|
||||
enabled: true
|
||||
mvc:
|
||||
format:
|
||||
date-time: yyyy-MM-dd HH:mm:ss
|
||||
jackson:
|
||||
# 日期格式化
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
serialization:
|
||||
# 格式化输出
|
||||
indent_output: false
|
||||
# 忽略无法转换的对象
|
||||
fail_on_empty_beans: false
|
||||
deserialization:
|
||||
# 允许对象忽略json中不存在的属性
|
||||
fail_on_unknown_properties: false
|
||||
# 实时更新数据库结构
|
||||
flyway:
|
||||
enabled: true
|
||||
locations: classpath:db/migration
|
||||
table: flyway_schema_history
|
||||
|
||||
# Sa-Token配置
|
||||
sa-token:
|
||||
# token名称 (同时也是cookie名称)
|
||||
token-name: Authorization
|
||||
# token有效期 设为一天 (必定过期) 单位: 秒
|
||||
timeout: 86400
|
||||
# token临时有效期 (指定时间无操作就过期) 单位: 秒
|
||||
activity-timeout: 86400
|
||||
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
|
||||
is-concurrent: true
|
||||
# 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
|
||||
is-share: false
|
||||
# 是否尝试从header里读取token
|
||||
is-read-header: true
|
||||
# 是否尝试从cookie里读取token
|
||||
is-read-cookie: false
|
||||
# token前缀
|
||||
token-prefix: "Bearer"
|
||||
# jwt秘钥
|
||||
jwt-secret-key: abcdefghijklmnopqrstuvwxyz
|
||||
|
||||
# security配置
|
||||
security:
|
||||
# 排除路径
|
||||
excludes:
|
||||
# 静态资源
|
||||
- /*.html
|
||||
- /**/*.html
|
||||
- /**/*.css
|
||||
- /**/*.js
|
||||
# 公共路径
|
||||
- /favicon.ico
|
||||
- /error
|
||||
# swagger 文档配置
|
||||
- /*/api-docs
|
||||
- /*/api-docs/**
|
||||
# actuator 监控配置
|
||||
- /actuator
|
||||
- /actuator/**
|
||||
# 扫码枪获取出入库单详情
|
||||
- /wms/stockIoDetail
|
||||
- /wms/stockIo/scanInStock
|
||||
# WebSocket路径
|
||||
- /websocket/**
|
||||
- /wms/websocket/**
|
||||
# WebSocket测试接口
|
||||
- /websocket/test/**
|
||||
- /websocket/direct/**
|
||||
# 测试接口
|
||||
- /test/**
|
||||
- /klp/generateRecord
|
||||
- /klp/generateRecord/**
|
||||
|
||||
# 测接口
|
||||
# - /ems/energyConsumption
|
||||
# - /ems/energyConsumption/**
|
||||
|
||||
|
||||
# MyBatisPlus配置
|
||||
# https://baomidou.com/config/
|
||||
mybatis-plus:
|
||||
# 不支持多包, 如有需要可在注解配置 或 提升扫包等级
|
||||
# 例如 com.**.**.mapper
|
||||
mapperPackage: com.klp.**.mapper
|
||||
# 对应的 XML 文件位置
|
||||
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||
# 实体扫描,多个package用逗号或者分号分隔
|
||||
typeAliasesPackage: com.klp.**.domain
|
||||
# 启动时是否检查 MyBatis XML 文件的存在,默认不检查
|
||||
checkConfigLocation: false
|
||||
configuration:
|
||||
# 自动驼峰命名规则(camel case)映射
|
||||
mapUnderscoreToCamelCase: true
|
||||
# MyBatis 自动映射策略
|
||||
# NONE:不启用 PARTIAL:只对非嵌套 resultMap 自动映射 FULL:对所有 resultMap 自动映射
|
||||
autoMappingBehavior: PARTIAL
|
||||
# MyBatis 自动映射时未知列或未知属性处理策
|
||||
# NONE:不做处理 WARNING:打印相关警告 FAILING:抛出异常和详细信息
|
||||
autoMappingUnknownColumnBehavior: NONE
|
||||
# 更详细的日志输出 会有性能损耗 org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
# 关闭日志记录 (可单纯使用 p6spy 分析) org.apache.ibatis.logging.nologging.NoLoggingImpl
|
||||
# 默认日志输出 org.apache.ibatis.logging.slf4j.Slf4jImpl
|
||||
logImpl: org.apache.ibatis.logging.nologging.NoLoggingImpl
|
||||
global-config:
|
||||
# 是否打印 Logo banner
|
||||
banner: true
|
||||
dbConfig:
|
||||
# 主键类型
|
||||
# AUTO 自增 NONE 空 INPUT 用户输入 ASSIGN_ID 雪花 ASSIGN_UUID 唯一 UUID
|
||||
idType: ASSIGN_ID
|
||||
# 逻辑已删除值
|
||||
logicDeleteValue: 2
|
||||
# 逻辑未删除值
|
||||
logicNotDeleteValue: 0
|
||||
# 字段验证策略之 insert,在 insert 的时候的字段验证策略
|
||||
# IGNORED 忽略 NOT_NULL 非NULL NOT_EMPTY 非空 DEFAULT 默认 NEVER 不加入 SQL
|
||||
insertStrategy: NOT_NULL
|
||||
# 字段验证策略之 update,在 update 的时候的字段验证策略
|
||||
updateStrategy: NOT_NULL
|
||||
# 字段验证策略之 select,在 select 的时候的字段验证策略既 wrapper 根据内部 entity 生成的 where 条件
|
||||
where-strategy: NOT_NULL
|
||||
|
||||
# 数据加密
|
||||
mybatis-encryptor:
|
||||
# 是否开启加密
|
||||
enable: false
|
||||
# 默认加密算法
|
||||
algorithm: BASE64
|
||||
# 编码方式 BASE64/HEX。默认BASE64
|
||||
encode: BASE64
|
||||
# 安全秘钥 对称算法的秘钥 如:AES,SM4
|
||||
password:
|
||||
# 公私钥 非对称算法的公私钥 如:SM2,RSA
|
||||
publicKey:
|
||||
privateKey:
|
||||
|
||||
# Swagger配置
|
||||
swagger:
|
||||
info:
|
||||
# 标题
|
||||
title: '标题:${klp.name}后台管理系统_接口文档'
|
||||
# 描述
|
||||
description: '描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...'
|
||||
# 版本
|
||||
version: '版本号: ${klp-flowable-plus.version}'
|
||||
# 作者信息
|
||||
contact:
|
||||
name: KonBAI
|
||||
email: 1527468660@qq.com
|
||||
url: https://gitee.com/KonBAI-Q/klp-flowable-plus
|
||||
components:
|
||||
# 鉴权方式配置
|
||||
security-schemes:
|
||||
apiKey:
|
||||
type: APIKEY
|
||||
in: HEADER
|
||||
name: ${sa-token.token-name}
|
||||
|
||||
springdoc:
|
||||
api-docs:
|
||||
# 是否开启接口文档
|
||||
enabled: true
|
||||
swagger-ui:
|
||||
# 持久化认证数据
|
||||
persistAuthorization: true
|
||||
#这里定义了两个分组,可定义多个,也可以不定义
|
||||
group-configs:
|
||||
- group: 1.演示模块
|
||||
packages-to-scan: com.klp.demo
|
||||
- group: 2.系统模块
|
||||
packages-to-scan: com.klp.web
|
||||
- group: 3.代码生成模块
|
||||
packages-to-scan: com.klp.generator
|
||||
|
||||
# 防止XSS攻击
|
||||
xss:
|
||||
# 过滤开关
|
||||
enabled: true
|
||||
# 排除链接(多个用逗号分隔)
|
||||
excludes: /system/notice
|
||||
# 匹配链接
|
||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||
|
||||
# 全局线程池相关配置
|
||||
thread-pool:
|
||||
# 是否开启线程池
|
||||
enabled: false
|
||||
# 队列最大长度
|
||||
queueCapacity: 128
|
||||
# 线程池维护线程所允许的空闲时间
|
||||
keepAliveSeconds: 300
|
||||
|
||||
--- # 分布式锁 lock4j 全局配置
|
||||
lock4j:
|
||||
# 获取分布式锁超时时间,默认为 3000 毫秒
|
||||
acquire-timeout: 3000
|
||||
# 分布式锁的超时时间,默认为 30 秒
|
||||
expire: 30000
|
||||
|
||||
--- # Actuator 监控端点的配置项
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: '*'
|
||||
endpoint:
|
||||
health:
|
||||
show-details: ALWAYS
|
||||
logfile:
|
||||
external-file: ./logs/sys-console.log
|
||||
|
||||
--- # Flowable 配置
|
||||
flowable:
|
||||
# 关闭定时任务 job
|
||||
async-executor-activate: false
|
||||
# 库与数据库表结构不一致时,会自动将数据库表结构升级至新版本。
|
||||
database-schema-update: true
|
||||
idm:
|
||||
# 关闭idm引擎 数据库不会创建act_id_*表,流程流转不会使用act_id_*相关的表
|
||||
enabled: false
|
||||
# 关闭流程定义文件自动检查
|
||||
check-process-definitions: false
|
||||
# 关闭历史任务定时任务job
|
||||
async-history-executor-activate: false
|
||||
|
||||
# 图像识别 OCR 配置(语言包绝对路径)
|
||||
tesseract:
|
||||
data-path: D:/tessdata # Windows开发环境
|
||||
# datapath: /opt/tessdata # Linux生产环境
|
||||
|
||||
|
||||
# 图片识别配置
|
||||
image:
|
||||
recognition:
|
||||
# AI API配置
|
||||
api-url: https://api.siliconflow.cn/v1/chat/completions
|
||||
model-name: Qwen/Qwen2.5-VL-32B-Instruct
|
||||
api-key: sk-sbmuklhrcxqlsucufqebiibauflxqfdafqjxaedtwirurtrc
|
||||
max-retries: 3
|
||||
temperature: 0.0
|
||||
max-tokens: 4096
|
||||
|
||||
# 图片处理配置
|
||||
max-image-dimension: 512
|
||||
image-quality: 60
|
||||
|
||||
# 销售话术生成器配置
|
||||
sales:
|
||||
script:
|
||||
ai:
|
||||
# DeepSeek API配置
|
||||
api-key: sk-5eb55d2fb2cc4fe58a0150919a1f0d70
|
||||
base-url: https://api.deepseek.com/v1
|
||||
model-name: deepseek-chat
|
||||
max-retries: 3
|
||||
temperature: 1.0
|
||||
|
||||
camera:
|
||||
media-server-host: http://47.117.71.33:15218 # ZLMediaKit 控制台地址
|
||||
api-secret: kuQV244gFXu7fBev9UBFkm0IrslUC2A9 # 必须与ZLMediaKit的config.ini一致
|
||||
7678
klp-oa/klp-admin/src/main/resources/db/migration/V1__init.sql
Normal file
7678
klp-oa/klp-admin/src/main/resources/db/migration/V1__init.sql
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,31 @@
|
||||
-- auto-generated definition
|
||||
CREATE TABLE dv_special_equipment
|
||||
(
|
||||
equipment_id BIGINT NOT NULL COMMENT '设备ID'
|
||||
PRIMARY KEY,
|
||||
equipment_code VARCHAR(64) NOT NULL COMMENT '设备编码',
|
||||
equipment_name VARCHAR(255) NOT NULL COMMENT '设备名称(如:锅炉、压力容器、压力管道、电梯、起重机械等)',
|
||||
specification_model VARCHAR(255) NULL COMMENT '规格型号',
|
||||
manufacturer VARCHAR(255) NULL COMMENT '制造单位',
|
||||
production_date DATE NULL COMMENT '制造日期',
|
||||
installation_date DATE NULL COMMENT '安装日期',
|
||||
use_start_date DATE NULL COMMENT '投入使用日期',
|
||||
registration_no VARCHAR(64) NULL COMMENT '特种设备注册编号',
|
||||
safety_manager VARCHAR(64) NULL COMMENT '安全负责人',
|
||||
attachment TEXT NULL COMMENT '附件路径(多个附件用逗号分隔)',
|
||||
inspection_cycle INT NOT NULL COMMENT '检验周期(月)',
|
||||
last_inspection_time DATETIME NULL COMMENT '上次检验时间',
|
||||
next_inspection_time DATETIME NULL COMMENT '下次检验时间',
|
||||
current_status VARCHAR(32) NULL COMMENT '当前状态(在用、停用、报废等)',
|
||||
remark VARCHAR(500) DEFAULT '' NULL COMMENT '备注',
|
||||
del_flag tinyint(1) default 0 not null comment '删除标志(0=正常,1=已删除)',
|
||||
create_by VARCHAR(64) DEFAULT '' NULL COMMENT '创建者',
|
||||
create_time DATETIME NULL COMMENT '创建时间',
|
||||
update_by VARCHAR(64) DEFAULT '' NULL COMMENT '更新者',
|
||||
update_time DATETIME NULL COMMENT '更新时间',
|
||||
INDEX idx_equipment_code (equipment_code),
|
||||
INDEX idx_equipment_type (equipment_name),
|
||||
INDEX idx_next_inspection (next_inspection_time),
|
||||
INDEX idx_safety_manager (safety_manager)
|
||||
)
|
||||
COMMENT '特种设备表(包含锅炉、压力管道、电梯等特种设备信息)' CHARSET = utf8mb4;
|
||||
@@ -0,0 +1,6 @@
|
||||
alter table wms_purchase_plan_detail
|
||||
modify plan_id bigint null comment '采购计划ID';
|
||||
|
||||
alter table wms_purchase_plan_detail
|
||||
add detail_code varchar(64) null comment '详情编码' after plan_id;
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
alter table wms_manufacturing_spec
|
||||
modify spec_id bigint auto_increment comment '主键';
|
||||
|
||||
DROP TABLE IF EXISTS `wms_product_spec_group`;
|
||||
CREATE TABLE wms_product_spec_group (
|
||||
group_id BiGINT AUTO_INCREMENT PRIMARY KEY COMMENT '主键',
|
||||
group_code VARCHAR(50) NOT NULL COMMENT '产品规范组编码',
|
||||
product_id BIGINT NOT NULL COMMENT '绑定的产品ID',
|
||||
group_name VARCHAR(100) COMMENT '产品规范组名称',
|
||||
status INT DEFAULT 1 COMMENT '状态(字典:1=启用,2=停用)',
|
||||
remark VARCHAR(500) COMMENT '备注',
|
||||
|
||||
create_by VARCHAR(64) NULL COMMENT '创建人',
|
||||
create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
update_by VARCHAR(64) NULL COMMENT '更新人',
|
||||
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
del_flag INT DEFAULT 0 COMMENT '删除标志(0=正常,1=删除)',
|
||||
|
||||
UNIQUE KEY uq_group_code (group_code)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='产品规范组表';
|
||||
|
||||
DROP TABLE IF EXISTS `wms_product_spec`;
|
||||
CREATE TABLE wms_product_spec (
|
||||
spec_id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '主键',
|
||||
group_id BIGINT NOT NULL COMMENT '所属产品规范组ID',
|
||||
|
||||
spec_key VARCHAR(100) NOT NULL COMMENT '规范键',
|
||||
spec_value VARCHAR(500) NOT NULL COMMENT '规范值',
|
||||
|
||||
remark VARCHAR(500) COMMENT '备注',
|
||||
|
||||
create_by VARCHAR(64) NULL COMMENT '创建人',
|
||||
create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
update_by VARCHAR(64) NULL COMMENT '更新人',
|
||||
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
del_flag INT DEFAULT 0 COMMENT '删除标志(0=正常,1=删除)'
|
||||
|
||||
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='产品规范表(键值对模式)';
|
||||
|
||||
DROP TABLE IF EXISTS `wms_production_task`;
|
||||
CREATE TABLE wms_production_task (
|
||||
task_id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '主键',
|
||||
|
||||
product_spec_group_id BIGINT NOT NULL COMMENT '产品规范组ID',
|
||||
manufacturing_spec_id BIGINT NOT NULL COMMENT '制造规范ID',
|
||||
order_id BIGINT NOT NULL COMMENT '订单ID',
|
||||
order_item_id BIGINT NOT NULL COMMENT '订单明细ID',
|
||||
|
||||
plan_name VARCHAR(200) NOT NULL COMMENT '计划名称',
|
||||
plan_code VARCHAR(100) NOT NULL COMMENT '计划编号',
|
||||
|
||||
status INT DEFAULT 0 COMMENT '状态(字典:0=未开始,1=进行中,2=完成,3=暂停,4=取消)',
|
||||
|
||||
remark VARCHAR(500) COMMENT '备注',
|
||||
|
||||
create_by VARCHAR(64) NULL COMMENT '创建人',
|
||||
create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
update_by VARCHAR(64) NULL COMMENT '更新人',
|
||||
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
del_flag INT DEFAULT 0 COMMENT '删除标志(0=正常,1=删除)'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='生产任务表';
|
||||
49
klp-oa/klp-admin/src/main/resources/i18n/messages.properties
Normal file
49
klp-oa/klp-admin/src/main/resources/i18n/messages.properties
Normal file
@@ -0,0 +1,49 @@
|
||||
#错误消息
|
||||
not.null=* 必须填写
|
||||
user.jcaptcha.error=验证码错误
|
||||
user.jcaptcha.expire=验证码已失效
|
||||
user.not.exists=对不起, 您的账号:{0} 不存在.
|
||||
user.password.not.match=用户不存在/密码错误
|
||||
user.password.retry.limit.count=密码输入错误{0}次
|
||||
user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟
|
||||
user.password.delete=对不起,您的账号:{0} 已被删除
|
||||
user.blocked=对不起,您的账号:{0} 已禁用,请联系管理员
|
||||
role.blocked=角色已封禁,请联系管理员
|
||||
user.logout.success=退出成功
|
||||
length.not.valid=长度必须在{min}到{max}个字符之间
|
||||
user.username.not.blank=用户名不能为空
|
||||
user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头
|
||||
user.username.length.valid=账户长度必须在{min}到{max}个字符之间
|
||||
user.password.not.blank=用户密码不能为空
|
||||
user.password.length.valid=用户密码长度必须在{min}到{max}个字符之间
|
||||
user.password.not.valid=* 5-50个字符
|
||||
user.email.not.valid=邮箱格式错误
|
||||
user.email.not.blank=邮箱不能为空
|
||||
user.phonenumber.not.blank=用户手机号不能为空
|
||||
user.mobile.phone.number.not.valid=手机号格式错误
|
||||
user.login.success=登录成功
|
||||
user.register.success=注册成功
|
||||
user.register.save.error=保存用户 {0} 失败,注册账号已存在
|
||||
user.register.error=注册失败,请联系系统管理人员
|
||||
user.notfound=请重新登录
|
||||
user.forcelogout=管理员强制退出,请重新登录
|
||||
user.unknown.error=未知错误,请重新登录
|
||||
##文件上传消息
|
||||
upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB!
|
||||
upload.filename.exceed.length=上传的文件名最长{0}个字符
|
||||
##权限
|
||||
no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]
|
||||
repeat.submit.message=不允许重复提交,请稍候再试
|
||||
rate.limiter.message=访问过于频繁,请稍候再试
|
||||
sms.code.not.blank=短信验证码不能为空
|
||||
sms.code.retry.limit.count=短信验证码输入错误{0}次
|
||||
sms.code.retry.limit.exceed=短信验证码输入错误{0}次,帐户锁定{1}分钟
|
||||
email.code.not.blank=邮箱验证码不能为空
|
||||
email.code.retry.limit.count=邮箱验证码输入错误{0}次
|
||||
email.code.retry.limit.exceed=邮箱验证码输入错误{0}次,帐户锁定{1}分钟
|
||||
xcx.code.not.blank=小程序code不能为空
|
||||
28
klp-oa/klp-admin/src/main/resources/spy.properties
Normal file
28
klp-oa/klp-admin/src/main/resources/spy.properties
Normal file
@@ -0,0 +1,28 @@
|
||||
# p6spy 性能分析插件配置文件
|
||||
modulelist=com.baomidou.mybatisplus.extension.p6spy.MybatisPlusLogFactory,com.p6spy.engine.outage.P6OutageFactory
|
||||
# 自定义日志打印
|
||||
logMessageFormat=com.baomidou.mybatisplus.extension.p6spy.P6SpyLogger
|
||||
#日志输出到控制台
|
||||
appender=com.baomidou.mybatisplus.extension.p6spy.StdoutLogger
|
||||
# 使用日志系统记录 sql
|
||||
#appender=com.p6spy.engine.spy.appender.Slf4JLogger
|
||||
# 设置 p6spy driver 代理
|
||||
#deregisterdrivers=true
|
||||
# 取消JDBC URL前缀
|
||||
useprefix=true
|
||||
# 配置记录 Log 例外,可去掉的结果集有error,info,batch,debug,statement,commit,rollback,result,resultset.
|
||||
excludecategories=info,debug,result,commit,resultset
|
||||
# 日期格式
|
||||
dateformat=yyyy-MM-dd HH:mm:ss
|
||||
# SQL语句打印时间格式
|
||||
databaseDialectTimestampFormat=yyyy-MM-dd HH:mm:ss
|
||||
# 实际驱动可多个
|
||||
#driverlist=org.h2.Driver
|
||||
# 是否开启慢SQL记录
|
||||
outagedetection=true
|
||||
# 慢SQL记录标准 2 秒
|
||||
outagedetectioninterval=2
|
||||
# 是否过滤 Log
|
||||
filter=true
|
||||
# 过滤 Log 时所排除的 sql 关键字,以逗号分隔
|
||||
exclude=SELECT 1
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.klp.test;
|
||||
|
||||
import com.klp.common.config.KLPConfig;
|
||||
import org.junit.jupiter.api.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 单元测试案例
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@SpringBootTest // 此注解只能在 springboot 主包下使用 需包含 main 方法与 yml 配置文件
|
||||
@DisplayName("单元测试案例")
|
||||
public class DemoUnitTest {
|
||||
|
||||
@Autowired
|
||||
private KLPConfig KLPConfig;
|
||||
|
||||
@DisplayName("测试 @SpringBootTest @Test @DisplayName 注解")
|
||||
@Test
|
||||
public void testTest() {
|
||||
System.out.println(KLPConfig);
|
||||
}
|
||||
|
||||
@Disabled
|
||||
@DisplayName("测试 @Disabled 注解")
|
||||
@Test
|
||||
public void testDisabled() {
|
||||
System.out.println(KLPConfig);
|
||||
}
|
||||
|
||||
@Timeout(value = 2L, unit = TimeUnit.SECONDS)
|
||||
@DisplayName("测试 @Timeout 注解")
|
||||
@Test
|
||||
public void testTimeout() throws InterruptedException {
|
||||
Thread.sleep(3000);
|
||||
System.out.println(KLPConfig);
|
||||
}
|
||||
|
||||
|
||||
@DisplayName("测试 @RepeatedTest 注解")
|
||||
@RepeatedTest(3)
|
||||
public void testRepeatedTest() {
|
||||
System.out.println(666);
|
||||
}
|
||||
|
||||
@BeforeAll
|
||||
public static void testBeforeAll() {
|
||||
System.out.println("@BeforeAll ==================");
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
public void testBeforeEach() {
|
||||
System.out.println("@BeforeEach ==================");
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void testAfterEach() {
|
||||
System.out.println("@AfterEach ==================");
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void testAfterAll() {
|
||||
System.out.println("@AfterAll ==================");
|
||||
}
|
||||
|
||||
}
|
||||
54
klp-oa/klp-admin/src/test/java/com/klp/test/TagUnitTest.java
Normal file
54
klp-oa/klp-admin/src/test/java/com/klp/test/TagUnitTest.java
Normal file
@@ -0,0 +1,54 @@
|
||||
package com.klp.test;
|
||||
|
||||
import org.junit.jupiter.api.*;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
/**
|
||||
* 标签单元测试案例
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@SpringBootTest
|
||||
@DisplayName("标签单元测试案例")
|
||||
public class TagUnitTest {
|
||||
|
||||
@Tag("dev")
|
||||
@DisplayName("测试 @Tag dev")
|
||||
@Test
|
||||
public void testTagDev() {
|
||||
System.out.println("dev");
|
||||
}
|
||||
|
||||
@Tag("prod")
|
||||
@DisplayName("测试 @Tag prod")
|
||||
@Test
|
||||
public void testTagProd() {
|
||||
System.out.println("prod");
|
||||
}
|
||||
|
||||
@Tag("local")
|
||||
@DisplayName("测试 @Tag local")
|
||||
@Test
|
||||
public void testTagLocal() {
|
||||
System.out.println("local");
|
||||
}
|
||||
|
||||
@Tag("exclude")
|
||||
@DisplayName("测试 @Tag exclude")
|
||||
@Test
|
||||
public void testTagExclude() {
|
||||
System.out.println("exclude");
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
public void testBeforeEach() {
|
||||
System.out.println("@BeforeEach ==================");
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void testAfterEach() {
|
||||
System.out.println("@AfterEach ==================");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user